Repository navigation
Conversation
After a server restart every cookie session is gone (they live in memory). An open tab's background requests then carry only the dead cookie and no Authorization header. Each one was counted as a failed login: ten filled the single-user per-IP bucket within seconds, and the 429 that followed carries no WWW-Authenticate challenge, so the browser never showed its login dialog again and reloading could not recover for 15 minutes. Behind a tunnel all clients share 127.0.0.1, so every device was locked out. Multi-user mode had the same shape against its per-IP pre-gate, which refuses even a correct password once full. A request with no Authorization header is not a guess and runs no password check, so it is now challenged with a plain 401 and not counted, in both modes and even while the IP is limited. Wrong and malformed credentials are counted and limited exactly as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thank you for tracking this down. This PR stops counting requests that carry no I traced both hooks and the change is right. In single-user mode the correct password already beat the rate limit, so the challenge was the only thing a lockout took away. In multi-user mode the early return comes before the in-flight join and both pre-verify gates, so a header-less request runs no scrypt and takes no slot. The three new tests fail on master without the fix, the full Two small things are left, and I will add both on top when I merge, so you don't need to push anything:
In the same pass I'll make two cosmetic changes: a blank comment line before the new paragraph at Thanks again for the fix. |
…llenge Review on Ark0N#838. The unchanged half had no test: send the cap's worth of `Authorization: Bearer x` and expect the next request to be 429, in single-user and multi-user mode. Both fail if the header-less skip is widened to malformed headers. docs/security-architecture.md gets a pipeline step for the header-less challenge (not counted, even during a lockout), and the Rate limit rows in CLAUDE.md and docs/architecture-invariants.md say so, so a later change cannot bring the counting back unnoticed. auth.ts uses challengeBasicAuth() at the two spots that still inlined it, with a blank comment line before the new paragraph. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thank you for the follow-up commit. This PR stops counting requests with no The second commit covers everything from my earlier comment: the new pipeline step in You don't need to push anything else. This is ready to merge as it stands. |
The pipeline list said it "runs in this order" but put the no-header challenge before the HTTP Basic check, while single-user auth.ts checks the correct password first. Swap steps 3 and 4. Note in the README and the Security / Remote-Access wiki pages that a request with no credentials is never counted, and add the patch changeset. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lockout The single-user suite pinned this; the multi-user one only showed that header-less requests are not counted. Fill the per-IP bucket with malformed headers, then expect 401 + challenge for no header and 429 for another malformed one. Fails on master. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Pushed three commits that cover the review items:
Checks on 5ff0187:
🤖 Generated with Claude Code |
|
Thank you for the two follow-up commits. This PR stops counting requests with no I checked the latest head ( You don't need to push anything else. This is ready to merge as it stands. Thanks again for tracking down the lockout. |
Problem
After a server restart, a browser that had Codeman open gets stuck on
Too Many Requests — try again laterand reloading doesn't help.Authorizationheader. Each was counted as a failed login against the client IP.AUTH_FAILURE_MAX) within seconds.WWW-Authenticatechallenge, so the browser never shows its login dialog again. The user can't type the (still accepted) correct password until the 15-minute window expires.Behind a tunnel all traffic arrives as
127.0.0.1, so one stale tab locks out every device. Multi-user mode has the same shape: credential-less requests filled the per-IP pre-gate (AUTH_IP_FAILURE_MAX), which refuses even a correct password once full.Fix
A request with no
Authorizationheader is not a guess and runs no password check. It now gets a plain401+WWW-Authenticatechallenge and is not counted, in both modes and even while the IP is rate-limited. That keeps the browser's login dialog reachable.Unchanged: wrong credentials and malformed
Authorizationheaders are counted and limited exactly as before (same buckets, same caps, same 429 +Retry-After). The hook-secret bucket is untouched.Security: nothing is gained by sending header-less requests. They cost no scrypt and reveal nothing beyond the existing 401.
Tests
auth-security.test.ts: cookie-only requests (3× the cap) stay 401 with a challenge and leave the wrong-password bucket empty. During a lockout a header-less request still gets the 401 challenge, while wrong credentials still get 429. A malformed header (Bearer x) is still counted: 10 get 401, the next 429.multiuser-auth.test.ts: cookie-only requests pastAUTH_IP_FAILURE_MAXstay 401, the per-IP bucket stays empty, and the correct password logs in. With the per-IP bucket full, a header-less request still gets the 401 challenge and a malformed one gets 429. Malformed headers still fill the per-IP cap.masterwithout the fix; the two malformed-header tests pass on both, since they pin unchanged behaviour. The six auth suites pass with it (163 tests). Typecheck, lint, format:check, check:frontend-syntax and check:browser-excludes are clean.masterthe 10th stale-cookie request got 429 with no challenge. With this PR, 30 of them got 401 +WWW-Authenticate: Basic realm="Codeman", the correct password logged in, 10 (single-user) or 50 (multi-user) ×Bearer xstill led to 429, and a header-less request during that lockout got the 401 challenge.Docs
docs/security-architecture.mdlists the no-header step in the auth pipeline; the rate-limit rows inCLAUDE.mdanddocs/architecture-invariants.md, the README and the Security / Remote-Access wiki pages say a request without credentials is never counted. Patch changeset included.🤖 Generated with Claude Code