mirror of
https://github.com/bitbaum/vitareba.git
synced 2026-12-05 07:28:27 +01:00
/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>