Skip to content

[PM-31112] Decouple local tools crypto from user key#19433

Open
mzieniukbw wants to merge 11 commits intomainfrom
km/pm-31112-use-local-user-data-key
Open

[PM-31112] Decouple local tools crypto from user key#19433
mzieniukbw wants to merge 11 commits intomainfrom
km/pm-31112-use-local-user-data-key

Conversation

@mzieniukbw
Copy link
Copy Markdown
Contributor

@mzieniukbw mzieniukbw commented Mar 8, 2026

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-31112
Requires bitwarden/sdk-internal#829

📔 Objective

Decouples local tools crypto from direct use of user key into an indirect local user data key. Used by password generator history and email forwarders encryption.
This will allow for user key rotation without logout, since we just have to re-encrypt the local user data key with the new user key, without re-encrypting all other data.
The local user data key state is not exposed in SDK. For backwards compatibility the local user data key is user key wrapped user key - this allows us to use it as drop in replacement
The SDK's CryptoClient exposes two new WASM stop-gap functions for encryption with the local user data key - intended to be only used by tools at this moment.

📸 Screenshots

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 8, 2026

Logo
Checkmarx One – Scan Summary & Details0f1fcc68-966f-47aa-9595-ab51cafafbfb


Fixed Issues (1) Great job! The following issues were fixed in this Pull Request
Severity Issue Source File / Package
LOW Angular_Usage_of_Unsafe_DOM_Sanitizer /libs/components/src/svg/svg.component.ts: 29

@mzieniukbw mzieniukbw requested review from a team and eligrubb and removed request for a team March 8, 2026 01:41
quexten
quexten previously approved these changes Mar 9, 2026
@mzieniukbw mzieniukbw marked this pull request as ready for review March 9, 2026 12:42
@mzieniukbw mzieniukbw requested review from a team as code owners March 9, 2026 12:42
quexten
quexten previously approved these changes Mar 9, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 9, 2026

Codecov Report

❌ Patch coverage is 66.66667% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 45.36%. Comparing base (0465bb2) to head (43187bb).
⚠️ Report is 60 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...s/history/src/legacy-password-history-decryptor.ts 25.00% 6 Missing ⚠️
...ommon/src/tools/cryptography/user-key-encryptor.ts 75.00% 4 Missing ⚠️
libs/importer/src/components/importer-providers.ts 0.00% 1 Missing ⚠️
...ons/history/src/local-generator-history.service.ts 83.33% 1 Missing ⚠️
...y/src/create-legacy-password-generation-service.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #19433      +/-   ##
==========================================
- Coverage   45.37%   45.36%   -0.01%     
==========================================
  Files        3764     3764              
  Lines      110625   110617       -8     
  Branches    16818    16821       +3     
==========================================
- Hits        50191    50181      -10     
- Misses      58227    58230       +3     
+ Partials     2207     2206       -1     

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

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

mcamirault
mcamirault previously approved these changes Mar 9, 2026
@mzieniukbw mzieniukbw marked this pull request as draft March 9, 2026 16:07
@mzieniukbw
Copy link
Copy Markdown
Contributor Author

Looks like we can't use sdk-managed state. Need to make change to SDK first.

@mzieniukbw mzieniukbw dismissed stale reviews from mcamirault and quexten via ef5fdd0 March 10, 2026 11:45
@mzieniukbw mzieniukbw marked this pull request as ready for review March 10, 2026 15:21
@mzieniukbw mzieniukbw requested a review from a team as a code owner March 10, 2026 15:21
@mzieniukbw mzieniukbw requested a review from quexten March 10, 2026 15:50
@mzieniukbw mzieniukbw requested a review from mcamirault March 10, 2026 15:50
Copy link
Copy Markdown
Member

@dani-garcia dani-garcia left a comment

Choose a reason for hiding this comment

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

Platform changes lgtm

Copy link
Copy Markdown
Contributor

@mcamirault mcamirault left a comment

Choose a reason for hiding this comment

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

Tools changes still look good

@sonarqubecloud
Copy link
Copy Markdown

@bw-ghapp
Copy link
Copy Markdown
Contributor

bw-ghapp bot commented Mar 11, 2026

Changes in this PR impact the Autofill experience of the browser client

BIT has tested the core experience with these changes and all feature flags disabled.

✅ Fortunately, these BIT tests have passed! 🎉

@bw-ghapp
Copy link
Copy Markdown
Contributor

bw-ghapp bot commented Mar 11, 2026

Changes in this PR impact the Autofill experience of the browser client

BIT has tested the core experience with these changes and the feature flag configuration used by vault.bitwarden.com.

✅ Fortunately, these BIT tests have passed! 🎉

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.

4 participants