-
Notifications
You must be signed in to change notification settings - Fork 12
[PM-22861] Account security state #322
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
Conversation
Great job, no security vulnerabilities found in this Pull Request |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #322 +/- ##
==========================================
+ Coverage 71.86% 72.72% +0.85%
==========================================
Files 240 241 +1
Lines 19635 20154 +519
==========================================
+ Hits 14111 14656 +545
+ Misses 5524 5498 -26 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Security state seems like it would fit better in the bitwarden-core crate than crypto, similar to EncryptionSettings. |
The reason it lives in That does make me wonder if namespace should really be a generic parameter, similar to how key context is done with the actual key ids being defined in core. |
This seems to only be enforced by convention though, there's nothing in the type system providing compiler level safety?
I think so, or leaving the code signing concepts in crypto but lifting out the application logic. Or splitting up the crypto crate into multiple more focused areas where some provide low level utilities but other mixing domain logic. |
Yeah, that is true, currently this relies on people reading the documentation. I think we can change this in the long term to:
This does not provide complete safety, but at least makes accidental misuse less likely. |
I think resorting the crypto crate is something we wanted to do anyways after "user crypto v2" is done; I recall we had a DM about this with you and Dani, for how this would look. I'd like to defer resorting the crate for after the bigger changes here are done however. Are we OK with putting this in |
I think I'd prefer to just put it in core right now and not have a link in the documentation. It's weird that we have crypto errors that are only thrown by other crates. We can always lift it in later if we think it fits better. |
Moving this to draft until the preceeding PR is merged. |
a756507
to
7fa725f
Compare
/// Initializes the user's cryptographic state for v2 users. | ||
/// If the client already contains a v1 user, then this user's private-key will be | ||
/// re-used. | ||
pub(crate) fn make_keys_for_user_crypto_v2( |
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 moves more to the SDK than had been previously in the SDK. Since this API is not used yet a breaking change seemed OK.
…k-internal into km/account-security-version
|
🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-22861
📔 Objective
This adds the initial version of account security state to the sdk, on init of the sdk state, and for enrollment to v2 crypto.
Account security state is an attestation to a specific version and featureset that is enabled. The version is used to prevent cryptographic downgrades of the account state.
This will prevent downgrades in the following ways:
A security version then is used to lock down specific features. If a feature is to be disabled, then a migrator is needed. After migrating the account not to use the retired feature, the version is incremented and any subsequent syncs with that format included are rejected.
This PR stores the account security state on the client for v2 users. However, besides validating that the state is correctly signed, it is not yet used.
⏰ 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