-
Notifications
You must be signed in to change notification settings - Fork 141
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
File URL reparse bug with percent encoded windows drive letter #559
Comments
Nice find. I kinda like 3 (and then returning failure or explicitly dropping it). 1 and 2 seem a bit too generic. |
I think, if Yet another example, which leads to the same bug: var u = new URL("file://h/")
u.hostname = "c|"
// u.href == "file://c|/" |
Does your table include Chrome on Linux or Chrome on Windows? There are some functional differences in Chromium's interpretation of Windows drive letters in URLs on different operating systems, as seen by looking for While I do think URL parsing should be idempotent, I don't have a strong opinion here. I initially think all those URLs should be canonicalized to |
I tested both. The same result:
|
After tinkering around a bit more, I think we should have |
I think I can agree with you, but what result must be here: var u = new URL("file://h/path")
u.hostname = "c|" Currently result ( |
Ah, yes. I think we should reject a windows drive letter or something that would percent decode to a windows drive letter in the hostname setter but not in the main parser. |
Coincidentally, step 1.3.1 in the file host state, states that file-hosts should be parsed as non-special, i.e. as opaque hosts, I think that's a typo. |
It might not be an unreasonable idea to just add |
I tried implementing forbidding '|' in hosts in https://bugs.webkit.org/show_bug.cgi?id=220778 |
https://bugs.webkit.org/show_bug.cgi?id=220778 Patch by Alex Christensen <achristensen@webkit.org> on 2021-01-26 Reviewed by Youenn Fablet. LayoutTests/imported/w3c: * web-platform-tests/url/a-element-expected.txt: * web-platform-tests/url/a-element-origin-expected.txt: * web-platform-tests/url/a-element-origin-xhtml-expected.txt: * web-platform-tests/url/a-element-xhtml-expected.txt: * web-platform-tests/url/failure-expected.txt: * web-platform-tests/url/resources/urltestdata.json: * web-platform-tests/url/url-constructor-expected.txt: * web-platform-tests/url/url-origin-expected.txt: Source/WTF: This is one of the proposed solutions to whatwg/url#559 and RFC 3986 and 3987 forbid such characters, so let's try forbidding it. * wtf/URLParser.cpp: (WTF::isC0Control): (WTF::isForbiddenHostCodePoint): LayoutTests: * fast/url/file-http-base-expected.txt: * fast/url/file-http-base.html: Canonical link: https://commits.webkit.org/233360@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271899 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=220778 Patch by Alex Christensen <achristensen@webkit.org> on 2021-01-26 Reviewed by Youenn Fablet. LayoutTests/imported/w3c: * web-platform-tests/url/a-element-expected.txt: * web-platform-tests/url/a-element-origin-expected.txt: * web-platform-tests/url/a-element-origin-xhtml-expected.txt: * web-platform-tests/url/a-element-xhtml-expected.txt: * web-platform-tests/url/failure-expected.txt: * web-platform-tests/url/resources/urltestdata.json: * web-platform-tests/url/url-constructor-expected.txt: * web-platform-tests/url/url-origin-expected.txt: Source/WTF: This is one of the proposed solutions to whatwg/url#559 and RFC 3986 and 3987 forbid such characters, so let's try forbidding it. * wtf/URLParser.cpp: (WTF::isC0Control): (WTF::isForbiddenHostCodePoint): LayoutTests: * fast/url/file-http-base-expected.txt: * fast/url/file-http-base.html: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@271899 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Is there a consensus on changing the spec to forbid '|' in hosts to solve this issue? |
Firefox already forbids |
@achristensen07 want to make the change to the specification as well? |
This fixes issue whatwg#559.
This fixes issue whatwg#559.
Github found my PR to this repo. web-platform-tests/wpt#28118 is my PR for the tests. |
There is a reparse bug, when parsing URL with percent encoded windows drive letter (
C|
) in the host. URLs to test:file://%43%7C
file://C%7C
file://%43|
Any of them parses to
file://c|/
, the latter - tofile:///c:/
.Let's see how browsers parse them:
file://c%7C/
file://c%7C/
file:///
file:///
file://c|/
file:///c:/
Safari has the same bug as spec. Chrome suggests possible resolution.
Some ways how to fix bug:
|
in the host after host parsing (as Chrome does)|
after host parsing.The text was updated successfully, but these errors were encountered: