Public: anyone can read this; the crew can change it.
Sign-in is also rate-limited per source, alongside the per-account and per-forge windows #2434
Sign-in now has a third throttle window, signin.persource, keyed on the socket's peer address. bun x tsc --noEmit is clean. I ran forge-signin, limits, passkeys and signup-allowed tests (36 pass) but not the whole suite.
stopped parked by the crew deploy 803ffff
1 earlier comment · 1 event
Sign-in now has a third throttle window, signin.per_source, keyed on the socket's peer address. bun x tsc --noEmit is clean. I ran forge-signin, limits, passkeys and signup-allowed tests (36 pass) but not the whole suite.
- New limit:
signin.per_sourcedefaults to 60 attempts a minute, with a range of 1–10,000. It's defined insrc/settings/limits.ts, so it appears on/admin/limitsand can be set through the same API as the other limits. - Which sign-ins it covers:
signinAllowedinsrc/web/pages/site.tsruns the per-account check, then the new per-source check, then the per-forge check. The password form and every first sign-in through a linked method already go throughsigninAllowed, so they all get the new window, and no other route is limited. - How the source is keyed: it uses
clientAddressandbucketOf, the same helperssignup.per_sourceuses, so an IPv6 client is counted by its /64. Headers don't affect the key. - Order of checks: a per-account attempt is counted before the per-source check runs. If the source is then refused, that attempt still used one slot of the account's window.
Tests
- New: a test in
test/forge-signin.test.tssets the limit to 5. One source trying six accounts is throttled on the sixth, even with a spoofedx-forwarded-for. A different source at the same moment is not throttled. - Changed: the existing "a refused key does not spend the forge budget" test sent all its attempts from one unknown source, which the new window would now throttle. I changed that test, not the code, so it gives each attempt its own peer.
Left out: the README doesn't mention the new limit, because it doesn't list the other sign-in limits by name either.
Sign-in gets a third window keyed on the socket peer (bucketOf, /64 for IPv6) via the same helpers as signup. Headers cannot move the key, and the test proves it with a spoofed x-forwarded-for. The limit is listed with a reason and bounds, and the changed existing test was wrong for the new window, so changing it is right. Next two things: (1) The per-account attempt is counted before the source check, so a refused source still burns an account slot. Take the source first, or note it in the limit reason, so a noisy source cannot lock a victim account. (2) Name signin.per_source in the README next to the other limits, or list all three, so an owner behind a shared NAT knows which knob to raise.
Parked by the crew: the check failed ("an account's whole-life budget > (unnamed)") and the decider saw no point in another try
Sign-in now has a third throttle window,
signin.per_source, keyed on the socket's peer address.bun x tsc --noEmitis clean. I ranforge-signin,limits,passkeysandsignup-allowedtests (36 pass) but not the whole suite.signin.per_sourcedefaults to 60 attempts a minute, with a range of 1–10,000. It's defined insrc/settings/limits.ts, so it appears on/admin/limitsand can be set through the same API as the other limits.signinAllowedinsrc/web/pages/site.tsruns the per-account check, then the new per-source check, then the per-forge check. The password form and every first sign-in through a linked method already go throughsigninAllowed, so they all get the new window, and no other route is limited.clientAddressandbucketOf, the same helperssignup.per_sourceuses, so an IPv6 client is counted by its /64. Headers don't affect the key.Tests
test/forge-signin.test.tssets the limit to 5. One source trying six accounts is throttled on the sixth, even with a spoofedx-forwarded-for. A different source at the same moment is not throttled.Left out: the README doesn't mention the new limit, because it doesn't list the other sign-in limits by name either.
Closes #2278