Skip to content

[PM-32439] Consolidate safe module cryptographic namespacing strategy#770

Draft
quexten wants to merge 7 commits intomainfrom
km/consolidate-values
Draft

[PM-32439] Consolidate safe module cryptographic namespacing strategy#770
quexten wants to merge 7 commits intomainfrom
km/consolidate-values

Conversation

@quexten
Copy link
Contributor

@quexten quexten commented Feb 16, 2026

🎟️ Tracking

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

📔 Objective

Expands the cryptographic namespace separation to follow a clearer strategy. Specifically, there are now two layers of namespace separation, the object layer and the content layer. On the object layer we partition the cryptographic primitives (Encrypt0, Sign1) into safe primitives (DataEnvelope, PasswordProtectedKeyEnvelope, etc). On the content layer, we partition each of the above subsets further, by use-case. For example, a valid partitioning for PasswordProtectedKeyEnvelope would be {MasterPassword, Pin}.

This prevents a class of attacks where the server switches cryptographic objects, signed/encrypted under the same key. This eliminates any kind of cryptographic analysis that would be needed to prevent the above attacks / limits security analysis to each sub-namespace spanned by the combination of the object and content namespace layer.

🚨 Breaking Changes

@github-actions
Copy link
Contributor

github-actions bot commented Feb 16, 2026

Logo
Checkmarx One – Scan Summary & Details01a0db60-98c2-4d77-9471-f0c26fb66f7f

Great job! No new security vulnerabilities introduced in this pull request

@github-actions
Copy link
Contributor

github-actions bot commented Feb 16, 2026

🔍 SDK Breaking Change Detection Results

SDK Version: km/consolidate-values (20773fa)
Completed: 2026-02-18 15:02:10 UTC
Total Time: 280s

Client Status Details
typescript ✅ No breaking changes detected TypeScript compilation passed with new SDK version - View Details

Breaking change detection completed. View SDK workflow

@codecov
Copy link

codecov bot commented Feb 16, 2026

Codecov Report

❌ Patch coverage is 87.24490% with 25 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.07%. Comparing base (5119759) to head (20773fa).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
.../safe/password_protected_key_envelope_namespace.rs 20.00% 12 Missing ⚠️
crates/bitwarden-crypto/src/safe/data_envelope.rs 50.00% 10 Missing ⚠️
crates/bitwarden-core/src/key_management/crypto.rs 83.33% 1 Missing ⚠️
...bitwarden-core/src/key_management/crypto_client.rs 80.00% 1 Missing ⚠️
...crypto/src/safe/password_protected_key_envelope.rs 99.20% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #770      +/-   ##
==========================================
+ Coverage   82.05%   82.07%   +0.02%     
==========================================
  Files         331      332       +1     
  Lines       38348    38514     +166     
==========================================
+ Hits        31466    31610     +144     
- Misses       6882     6904      +22     

☔ 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.

@quexten quexten force-pushed the km/consolidate-values branch from 96c814a to 9f988f2 Compare February 16, 2026 13:17
@quexten quexten changed the title Consolidate namespace headers Consolidate safe namespacing strategy Feb 16, 2026
@quexten quexten changed the title Consolidate safe namespacing strategy Consolidate safe module cryptographic namespacing strategy Feb 16, 2026
@quexten quexten changed the title Consolidate safe module cryptographic namespacing strategy [PM-32439] Consolidate safe module cryptographic namespacing strategy Feb 18, 2026
@quexten quexten force-pushed the km/consolidate-values branch from a267c1d to db20456 Compare February 18, 2026 13:03
/// The label used for the namespace ensuring strong domain separation when using data envelopes.
pub(crate) const DATA_ENVELOPE_NAMESPACE: i64 = -80001;
// The label used for defining the namespace of a signed object
pub(crate) const SIGNING_NAMESPACE: i64 = 80000;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Keeping signing namespace a separate layer. It spans a separate namespace that does not just include safe objects.

@sonarqubecloud
Copy link

@quexten quexten marked this pull request as ready for review February 19, 2026 13:19
@quexten quexten requested review from a team as code owners February 19, 2026 13:19
@quexten quexten marked this pull request as draft February 19, 2026 13:20
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

Comments