-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
path parameters are overwritten by query parameters with the same name #3069
Comments
Hi, thanks for your issue report. Could you share an example of this? I did some quick code spelunking and it seems to me that values that are specified in the path are added to the query parameter filter appropriately:
If this bug report is accurate I'd suspect a problem with the filter. It also strikes me as possible that you could construct a query parameter using the json name instead of the proto name and bypass the filter. Could you confirm whether |
hey @johanbrandhorst you are actually right. You need to define I fixed the example in my original post above. |
OK, then I both understand the issue and the cause. The query parameter parser is intentionally lenient in the parsing of query parameters, but clearly that is causing this problem. Removing the parsing of json name query parameters would be a breaking change, and although I'm happy to do that for what could arguably be considered a security issue, I think we should just make the filter look for both the protobuf and json name format. We can modify the gateway generator to output both the proto name and json name into the double array, which should fix the issue. Would you be willing to help contribute this fix? |
hey @johanbrandhorst, I would like to help providing a fix for that. 👍 I‘ll give it a try. |
I think we need to add the jsonName to this line:
|
there we go #3072 |
🐛 Bug Report
if you have path parameter in your proto endpoint definition, you can overwrite the value by setting a query parameter with the same name. This is a security issue in my opinion since a gateway or routing rule maybe only checks the path but not the query parameters.
To Reproduce
The following service definition given:
One can call the API with
GET <host>/admin/<some_resource_id>
and gets the resource back. But it is also possible to call the endpoint like this:GET <host>/admin/<my_resource_id>?resourceId=<some_other_resource_id>
In the GRPC Handler the value of resource_id is set to <some_other_resource_id> instead of <my_resource_id>
Expected behavior
It should not be possible to overwrite path parameters with query parameters.
Actual Behavior
It is possible to overwrite path parameters with query parameters.
The text was updated successfully, but these errors were encountered: