[PM-35105] Add hazmat module and shared COSE symmetric encryption#1202
[PM-35105] Add hazmat module and shared COSE symmetric encryption#1202quexten wants to merge 8 commits into
Conversation
Introduces a hazmat::symmetric_encryption module (moving the XChaCha20-Poly1305 primitive into it and adding AES-256-GCM), and a shared cose::symmetric layer that seals/unseals COSE Encrypt/Encrypt0 bodies with either cipher, declaring the content-encryption algorithm in the protected header. Migrates the data, symmetric-key, and password-protected key envelopes to the shared encrypt/decrypt helpers. The password envelope's COSE byte layout shifts, so the pin corruption test now flips a byte at the envelope midpoint.
🔍 SDK Breaking Change DetectionSDK Version:
Breaking change detection uses the build of the SDK from this branch, including any incompatibities pre-existing on or merged into this branch. Check the workflow logs to confirm. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## km/high-entropy-secret #1202 +/- ##
==========================================================
+ Coverage 85.09% 85.17% +0.07%
==========================================================
Files 465 467 +2
Lines 63947 64291 +344
==========================================================
+ Hits 54415 54757 +342
- Misses 9532 9534 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
🤖 Bitwarden Claude Code ReviewOverall Assessment: APPROVE Reviewed the new Code Review DetailsNo new findings. Backward-compatibility verification:
Notes (not findings):
Dependency Changes
|
|
|
||
| [dependencies] | ||
| aes = { version = "0.9.0", features = ["zeroize"] } | ||
| aes-gcm = { version = "0.11.0-rc.4", features = ["zeroize"] } |
There was a problem hiding this comment.
aes-gcm added — confirm AppSec dependency review was completed.
Details
aes-gcm = "0.11.0-rc.4" is a net-new direct dependency for bitwarden-crypto. Bitwarden's Dependency Review and Approval process requires AppSec review (typically tracked via a VULN task) before introducing a new dependency, and the PR description references only PM-35105 with no approval signal.
Two specifics worth confirming with AppSec:
- This is a release-candidate version (
0.11.0-rc.4), not a stable release. Pre-release crypto dependencies warrant extra scrutiny on maintenance/stability. - It is published by the RustCrypto org (same as the existing
aesandchacha20poly1305deps), which should ease review.
If approval was already obtained out-of-band, linking the VULN task in the PR description resolves this.
Reference: Bitwarden Dependency Review and Approval process (Stage 1–4).
There was a problem hiding this comment.
|



🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-35105
📔 Objective
Stacked PR 2/4 (on top of #1201).
Introduces a
hazmat::symmetric_encryptionmodule (moving XChaCha20-Poly1305 into it and adding AES-256-GCM), and a sharedcose::symmetriclayer that seals/unseals COSE Encrypt/Encrypt0 bodies with either cipher, declaring the content-encryption algorithm in the protected header. Migrates the data, symmetric-key, and password-protected key envelopes to the shared encrypt/decrypt helpers.The password envelope's COSE byte layout shifts, so the pin corruption test now flips a byte at the envelope midpoint.
Base:
km/high-entropy-secret(#1201).