Skip to content

fix(recovery): count wrong recovery codes per account and lengthen the codes - #624

Merged
Bccorb merged 1 commit into
mainfrom
fix/recovery-code-guess-budget
Nov 27, 2026
Merged

Bccorb merged 1 commit into
mainfrom
fix/recovery-code-guess-budget

Conversation

@Bccorb

@Bccorb Bccorb commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Self-service account recovery codes are stronger and their guesses are counted per account.

  • Email recovery codes are six letters, like the sign-in code, and phone codes are eight digits.
  • Each account may spend ten wrong recovery codes per channel in any 24 hours, counted across every /recovery/start and stored in auth_failures. A guess is claimed before the code is compared, so parallel requests cannot overspend it.
  • Once the budget is spent, /recovery/start sends no code and /recovery/verify checks none until the oldest wrong code is 24 hours old. Both answer as they otherwise would (200 and 401 invalid_recovery_code).
  • The budget is separate for each channel and does not affect sign-in lockout. If it cannot be read, the channel is treated as spent.

…e codes

Email recovery codes are six letters and phone codes eight digits. Wrong codes
are recorded in auth_failures per account and channel, claimed before the code
is compared, and ten in 24 hours stop that channel until the oldest ages out.
A spent or unreadable budget answers as a wrong code and sends nothing.
@Bccorb
Bccorb merged commit e5ad08e into main Nov 27, 2026
9 checks passed
@Bccorb
Bccorb deleted the fix/recovery-code-guess-budget branch November 27, 2026 04:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant