Skip to content

PM-42349: bug: Hide static password mask when field is blank - #7376

Open
david-livefront wants to merge 1 commit into
mainfrom
PM-42349-hide-mask
Open

PM-42349: bug: Hide static password mask when field is blank#7376
david-livefront wants to merge 1 commit into
mainfrom
PM-42349-hide-mask

Conversation

@david-livefront

@david-livefront david-livefront commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

🎟️ Tracking

PM-42349

📔 Objective

This PR ensures that an empty password field does not have the mask displayed.

@david-livefront
david-livefront requested a review from a team as a code owner September 9, 2026 19:50
@github-actions github-actions Bot added app:password-manager Bitwarden Password Manager app context app:authenticator Bitwarden Authenticator app context t:bug Change Type - Bug labels Sep 9, 2026
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

🤖 Bitwarden Claude Code Review

Overall Assessment: APPROVE

This is a single-file bug fix in the shared :ui module that suppresses the static password mask when the underlying text is blank. The new expression staticCharacterCount?.takeIf { text.text.isNotEmpty() } ?: text.text.length falls through to a length of 0 for empty input, and the OffsetMapping remains valid in that case (both originalToTransformed and transformedToOriginal resolve to 0). Both call sites — BitwardenHiddenPasswordField and the readOnly branch of BitwardenPasswordField — are non-editable fields, so the change carries no input-handling risk, and the non-static path used by editable password fields is untouched. One documentation accuracy finding was raised inline.

Code Review Details
  • ♻️ : KDoc still says the transformed text "always" contains staticCharacterCount mask characters, which this change makes untrue for blank input
    • ui/src/main/kotlin/com/bitwarden/ui/platform/components/util/BitwardenPasswordVisualTransformation.kt:12

import com.bitwarden.ui.platform.base.util.toAnnotatedString

/**
* Returns a [VisualTransformation] that masks text with [mask]. When [staticCharacterCount] is

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.

♻️ DEBT: KDoc now contradicts the behavior this PR introduces.

Details and fix

The sentence continuing on the next line states that when staticCharacterCount is non-null "the transformed text always contains that number of mask characters." After this change, blank input produces zero mask characters, so a caller of this public :ui API reading the doc would expect the opposite of what happens.

Suggested wording:

/**
 * Returns a [VisualTransformation] that masks text with [mask]. When [staticCharacterCount] is
 * non-null and the text is non-empty, the transformed text contains that number of mask
 * characters. Blank text is never masked.
 */

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@claude this is resolved.

@codecov

codecov Bot commented Sep 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.78%. Comparing base (051b2ac) to head (03eb81e).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7376      +/-   ##
==========================================
+ Coverage   85.73%   86.78%   +1.04%     
==========================================
  Files        1056      887     -169     
  Lines       69016    65838    -3178     
  Branches    10279    10169     -110     
==========================================
- Hits        59170    57136    -2034     
+ Misses       6233     5124    -1109     
+ Partials     3613     3578      -35     
Flag Coverage Δ
app-data 18.39% <ø> (-0.01%) ⬇️
app-ui-auth-tools 18.74% <ø> (-0.18%) ⬇️
app-ui-platform 16.29% <ø> (-0.38%) ⬇️
app-ui-vault 27.07% <ø> (-0.62%) ⬇️
authenticator 6.04% <ø> (+0.04%) ⬆️
lib-core-network-bridge 4.06% <ø> (ø)
lib-data-ui 1.19% <ø> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

app:authenticator Bitwarden Authenticator app context app:password-manager Bitwarden Password Manager app context t:bug Change Type - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant