Repository navigation
fix: take the client IP from CF-Connecting-IP - #7
Merged
Merged
Conversation
The rightmost X-Forwarded-For hop is a Cloudflare/Railway proxy address in production (sessions created from 2605:59ca:... were fingerprinted 152.233.40.1 and .2), so every client behind the same proxy shared one rate-limit bucket and one 10-session cap. Cloudflare sets CF-Connecting-IP to the connecting address and replaces any client-supplied value. Prefer it, and fall back to the X-Forwarded-For rule when it is absent.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since blip#5, rate limiting and the per-IP session cap use the rightmost
X-Forwarded-Forhop. In production that's a proxy address: seven sessions created from2605:59ca:…were fingerprinted152.233.40.1and152.233.40.2. Every client behind the same proxy shares one bucket, so 5 session creates per minute and 10 active anonymous sessions apply across all of them.api.useblip.emailis proxied by Cloudflare, which setsCF-Connecting-IPto the connecting address and overwrites any value the client sends.ClientIp.resolvenow prefers it and falls back to the existingX-Forwarded-Forrule when it's missing (local dev, tests).The service has no
*.up.railway.appdomain, so there's no way to reach it without going through Cloudflare. If one is added later,CF-Connecting-IPbecomes spoofable through it.Deploy implications
Reaches production after blip-cloud bumps
blip.sha.