Skip to content

feat: improved masked inputs management - #8629

Open
albertasaftei wants to merge 12 commits into
usebruno:mainfrom
albertasaftei:feature/masked-inputs-improvement
Open

albertasaftei wants to merge 12 commits into
usebruno:mainfrom
albertasaftei:feature/masked-inputs-improvement

Conversation

@albertasaftei

@albertasaftei albertasaftei commented Jul 15, 2026 •

Copy link
Copy Markdown

fixes: #8630
Internal Jira: BRU-3895

Description

Changed the masked inputs logic so if the user starts by inserting an env variable, it won't show masked by default. While writing it manually, it will normally be shown as masked

This is the same behaviour Postman is using and I find it useful. It removes an additional click to unmask the env var.

Screen.Recording.2026-07-15.at.16.26.02.mov

Added a reusable utility that will be used for masked inputs, approach is simple yet effective.

Contribution Checklist:

  • I've used AI significantly to create this pull request
  • [ x ] The pull request only addresses one issue or adds one feature.
  • [ x ] The pull request does not introduce any breaking changes
  • [ x ] I have added screenshots or gifs to help explain the change if applicable.
  • [ x ] I have read the contribution guidelines.
  • [ x ] Create an issue and link to the pull request.

Summary by CodeRabbit

Summary

  • New Features

    • Added a shouldMaskValue utility to determine when secret values should be masked.
    • Updated authentication editors (AWS V4, Basic, Bearer, Digest, OAuth1/OAuth2, WSSE, NTLM, EdgeGrid, and Client Certificate passphrases) to apply masking based on the current field value instead of always masking.
  • Bug Fixes

    • Secret masking now refreshes immediately when input state changes (removed brief input-read debounce).

@coderabbitai

coderabbitai Bot commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Secret masking now depends on field values across collection and request authentication editors. The shared masking utility is added, and masked-editor updates occur synchronously after input reads.

Changes

Authentication masking

Layer / File(s) Summary
Masking utility and editor timing
packages/bruno-app/src/utils/auth/index.js, packages/bruno-app/src/utils/common/masked-editor.js
Adds shouldMaskValue and applies masked-editor updates synchronously.
Collection authentication masking
packages/bruno-app/src/components/CollectionSettings/Auth/*, packages/bruno-app/src/components/CollectionSettings/ClientCertSettings/index.js
Collection authentication and certificate passphrase editors derive masking from current values while preserving existing warning and dispatch behavior.
Request authentication masking
packages/bruno-app/src/components/RequestPane/Auth/*
Request authentication secret fields use value-sensitive masking across standard, EdgeGrid, OAuth1, OAuth2, and WSSE authentication editors.

Estimated code review effort: 2 (Simple) | ~15 minutes

Suggested reviewers: helloanoop

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: improved handling of masked inputs, including conditional masking for variable references.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Secrets hide, then variables gleam,
Braces guide the masking scheme.
Auth fields update as values flow,
Editors respond without delay,
Warnings keep their steady glow.

Comment @coderabbitai help to get the list of available commands.

@albertasaftei albertasaftei mentioned this pull request Jul 15, 2026
2 of 4 tasks

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (3)
packages/bruno-app/src/components/RequestPane/Auth/OAuth2/PasswordCredentials/index.js (2)

58-60: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Avoid single-line abstractions.

As per coding guidelines, avoid single-line abstractions that only add a call-stack frame. You can map this directly to save instead of wrapping it in handleSave.

♻️ Proposed refactor
-  const handleSave = () => {
-    save();
-  };
+  const handleSave = save;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/bruno-app/src/components/RequestPane/Auth/OAuth2/PasswordCredentials/index.js`
around lines 58 - 60, Remove the redundant handleSave wrapper and pass the
existing save function directly to the relevant consumer in the
PasswordCredentials component, preserving the current save behavior.

Source: Coding guidelines


23-30: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Keep function parameters on a single line.

As per coding guidelines, do not add newlines inside function parentheses. Please revert the formatting of these parameters to a single line to maintain compliance.

♻️ Proposed formatting fix
-const OAuth2PasswordCredentials = ({
-  save,
-  item = {},
-  request,
-  handleRun,
-  updateAuth,
-  collection
-}) => {
+const OAuth2PasswordCredentials = ({ save, item = {}, request, handleRun, updateAuth, collection }) => {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/bruno-app/src/components/RequestPane/Auth/OAuth2/PasswordCredentials/index.js`
around lines 23 - 30, Reformat the OAuth2PasswordCredentials function
declaration so all parameters remain on a single line inside the parentheses,
without changing the function’s behavior or parameter list.

Source: Coding guidelines

packages/bruno-app/src/components/CollectionSettings/Auth/BearerAuth/index.js (1)

22-22: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Remove leftover debug statement.

This console.log appears to be a leftover debug artifact and should be removed.

♻️ Proposed fix
-  console.log({ bearerToken });
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/bruno-app/src/components/CollectionSettings/Auth/BearerAuth/index.js`
at line 22, Remove the leftover console.log statement that logs bearerToken in
the BearerAuth component, leaving the surrounding authentication logic
unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/bruno-app/src/utils/auth/index.js`:
- Around line 110-113: Update shouldMaskValue to detect Bruno environment
variables only when the value contains the double-curly-brace marker "{{",
rather than any single "{". Preserve the existing masking behavior for empty,
non-string, and marker-free values.

---

Nitpick comments:
In
`@packages/bruno-app/src/components/CollectionSettings/Auth/BearerAuth/index.js`:
- Line 22: Remove the leftover console.log statement that logs bearerToken in
the BearerAuth component, leaving the surrounding authentication logic
unchanged.

In
`@packages/bruno-app/src/components/RequestPane/Auth/OAuth2/PasswordCredentials/index.js`:
- Around line 58-60: Remove the redundant handleSave wrapper and pass the
existing save function directly to the relevant consumer in the
PasswordCredentials component, preserving the current save behavior.
- Around line 23-30: Reformat the OAuth2PasswordCredentials function declaration
so all parameters remain on a single line inside the parentheses, without
changing the function’s behavior or parameter list.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 19c58acb-1c5c-4796-a5c3-f809a1bc3e63

📥 Commits

Reviewing files that changed from the base of the PR and between 33ce3fa and f57a4b3.

📒 Files selected for processing (21)
  • packages/bruno-app/src/components/CollectionSettings/Auth/AwsV4Auth/index.js
  • packages/bruno-app/src/components/CollectionSettings/Auth/BasicAuth/index.js
  • packages/bruno-app/src/components/CollectionSettings/Auth/BearerAuth/index.js
  • packages/bruno-app/src/components/CollectionSettings/Auth/DigestAuth/index.js
  • packages/bruno-app/src/components/CollectionSettings/Auth/EdgeGridAuth/index.tsx
  • packages/bruno-app/src/components/CollectionSettings/Auth/NTLMAuth/index.js
  • packages/bruno-app/src/components/CollectionSettings/Auth/WsseAuth/index.js
  • packages/bruno-app/src/components/CollectionSettings/ClientCertSettings/index.js
  • packages/bruno-app/src/components/RequestPane/Auth/AwsV4Auth/index.js
  • packages/bruno-app/src/components/RequestPane/Auth/BasicAuth/index.js
  • packages/bruno-app/src/components/RequestPane/Auth/BearerAuth/index.js
  • packages/bruno-app/src/components/RequestPane/Auth/DigestAuth/index.js
  • packages/bruno-app/src/components/RequestPane/Auth/EdgeGridAuth/index.tsx
  • packages/bruno-app/src/components/RequestPane/Auth/NTLMAuth/index.js
  • packages/bruno-app/src/components/RequestPane/Auth/OAuth1/index.js
  • packages/bruno-app/src/components/RequestPane/Auth/OAuth2/AuthorizationCode/index.js
  • packages/bruno-app/src/components/RequestPane/Auth/OAuth2/ClientCredentials/index.js
  • packages/bruno-app/src/components/RequestPane/Auth/OAuth2/PasswordCredentials/index.js
  • packages/bruno-app/src/components/RequestPane/Auth/WsseAuth/index.js
  • packages/bruno-app/src/utils/auth/index.js
  • packages/bruno-app/src/utils/common/masked-editor.js

@helloanoop

Copy link
Copy Markdown
Contributor

Hey @albertasaftei

We're aligned with the change, but the PR diff is much larger than it needs to be. It looks like your editor has introduced a number of formatting-only changes. Would you be able to remove those and keep the diff limited to just the changes required for this PR?

@albertasaftei

Copy link
Copy Markdown
Author

hello @helloanoop, i'm removing all the formatting edits.

Wouldn't it be better to add a .pretierrc file just to keep formatting edits the same for all the contributors?

@helloanoop

Copy link
Copy Markdown
Contributor

Thank you. We have eslint to help with lint.

As far as our stance on prettier, I'd let @bijin-bruno / @sid-bruno comment it.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/bruno-app/src/utils/common/masked-editor.js (1)

357-366: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Revert unrelated formatting-only edits in this cohort.

These hunks do not change masking behavior and make the PR harder to review. Restore the existing formatting and retain only the required masking changes; Line 360-366 also introduces newlines inside markText(...).

As per coding guidelines, **/* diffs must remain minimal and avoid unnecessary whitespace changes. The PR objectives likewise call for removing editor-introduced formatting changes.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/bruno-app/src/utils/common/masked-editor.js` around lines 357 - 366,
Revert formatting-only changes while preserving required behavior: restore the
existing formatting around maskedNode and markText in
packages/bruno-app/src/utils/common/masked-editor.js:357-366, including the
original single-line markText call. Also restore prior formatting, with no
functional changes, at
packages/bruno-app/src/components/CollectionSettings/Auth/BasicAuth/index.js:17,74;
BearerAuth/index.js:17,46-48; DigestAuth/index.js:17,74;
NTLMAuth/index.js:17,23-34,88-90; WsseAuth/index.js:17,74;
packages/bruno-app/src/components/RequestPane/Auth/BasicAuth/index.js:9,84;
OAuth2/PasswordCredentials/index.js:7,17,45,79-86,108-110,135-138,139-152,172-224,264-301;
and WsseAuth/index.js:9,84.

Source: Coding guidelines

🧹 Nitpick comments (1)
packages/bruno-app/src/components/RequestPane/Auth/OAuth2/AuthorizationCode/index.js (1)

19-27: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy lift

Revert unrelated editor formatting changes.

Keep this PR focused on value-aware masking; the reformatting expands review and blame churn.

  • packages/bruno-app/src/components/RequestPane/Auth/OAuth2/AuthorizationCode/index.js#L19-L27: revert unrelated component reformatting.
  • packages/bruno-app/src/utils/auth/index.js#L2-L4: restore the prior import formatting.
  • packages/bruno-app/src/components/CollectionSettings/ClientCertSettings/index.js#L44-L48: revert unrelated schema formatting.
  • packages/bruno-app/src/components/CollectionSettings/Auth/AwsV4Auth/index.js#L17-L19: revert unrelated declaration reformatting.
  • packages/bruno-app/src/components/RequestPane/Auth/BearerAuth/index.js#L9-L9: restore the prior import formatting.
  • packages/bruno-app/src/components/RequestPane/Auth/DigestAuth/index.js#L8-L8: restore the prior import formatting.
  • packages/bruno-app/src/components/RequestPane/Auth/NTLMAuth/index.js#L9-L9: restore the prior import formatting.
  • packages/bruno-app/src/components/RequestPane/Auth/OAuth1/index.js#L6-L13: restore unrelated import reformatting.
  • packages/bruno-app/src/components/RequestPane/Auth/OAuth2/ClientCredentials/index.js#L17-L17: revert unrelated component reformatting.

As per coding guidelines, “Keep diffs minimal, avoid unnecessary whitespace changes.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/bruno-app/src/components/RequestPane/Auth/OAuth2/AuthorizationCode/index.js`
around lines 19 - 27, Revert unrelated formatting changes while preserving the
value-aware masking changes: restore prior formatting in
packages/bruno-app/src/components/RequestPane/Auth/OAuth2/AuthorizationCode/index.js
(19-27), packages/bruno-app/src/utils/auth/index.js (2-4),
packages/bruno-app/src/components/CollectionSettings/ClientCertSettings/index.js
(44-48),
packages/bruno-app/src/components/CollectionSettings/Auth/AwsV4Auth/index.js
(17-19), packages/bruno-app/src/components/RequestPane/Auth/BearerAuth/index.js
(9), packages/bruno-app/src/components/RequestPane/Auth/DigestAuth/index.js (8),
packages/bruno-app/src/components/RequestPane/Auth/NTLMAuth/index.js (9),
packages/bruno-app/src/components/RequestPane/Auth/OAuth1/index.js (6-13), and
packages/bruno-app/src/components/RequestPane/Auth/OAuth2/ClientCredentials/index.js
(17). Keep functional changes intact and avoid additional whitespace or
declaration/import reformatting.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@packages/bruno-app/src/components/CollectionSettings/Auth/BasicAuth/index.js`:
- Line 71: Restrict shouldMaskValue in
packages/bruno-app/src/utils/auth/index.js to return the variable-reference
result only for the exact supported environment-variable syntax/prefix, while
masking literal secrets containing braces. Add regressions covering literal
braces and valid variable references. Apply the corrected predicate at
packages/bruno-app/src/components/CollectionSettings/Auth/BasicAuth/index.js:71,
packages/bruno-app/src/components/CollectionSettings/Auth/BearerAuth/index.js:45,
packages/bruno-app/src/components/CollectionSettings/Auth/DigestAuth/index.js:71,
packages/bruno-app/src/components/CollectionSettings/Auth/NTLMAuth/index.js:87,
packages/bruno-app/src/components/CollectionSettings/Auth/WsseAuth/index.js:71,
packages/bruno-app/src/components/RequestPane/Auth/BasicAuth/index.js:81,
packages/bruno-app/src/components/RequestPane/Auth/OAuth2/PasswordCredentials/index.js:105,
and packages/bruno-app/src/components/RequestPane/Auth/WsseAuth/index.js:81.

---

Outside diff comments:
In `@packages/bruno-app/src/utils/common/masked-editor.js`:
- Around line 357-366: Revert formatting-only changes while preserving required
behavior: restore the existing formatting around maskedNode and markText in
packages/bruno-app/src/utils/common/masked-editor.js:357-366, including the
original single-line markText call. Also restore prior formatting, with no
functional changes, at
packages/bruno-app/src/components/CollectionSettings/Auth/BasicAuth/index.js:17,74;
BearerAuth/index.js:17,46-48; DigestAuth/index.js:17,74;
NTLMAuth/index.js:17,23-34,88-90; WsseAuth/index.js:17,74;
packages/bruno-app/src/components/RequestPane/Auth/BasicAuth/index.js:9,84;
OAuth2/PasswordCredentials/index.js:7,17,45,79-86,108-110,135-138,139-152,172-224,264-301;
and WsseAuth/index.js:9,84.

---

Nitpick comments:
In
`@packages/bruno-app/src/components/RequestPane/Auth/OAuth2/AuthorizationCode/index.js`:
- Around line 19-27: Revert unrelated formatting changes while preserving the
value-aware masking changes: restore prior formatting in
packages/bruno-app/src/components/RequestPane/Auth/OAuth2/AuthorizationCode/index.js
(19-27), packages/bruno-app/src/utils/auth/index.js (2-4),
packages/bruno-app/src/components/CollectionSettings/ClientCertSettings/index.js
(44-48),
packages/bruno-app/src/components/CollectionSettings/Auth/AwsV4Auth/index.js
(17-19), packages/bruno-app/src/components/RequestPane/Auth/BearerAuth/index.js
(9), packages/bruno-app/src/components/RequestPane/Auth/DigestAuth/index.js (8),
packages/bruno-app/src/components/RequestPane/Auth/NTLMAuth/index.js (9),
packages/bruno-app/src/components/RequestPane/Auth/OAuth1/index.js (6-13), and
packages/bruno-app/src/components/RequestPane/Auth/OAuth2/ClientCredentials/index.js
(17). Keep functional changes intact and avoid additional whitespace or
declaration/import reformatting.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 730bf81f-161e-4a82-9f79-717156e3e219

📥 Commits

Reviewing files that changed from the base of the PR and between b689c2a and 718f216.

📒 Files selected for processing (19)
  • packages/bruno-app/src/components/CollectionSettings/Auth/AwsV4Auth/index.js
  • packages/bruno-app/src/components/CollectionSettings/Auth/BasicAuth/index.js
  • packages/bruno-app/src/components/CollectionSettings/Auth/BearerAuth/index.js
  • packages/bruno-app/src/components/CollectionSettings/Auth/DigestAuth/index.js
  • packages/bruno-app/src/components/CollectionSettings/Auth/NTLMAuth/index.js
  • packages/bruno-app/src/components/CollectionSettings/Auth/WsseAuth/index.js
  • packages/bruno-app/src/components/CollectionSettings/ClientCertSettings/index.js
  • packages/bruno-app/src/components/RequestPane/Auth/AwsV4Auth/index.js
  • packages/bruno-app/src/components/RequestPane/Auth/BasicAuth/index.js
  • packages/bruno-app/src/components/RequestPane/Auth/BearerAuth/index.js
  • packages/bruno-app/src/components/RequestPane/Auth/DigestAuth/index.js
  • packages/bruno-app/src/components/RequestPane/Auth/NTLMAuth/index.js
  • packages/bruno-app/src/components/RequestPane/Auth/OAuth1/index.js
  • packages/bruno-app/src/components/RequestPane/Auth/OAuth2/AuthorizationCode/index.js
  • packages/bruno-app/src/components/RequestPane/Auth/OAuth2/ClientCredentials/index.js
  • packages/bruno-app/src/components/RequestPane/Auth/OAuth2/PasswordCredentials/index.js
  • packages/bruno-app/src/components/RequestPane/Auth/WsseAuth/index.js
  • packages/bruno-app/src/utils/auth/index.js
  • packages/bruno-app/src/utils/common/masked-editor.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/bruno-app/src/components/RequestPane/Auth/AwsV4Auth/index.js

@sid-bruno

sid-bruno commented Jul 23, 2026 •

Copy link
Copy Markdown
Collaborator

TLDR;
We'd love to use prettier but we're not that opinionated about the code style and 2nd it breaks community PR's and adds to our engg bandwidth for our distribution sync.


Prettier for whitespace-only changes sounds reasonable in theory, but as the trail of changes you saw shows, it diverges quite a bit from our existing code style and what it currently allows.

There's also a secondary risk: larger merge conflicts between the OSS and Distribution repo, which adds to maintainer overhead. I want to make contributing easier, but not at the cost of reviewers having to manually re-read every line to confirm which changes were actually relevant, or losing the guarantee that OSS and Distribution changes stay validated together. That's real engineering bandwidth we'd be trading away.

On the conflict side specifically - GitHub and git do support ignoring whitespace changes (e.g. git merge -Xignore-space-change), but that caused issues during our last attempt at a distribution sync, so we haven't gone back to it.

Antfu's post also covers the line-wrap noise this introduces, which is worth avoiding.

Practically, it makes more sense to just ask contributors to save files without their formatters running, rather than having a few team members repeatedly spend time untangling merges.

There's also the problem where if we now run prettier on the entire codebase, we will have quite a few community PR's that would have to be updated just because someone from bruno decided an arrow function just has to have enclosing braces.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Masked inputs management

6 participants