spring-cloud / spring-cloud/spring-cloud-gateway
FormFilter is matching encoded values against decoded values
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 4.9k
- Forks
- 3.5k
- Avg merge
- 20h 57m
- Merged PRs (30d)
- 8
Description
This seems to be a bug in the class added as part of https://github.com/spring-cloud/spring-cloud-gateway/issues/3094.
Map<String, String[]> form = request.getParameterMap();
String queryString = request.getQueryString();
The first line gets decoded values; the second one does not.
So in the code further down that figures out whether something is a query param or not, it fails to correctly match the "form" parameter against a query parameter and then duplicates the query parameter in the form.
Downstream services will see this duplication. A Spring Web service using @RequestParam will see the parameter set to "foo,foo" instead of the expected "foo".
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the FormFilter class added for issue 3094 and trace how request.getParameterMap() is compared with request.getQueryString(). Reproduce a request whose parameter is encoded in the query string, then verify that the downstream form parameter is not duplicated and that the resulting value remains "foo" rather than "foo,foo".
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100