Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[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

Merged

Conversation

@nicolas-grekas
Copy link
Member

@nicolas-grekasnicolas-grekas commentedSep 3, 2024
edited
Loading

QA
Branch?7.2
Bug fix?no
New feature?no
Deprecations?no
Issues-
LicenseMIT

Let's save some memory allocations and callbacks when we can.

Tweaks#33574 and#52924

smnandre reacted with thumbs up emoji
@carsonbotcarsonbot added this to the7.2 milestoneSep 3, 2024
@nicolas-grekasnicolas-grekasforce-pushed thehk-trusted-proxies branch 2 times, most recently from9033e91 todbe2679CompareSeptember 3, 2024 08:41
@nicolas-grekasnicolas-grekas changed the title[HttpFoundation] µ-optimize Request::setTrustedProxies()[HttpFoundation] AddPRIVATE_SUBNETS as a shortcut for private IP address ranges toRequest::setTrustedProxies()Sep 3, 2024
Copy link
MemberAuthor

@nicolas-grekasnicolas-grekas left a comment
edited
Loading

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()`
}
}

if (false !== ($i =array_search('PRIVATE_SUBNETS',$proxies,true)) ||false !== ($i =array_search('private_ranges',$proxies,true))) {
Copy link
Member

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 ?

Copy link
MemberAuthor

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
Copy link

Hi, this improvement be retroactive up to and including 6.4, 7.0 and 7.1?

@xabbuh
Copy link
Member

New features are not backported to already released Symfony versions. You will have to upgrade to 7.2 to be able to use it.

ValentinRgt reacted with thumbs up emoji

@faizanakram99
Copy link
Contributor

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.

@nicolas-grekas sorry for the ping, will PRIVATE_SUBNETS and REMOTE_ADDR work with the new env vars SYMFONY_TRUSTED_PROXIES?

@nicolas-grekas
Copy link
MemberAuthor

They should yes.

faizanakram99 reacted with thumbs up emoji

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@stofstofstof left review comments

@derrabusderrabusderrabus approved these changes

@xabbuhxabbuhxabbuh approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

7.2

Development

Successfully merging this pull request may close these issues.

7 participants

@nicolas-grekas@ValentinRgt@xabbuh@faizanakram99@stof@derrabus@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp