-
Notifications
You must be signed in to change notification settings - Fork 16
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
fix #1076: Dialogue allows colons in http paths and query parameters #2360
Conversation
This is required by some GCP APIs, where encoded colons are not respected. [rfc3986 section 3.3](https://datatracker.ietf.org/doc/html/rfc3986#section-3.3) clearly allows colon as a pchar, however not all servers are necessarily fully compliant with the rfc. We've had issues with specific sub-delimiters in the past. This shouldn't be terribly risky, esepcially given this implementaiton has never allowed unencoded colons before, and we have no evidence to suggest they should be problematic.
Generate changelog in
|
e251fa8
to
54369fd
Compare
// expect the sub-delims to be relevant here in the vast majority of cases. With sufficient | ||
// research and testing, we should incorporate relevant sub-delims into IS_P_CHAR and update this | ||
// to: 'IS_P_CHAR.or(CharMatcher.is('/'))'. | ||
private static final CharMatcher IS_PATH = IS_P_CHAR.or(SUB_DELIMS).or(CharMatcher.is('/')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated IS_PATH
to be derived from IS_P_CHAR
so we don't have to worry about additions to IS_P_CHAR
getting out of sync. This matcher is only used on the input base-url path component, not subsequent sections.
Shall we update the |
good call, updated! |
👍 lgtm |
|
This is required by some GCP APIs, where encoded colons are not respected.
Most places where we'd end up with colons in URIs are within path variable values, where we'd expect values to be handled correctly regardless of percent encoding. For the most part, percent encoding should work fine unless a server uses precise matching on uri segments, where we run into issues.
rfc3986 section 3.3 clearly allows colon as a pchar, however not all servers are necessarily fully compliant with the rfc. We've had issues with specific sub-delimiters in the past. This shouldn't be terribly risky, esepcially given this implementaiton has never allowed unencoded colons before, and we have no evidence to suggest they should be problematic.
Before this PR
After this PR
==COMMIT_MSG==
fix #1076: Dialogue allows colons in http paths and query parameters
==COMMIT_MSG==
Possible downsides?
It's possible that some servers, proxies, etc do not handle unencoded colons well in paths.
Behavior of common http clients:
Note that the default behavior of these clients doesn't necessarily mean that it's unsafe to do otherwise, however we should tread carefully around nonstandard behavior.
🔴 Python 3.9.6 urllib.parse
🔴 Apache HttpComponents (httpcore-5.3) UriBuilder
🟢 Curl 8.10.1
caveat -- curl sends what you give it with the exception of unicode characters. Not clear that this is a reasonable test, since the raw URI is provided as an input.
🟢 OkHttp
similar to curl, the uri is provided as an input, and it doesn't further escape colons