← Tutti i modelli

Link monouso con scadenza, nessuna enumerazione degli account, sessioni revocate dopo la reimpostazione.

Spec — Password reset

Status: draft · Created: 2026-11-10

1. Context and goal

People who forgot their password get back into their account by email, safely and without the flow revealing who has an account.

2. Functional requirements (EARS)

  • FR-1: WHEN a reset is requested for any email, THE SYSTEM SHALL answer 202 with the same body, and within 100 ms of the same response time, whether or not an account exists.
  • FR-2: WHEN the email belongs to an account, THE SYSTEM SHALL send a link with a random token of at least 128 bits that expires after 30 minutes, and store only a hash of the token.
  • FR-3: WHILE an email has received 3 links in the last hour or an IP has made 20 requests in the last hour, THE SYSTEM SHALL send no further link, answering 202 for the email and 429 with Retry-After for the IP.
  • FR-4: IF a token is expired, already used or superseded by a newer request, THEN THE SYSTEM SHALL answer 410 and offer to request a new link.
  • FR-5: WHEN a valid token comes with a new password, THE SYSTEM SHALL require at least 12 characters not found in a list of breached passwords, and answer 422 naming the failed rule otherwise.
  • FR-6: WHEN the password is changed, THE SYSTEM SHALL mark the token used and revoke every session and refresh token of the account within 5 seconds.
  • FR-7: WHEN the password is changed, THE SYSTEM SHALL email the account owner a notice with the time and IP address, and write an audit entry.

3. Out of scope

  • Reset by SMS or security questions.
  • Account recovery when the person no longer has the email address.