-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpKernel] Support querystring in action arguments #19655
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
Comments
There is already http://symfony.com/doc/master/bundles/FOSRestBundle/annotations-reference.html, wouldn't an argument value resolver mess with it? |
I'm not entirely sure how this implementation works, but I doubt it. The argument value resolver will simply check if the request parameter exists (just like the attribute variant) and yield it if possible. |
The other solution would be to add the parameters in Symfony elsewhere, meaning they end up in the attributes. This would make it possible to create a parameter converter for |
It has been rejected in the past. Being able to get the value of routing parameters is ok ( |
But wouldn't it be the exact same thing as reading the request query manually? It would merely be a shortcut. I could also add bogus info there or in the route parameters, wouldn't make a difference as far as I can tell. I could even make a parameter converter that already does this so I fail to see which security issues this would raise. |
@iltar you're right, it's the same when reading manually. However, that's the risk in terms of security, we just should not advertise with "add a method argument, and it's automagically populated by the user" (whereas route arguments are controlled by the developer). Eventually we create a backdoor entrance; the risk of writing "bad" code that is. (Consider the no. of projects this is gonna affect.) |
In that case, would it be an idea to white-list query string parameters in the route config? |
Could work. Not sure how intuitive that is, not everybody uses annotations/comments to clarify. Personally i was thinking more along the lines of; Think But yes, if we go this way, we need a whitelist. Period :) edit: i like the idea, because it allows for less boilerplate controller code (validating the request), ie im also waiting for stuff like #19296 |
Ref #3254 |
Closed at it will most likely not be fixed |
@fabpot I am still curious about whitelisting GET query parameters. Shouldn't it resolve your security concerns? |
One feature I'm often missing, is the ability to fetch query parameters directly from the method arguments. With the refactoring I've made it easier to add functionality, I was thinking to use this if the feature would be decided.
Current scenario
Proposed scenario
This should also support arrays and optional values for example:
Would this be something I can add to the core? If not I can add it to my own bundle for people that do need it.
The text was updated successfully, but these errors were encountered: