Skip to content

[1.x] fix: delete stale password tokens when requesting a new reset - #4547

Merged
imorland merged 1 commit into
1.xfrom
im/security-password-reset-token-accumulation
Apr 11, 2026
Merged

[1.x] fix: delete stale password tokens when requesting a new reset#4547
imorland merged 1 commit into
1.xfrom
im/security-password-reset-token-accumulation

Conversation

@imorland

@imorland imorland commented Apr 11, 2026

Copy link
Copy Markdown
Member

Summary

  • Each password reset request generated a new token without removing prior ones, leaving multiple valid tokens accumulating indefinitely
  • Any stale token could be exploited if obtained out-of-band, with no expiry enforced at the time of discovery
  • Now purges all existing tokens for the user before generating a new one in RequestPasswordResetJob

Test plan

  • PasswordResetTokenAccumulationTest::existing_password_tokens_are_deleted_when_new_reset_is_requested — fails before fix, passes after
  • Existing PasswordEmailTokensTest suite — no regressions

@imorland imorland changed the title fix: delete stale password tokens when requesting a new reset [1.x] fix: delete stale password tokens when requesting a new reset Apr 11, 2026
Each password reset request generated a new token without removing
prior ones, leaving multiple valid tokens accumulating in the database
indefinitely. Any of these tokens could be exploited if obtained.

Now clears all existing tokens for the user before generating a new one.
@imorland
imorland force-pushed the im/security-password-reset-token-accumulation branch from 97ce05a to 9088304 Compare April 11, 2026 11:31
@imorland imorland added this to the 1.8.16 milestone Apr 11, 2026
@imorland
imorland marked this pull request as ready for review April 11, 2026 12:39
@imorland
imorland requested a review from a team as a code owner April 11, 2026 12:39
@imorland
imorland merged commit 103c9dd into 1.x Apr 11, 2026
409 checks passed
@imorland
imorland deleted the im/security-password-reset-token-accumulation branch April 11, 2026 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant