Skip to content

fix: take the client IP from CF-Connecting-IP - #7

Merged
bmc08gt merged 1 commit into
mainfrom
fix/client-ip-cloudflare
Oct 1, 2026
Merged

bmc08gt merged 1 commit into
mainfrom
fix/client-ip-cloudflare

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Oct 1, 2026

Copy link
Copy Markdown
Member

Since blip#5, rate limiting and the per-IP session cap use the rightmost X-Forwarded-For hop. In production that's a proxy address: seven sessions created from 2605:59ca:… were fingerprinted 152.233.40.1 and 152.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.email is proxied by Cloudflare, which sets CF-Connecting-IP to the connecting address and overwrites any value the client sends. ClientIp.resolve now prefers it and falls back to the existing X-Forwarded-For rule when it's missing (local dev, tests).

The service has no *.up.railway.app domain, so there's no way to reach it without going through Cloudflare. If one is added later, CF-Connecting-IP becomes spoofable through it.

Deploy implications

Reaches production after blip-cloud bumps blip.sha.

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.
@bmc08gt bmc08gt self-assigned this Oct 1, 2026
@bmc08gt
bmc08gt merged commit 6ab6085 into main Oct 1, 2026
3 checks passed
@bmc08gt
bmc08gt deleted the fix/client-ip-cloudflare branch October 1, 2026 03:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant