Skip to content

Auth/PM-32102 - (1) Create ConvertUserToKeyConnectorCommand (2) Remove salt on key connector conversion#7692

Draft
JaredSnider-Bitwarden wants to merge 4 commits into
mainfrom
auth/pm-32102/remove-salt-on-key-connector-conversion
Draft

Auth/PM-32102 - (1) Create ConvertUserToKeyConnectorCommand (2) Remove salt on key connector conversion#7692
JaredSnider-Bitwarden wants to merge 4 commits into
mainfrom
auth/pm-32102/remove-salt-on-key-connector-conversion

Conversation

@JaredSnider-Bitwarden
Copy link
Copy Markdown
Contributor

@JaredSnider-Bitwarden JaredSnider-Bitwarden commented May 21, 2026

🎟️ Tracking

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

⚠️ This a Claude first draft - unreviewed for accuracy, testing, and completeness.

📔 Objective

📸 Screenshots

Introduces an opinionated in-memory mutation that nulls MasterPassword
and MasterPasswordSalt together, preserving the credential/salt invariant.
Updates RevisionDate and AccountRevisionDate; intentionally leaves
LastPasswordChangeDate untouched since this is credential removal rather
than a password change.
Extracts the Key Connector conversion logic into a dedicated command in
the Key Management domain, mirroring the SetKeyConnectorKeyCommand
pattern. The command composes IMasterPasswordService.PrepareClearMasterPassword
to clear the credential — including the salt — before flipping
UsesKeyConnector, optionally writing the wrapped user key, persisting,
and emitting the migration event.
…nnectorCommand

Injects IConvertUserToKeyConnectorCommand and switches both
PostConvertToKeyConnectorAsync and PostEnrollToKeyConnectorAsync to use it
instead of IUserService.ConvertToKeyConnectorAsync. Unit tests are
retargeted to the new dependency. The integration tests now assert
MasterPasswordSalt is nulled alongside MasterPassword, which is the
behavior change the ticket exists to enforce.
The method's only production callers were the two endpoints on
AccountsKeyManagementController, which now depend on
IConvertUserToKeyConnectorCommand directly. Deleting it continues the
ongoing decomposition of UserService. CheckCanUseKeyConnector stays in
place — it is still called by the legacy SetKeyConnectorKeyAsync,
which is scheduled for removal in PM-27328.
@JaredSnider-Bitwarden JaredSnider-Bitwarden changed the title Auth/pm 32102/remove salt on key connector conversion Auth/PM-32102 - (1) Create ConvertUserToKeyConnectorCommand (2) Remove salt on key connector conversion May 21, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 21, 2026

Codecov Report

❌ Patch coverage is 98.21429% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 60.45%. Comparing base (b848298) to head (dce0771).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...ement/Commands/ConvertUserToKeyConnectorCommand.cs 97.61% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7692      +/-   ##
==========================================
- Coverage   64.86%   60.45%   -4.41%     
==========================================
  Files        2140     2141       +1     
  Lines       94629    94666      +37     
  Branches     8445     8448       +3     
==========================================
- Hits        61377    57233    -4144     
- Misses      31156    35428    +4272     
+ Partials     2096     2005      -91     

☔ View full report in Codecov by Sentry.
📢 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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant