-
Notifications
You must be signed in to change notification settings - Fork 142
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
Encode ' in username and password #608
Comments
I think I'm ok with aligning Safari with Chrome and Firefox. |
3986 defines userinfo to include userinfo = *( unreserved / pct-encoded / sub-delims / ":" )
unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
/ "*" / "+" / "," / ";" / "=" So, it needs to be unescaped. Same for |
@mnot Why do you say that
Nothing seems to forbid implementations from encoding sub-delims as they see appropriate, for e.g., XSS mitigations. |
(Referencing #379 because it has a good overview) |
Encoding raw characters that don't need to be encoded before they're consumed by applications is unexpected behaviour, without some sort of documentation or justification. I could see mitigating XSS as a justification for serialising a URL with encoded Given that WHATWG specs like URL are "low-level", I'd think that the focus would be on offering high-fidelity APIs for what's seen on the wire, rather than anticipating issues like XSS, when those only affect a subset of users (especially with |
The WHATWG URL Standard internally stores components in a percent-encoded form, to make full URL serializing simpler (it's just string concatenation). That is already the status quo, and not a focus of this issue. Though the original issue was phrased in terms of the JavaScript getters, it could equivalently be phrased as "should |
Is XSS really the argument here? Because |
@annevk maybe not in this particular case. Interop is perhaps the bigger case here. Also, I would think that we already have implementer interest, considering Chrome and Firefox already implement this behavior? |
That's right. I'm sympathetic to the point of view to not encode unless it's strictly needed, but I also don't care strongly what we end up doing for these particular components. |
Firefox ended up aligning with Safari and the specification:
That makes me inclined to close this. cc @hayatoito |
In Chrome and Firefox, the
'
is escaped, in addition to Go. However, Safari, Node.js, and Ruby don't escape the'
.The case for
'
is weaker than^
in pathname (#607), but would allow us to align with 2/3 implementations still. In addition, we currently escape;
in userinfo, even though Go and Ruby don't escape it.Making the change would be slightly tricky: adding
'
to userinfo set would also add it to the component set; however, the component set is effectively frozen due to its alignment with encodeURIComponent.Fun fact, Chrome's equivalent of the component set actually includes
'
despite what its documentation claims. But registerProtocolHandler uses the "kQueryCharmap" defined in a separate part of the codebase, that happens to correspond exactly to encodeURIComponent.The text was updated successfully, but these errors were encountered: