Repository navigation
fix(hosting): accept the remaining WHATWG host characters in CORS origins and pin the fallback's invariants (#945) - #948
Merged
Conversation
Collaborator
Author
|
net472 mutation replay on Windows (KAER), head
Part of #945. |
This was referenced Nov 17, 2026
Merged
Merged
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.
📝 Description
What does this PR do?
Parts 1 and 3 of #945, the follow-up to #929.
CorsOriginPolicyfalls back to a bounded ASCII-host check when .NET'sUrirefuses an origin. That fallback still refused four host characters that the WHATWG URL parser in opencode's CLI accepts. The fallback's invariants also had no corpus rows of their own. Upstream's behaviour is the oracle (external/opencode/packages/cli/src/services/service-config.tsat the 2.3.0 pin).Part 1: the remaining host characters.
",`,{and}are accepted, alone and inside a label. Their percent-encoded forms (%22,%60,%7b,%7d) stay refused, as upstream refuses them. The production change is one line: the fallback's allowlist inCorsOriginPolicy.cs.Part 3: the fallback's invariants. New corpus rows pin:
http://xn--9ca.a!baccepted,http://xn--a.a!brefused);Every one of these rows already matched the policy; they lock its behaviour in.
Docs:
CorsOriginPolicy(docs/architecture/client-runtime.md) now says exactly when the fallback applies:Uri.TryCreaterefuses the whole item, and the host is the text after://up to the first:, or to the end of the item. It also lists the full alphabet. In place of "without imposing DNS length limits", it says that ordinary ASCII names carry no DNS length limit, while ACE (xn--) labels are validated byIdnMapping, which enforces its 63-character label limit.CHANGELOG.md: CORS origin policy: oracle rows for empty labels, DNS length limits and WHATWG-only host characters #929's Fixes entry now covers both issues.Related Issue(s):
🔄 Type of Change
🎯 Protocol & API Surface
spec/) is untouchedexternal/was hand-edited🧪 Testing
How has this been tested?
The oracle corpus grows from 147 to 172 rows:
Every verdict comes from upstream's own
ServiceConfig.set("cors", origin)viabun tools/oracles/service-config.ts. No existing verdict changed. After the commit, the oracle ran twice more with a clean tree each time.Local check (macOS arm64, on master
a086fb4b), all green:e4fc68c8:dotnet build -c Release, and again with-p:IncludeNet472Tests=true;verify-clones;--helpandgenerate --verify.Mutation proof: 18 mutants, applied one at a time under the full analyzer build. Each fails
CorsOriginPolicyTests.IsOrigin_Should_Match_Every_Upstream_Cors_Verdictat its corpus row, on net10.0 and net11.0. They cover:%control;The net472 replay is pending on the Windows gate host. This PR is enqueued only after it passes.
Review: a fresh cross-family read found nothing blocking. Its CHANGELOG finding is fixed.
📚 Documentation
CHANGELOG.mdentry updated for the user-facing fixKnown follow-ups
IdnMapping's label limit). Whether to record that as a divergence or match it is the maintainer's decision (ADR-0031), and it follows as its own small PR.http://xn--"-mgais valid upstream,http://xn--"-9cais invalid) have no corpus rows yet. They go with part 2.