Skip to content

network: normalize IDN policies and URL approvals - #336944

Closed
Dmitriy Vasyura (dmitrivMS) wants to merge 2 commits into
mainfrom
dmitriv/network-filter-idn-wildcards
Closed

Dmitriy Vasyura (dmitrivMS) wants to merge 2 commits into
mainfrom
dmitriv/network-filter-idn-wildcards

Conversation

@dmitrivMS

@dmitrivMS Dmitriy Vasyura (dmitrivMS) commented Sep 20, 2026

Copy link
Copy Markdown
Collaborator

Normalize wildcard domain suffixes with the same URL-aware authority normalization used for exact domain patterns before validating and matching them. This makes Unicode and Punycode hostnames match consistently while preserving existing hostname validation and IPv4 handling.

Also canonicalize sandbox allow/deny policies and preflight URL hosts. Patterns that cannot be normalized now fail with a configuration error. URL trust and auto-approval matching treats equivalent literal hostname labels consistently while preserving scheme, port, path, and wildcard semantics.

Add regression coverage for canonicalization, base-domain and subdomain matching, allow/deny behavior, explicit approval exceptions, sandbox configuration, and filtering before web content extraction. Include unrelated-domain controls to guard against overmatching.

Scope: Partial Unicode wildcard labels retain their existing spelling-sensitive matching and remain a follow-up. No decoder dependency is added.

Validation: 328 Electron tests pass (2 existing Windows skips), and 226 Node tests pass. Targeted transpilation, changed-file TypeScript diagnostics, ESLint, hygiene, and whitespace checks pass. Native Linux/macOS sandbox execution was not run. Full client compile/typecheck remains blocked locally by SDK metadata/API mismatches and missing Electron typings.

Normalize wildcard suffixes with the URL-aware authority helper before validating the pattern. Add matching, policy, and fetch-tool regression coverage while preserving existing domain handling.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings September 20, 2026 19:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The focused implementation is consistent with existing authority normalization and has comprehensive regression coverage.

Review effort: Balanced
Findings: None

What changed in this PR

Normalizes Unicode wildcard domains consistently with exact domain patterns.

Changes:

  • Canonicalizes wildcard suffixes to Punycode.
  • Adds matcher, policy, and extraction regression coverage.
File Description
src/​vs/​workbench/​contrib/​chat/​test/​electron-browser/​tools/​builtinTools/​fetchPageTool.test.ts Verifies denied URLs are filtered before extraction.
src/​vs/​platform/​networkFilter/​test/​common/​networkFilterService.test.ts Tests Unicode wildcard allow/deny policies.
src/​vs/​platform/​networkFilter/​test/​common/​domainMatcher.test.ts Covers canonicalization and matching boundaries.
src/​vs/​platform/​networkFilter/​common/​domainMatcher.ts Normalizes wildcard suffix authorities before validation.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@adhixmartinez-sudo

adhixmartinez-sudo commented Sep 20, 2026 via email

Copy link
Copy Markdown

@dmitrivMS Dmitriy Vasyura (dmitrivMS) added this to the 1.139.0 milestone Sep 20, 2026
@dmitrivMS
Dmitriy Vasyura (dmitrivMS) marked this pull request as ready for review September 20, 2026 19:54
@dmitrivMS Dmitriy Vasyura (dmitrivMS) added the network Network related issues label Sep 20, 2026
@dmitrivMS
Dmitriy Vasyura (dmitrivMS) marked this pull request as draft September 20, 2026 19:55
auto-merge was automatically disabled September 20, 2026 19:55

Pull request was converted to draft

Canonicalize sandbox domain policies and preflight URL hosts, rejecting patterns that cannot be normalized. Match equivalent Unicode and Punycode literal host labels in URL trust and approval rules while preserving existing glob semantics.

Partial Unicode wildcard labels remain outside this change.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dmitrivMS Dmitriy Vasyura (dmitrivMS) changed the title network: normalize Unicode wildcard domain patterns network: normalize IDN policies and URL approvals Sep 20, 2026
Dmitriy Vasyura (dmitrivMS) added a commit that referenced this pull request Sep 20, 2026
Merge the IDN network-filter and sandbox changes with effective URL destination normalization. Preserve both normalization stages and their regression coverage, and add combined IDN plus effective-path approval and exclusion tests.

Consolidates #336944 into #336960.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dmitrivMS

Copy link
Copy Markdown
Collaborator Author

Superseded by #336960, which now includes both original commits from this PR, the effective URL/trust/approval fixes, both regression suites, and additional combined IDN/path tests. Combined validation: 498 tests pass; targeted typecheck, hygiene, and canonical policy export pass. Closing in favor of the consolidated PR rather than landing two overlapping matcher changes. The source branch is retained.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

network Network related issues security

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants