fix(auth): invalidate prior pending reset tokens when a new reset is requested #284
No reviewers
Labels
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
psa-systems/bunyip!284
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/BUNYIP-256-cap-pending-reset-tokens"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
BUNYIP-256: shrink the live password-reset-token surface to exactly one per user. When
request_password_resetissues a fresh token, any still-valid older tokens for the same user are marked used in the same flow.The audit's framing was an O(N) Argon2 DoS amplifier - that turned out to be wrong against this codebase: the actual lookup is
find_password_reset_token_by_hashdoing a single indexed SELECT by SHA-256 hash, no Argon2 loop. The remaining defense-in-depth wins still hold and are worth shipping:The new
TokenRepository::revoke_pending_password_reset_tokensis a single UPDATE; failure is logged and the request proceeds (no false-negative blocking the legitimate reset).complete_password_resetcontinues to work unchanged because it always operates on the most-recent token.#BUNYIP-256