-
Notifications
You must be signed in to change notification settings - Fork 25
[PM-18938] Isolate decryption support for type 0 user keys #585
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Great job! No new security vulnerabilities introduced in this pull request |
🔍 SDK Breaking Change Detection ResultsSDK Version:
Breaking change detection completed. View SDK workflow |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #585 +/- ##
==========================================
+ Coverage 79.46% 79.52% +0.05%
==========================================
Files 302 302
Lines 32331 32423 +92
==========================================
+ Hits 25691 25783 +92
Misses 6640 6640 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
a43d18f to
60dfd44
Compare
quexten
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving, but I have one optional comment / request. Other than that looks good; Nice work!
|
Claude finished @eligrubb's task —— View job Code Review CompleteSummaryThis PR successfully isolates Type 0 key decryption support to the PR Description QualityThe PR description is well-structured and comprehensive:
FindingsFinding 1: Inconsistent error naming in 💭 In Context// Line 155-157
EncString::Cose_Encrypt0_B64 { .. } => {
return Err(CryptoError::OperationNotSupported(
crate::error::UnsupportedOperationError::DecryptionNotImplementedForKey, // ✓ Now uses correct error
));
}Status: This has actually been addressed in the current PR (line 156 uses Finding 2: Test moved without tracking relationship to isolated code path 💭 The test Suggested addition#[test]
// This test validates the ONLY remaining Type 0 decryption path:
// master_key.rs:decrypt_user_key() for backward compatibility with legacy accounts
fn test_decrypt_cbc256() {Finding 3: Missing test coverage for blocked COSE user key decryption
Suggested test#[test]
fn test_decrypt_user_key_fails_for_cose() {
let master_key = MasterKey::generate(rand::thread_rng());
// Create a COSE-encrypted EncString (dummy values are fine for this test)
let cose_enc_str = EncString::Cose_Encrypt0_B64 {
data: vec![0u8; 32],
};
let result = master_key.decrypt_user_key(cose_enc_str);
assert!(
matches!(
result,
Err(CryptoError::OperationNotSupported(
crate::error::UnsupportedOperationError::DecryptionNotImplementedForKey
))
),
"Expected COSE user key decryption to fail"
);
}Finding 4: Comprehensive test coverage for new restrictions 👍 Excellent test coverage added in
Finding 5: Direct AES call preserves exact behavior for master key path 👍 The isolated path in Security & Backward Compatibility AssessmentBackward Compatibility: ✓ Maintained
Security: ✓ Improved
Crypto Safety: ✓ Appropriate
Test Coverage AnalysisPatch Coverage: 88.78% (12 lines missing coverage per Codecov) Missing coverage breakdown:
Good Practices Observed
Action Items
Status of Previous Review Comments@quexten's review comment about switching to |
Thomas-Avery
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! LGTM

🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-18938
📔 Objective
Isolates Type 0 key decryption to the
master_key.rs:decrypt_user_key()flow. All other uses now raise newbitwarden-cryptoerrorUnsupportedOperationError::DecryptionNotImplementedForKey.This is another small step in deprecating use of legacy Type 0 keys in the sdk, see tech breakdown. Type 0 keys have been deprecated from active use for a long time, this continues the process of removing their functionality while still supporting master key decryption for old accounts.
Type 0-based encryption was already deprecated in a prior PR, this change isolates decryption. Prior work isolated clients to use only the
master_key.rs:decrypt_user_keypath (in TS clients, viaPureCrypto.decrypt_user_key_with_master_key#465). Other uses of type 0 keys are expected to now throw an error.🚨 Breaking Changes
⏰ Reminders before review
team
🦮 Reviewer guidelines
:+1:) or similar for great changes:memo:) or ℹ️ (:information_source:) for notes or general info:question:) for questions:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmedissue and could potentially benefit from discussion
:art:) for suggestions / improvements:x:) or:warning:) for more significant problems or concerns needing attention:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt:pick:) for minor or nitpick changes