-
Notifications
You must be signed in to change notification settings - Fork 17.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
html/template: reserved character "()" in href attribute is autoescaped. #63586
Comments
cc @golang/security |
From html/template/url.go:
|
Format (webp) is incorrectly encoded to format%28webp%29, and the browser will not encode Format (webp)
|
I believe the server is rightfully using ')' as a delimiter, and the escaped URI is for another (non-existing) resource. https://www.rfc-editor.org/%72%66%63/%72%66%63%33%39%38%36#%73%65%63%74%69%6F%6E%2D%32.%32 2.2
Changing the encoding of delimiters may not be undone by normalization. 2.3
Only unreserved mentioned. 3.3
'(' can be a delimiter (path, sub-delims, reserved) or an octet/character. '(' and '&' are in the same class, percent-encoding '&' would break most queries. It seems '(' is not the same as '%28', although many implementations do not use '(' as a delimiter. The go http library escapes '(' into '%28' and unescapes '%3B' into ';' when parsing URLs. Both are sub-delimiters. edit: |
Browsers and html/template sometimes disagree about the level of escaping required. In the asuracomics URL, using format:%28webp) works fine, but format:%28webp%29 does not. Note that Wikipedia has no problem serving https://en.wikipedia.org/wiki/Comma_%28disambiguation%29. It seems reasonable to me to declare this a server bug and leave html/template alone. |
I ran into what I believe is the more general case version of this bug today, which is that |
I think reservedcharacters percent encoding is not performed according to the RFC 3986 spec.
What version of Go are you using (
go version
)?1.21
What did you do?
What did you expect to see?
What did you see instead?
The text was updated successfully, but these errors were encountered: