Repository navigation
Socrate v1.14.5
Security patch release on the v1.x line, hardening the second factor. A wrong TOTP or
recovery code now counts toward the account lockout like a wrong password, and a TOTP code is
accepted only once (migration 0032, a NOT NULL DEFAULT 0 column added on startup). No
environment variable, no change of default, no token-contract change.
Security
-
A TOTP code is accepted once. The time step of the last TOTP code accepted for a user is
stored (users.mfa_last_step, migration 0032), and a code of that step or an earlier one is
refused as a wrong code, on sign-in and on enrollment confirmation (so the code that confirmed
the enrollment cannot then sign in). The step is recorded with a conditional update, so two
requests with the same code cannot both pass, and a full-row save of the user does not move it
back. Recovery codes are unchanged (already single-use). Deploy note: migration 0032 adds a
NOT NULL DEFAULT 0column and runs on startup; no environment variable, no change of default. -
A wrong second-factor code counts toward the account lockout. On every sign-in path that
asks for a TOTP or recovery code after the password (POST /api/auth/login, the hosted login
form, the hosted account page,POST /api/admin/loginandPOST /api/admin/elevate), a wrong
code now increments the same per-account failed-attempt counter as a wrong password, and the
account is locked for the lockout duration when the counter reaches the limit (an
account_lockedevent with reasonmfa_invalid). A locked account is refused before any code
is checked, on/api/admin/elevatetoo, which now answers403 account is lockedlike the
login endpoints. A missing code, a valid code, a redeemed recovery code and a failure to check
the code (e.g. a storage error) do not count; a complete sign-in still resets the counter.
Deploy note: no migration, no environment variable, no change of default (the existing limit
and lockout duration apply).