-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[HttpFoundation] Add Request::set/getAllowedHttpMethodOverride() to list which HTTP methods can be overridden
#61979
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
93d5adf to
ff33c15
Compare
Request::$allowedHttpMethodOverride to list which HTTP methods can be overriddenRequest::set/getAllowedHttpMethodOverride() to list which HTTP methods can be overridden
ff33c15 to
4704a8e
Compare
a7f5d06 to
eac4c7c
Compare
…ich HTTP methods can be overridden
eac4c7c to
a4f51c9
Compare
| } | ||
| $container->parameterCannotBeEmpty('kernel.secret', 'A non-empty value for the parameter "kernel.secret" is required. Did you forget to configure the '.$emptySecretHint.'?'); | ||
|
|
||
| $container->setParameter('kernel.http_method_override', $config['http_method_override']); |
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.
Not that this naming is quite unfortunate as it's confusing: the setting is only about allowing the use of the _method parameter. Overriding using the header is always available.
A better name would have been enable_http_method_override_parameter, like the name of the corresponding static method. In case anyone wants to follow up in another PR (deprecating the option, the parameter, BC/FC layer, etc.).
|
Thank you @nicolas-grekas. |
| } | ||
|
|
||
| if (null !== $allowedHttpMethodOverride) { | ||
| $container->getDefinition('http_cache') |
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.
For what do we need this?
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.
Git blame tells me its for configuring this before httpcache is created, which can happen super early before bundles are initialized
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.
This feature addresses https://github.com/symfony/symfony/pull/61949/files#r2402280654 and hardens HttpFoundation by giving control over which HTTP methods can be overridden:
Providing no method disables verb tunneling altogether:
Request::setAllowedHttpMethodOverride([]);This setting can be set using standard Symfony configuration:
2 implementations note: