Repository navigation
fix: validate reset passwords, revoke sessions and other reset tokens - #1348
Merged
thlpkee20-wq merged 2 commits intoOct 22, 2026
Conversation
|
@Oluwasegun6921 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Oluwasegun6921
force-pushed
the
security/issue-1293-security-password-reset-resetpassword-skips
branch
from
October 22, 2026 06:52
8316ba4 to
d01ca0f
Compare
Strips the payload this branch picked up (deleted api.js, truncated eslint.config.js, unhooked package.json). No functional change to the branch's own work.
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.
Overview
This PR hardens
PasswordResetService.resetPasswordso a password reset enforces the same strength rules as registration, revokes the user's existing sessions, and invalidates any other outstanding reset tokens — all within the existing transaction. The route now surfaces validation failures as400and distinguishes them from an invalid/expired token.Related Issue
Changes
🔒 Password Reset Hardening
[MODIFY]
src/services/passwordResetService.tsvalidatePasswordStrength(newPassword)before opening the transaction, so a weak password never touches the token.row.user_id(UPDATE sessions SET revoked_at = NOW() WHERE user_id = $1 AND revoked_at IS NULL).{ ok: false, reason }) so callers can tell a validation failure from an invalid token.[MODIFY]
src/routes/passwordReset.ts400response; invalid/expired token keeps its existing handling.🧪 Tests
[MODIFY]
src/services/passwordResetService.test.tsmaster.[MODIFY]
src/routes/passwordReset.test.ts400and leaves the token unused.Verification Results
passwordResetService.test.tsandpasswordReset.test.tsmasterCloses #1293