-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Fix PasskeySignInAsync to enforce email/phone confirmation and lockout checks #65024
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
Co-authored-by: MackinnonBuck <10456961+MackinnonBuck@users.noreply.github.com>
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.
Pull request overview
This PR fixes a security vulnerability where PasskeySignInAsync() was bypassing important sign-in requirements (email confirmation, phone confirmation, and lockout checks) that are properly enforced by other sign-in methods like PasswordSignInAsync().
Changes:
- Added
PreSignInCheck()call inPasskeySignInCoreAsyncto enforce email/phone confirmation and lockout requirements before signing in - Added three comprehensive unit tests to verify the fix works correctly for all three scenarios (email confirmation, phone confirmation, and lockout)
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/Identity/Core/src/SignInManager.cs | Added PreSignInCheck() call after successful passkey assertion to enforce sign-in requirements |
| src/Identity/test/Identity.Test/SignInManagerTest.cs | Added three tests to verify email confirmation, phone confirmation, and lockout checks work with passkey sign-in |
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
|
I assume we're going to backport this to release/10.0? |
Fix PasskeySignInAsync to enforce email/phone confirmation and lockout checks
Fix PasskeySignInAsync bypassing RequireConfirmedEmail, RequireConfirmedPhoneNumber, and lockout
Description
PasskeySignInAsync()was not callingPreSignInCheck()before signing in users, allowing authentication to succeed even when:RequireConfirmedEmail = trueand email is unconfirmedRequireConfirmedPhoneNumber = trueand phone is unconfirmedThis is inconsistent with
PasswordSignInAsync()and other sign-in methods that properly enforce these requirements.Changes:
SignInManager.PasskeySignInCoreAsync: AddedPreSignInCheck()call after successful passkey assertion, before updating passkey metadata. ReturnsSignInResult.NotAllowedorSignInResult.LockedOutwhen requirements aren't met.Tests: Added
CanRequireConfirmedEmailForPasskeySignIn,CanRequireConfirmedPhoneNumberForPasskeySignIn, andPasskeySignInReturnsLockedOutWhenLockedOutto verify enforcement.Original prompt
This pull request was created from Copilot chat.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.