Public: anyone can read this; the crew can change it.
Signup is rate-limited per source and per forge, set on /admin/limits like sign-in #2306
Signup is now rate-limited per source and per forge through signupAllowed(ctx), with both limits settable on /admin/limits. The branch was already pushed and nothing has changed since, so I made no new changes this run. Issue #2277 has no new comments, and this pull (#2306) is open and mergeable.
stopped parked by the crew deploy 939193f
Signup is now rate-limited per source and per forge through signupAllowed(ctx), with both limits settable on /admin/limits. The branch was already pushed and nothing has changed since, so I made no new changes this run. Issue #2277 has no new comments, and this pull (#2306) is open and mergeable. I did not re-run the tests this time. The results below are from my earlier run.
What changed
src/http/signup-limit.tsaddssignupAllowed(ctx)with two windows, per source and per forge. The source is the socket's peer address (clientAddress).signup.per_source(default 5 a minute) andsignup.per_forge(default 60 a minute) are insrc/settings/limits.ts, so they show on /admin/limits.- The doors covered are the signup form,
POST /api/v1/users, both passkey signup routes, and the terminal signup screen. The passkey routes used to share sign-in's limiter and no longer do. - A throttled form re-renders with 429, a "Try again in N seconds" message and
retry-after. The API and passkey routes answer 429 withretry-afterand arate_limitederror. test/signup-limit.test.tsis gated automatically, since the gate is every test file except the excluded ones. It covers:- the defaults;
- the API throttled after 5 attempts, with
retry-after; - the form's 429 page;
- a different route from the same source not throttled;
- the per-forge window holding across sources.
Test results
bun test test/app-domains.test.ts test/capacity.test.tsgave 24 pass, 0 fail, 252 expects. This needsFORGE_CHECK_SHARDSunset: the sandbox sets it to 4, and one capacity test then fails, with or without this change.- The new test file and
test/limits.test.ts,test/passkeys.test.tsandtest/forge-signin.test.tspass, and the type check is clean.
Left out
- Edge login is not throttled, because the platform edge has already signed that person in.
- Spawned-forge, claim and crew account creation are not throttled, because they are not open signup.
clientAddresshonoursX-Forwarded-Forfrom a trusted proxy, and loopback counts as trusted whenFORGE_TRUSTED_PROXIESis unset. That rule was already there and I did not change it.- The per-source budget is per route, so passkey signup's options step and its create step each get their own.
Try it: set signup.per_source to 2 on /admin/limits, then post to /api/v1/users three times from one address. The third answer is 429 with retry-after.
🤖 Generated with Claude Code
Parked by the crew: the check failed ("verified email > re-sending is rate limited") and the decider saw no point in another try
Signup is now rate-limited per source and per forge through
signupAllowed(ctx), with both limits settable on /admin/limits. The branch was already pushed and nothing has changed since, so I made no new changes this run. Issue #2277 has no new comments, and this pull (#2306) is open and mergeable. I did not re-run the tests this time. The results below are from my earlier run.What changed
src/http/signup-limit.tsaddssignupAllowed(ctx)with two windows, per source and per forge. The source is the socket's peer address (clientAddress).signup.per_source(default 5 a minute) andsignup.per_forge(default 60 a minute) are insrc/settings/limits.ts, so they show on /admin/limits.POST /api/v1/users, both passkey signup routes, and the terminal signup screen. The passkey routes used to share sign-in's limiter and no longer do.retry-after. The API and passkey routes answer 429 withretry-afterand arate_limitederror.test/signup-limit.test.tsis gated automatically, since the gate is every test file except the excluded ones. It covers:retry-after;Test results
bun test test/app-domains.test.ts test/capacity.test.tsgave 24 pass, 0 fail, 252 expects. This needsFORGE_CHECK_SHARDSunset: the sandbox sets it to 4, and one capacity test then fails, with or without this change.test/limits.test.ts,test/passkeys.test.tsandtest/forge-signin.test.tspass, and the type check is clean.Left out
clientAddresshonoursX-Forwarded-Forfrom a trusted proxy, and loopback counts as trusted whenFORGE_TRUSTED_PROXIESis unset. That rule was already there and I did not change it.Try it: set
signup.per_sourceto 2 on /admin/limits, then post to/api/v1/usersthree times from one address. The third answer is 429 withretry-after.🤖 Generated with Claude Code
Closes #2277