You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
client_ip trusts the client-controlled leftmost X-Forwarded-For entry #7601
The client controls the leftmost entry. A proxy appends the address it saw to the right. So any client can set client_ip to any value by sending its own X-Forwarded-For. Reflex has no setting for which proxies to trust.
Proxy adds a separate line (6.6.6.6 / 203.0.113.7)
203.0.113.7
6.6.6.6 (spoofed)
Honest client, two proxies each add a line (203.0.113.7 / 10.0.0.2)
10.0.0.2 (wrong)
203.0.113.7
On main, the second row resists the spoof only because the last line wins. That same rule gives the wrong address in the third row. #7588 treats repeated lines as one list, as RFC 9110 §5.3 requires. Then all layouts behave like the first row, where main is already spoofable.
Possible fix
Take the client address from the right, and skip a configured number of trusted proxy hops (or a list of trusted proxy addresses). This is how Uvicorn's --forwarded-allow-ips and similar settings work. With no trusted proxy configured, use the socket peer address (asgi.scope["client"]), not the header.
This adds a config option, so it needs a decision on the API and on the default.
Activity
linear-code commentedon Oct 19, 2026
ENG-13416