Repository navigation
Sign-in: the e-mail code stands in for a second factor that is gone - #260
Merged
Merged
Conversation
…gone An administrator whose only second factor was a passkey on a broken device could not sign in: the login asked for that passkey and offered nothing else, and the e-mail code could not be switched on because that is an account change, which needs the same passkey. The way back in was the recovery CLI, which a realm administrator cannot reach. ADR 0025, amendment 3: - After a password, the e-mail code is offered beside the user's own second factor (TOTP or a usable passkey) wherever the target offers the e-mail code after a password. No opt-in; a confirmed address is required. Browser only: no native grant starts with a password. - It stands in for a factor the user has. A user without any second factor still gets the setup duty, and the fallback never raises the level. - A session signed in with the password and a fresh e-mail code may change what protects the account (remove the passkey, set up TOTP). The step-up for an account change offers the code. - For EmailFallbackWaitHours (realm setting, default 24, 0-720) after a password reset by e-mail the fallback is neither offered nor accepted: password and code would come from the same mailbox. UserSecurityData.PasswordResetByEmailAt records the reset. - A realm that does not offer the e-mail code after a password has no fallback. This deliberately reverses the earlier hardening that issued the e-mail second factor only to users who had switched it on (audit M2). The opt-in still gates the code for a user without another factor. Also: - A password reset by e-mail now sends the account-change notice; only the change in the profile did. - /api/account/email-otp/login accepts a code only where one may be issued as this user's second factor. A code issued by the e-mail-code sign-in shares the challenge and was accepted there after a password. Tests: unit tests for the rule and the wait; integration scenarios S15-S17 (sign in and remove the passkey, the wait after a reset including a code from the sign-in path, confirming an account change from a password session) and the realm switch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Why
An administrator whose only second factor was a passkey on a broken device could not sign in: the login asked for that passkey and offered nothing else. The e-mail code could not be switched on either, because that is an account change, which needs the same passkey. The way back in was the recovery CLI, which a realm administrator cannot reach.
What changes (ADR 0025, amendment 3)
EmailFallbackWaitHours(new realm setting, default 24, 0–720) after a password reset by e-mail the fallback is neither offered nor accepted: password and code would come from the same mailbox.This deliberately reverses the earlier hardening that issued the e-mail second factor only to users who had switched it on (audit M2). The opt-in still gates the code for a user without another factor.
Also
/api/account/email-otp/loginaccepts a code only where one may be issued as this user's second factor. A code issued by the e-mail-code sign-in shares the challenge and was accepted there after a password.Not covered
Accounts without a password, and realms that switch the fallback off, still need the operator. A reset by another administrator in the admin console and recovery codes are not part of this.
Tests
🤖 Generated with Claude Code