[1.x] fix: enforce expiry check on password reset token submission - #4545
Merged
Conversation
imorland
force-pushed
the
im/security-password-reset-token-expiry
branch
from
April 11, 2026 11:31
33fbffc to
f913c60
Compare
POST /reset accepted any token present in the database without checking
whether it had expired, while GET /reset/{token} correctly enforced the
24-hour window. An attacker with access to a stale token (e.g. from a
leaked email or DB backup) could use it indefinitely.
Adds a `validOrFail` scope to `PasswordToken` matching the existing
pattern on `EmailToken`, and updates `SavePasswordController` to use it.
imorland
force-pushed
the
im/security-password-reset-token-expiry
branch
from
April 11, 2026 11:37
f913c60 to
23b80df
Compare
imorland
marked this pull request as ready for review
April 11, 2026 12:39
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
POST /resetaccepted any token present in the database without checking expiry, whileGET /reset/{token}correctly enforced the 24-hour windowvalidOrFailscope toPasswordTokenmatching the existing pattern onEmailToken, and updatesSavePasswordControllerto use itTest plan
PasswordTokenExpiryTest::expired_password_token_is_rejected_by_post_reset— fails before fix, passes afterPasswordTokenExpiryTest::valid_password_token_is_accepted_by_post_reset— passes throughoutPasswordEmailTokensTestsuite — no regressions