fix(passkey): an account with a passkey starts by proving the email - #206
Merged
Merged
Conversation
POST /auth/passkey/prepare-registration was unauthenticated and created an account for any unclaimed email with emailVerified: true, started a session and returned a token, before the address was proven or a passkey existed. Anyone could claim somebody else's address; any RP trusting email_verified (course purchases on mikefluff.com are looked up by it) treated them as its owner, and the real owner signing in later by magic link landed in an account holding the claimant's passkey. - The endpoint and AuthService.createUserForPasskey are gone. Registration is the email one-time code (/auth/otp/request, /auth/otp/verify: proves the address, creates the account, starts the session), then the authenticated /passkey/registration/options + verify. An existing account just gets a passkey added, so the 'already exists' loop is gone too. - Passkey sign-in goes through establishSession (regenerate, signed cookie) instead of mutating the session it arrived with. amr carries mfa only when the authenticator verified the user. - authentication/options ignores email: scoping by it returned that address's credential ids. Sign-in is discoverable-only; registration requires a resident key, drops the platform-only restriction and the client-device hint so security keys and phones work, and throttles options. - The sign-in page no longer flips to registration on 'passkey not found'. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FdVXRzoHDTGciZtVhbhy8y
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.
POST /auth/passkey/prepare-registration was unauthenticated and created an
account for any unclaimed email with emailVerified: true, started a session and
returned a token, before the address was proven or a passkey existed. Anyone
could claim somebody else's address; any RP trusting email_verified (course
purchases on mikefluff.com are looked up by it) treated them as its owner, and
the real owner signing in later by magic link landed in an account holding the
claimant's passkey.
the email one-time code (/auth/otp/request, /auth/otp/verify: proves the
address, creates the account, starts the session), then the authenticated
/passkey/registration/options + verify. An existing account just gets a
passkey added, so the 'already exists' loop is gone too.
instead of mutating the session it arrived with. amr carries mfa only when
the authenticator verified the user.
address's credential ids. Sign-in is discoverable-only; registration
requires a resident key, drops the platform-only restriction and the
client-device hint so security keys and phones work, and throttles options.
Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01FdVXRzoHDTGciZtVhbhy8y