You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CORS origin policy: oracle rows for empty labels, DNS length limits and WHATWG-only host characters #929
CorsOriginPolicy (src/OpenCode.Sdk/Hosting/BackgroundService/Internal/Config/CorsOriginPolicy.cs, #213 slice S-c) decides which CORS origins OpenCodeServiceConfiguration.SetCorsOriginsAsync accepts. It accepts an origin only when the input equals scheme://host[:port] rebuilt from .NET's own Uri and IdnMapping parse, so it can be stricter than upstream's check (external/opencode/packages/cli/src/services/service-config.ts, WHATWG URL parsing), never looser. Its oracle corpus (tests/OpenCode.Sdk.Tests/Hosting/BackgroundService/Config/Fixtures/cors-origin-corpus.json, 81 verdicts produced by upstream's own code) matches upstream on every row, but it has no rows for input classes where the two parsers are known to differ:
empty labels: http://a..b, http://. (the policy's domain check accepts an empty label set as all-valid, then .NET's parse decides);
a label over 63 characters, or a name over 253: IdnMapping and .NET's DNS check enforce these lengths, WHATWG does not (VerifyDnsLength false);
host code points WHATWG allows but .NET may reject: !$&'()*+;=~.
On any of these the SDK may refuse an origin the CLI stores. That would be an unrecorded parity gap.
Done when
The oracle corpus has rows for each class above (verdicts generated by bun tools/oracles/service-config.ts from upstream's code), and either the policy matches every new verdict on net10.0, net11.0 and net472, or each disagreement is recorded as a divergence in canon with its reason. Found by the cross-family review of #213 S-c; not blocking under the review convergence rule.
Activity