rate limiting: the in-process limiter is keyed per full IPv6 address and was looser than the edge #142
Etiketter
Inga etiketter
area/backups
area/ci
area/control-panel
area/identity
area/infra
area/observability
area/payments
area/security
area/storage
area/web
blocked
needs-info
needs-triage
ready-for-implementation
type
bug
type
chore
type
docs
type
epic
type
feature
type
task
wontfix
Ingen milstolpe
Inget projekt
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Inget förfallodatum satt.
Beroenden
Inga beroenden satta
Referens
bitborg/bitborg-web#142
Läser in…
Hänvisa till i nytt ärende
Ingen beskrivning angiven.
Ta bort grenen "%!s()"
Borttagning av en gren är permanent. Även om den borttagna grenen kan fortsätta existera en kort tid innan den faktiskt tas bort, kan det INTE ångras i de flesta fall. Vill du fortsätta?
Found while tuning the edge rate limits in bitborg-infra (#302/#304 there). The edge zone is documented as
defence-in-depth over this limiter, so the two have to be sized as a pair — and they were not.
Two defects
1. Same shared-egress problem as the edge had.
src/lib/rate-limit.tskeys onclientIp()(the lastentry of
X-Forwarded-For) with no IPv6 prefixing. So:shape an announcement produces;
/64 it already controls and get a fresh budget every time. The edge zone groups IPv6 by
/56preciselyto stop that.
2. The layering was upside down. Budgets here are
signup5/min,captcha30/min (shared acrosschallenge and redeem) and
resend3/min. The edge zone was set to 10 events/min while counting fourrequests per sign-up, so the outer ring was tighter than the inner one it exists to back up — the app
limiter never engaged at all. The edge fix raises that to 30 on the state-changing endpoints only, which
puts the ordering back the right way up. This issue is the other half.
Done when
/56, so an address rotation does not mint anew budget.
a budget sized for a shared egress, or key on something better than the address for the endpoints where
it matters.
either one can see that they are a pair. Right now nothing in this file mentions the edge zone at all,
which is how they got inverted.
Worth doing carefully rather than quickly: making a limiter stricter on the sign-up path is a way to break
sign-up, and making it looser is a way to invite the abuse it exists to stop.