-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
HttpURI.parseQuery rejects [
and ]
characters in path section
#12259
Comments
I'm inclined to close this, as the input URL/URI for this to trigger would be That input URI would be in violation of https://datatracker.ietf.org/doc/html/rfc3986 as the Example, against Jetty 12.0.13 and the ee10-demo-jetty webapp.
Also of note, is that Java itself doesn't like this URI and expects those characters to be encoded.
|
@gregw thoughts? |
[
and ]
characters in path section
The java URI parsing itself rejects the in the raw
And the java URL class will accept the unencoded path, but then reject an attempt to present it as a URI.
|
FWIW this tripped us up due to some (IMO) slightly strange behaviour in nginx. We have a URL containing We haven't yet figured out a way to prevent nginx doing that so we had to rollback jetty for now. https://stackoverflow.com/questions/67521017/nginx-rewriting-brackets-in-reverse-proxy |
That would be a different issue. |
Ah sorry, I think I was unclear - the urlencoded characters are in the path not the query. e.g. http://localhost:8000/path/with(encoded)values[here] which would go out from nginx as: proxy_pass http://localhost:8000/path/with%28encoded%29values%5Bhere%5D but arrive at Jetty as http://localhost:8000/path/with%28encoded%29values[here] And now returns a 400 error. |
The raw, unencoded, See https://datatracker.ietf.org/doc/html/rfc3986#section-3.3 The defined https://datatracker.ietf.org/doc/html/rfc3986#appendix-A It's a shame that nginx doesn't honor user provided pct-encoded. |
@moddular I agree this is strange behaviour, but it is also (kind of) documented, and can be solved in the configuration. See https://serverfault.com/questions/459369/disabling-url-decoding-in-nginx-proxy |
We are not going to make this change. |
Jetty version(s)
12.0.13
Jetty Environment
Any
Java version/vendor
(use: java -version)
Any
OS type/version
Any
Description
As reported in
UriCompliance.Violation.USER_INFO
to deprecate user info inHttpURI
#12012 (comment)How to reproduce?
The
[
and]
are considered reserved characters in thegen-delims
ABNF in the URI spec.https://datatracker.ietf.org/doc/html/rfc3986#section-2.2
Those two characters are reserved for IPv6 or IPvLiteral authority sections on the URI.
Seems like the change from parsing the whole URI to just parsing the pathQuery is tripping up the gen-delims vs sub-delims nuance of the path parsing.
For the parsing of URI path, the ANBF doesn't mention that the
gen-delims
characters as part ofpchar
, is that the flaw?See: https://datatracker.ietf.org/doc/html/rfc3986#section-3.3
The text was updated successfully, but these errors were encountered: