Repository navigation
test: a non-special URL host accepts every supplementary code point (needs oven-sh/WebKit#1026) - #48463
Draft
robobun wants to merge 1 commit into
Draft
test: a non-special URL host accepts every supplementary code point (needs oven-sh/WebKit#1026)#48463robobun wants to merge 1 commit into
robobun wants to merge 1 commit into
Conversation
Collaborator
Author
|
Updated 6:27 AM PT - Nov 10th, 2026
❌ @robobun, your commit 5d7555e has some failures in 🧪 To try this PR locally: bunx bun-pr 48463That installs a local version of the PR into your bun-48463 --bun |
Collaborator
Author
|
Status
|
…p ci]
A forbidden host code point is one of 17 ASCII code points. WebKit's URL
parser tested only the low 16 bits of a host code point, so a non-special
URL such as "zz://a\u{10020}/" was refused. oven-sh/WebKit#1026 tests the
whole code point.
These tests fail until WEBKIT_VERSION names a WebKit build that has that
change. CI is skipped for that reason.
robobun
force-pushed
the
robobun/d91ff92b/bump-webkit-url-opaque-host-code-point
branch
from
November 10, 2026 18:18
5d7555e to
12bfc77
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
new URL("zz://a\u{10020}/")throwsTypeError: Invalid URL. Node.js and the URL Standard give the hosta%F0%90%80%A0. Bun 1.2.3 and later refuse 272 such code points. Bun 1.2.2 did not.char16_tbefore the test for the 17 ASCII code points that no host can hold (Source/WTF/wtf/URLParser.cpp:709in oven-sh/WebKit). U+10020 is tested as U+0020.Fix
WEBKIT_VERSIONmove after it merges. This PR has the Bun tests and changes no pin.test/js/web/url/url.test.ts, 4 new tests. They fail on Bun 1.4.3 and on a debug build of main. They pass on a debug build with the preview build of that pull request.Background
WEBKIT_VERSIONnames the build. It moves several times a week.Notes
When to mark this ready. When
git merge-base --is-ancestor <merge commit of oven-sh/WebKit#1026> <WEBKIT_VERSION of main>succeeds in a WebKit clone. Then rebase (the diff is one test file), drop[skip ci]from the commit subject, runbun bd test test/js/web/url/url.test.ts, and mark it ready. A comment on this pull request wakes the author.Repro.
TypeError TypeError TypeErrora%F0%90%80%81 a%F0%90%80%A1 a%F0%9F%98%80zz://example/pa%F0%90%80%80 a%F0%90%80%A0 a%F0%90%80%AFzz://a%F0%90%80%A0b/pThe refused code points are U+n0000, U+n0009, U+n000A, U+n000D, U+n0020, U+n0023, U+n002F, U+n003A, U+n003C, U+n003E, U+n003F, U+n0040, U+n005B to U+n005E and U+n007C, for n = 1 to 16: the ones whose low 16 bits are a forbidden host code point.
Counts. One script, every supplementary code point as the host of
zz://, then each one with a low half under U+0080 through the two setters:new URLrefuseshostsetter refuseshostnamesetter refusesThe last column is U+0000, space,
<,>,[,\,],^and|in an 8-bit string and in a 16-bit string. The other 8 forbidden host code points have another role: tab, LF and CR are removed from the input,#,/and?end the authority,:starts the port, and@ends the userinfo.Who meets it. No issue reports it, and no row of the WPT
urltestdata.jsonhas a supplementary code point in a non-special host. Of the 272 code points, 177 are unassigned in Unicode 15.1 and 34 are private use. The 61 assigned ones are 14 Linear B signs, 34 CJK ideographs of Extensions B and G, and 13 tag characters. None is an emoji.What changes in Bun when the pin has the fix. The constructor with and without a base,
URL.canParse,URL.parse, thehref,hostandhostnamesetters,new Request(url),Response.redirect(url)and URLPattern inputs all end in the same call ofWTF::URLParser. Not reached: the same code points in the path, the query or the userinfo, the host of an http URL (IDNA decides there), BMP code points, and strings with no character above U+00FF. A script that goes through every one of these entry points prints the same 30 lines on a debug build with the fix and on Node.js v26.3.0.The entry points that do I/O stop at the next step, as they do today for the neighbour U+10021:
fetch("s3://…")with an S3 endpointERR_INVALID_URLnew WebSocket("ws+unix://…")SyntaxError: Invalid url for WebSocketws+unix://a%F0%90%80%A0b/new Bun.RedisClient("redis://…").connect()TypeError: Invalid URL formatERR_REDIS_CONNECTION_CLOSEDnew Bun.SQL("postgres://…")TypeError: Invalid URLERR_POSTGRES_CONNECTION_REFUSEDThe tests. The 4 tests are in the existing file, beside the other opaque-host test.
zz://H/,zz://u:p@H/, and//H/qon azz:base), 4,896 parses, and compares each result withencodeURIComponent. The parser reads the authority 16 code units at a time, and narrows them in a different way on x64 and arm64. So 5 of the hosts are 34 code units long, with the code point at the start of a block, across the edge of two blocks and after the last full block.USE_SYSTEM_BUN=1 bun test test/js/web/url/url.test.ts -t "opaque hosts"gives 4 failures on Bun 1.4.3. A debug build of main at98cda0d8b1gave the same 4 failures with the first version of these tests. A debug build of98cda0d8b1with the preview build of oven-sh/WebKit#1026 passes the file (32 tests). A fail-before check that reverts onlysrc/andpackages/cannot show both sides here, because the fix is not in this repository.Evidence from the first state of this pull request. It pinned the preview build of oven-sh/WebKit#1026 (
ee59053d, the pin of main at that time, plus that one commit). Debug ASAN builds of one Bun commit with the two pins:ee59053d)test/js/web/url/url.test.tstest/js/web/url/url-wpt-constructor.test.tstest/js/web/urlpattern/urlpattern.test.tstest/js/node/urltest-url*,test-urlpatternandtest-whatwg-url*oftest/js/node/test/parallel(42 files)CI on that pin (build 139721) passed 184 of 188 jobs, with
url.test.tson 10 test lanes (Linux glibc and musl, macOS arm64, Windows x64 and arm64, ASAN). The 4 macOS x64 test jobs failed on the CI machines before they reached the file: no agent took them for three attempts, and in the fourth the checkout directory was removed while the tests ran. In the lane that ships for Linux x64, 3 of the 920 objects of the WTF, bmalloc and JavaScriptCore archives differ between the two WebKit builds:URLParser.cpp.o(the change),URL.cpp.o(only the checksum ofURLParser.hin its debug info) and one JavaScriptCore unified source (onlybyteCodeCacheVersion, which follows the revision).Self-review. 5 concerns, none about the WebKit diff. (1) The descriptions did not say that no user reported the bug. (2) The order against oven-sh/WebKit#1015, which touches the deleted declaration: there is a note on it. (3) This pull request was a dedicated bump to a preview build. The pin of main passed it on the same day (it is
873ab3a4now), and a new preview for each pin move costs a build of every lane. It has the tests only now. (4) The cost line in oven-sh/WebKit#1026 named one input as a range. It is measured over 2,025 inputs now. (5) A comment in the test said that@ends the host. It ends the userinfo. The review also asked for hosts of 16 code units or more and for a host after userinfo. The first test has them now.Not part of this change. Chromium 153 refuses a different and larger set of supplementary code points in this position (69,632), so it is not a reference here.
WTF::URLHelpershas the same conversion in its lookalike-character test (URLHelpers.cpp:179). Bun does not link that code.