Expired Password Reset Token Remains Valid
Level 2 · node · Security · Token expiry timestamp unit mismatch
Scenario
An account recovery service stores reset-token expiresAt values as Unix seconds. The validation service receives the current time in milliseconds, converts it to seconds, but then multiplies expiresAt by 1000 during comparison. As a result, already expired reset tokens remain valid far longer than intended.
Requirements
- Interpret expiresAt as Unix seconds - Interpret nowMs as Unix milliseconds - Reject a token when the current time is at or beyond expiresAt - Allow a token that has not expired yet - Reject missing or already-used tokens
Acceptance criteria
- A token before expiry validates successfully
- A token is rejected exactly at its expiry time
- A token after expiry is rejected
- A used token is rejected
- A missing token is rejected