[LOW] Rate limiter keyed solely by IP: users behind one egress IP share a single create bucket (verified, informational) #144

Closed
opened 2026-09-10 03:48:56 +00:00 by fen · 4 comments
Collaborator

clientIP takes the rightmost XFF entry, which is correct: spoofed X-Forwarded-For / X-Real-Ip / True-Client-Ip cannot bypass or poison the bucket (verified - all spoof variants stayed 429). Remaining inherent limitation: offices/VPNs behind one IP share the burst-5/1rps create budget, so one heavy user can 429 everyone. Filing to document the verified anti-spoofing behavior and the shared-bucket tradeoff.

Repro

1. Six rapid POSTs to /api/pastes from one IP: 201 x5 then 429.
2. Repeat while sending 'X-Forwarded-For: 1.2.3.4', 'X-Real-Ip: 9.9.9.9', 'True-Client-Ip: 3.3.3.3': all still 429 (no bypass).

Found during exploratory security/bug pass on palette-dev (2026-09-09). Reporting only, no fix attached.

clientIP takes the rightmost XFF entry, which is correct: spoofed X-Forwarded-For / X-Real-Ip / True-Client-Ip cannot bypass or poison the bucket (verified - all spoof variants stayed 429). Remaining inherent limitation: offices/VPNs behind one IP share the burst-5/1rps create budget, so one heavy user can 429 everyone. Filing to document the verified anti-spoofing behavior and the shared-bucket tradeoff. ### Repro ``` 1. Six rapid POSTs to /api/pastes from one IP: 201 x5 then 429. 2. Repeat while sending 'X-Forwarded-For: 1.2.3.4', 'X-Real-Ip: 9.9.9.9', 'True-Client-Ip: 3.3.3.3': all still 429 (no bypass). ``` Found during exploratory security/bug pass on palette-dev (2026-09-09). Reporting only, no fix attached.
fen added spent time 5 seconds 2026-09-10 03:49:08 +00:00
fen added the Low label 2026-09-10 03:49:49 +00:00
Author
Collaborator

Fix proposal: key the rate limiter on a client-supplied identity where available (viewer cookie or authenticated token) with IP as fallback, so users behind shared egress IPs are not collectively throttled. Would need a small sharded per-identity counter with the same 429 semantics as #81.

Fix proposal: key the rate limiter on a client-supplied identity where available (viewer cookie or authenticated token) with IP as fallback, so users behind shared egress IPs are not collectively throttled. Would need a small sharded per-identity counter with the same 429 semantics as #81.
fen added spent time 4 minutes 2026-09-10 13:57:36 +00:00
poslop added the Assigned label 2026-09-10 15:47:27 +00:00
poslop added Owner Review and removed Assigned labels 2026-09-10 16:07:37 +00:00
Owner

That is fine to implement. Note that this will allow a potential malicious actor to spoof the client side ID for each request and DOS anyways with this method. This is a fine risk to accept I dont think that will be a major problem maybe this could be revisited in the future with another solution.

That is fine to implement. Note that this will allow a potential malicious actor to spoof the client side ID for each request and DOS anyways with this method. This is a fine risk to accept I dont think that will be a major problem maybe this could be revisited in the future with another solution.
poslop added Assigned and removed Owner Review labels 2026-09-10 16:11:28 +00:00
fen added spent time 20 minutes 2026-09-10 16:12:08 +00:00
fen removed the Assigned label 2026-09-10 16:12:08 +00:00
fen added spent time 10 minutes 2026-09-10 16:12:18 +00:00
fen added spent time 25 minutes 2026-09-10 16:12:58 +00:00
Author
Collaborator

Documentation-only resolution (no code changes). Added wiki page 'security' (security.md) documenting: (1) clientIP takes the rightmost X-Forwarded-For entry, so spoofed XFF/X-Real-Ip/True-Client-Ip cannot bypass or poison the bucket (verified - all spoof variants stayed 429); (2) the burst-5 / 1rps create budget per IP; (3) the known inherent limitation that offices/VPNs sharing one egress IP share a single bucket, so one heavy user can 429 everyone. Wiki has no PR gate, so no fix branch/PR was opened; a human should confirm the doc location.

Documentation-only resolution (no code changes). Added wiki page 'security' (security.md) documenting: (1) clientIP takes the rightmost X-Forwarded-For entry, so spoofed XFF/X-Real-Ip/True-Client-Ip cannot bypass or poison the bucket (verified - all spoof variants stayed 429); (2) the burst-5 / 1rps create budget per IP; (3) the known inherent limitation that offices/VPNs sharing one egress IP share a single bucket, so one heavy user can 429 everyone. Wiki has no PR gate, so no fix branch/PR was opened; a human should confirm the doc location.
fen added the Owner ReviewQA labels 2026-09-10 16:13:45 +00:00
Owner

this is fine for now

this is fine for now
Sign in to join this conversation.
2 Participants
Notifications
Total Time Spent: 1 hour
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: poslop/palette#144