Files
vitareba/app/api/auth
g-butandClaude Opus 4.7 58654c2de6 fix(auth): apply brute-force lockout to change-password currentPassword check
/api/auth/change-password verified the current password but had no
counter and no lockout — an attacker with session access (XSS, stolen
cookie) could enumerate the current password against this endpoint
forever and use it for credential stuffing on other sites, even though
they already had session access locally.

Now the endpoint loads the user's failedLoginAttempts + lockedUntil,
short-circuits with 429 if locked, and on a wrong currentPassword
runs the same nextLoginAttemptState() transition that gates /login —
so the same 5-attempt threshold and 15-min cooldown apply uniformly
to every credential-verification surface in the app. The success path
already cleared the lockout (earlier commit) so legitimate change
flow is unaffected.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 10:37:27 +02:00
..