Skip to content

[PM-33393] fix: TOTP auth key can be shown by users without permission [bug-factory poc] - #7487

Merged
andrebispo5 merged 2 commits into
mainfrom
PM-33393-totp-key-hidden-passwords
Oct 15, 2026
Merged

andrebispo5 merged 2 commits into
mainfrom
PM-33393-totp-key-hidden-passwords

Conversation

@andrebispo5

@andrebispo5 andrebispo5 commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

branch: PM-33393-totp-key-hidden-passwords
base: main

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-33393

πŸ“” Objective

Automated fix produced by the bug factory (AI-49 proof of concept). Needs review from the owning team before merge.

verified: genuine, live, unduplicated. On "Edit login", a member with "Edit items, hidden passwords" taps Show and sees the raw authenticator key JBSWY3DPEHPK3PXP. I re-observed this on the device. The same code shipped in v2026.9.1-bwpm.

πŸ“Έ Screenshots

The bug was reproduced on an emulator before the fix. The fix itself is proven by a JVM unit test.

πŸ§ͺ Proof

./gradlew :app:testStandardDebugUnitTest --tests "*VaultAddEditScreenTest.in ItemType_Login state the TOTP text field should be visible but disabled*" on the base code (must fail) exited 1; with the fix (must pass) exited 0.

Base run
 available at: file://<repo>/build/reports/problems/problems-report.html

Deprecated Gradle features were used in this build, making it incompatible with Gradle 10.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/9.8.0/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
205 actionable tasks: 3 executed, 7 from cache, 195 up-to-date

The google-services Gradle plugin needs to be applied on a project with com.android.application or com.android.dynamic-feature.
WARNING: A restricted method in java.lang.System has been called
WARNING: java.lang.System::load has been called by org.robolectric.nativeruntime.DefaultNativeRuntimeLoader in an unnamed module
WARNING: Use --enable-native-access=ALL-UNNAMED to avoid a warning for callers in this module
WARNING: Restricted methods will be blocked in a future release unless native access is enabled


1 test completed, 1 failed

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:testStandardDebugUnitTest'.
> There were failing tests. See the report at: file://<repo>/app/build/reports/tests/testStandardDebugUnitTest/index.html

* Try:
> Run with --scan to get full insights from a Build Scan (powered by Develocity).

BUILD FAILED in 22s

Fix run
r
> Task :app:hiltAggregateDepsStandardDebugUnitTest UP-TO-DATE
> Task :app:hiltJavaCompileStandardDebugUnitTest NO-SOURCE
> Task :app:transformStandardDebugUnitTestClassesWithAsm FROM-CACHE
> Task :app:testStandardDebugUnitTest

[Incubating] Problems report is available at: file://<repo>/build/reports/problems/problems-report.html

Deprecated Gradle features were used in this build, making it incompatible with Gradle 10.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/9.8.0/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD SUCCESSFUL in 21s
205 actionable tasks: 3 executed, 7 from cache, 195 up-to-date
Consider enabling configuration cache to speed up this build: https://docs.gradle.org/9.8.0/userguide/configuration_cache_enabling.html

The google-services Gradle plugin needs to be applied on a project with com.android.application or com.android.dynamic-feature.
WARNING: A restricted method in java.lang.System has been called
WARNING: java.lang.System::load has been called by org.robolectric.nativeruntime.DefaultNativeRuntimeLoader in an unnamed module
WARNING: Use --enable-native-access=ALL-UNNAMED to avoid a warning for callers in this module
WARNING: Restricted methods will be blocked in a future release unless native access is enabled


πŸ€– Automated review

  • Round 1: 0 blocking finding(s)

⏰ Reminders before merge

  • An engineer from the owning team has reviewed this (AI-49 AC i18nΒ #4)
  • Feedback captured as findings

…it items… [bug-factory poc]

Automated fix from the AI-49 bug factory. Proof: ./gradlew :app:testStandardDebugUnitTest --tests "*VaultAddEditScreenTest.in ItemType_Login state the TOTP text field should be visible but disabled*" must fail on base and pass with the fix.
@github-actions github-actions Bot added app:password-manager Bitwarden Password Manager app context t:bug Change Type - Bug labels Oct 14, 2026
@codecov

codecov Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codecov Report

βœ… All modified and coverable lines are covered by tests.
βœ… Project coverage is 86.80%. Comparing base (43d7b8b) to head (333edb2).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7487   +/-   ##
=======================================
  Coverage   86.80%   86.80%           
=======================================
  Files         895      895           
  Lines       65676    65684    +8     
  Branches     9384     9385    +1     
=======================================
+ Hits        57007    57015    +8     
  Misses       5189     5189           
  Partials     3480     3480           
Flag Coverage Ξ”
app-data 18.65% <0.00%> (-0.01%) ⬇️
app-ui-auth-tools 18.68% <0.00%> (-0.01%) ⬇️
app-ui-platform 16.49% <0.00%> (-0.01%) ⬇️
app-ui-vault 26.89% <100.00%> (+<0.01%) ⬆️
authenticator 6.03% <0.00%> (-0.01%) ⬇️
lib-core-network-bridge 4.11% <0.00%> (-0.01%) ⬇️
lib-data-ui 1.25% <0.00%> (-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.

@andrebispo5
andrebispo5 marked this pull request as ready for review October 15, 2026 09:09
Copilot AI balanced review requested due to automatic review settings October 15, 2026 09:09
@andrebispo5
andrebispo5 requested review from a team and david-livefront as code owners October 15, 2026 09:09
@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

πŸ€– Bitwarden Claude Code Review

Overall Assessment: APPROVE

This PR fixes the TOTP key leak on the add/edit screen. When a user cannot view passwords and the item already has a key, TotpRow now renders BitwardenHiddenPasswordField. That component shows a fixed 8-character mask, is disabled, and suppresses the text toolbar, so the Show, Copy, and Delete actions are gone. The approach matches the existing hidden-password branch in PasswordRow, and the updated screen test checks the masked value and that the action buttons are absent.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

πŸ”΅ Needs a closer look

This security-sensitive permission fix requires the owning-team review explicitly requested before merge.

0 open findings

What changed in this PR

Prevents users without TOTP viewing permission from revealing an existing authenticator key on the Edit login screen.

Changes:

  • Displays existing restricted keys in a disabled, masked field.
  • Updates regression coverage to check masking and absence of reveal, copy, delete, and setup controls.
File Description
app/​src/​test/​kotlin/​com/​x8bit/​bitwarden/​ui/​vault/​feature/​addedit/​VaultAddEditScreenTest.kt Verifies restricted authenticator-key display and controls.
app/​src/​main/​kotlin/​com/​x8bit/​bitwarden/​ui/​vault/​feature/​addedit/​VaultAddEditLoginItems.kt Uses a hidden field when key viewing is disallowed.

🧠 Review effort: Balanced


πŸ’‘ Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@andrebispo5 andrebispo5 changed the title [PM-33393] fix: [Android] TOTP auth key can be shown by users with Edit items… [bug-factory poc] [PM-33393] fix: TOTP auth key can be shown by users without permission can see passwords [bug-factory poc] Oct 15, 2026
cardStyle = CardStyle.Full,
modifier = modifier
.fillMaxWidth()
.focusProperties { canFocus = false },

@david-livefront david-livefront Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why is this needed?

Wouldn't this be an accessibility issue?

@andrebispo5 andrebispo5 Oct 15, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It does not impair the accessibility features but it is also not necessary πŸ‘

@andrebispo5 andrebispo5 changed the title [PM-33393] fix: TOTP auth key can be shown by users without permission can see passwords [bug-factory poc] [PM-33393] fix: TOTP auth key can be shown by users without permission [bug-factory poc] Oct 15, 2026
@andrebispo5
andrebispo5 added this pull request to the merge queue Oct 15, 2026
@andrebispo5

Copy link
Copy Markdown
Contributor Author

@david-livefront Thank you! πŸ‘

Merged via the queue into main with commit 1470154 Oct 15, 2026
27 checks passed
@andrebispo5
andrebispo5 deleted the PM-33393-totp-key-hidden-passwords branch October 15, 2026 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

3 participants