Double encoded URLs
See original GitHub issueDescribe the bug
After migrating to cloud 2020.0.0-M6 from Hoxton.SR8 I started to have problems with double encoded URLs. It most probably only affects URL containing multiple =
charactors in one query parameter. Problem most probably is that ServerWebExchangeUtils#containsEncodedParts
reports false - taking URL as not encoded.
Sample
Exception is trapped in:
catch (IllegalArgumentException ignore) {
if (log.isTraceEnabled()) {
log.trace("Error in containsEncodedParts", ignore);
}
}
java.lang.IllegalArgumentException: Invalid character '=' for QUERY_PARAM in "key==%22value%22"
For URL:
/filter?query=key=="value"&page=0&size=30
This “kind” of URL should be valid and is used by https://github.com/jirutka/rsql-parser or FIQL (https://tools.ietf.org/html/draft-nottingham-atompub-fiql-00#section-4)
Seems the validation is too strict. As it cannot be replaced with custom implementation, it would essentially mean rewriting the RouteToRequestUrlFilter
filter (and potentially others, that use ServerWebExchangeUtils#containsEncodedParts
).
Issue Analytics
- State:
- Created 3 years ago
- Reactions:13
- Comments:15 (3 by maintainers)
@spencergibb I apologize for approaching you directly, but is there a chance, someone else could look at this? I am confident this is a bug (please see the unit test I provided) and I think there will be more users affected by it. As SGC should be a generic tool, it shouldn’t restrict the form of URLs more than the HTTP specification does.
I considered creating PR that fixes the issue, but I think it needs deeper analysis and considerations.
We really like SGC and we would like to upgrade to the newer version, but this prevents us from doing so. Thank you in advance.
@ctlove0523
I had meet same problem, in my case the gateway incoming uri encoded as:
the detail debug info show as belows