-
Notifications
You must be signed in to change notification settings - Fork 20
[PM-26177] Add methods to create rotateable key sets from PRF #494
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 |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #494 +/- ##
==========================================
- Coverage 78.10% 78.07% -0.04%
==========================================
Files 283 288 +5
Lines 27628 27853 +225
==========================================
+ Hits 21579 21745 +166
- Misses 6049 6108 +59 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
2514070
to
32ca764
Compare
}) | ||
} | ||
|
||
fn unlock<Ids: KeyIds>( |
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.
This method is currently unused since we don't yet have plans to use the rotateable key set on mobile, only to create them. However, it implements functionality that is currently done in TypeScript that could be moved to the SDK.
I can remove it until we decide to either migrate the browser apps to this SDK method or start using it in the mobile apps.
let pub_key = SpkiPublicKeyBytes::from(pub_key_bytes); | ||
let encapsulation_key = AsymmetricPublicCryptoKey::from_der(&pub_key)?; | ||
// TODO: There is no method to store only the public key in the store, so we | ||
// have pull out the encryption key to encapsulate it manually. |
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.
Note: I think this needs a KM-owned tech debt follow-up ticket. I'll make a jira ticket when this merges, but adding the APIs for this feels out of scope for an external PR.
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.
Changes look mostly good, thank you!
Only some minor questions / nits.
One more (optional) suggestion here would be to take test vectors from the TS clients and feed them into the unit tests so we know the implementation works the same way.
Thank you for the review!
I looked around the clients codebase, but I don't see a full test vector for an end-to-end (PRF, User Key) -> RotateableKeySet and back. There are mocked values that don't verify the actual cryptography in https://github.com/bitwarden/clients/blob/main/libs/auth/src/common/login-strategies/webauthn-login.strategy.spec.ts and https://github.com/bitwarden/clients/blob/main/libs/common/src/auth/services/webauthn-login/webauthn-login.service.spec.ts. The Rust types guarantee some of the other invariants tested in. Did you have some specific test vectors in mind? |
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.
Note: I'd recommend moving RotateableKeySet into it's own file, since it is a different cryptographic construction. key_rotation.rs
is really just meant for "User Key Rotation", which may interact with RotateableKeySets, but is a different use-case.
(As a KM note, key_rotation.rs
should probably be renamed to user_key_rotation.rs
)
Claude finished @iinuwa's task —— View job PR Review: Add methods to create rotateable key sets from PRFReview Tasks:
SummaryThis PR successfully implements PRF-based rotateable key set creation for mobile unlock passkeys. The implementation follows established patterns in the codebase and addresses the core requirements. However, there are several areas that need attention. 🎨 Code Quality & ArchitecturePositive Aspects
Areas for Improvementcrates/bitwarden-crypto/src/keys/prf.rs🎨 Minor Issues:
crates/bitwarden-crypto/src/store/key_rotation.rs📝 Observations:
crates/bitwarden-core/src/key_management/crypto.rs✅ Implementation looks correct:
🔒 Security AnalysisCryptographic Correctness
Security Concerns
🧪 TestingTest Coverage
Test QualityThe tests in 🚀 Performance & Efficiency
📋 API Design
|
|
🎟️ Tracking
PM-26177
📔 Objective
In order to set up unlock passkeys on mobile clients, this PR adds a method to create a rotateable key set derived from a PRF value.
This is based on existing code in the TypeScript library and web vault:
⏰ 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