-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpFoundation] Request->getRequestFormat should only rely on the request attributes #8967
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
Doing it that way is a BC break. I think it would be better to introduce a way to active the old behavior (off by default) and immediately deprecate this setting that would be removed in 3.0. |
In a similar way to enableHttpMethodParameterOverride? @fieg, since you had actual problems here, what is your opinion? |
Handling it similar as the I'm not sure if it should be deprecated tho, as the method parameter override isn't deprecated either? Perhaps they would both need to be deprecated then? Also, should a |
@fieg the HTTP method override is needed in case you design your app to work with Restful methods, because browsers don't support all HTTP methods but only GET and POST for form submission. Implementing |
Thank you for the clarification. I totally agree with you. |
@fabpot This is even worse than I thought. The GET parameter is winning over the request attribute. So even if you put a requirement on the |
Yes, it is probably a security problem if you have different access rules for different formats in your app. I suppose this is not a common pattern though. |
I agree this is a big and possibly security-related issue. Users can simply overwrite the format with whatever they want even when your route does not even support this format, e.g. The proposed change fixed it indeed. |
I'm going to merge this one on master for Symfony 3.0. |
ping @symfony/deciders |
@fabpot so this would just need to be a documented BC break for 3.0? Or will we do more work to try to trigger deprecation warnings? Anyways, I agree with the change. The trick is not breaking existing apps and giving an upgrade path - and that part doesn't seem to be here yet. |
I think documenting that this should be avoided in pre-2.8 is enough. People using the feature the wrong can easily fix their code as this is probably almost always a mis-configuration. Triggering a deprecation notice is also possible but then any end user will be able to trigger it which is probably not a good idea. |
👍 The preview error route also has a |
Thank you @pvandommelen. |
…rely on the request attributes (pvandommelen) This PR was squashed before being merged into the 3.0-dev branch (closes #8967). Discussion ---------- [HttpFoundation] Request->getRequestFormat should only rely on the request attributes | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | possibly | Deprecations? | no | Tests pass? | yes | Fixed tickets | #8966 | License | MIT | Doc PR | Added test case and fix for #8966. Is this functionality relied on somewhere? Commits ------- 7115c1e [HttpFoundation] Request->getRequestFormat should only rely on the request attributes
Added test case and fix for #8966. Is this functionality relied on somewhere?