Password-reset codes are a login: cap attempts, expire them fast, and alert on bursts of failed resets followed by a password change and new login
- Limit: a handful of wrong codes per request, per account and per source IP, then invalidate the code; short expiry; codes long enough to make guessing hopeless.
- Detect: many failed reset-code checks for one account (or one IP across many accounts), then a successful reset, a password change and a login from a new IP or device within minutes.
- Contain: a password reset should kill existing sessions and notify the user by a second channel; require MFA after a reset, not just before it.
- API keys: scope them, keep an inventory of what uses each, and make sure you can revoke all of them at once, as Dooray had to.
Sources: Dooray notice (Nov 14, 2026) · OWASP Forgot Password Cheat Sheet