Skip to content

fix(auth,core): client keys, reset budget, waitlist notice, audit deployment advisories - #604

Merged
jimhoyd merged 2 commits into
mainfrom
claude/client-keys-auth-budgets
Sep 23, 2026
Merged

jimhoyd merged 2 commits into
mainfrom
claude/client-keys-auth-budgets

Conversation

@jimhoyd

@jimhoyd jimhoyd commented Sep 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • [Bug]: password reset leaves the account-wide password attempt budget in place #546 (auth): a successful password reset now deletes the account-wide password-attempt key (login:password:<email>, hashed as elsewhere) instead of a key that is no longer written. Client-scoped keys are left to expire. Regression test: many clients exhaust the account-wide budget, the password is reset, and sign-in succeeds immediately. The test fails without the fix.
  • [Bug]: per-client rate limits key full IPv6 addresses, so one /64 gets unlimited budgets #547 (core + auth): rate-limit client keys now group an IPv6 address by its /64 network and an IPv4-mapped address (dotted or hex form) as IPv4.
    • Core: clientKey() in packages/core/src/client-address.ts, used by the throttle client and client-route partitions.
    • Auth: packages/auth/src/client-key.ts does the same job for the per-client password budget and the abuse-policy client and signupClient limits. Auth keeps its own copy because importing a new core export would break auth on the cores its peer range (>=0.5.0) still allows (see scripts/peer-api.ts). Both implementations are pinned to the shared vectors in test/client-key-vectors.json.
    • The /64 prefix is fixed and documented. Neither the throttle nor auth has an existing config setting that fits it.
    • Docs: docs/policies/operations.md, docs/policies/throttle.md, packages/auth/README.md.
  • [Bug]: auth registration still reveals whether an email has an account #548 (b) only (auth): in waitlist mode, the registration-attempt notice for an already-known address is no longer awaited before the reply. notice() was already best-effort and swallows delivery errors. Test: when the notice sender blocks, the duplicate still gets a 202 quickly. That test fails with the old await. Parts (a) and (c) are unchanged and still need a decision.
  • [Request]: audit warnings for shared-key throttles and public metrics #575 (core): urlcode audit reports a new non-blocking field, deploymentAdvisories:
    • client-throttle-without-trusted-proxies: lists the routes with client-partitioned throttles when no trusted proxies are declared.
    • metrics-on-public-listener: raised when --metrics is declared.
    • audit now accepts the serve flags --trusted-proxies and --metrics to describe the deployment under review; its own probe server applies neither. JS API: auditProject(app, { deployment }).
    • A malformed proxy list is refused rather than silently clearing the finding.
    • Documented in docs/READINESS.md#deployment-advisories and docs/MONITORING.md. No separate metrics bind address was added.

Changeset: .changeset/auth-client-keys-reset-budget.md (auth patch).

Verification

  • npm run verify: passed. Core 779, ui 91, auth 219, admin 67, store 32, forms 7 and workspace integration tests, all with 0 failures.
  • npm run test:package: passed.
  • npm run check:docs: passed.
  • CLI smoke: urlcode audit --metrics on a throttled project reports both advisories, and --trusted-proxies 10.0.0.0/8 clears them. ready is unaffected.

These are local synthetic checks. They are not an independent security review.

Closes #546
Closes #547
Closes #575
Refs #548

🤖 Generated with Claude Code

…eployment advisories

- auth: a password reset clears the account-wide `login:password:<email>`
  attempt budget instead of a key that is no longer written (#546).
- core/auth: rate-limit client keys group an IPv6 client by its /64 and an
  IPv4-mapped address as IPv4. Core's throttle uses clientKey from
  client-address.ts; auth keeps an equivalent helper so it still runs on
  every core its peer range allows. Both are pinned to shared vectors in
  test/client-key-vectors.json (#547).
- auth: in waitlist mode the duplicate-address registration notice is no
  longer awaited before replying (#548, part b).
- core: `urlcode audit` reports deploymentAdvisories for a client-partitioned
  throttle without declared trusted proxies and for --metrics on the public
  listener; audit takes --trusted-proxies/--metrics to describe the
  deployment (#575).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Comment thread packages/auth/src/client-key.ts Fixed
@jimhoyd
jimhoyd merged commit 7ebab2e into main Sep 23, 2026
61 checks passed
@jimhoyd
jimhoyd deleted the claude/client-keys-auth-budgets branch September 23, 2026 23:48
jimhoyd added a commit that referenced this pull request Sep 24, 2026
…on; scope sign-in-code issuance per client (#548) (#641)

(a) A duplicate /register returned the same generic 201 body as a genuine
registration, but also set a session cookie built from a token that was
never persisted server-side. The cookie looked valid while authenticating
nothing, so a caller could still tell new-signup from existing-email by
attempting an authenticated request with it. Duplicate registration now
keeps the same status/body but omits the session cookie entirely, clearing
only the anonymous flow cookie like the genuine path already does.

(c) Per-email sign-in code issuance had a 20/day cap with no scope on the
caller, so a single client could alone exhaust — or, since a fresh code
invalidates whichever one is in flight, alone keep cancelling — another
account's codes. A trusted client now also gets its own tighter per-email
daily budget, alongside the existing per-email cap, mirroring the
client-scoped budget already used for password guesses (#547).

Part (b) of #548 (the waitlist duplicate-notice timing signal) already
landed in #604.

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants