Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[HttpFoundation] AddPRIVATE_SUBNETS as a shortcut for private IP address ranges toRequest::setTrustedProxies()#58154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
9033e91 todbe2679Comparedbe2679 to8a27bd7ComparePRIVATE_SUBNETS as a shortcut for private IP address ranges toRequest::setTrustedProxies()8a27bd7 toc69c923CompareUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
c69c923 to3fd2dd1Compare
nicolas-grekas left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
While reading the code around, I realized thatprivate_ranges for trusted proxies works only for explicit static configuration, aka env vars are not supported.
I fixed this by adding support for thePRIVATE_SUBNETS special value in setTrustedProxies, next to the already supportedREMOTE_ADDR. Note the name and casing change, which look desired to me for consistency withREMOTE_ADDR.private_ranges is also supported for legacy reasons.
…ddress ranges to `Request::setTrustedProxies()`
3fd2dd1 to6bd4b4aCompare| } | ||
| } | ||
| if (false !== ($i =array_search('PRIVATE_SUBNETS',$proxies,true)) ||false !== ($i =array_search('private_ranges',$proxies,true))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
shouldprivate_ranges be deprecated in favor ofPRIVATE_SUBNETS or no ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I don't think it's worth the trouble for the community.
ValentinRgt commentedNov 12, 2024
Hi, this improvement be retroactive up to and including 6.4, 7.0 and 7.1? |
xabbuh commentedNov 12, 2024
New features are not backported to already released Symfony versions. You will have to upgrade to 7.2 to be able to use it. |
faizanakram99 commentedFeb 19, 2025
@nicolas-grekas sorry for the ping, will PRIVATE_SUBNETS and REMOTE_ADDR work with the new env vars SYMFONY_TRUSTED_PROXIES? |
nicolas-grekas commentedFeb 19, 2025
They should yes. |
Uh oh!
There was an error while loading.Please reload this page.
Let's save some memory allocations and callbacks when we can.
Tweaks#33574 and#52924