Repository navigation
fix(hosting): accept the CORS origins the CLI accepts for empty labels, long names and sub-delimiter hosts (#929) - #946
Merged
Conversation
…s, long names and sub-delimiter hosts (#929)
Collaborator
Author
|
net472 mutation replay on Windows at 60522e2:
|
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?
OpenCodeServiceConfiguration.SetCorsOriginsAsyncrefused CORS origins that opencode's CLI stores. The SDK'sCorsOriginPolicyaccepts an origin only when it equals the origin .NET's ownUriparse rebuilds, and that parse is stricter than the WHATWG URL parsing upstream uses (external/opencode/packages/cli/src/services/service-config.tsat the 2.3.0 pin). This PR closes the gap for the three classes #929 names. Upstream's behaviour is the oracle.http://a..b,http://.,http://a.42..) are accepted as upstream accepts them. The numeric-final-label rule now drops at most one terminal empty label, as WHATWG does, sohttp://a.42.andhttp://a..42stay refused.!$&'()*+;=~are accepted, alone and inside a label.Urirefuses the item, a bounded ASCII-host fallback takes over. It requires lowercasehttp://orhttps://, and a host of lowercase ASCII letters, digits,._-and those eleven characters. It lets the BCL parse the scheme and port with a fixed placeholder host, then rebuilds the origin with the original host. The existing exact comparison still decides every verdict, so the fallback cannot accept an origin upstream refuses: percent-encoded, userinfo, uppercase, default-port and path forms all stay refused, and the corpus has a row for each. The ACE, IPv4 and IPv6 paths are unchanged. No WHATWG or IDNA parser is ported.CorsOriginPolicy(docs/architecture/client-runtime.md) describes the fallback as shipped, andCHANGELOG.mdhas the fix under[Unreleased].Related Issue(s):
",`,{,}; long ACE labels; extra fallback invariant rows)🔄 Type of Change
🎯 Protocol & API Surface
spec/) is untouchedexternal/was hand-edited🧪 Testing
How has this been tested?
The oracle corpus grows from 81 to 147 rows: the 64 planned rows, plus
http://!@!andhttp://!:8080/, two rows that reach the fallback's userinfo and path checks. Every verdict comes from upstream's ownServiceConfig.set("cors", origin)viabun tools/oracles/service-config.ts. The 64 planned verdicts matched the predictions, and no existing verdict changed. After each corpus change the oracle ran twice more, with a clean tree each time.Local check on
60522e22(macOS arm64, on masterc903e9c5), all green:dotnet build -c Release, and again with-p:IncludeNet472Tests=true(0 warnings);verify-clones;--helpandgenerate --verify.Mutation proof: 22 mutants, one at a time under the full analyzer build, each failing
CorsOriginPolicyTests.IsOrigin_Should_Match_Every_Upstream_Cors_Verdicton net10.0 and net11.0 at its corpus row. They cover:The net472 replay is pending on the Windows gate host; this PR is enqueued only after it.
Review: a fresh cross-family read found nothing blocking. It confirmed by reading that the fallback cannot over-accept and that nothing in it depends on .NET Framework's
Uri. Its non-blocking findings are #945.📚 Documentation
CHANGELOG.mdentry added for the user-facing fixKnown follow-ups
",`,{,}), possibly over-long ACE labels (upstream's verdict not yet run), and corpus rows that lock the fallback's invariants. The canon's description of when the fallback applies gets made exact there.