-
Notifications
You must be signed in to change notification settings - Fork 1.5k
PM-2035: PRF Unlock (web + extension) #16662
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
This commit refactors the login-via-webauthn commit as per @JaredSnider-Bitwarden suggestions. It also fixes an existing issue where Icons are not displayed properly on the web vault. Remove old one. Rename the file Working refactor Removed the icon from the component Fixed icons not showing. Changed layout to be 'embedded'
Cleanup and testes
|
Fixed Issues (64)Great job! The following issues were fixed in this Pull Request
|
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.
While this is still in draft, I've put some early comments since it looks interesting.
A general question: Is the intended flow here that users set up their credentials as login credentials, but then they also happen to be able to unlock with it? (I.e the use case of "i want my credential to be only usable for unlock" is one we don't care about?)
libs/common/src/key-management/models/response/user-decryption.response.ts
Show resolved
Hide resolved
| } | ||
|
|
||
| // Step 1: Decrypt PRF encrypted private key using the PRF key | ||
| const privateKey = await this.encryptService.unwrapDecapsulationKey( |
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.
Non blocking for this PR but this should be abstracted away to the "rotateableKeySet" concept we use here. KM does not have an API and I don't expect it to be built in this PR but this needs cleaning up. We should probably drop a comment.
libs/key-management/src/abstractions/webauthn/webauthn-prf-unlock.service.abstraction.ts
Outdated
Show resolved
Hide resolved
libs/key-management/src/abstractions/webauthn/webauthn-prf-unlock.service.abstraction.ts
Outdated
Show resolved
Hide resolved
libs/key-management/src/abstractions/webauthn/webauthn-prf-unlock.service.abstraction.ts
Outdated
Show resolved
Hide resolved
libs/key-management/src/abstractions/webauthn/webauthn-prf-unlock.service.abstraction.ts
Outdated
Show resolved
Hide resolved
apps/browser/src/key-management/lock/services/extension-lock-component.service.ts
Outdated
Show resolved
Hide resolved
| .map((option) => WebAuthnPrfUserDecryptionOption.fromResponse(option)) | ||
| .filter((option) => option !== undefined); | ||
|
|
||
| await this.userDecryptionOptionsService.setUserDecryptionOptions(updatedOptions); |
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.
question: There is a slight race condition here. We check the activeAccount on row 423 and try to act only for it. However, since the setUserDecryptionOptions acts on the current account instead of accepting a userId, there is a theoretical risk that the account is changed between the check and this operation?
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.
block: Auth will change setUserDecryptionOptions to accept a UserId to eliminate this race.
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.
@bitwarden/team-auth-dev Did you get around to refactor setUserDecryptionOptions to accept a userid?
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.
Implemented here: #17069 (pull on main)
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.
Also implemented here (Plan a is to have this merge and rebase): #16894
Yes
I do care about that use case (quite a lot actually) -- but it will have to come next and is likely not impacting the unlock flow, just the login flow. (I'm imagining a checkbox that says 'Unlock only' and we just check that flag when the user tries to login). |
|
Note for auth reviewers: After brief discussion with @abergs the approach here seems reasonable and secure. It has yet to be discussed within KM, however it is essentially not that much different from our existing approach for masterpassword unlock which also locally caches the login decryption data for local unlock. In this case we are caching more data, but the data is only useful with the correct PRF key. It has some implications on how some future KM work will play out, such as key rotation without logout, but nothing that is blocking. |
|
As only a user, I would like to throw in something from the user's perspective. Personally I really long for that feature BTW, to make that clear from the beginning! But I do see a growing confusion to just using the term "Unlock with passkey" (on the button etc.). For a longer time now, I think it is already confusing enough to both call "login-with-passkeys"-passkeys and "FIDO2-2FA-passkeys" both just "passkeys". (at one point I thought, it would already be better to call them "login-passkey" and "2FA-passkey" to have some differentiation here) And I can already see users trying to unlock their vault with Bitwarden-2FA-"passkeys" (which BTW in the web vault, when you set them up, are also just called the "passkey" option), getting confused and desperate why it doesn't work. (as I understand this PR, only "login-with-passkey"-passkeys with encryption / PRF will work for unlocking?!) I do get the general idea to make it easy for users to just call both (login and 2FA) passkeys and be done with it. But I really think it creates more confusion for users, when two things that work differently and in different places (login / 2FA / unlocking) are all called the same... Sorry for the intrusion and "rant". 😉 (PS: I added "FIDO2" to the 2FA option as it was and still is also called the FIDO2-2FA option... of course "login-with-passkey" - or rather "passkeys" in general - are also FIDO2.) |
|
@pamperer562580892423 I hear where you are coming from.
We'll be looking to improve the UI where users register their passkeys, to more easily understand and control what capabilities each key has. The work will however take place in a separate PR. |
👍
Very good! Though, it's also difficult for users to remember those kind of things e.g. a few months later... If I may, I would suggest to also include something like "Unlock with passkey doesn't work with "2FA-passkeys". It only works with "login-passkeys" with encryption." in that error message here:
That way, users automatically see why it doesn't work if they try to use a 2FA-passkey...
Thanks for your response! 🤗 |
libs/key-management/src/services/webauthn/webauthn-prf-unlock.service.ts
Outdated
Show resolved
Hide resolved
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.
Some more smaller things
libs/key-management-ui/src/lock/services/webauthn-prf-unlock.service.ts
Outdated
Show resolved
Hide resolved
libs/key-management/src/services/webauthn/webauthn-prf-unlock.service.ts
Outdated
Show resolved
Hide resolved
libs/key-management/src/services/webauthn/webauthn-prf-unlock.service.ts
Outdated
Show resolved
Hide resolved
libs/key-management/src/services/webauthn/webauthn-prf-unlock.service.ts
Outdated
Show resolved
Hide resolved
libs/key-management/src/services/webauthn/webauthn-prf-unlock.service.ts
Outdated
Show resolved
Hide resolved
libs/key-management/src/services/webauthn/webauthn-prf-unlock.service.ts
Outdated
Show resolved
Hide resolved
libs/key-management/src/services/webauthn/webauthn-prf-unlock.service.ts
Outdated
Show resolved
Hide resolved
libs/key-management/src/services/webauthn/webauthn-prf-unlock.service.ts
Outdated
Show resolved
Hide resolved
libs/key-management/src/services/webauthn/webauthn-prf-unlock.service.ts
Outdated
Show resolved
Hide resolved
libs/key-management/src/services/webauthn/webauthn-prf-unlock.service.ts
Outdated
Show resolved
Hide resolved
libs/key-management-ui/src/lock/services/default-webauthn-prf-unlock.service.ts
Show resolved
Hide resolved
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.
KM code lgtm, however the active userid issue on setDecryptionOptions is concerning, so please fix / work with auth to fix before merging.
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.
The feedback addressed looks good. Two things, one open piece around missing things in setUserKeyAndContinue and an FYI of incoming eslint warnings from main.
libs/key-management-ui/src/lock/components/unlock-via-prf.component.ts
Outdated
Show resolved
Hide resolved
libs/key-management-ui/src/lock/services/webauthn-prf-unlock.service.ts
Outdated
Show resolved
Hide resolved
|
Claude finished @abergs's task —— View job PR Review: PRF Unlock ImplementationI've completed a comprehensive review of the latest changes. Here's my analysis: Summary of Changes Since Last ReviewThe PR has been significantly refined based on previous feedback. Key updates include:
Critical Issues Found1. Missing Unit Tests
|
Patrick-Pimentel-Bitwarden
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.
👍 Auth changes are great! Thank you. I see you have other comments pending so I'll watch to reapprove
b01dbbf
|
@claude you probably need to update your review. |
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.
👍 Auth changes are great! Thank you
Patrick-Pimentel-Bitwarden
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.
👍 Auth changes look good.
26a628a






🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-2035
📔 Objective
This PR introduces PRF powered unlock in our web + browser clients.
Here's a summary of the changes:
webauthn-prf-unlock.service.ts. Internally it forwards a few calls to the existingWebAuthnLoginPrfKeyServiceAbstraction.This PR is dependant on the server changes proposed in bitwarden/server#6401.
📸 Screenshots
Demo recording: https://share.cleanshot.com/tf9QTgBb
⏰ Reminders before review
🦮 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 confirmed issue 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