Repository navigation
fix: trust forwarded client IPs only behind configured proxies - #7614
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 8 files
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
[Medium impact] The PR appears safe to merge, with no outstanding findings. SummaryThe PR makes
No new actionable issues were found in the changes since the previous review. Reviews (2) · Last reviewed commit: "fix: address trusted proxy review feedba..." · Reviewed by Greptile |
Merging this PR will not alter performance
|
masenf
left a comment
There was a problem hiding this comment.
thanks for implementing this security enhancement
#7646) * Correct 0.10.1 news fragments and document REFLEX_BACKEND_START_METHOD The 7258 fragment described the opposite of what #7304 does (it raises an error for a missing __init__.py instead of loading the app), the repeated headers fragment still claimed client_ip came from the first x-forwarded-for hop after #7614 made that depend on trusted_proxy_hops, and the 7261 fragment belonged to a docs-only change. Add the backend start method variables to the self-hosting docs; they were only described in environment.py. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016T8wWv8bUUSzRHNGpKbSqW * Keep the 7258 fragment and scope the start method docs to Granian #7304 ended up passing Granian the configured module target, so the original fragment was accurate. The start method variables are only read on the Granian code paths. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016T8wWv8bUUSzRHNGpKbSqW --------- Co-authored-by: Claude <noreply@anthropic.com>
Summary
Fixes #7601. router.session.client_ip previously trusted the leftmost X-Forwarded-For value, which clients can spoof.
The connection peer address is now used by default. Applications behind trusted reverse proxies can set trusted_proxy_hops to select the client address from the forwarded chain.
Changes
Testing