Commit Graph
8 Commits
Author SHA1 Message Date
Lucas RayanandClaude Opus 5.5 9ef86ac425 fix(auth): keep a queued login from passing the cap
A reservation could expire while its request queued, and the guess was then
evaluated anyway. The wait for a hashing permit is now bounded to 30 s, and an
attempt whose reservation is gone is refused at permit time. At the cap, each
failure now reaches the disk, so a restart cannot reopen a slot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 07:01:16 -03:00
Lucas RayanandClaude Opus 5.5 b384ed91c3 fix(auth): make the login budget a true rolling cap
The leaky bucket allowed about 199 failures in a day; persisted timestamps now
hold it to 100 in any 24 hours, and only evaluated failures reach the disk. A
credential change from a live session keeps its own address as known. Promotion
clears the list, session MFA changes void stale pending tokens, reset frees pairs
whose budget was evicted, and only real accounts audit exhaustion.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 06:48:59 -03:00
Lucas RayanandClaude Opus 5.5 b9137e0948 feat(auth): cap login guessing with a per-account budget
Failures from unknown addresses are capped at 100 per rolling 24 hours per
username, refused before Argon2 and before the hashing queue. Addresses with
a completed login in the last 30 days skip the budget, stored hashed on the
user. IPv6 counts per /48 for the pair throttle and the budget. Unknown names
take the same path, with their budget in the stand-in table. Crossing the cap
audits login.budget_exhausted once per account per 24 hours. Eviction drops
faded entries, then the least counted, not the oldest.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 06:27:38 -03:00
Lucas RayanandClaude Opus 5.5 348e61ca95 fix(auth): close unauthenticated lockout and tighten the daemon's edges
Key login failures by username and client address with decay, plus a loose
per-username limit that delays every address by a bounded time. Refused
attempts write nothing. Unknown usernames share the code path. MFA and session
password checks keep a persistent user-bound count that needs a password or a
session to reach.

Also: local mode refuses a non-loopback bind outside a container; security
headers on every response; the Argon2 permit lives as long as the blocking
task; a required password change rechecks role, MFA and epoch; auth reset
works for any user; mfa_enabled in /api/auth/state; disabling MFA that is off
is refused with no side effects; StateCorrupt keeps only line and column.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 21:03:27 -03:00
Lucas RayanandClaude Opus 5.5 5ad89d5be5 fix(auth): throttle bootstrap and require reauth for user changes
Bootstrap takes the client IP, is limited per IP, and writes no audit line
once an admin exists. Creating, changing the role of or deleting a user now
needs a session with recent reauthentication; API tokens are refused.
/api/analyze and /api/update return fixed messages and log the detail.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 19:56:59 -03:00
Lucas RayanandClaude Opus 5.5 2b1bc63340 feat(auth): deny-by-default HTTP layer
A global middleware wraps the router and its fallback: only PUBLIC_ROUTES
answer without a credential, and unknown paths look like protected ones.
Adds cookie sessions with per-session CSRF, scoped Bearer tokens, the
/api/auth and /api/admin handlers, Transport for client IP and Secure, and
pending-token enrollment re-checked inside one store update.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 19:51:42 -03:00
Lucas RayanandClaude Opus 5.5 411a21ca6e fix(auth): force a password change after reset_admin
reset_admin now sets a persisted must_change_password flag. While it is set,
login and confirm_mfa return PasswordChangeRequired, a ticket that only allows
change_required_password, instead of a session. confirm_mfa therefore returns
LoginStep. change_password clears the flag and refuses the current password
as the new one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 19:29:52 -03:00
Lucas RayanandClaude Opus 5.5 2b71ae41c0 feat(auth): accounts, first-run setup and MFA login flow
Adds AuthService with single-use setup code, password login, TOTP and
recovery codes, enrollment, account management and local admin reset.
Attempts are reserved before Argon2 so parallel guesses cannot outrun the
per-account delay or the IP limit, and unknown usernames follow the same
schedule as real accounts. Passwords are NFC-normalized; repeated-character
and all-digit passwords are refused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 19:24:46 -03:00