fix(passkey): resolve Backup Eligible flag inconsistency on login (#2… - #2779
Open
guptamilind0099 wants to merge 1 commit into
Open
Conversation
…pabase#2732) Fix passkey verification failure when an authenticator's Backup Eligible (BE) flag changes between registration and authentication. This issue affected Apple iCloud Keychain passkeys where BE is false during initial registration before iCloud sync completes, and flips to true during subsequent logins. - Update newWebAuthnUserWithAssertion to align cred.Flags.BackupEligible with incoming assertion data for matching credentials. - Add UpdateLastUsedWithSignCountAndFlags to persist updated sign count, backup eligibility, and backup state in webauthn_credentials. - Add unit tests verifying Backup Eligible flag synchronization. Fixes supabase#2732
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix passkey verification failure when an authenticator's Backup Eligible (BE) flag changes between registration and authentication. This issue affected Apple iCloud Keychain passkeys where BE is false during initial registration before iCloud sync completes, and flips to true during subsequent logins.
newWebAuthnUserWithAssertionto aligncred.Flags.BackupEligiblewith incoming assertion data for matching credentials.UpdateLastUsedWithSignCountAndFlagsto persist updated sign count, backup eligibility, and backup state inwebauthn_credentials.Fixes #2732
What kind of change does this PR introduce?
Bug fix.
What is the current behavior?
POST /passkeys/authentication/verifyrejects valid WebAuthn assertions when an authenticator's Backup Eligible (BE) flag differs between registration and a later authentication ceremony.The client receives a generic
webauthn_verification_failed(HTTP 400), while the GoTrue server log records:"Backup Eligible flag inconsistency detected during login validation"This breaks passkey login for Apple iCloud Keychain passkeys (and other synced passkey authenticators) when a passkey registered prior to iCloud Keychain sync completion (where
BE = false) is used for authentication after sync activates (BE = true).Fixes #2732
What is the new behavior?
newWebAuthnUserWithAssertionininternal/api/passkey_webauthn.gosynchronizescred.Flags.BackupEligibleon candidate credentials matching the incoming assertion'sRawID. This allowsgo-webauthn's signature, challenge, origin, and counter verification to proceed without failing on strict immutability checks whenBEflips post-registration.UpdateLastUsedWithSignCountAndFlagsininternal/models/webauthn_credential.gopersists the updatedbackup_eligibleandbacked_upflags from the authenticator into thewebauthn_credentialsdatabase record.Additional context
@simplewebauthn/server) treatBackupEligibleandBackupStateflags as dynamic authenticator properties that can evolve post-registration rather than immutable attributes.BE = false) are unaffected.