Authentication and API security

Build password-reset flows resistant to abuse

Design reset tokens, response timing and messaging to limit account enumeration and credential-reset abuse. A reset endpoint can reveal registered accounts through different messages or timing. Long-lived reusable reset links can be stolen or replayed, and sensitive tokens may leak through logs or referrer headers. Security controls depend on client type, data sensitivity and deployment context; verify provider and standards guidance before production changes.

Threat model and trust boundaries

A reset endpoint can reveal registered accounts through different messages or timing. Long-lived reusable reset links can be stolen or replayed, and sensitive tokens may leak through logs or referrer headers.

  • Identify actors, assets and trust boundaries
  • Choose controls that address the stated threat
  • Test failure behavior and recovery paths

Implementation approach

Return consistent responses, rate-limit requests, generate unpredictable single-use tokens, store only a verifier where feasible, expire tokens promptly, invalidate sessions according to policy and use a no-referrer reset page.

  • Confirm the responsible owner
  • Apply the change to a representative case
  • Document decisions and exceptions

Practical example

Both registered and unknown email addresses receive the same confirmation text; a reset token is consumed once and cannot be used after a password change.

  • Reproduce the starting situation
  • Apply the described approach
  • Check the user-facing result

Verification and follow-up

Test enumeration through status, body and timing; test replay, expiry, rate limits and email-link leakage. Never log reset token values.

  • Test expected and failure cases
  • Compare with the recorded baseline
  • Agree the next review date and owner

Questions to keep in view

When should a team use this authentication and api security guide?

Design reset tokens, response timing and messaging to limit account enumeration and credential-reset abuse.

What should be checked before rollout?

Test enumeration through status, body and timing; test replay, expiry, rate limits and email-link leakage. Never log reset token values.