Fix PasskeySignInAsync to enforce email/phone confirmation and lockout checks - #65024
Conversation
Co-authored-by: MackinnonBuck <10456961+MackinnonBuck@users.noreply.github.com>
There was a problem hiding this comment.
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? |
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
|
/backport to release/10.0 |
|
Started backporting to |
|
@MackinnonBuck backporting to git am output$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch
Patch format detection failed.
Error: The process '/usr/bin/git' failed with exit code 128 |
|
This PR is documented as a breaking change in ASP.NET Core 11: It is the outcome of the issue I originally opened, which was fixed by this PR. Original issue: #65020 Sharing this for traceability, in case it helps future readers connect report → fix → documentation. Tested OK, problem solved. |
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.