Skip to content

terminal: reduce sandbox URL false positives#308894

Merged
dileepyavan merged 1 commit intomainfrom
DileepY/308785
Apr 10, 2026
Merged

terminal: reduce sandbox URL false positives#308894
dileepyavan merged 1 commit intomainfrom
DileepY/308785

Conversation

@dileepyavan
Copy link
Copy Markdown
Member

Summary

  • make bare host detection more conservative by requiring a small set of coding-related domain suffixes
  • continue treating explicit URLs and SSH remotes as domains even when the suffix looks file-like or otherwise uncommon
  • add regression tests covering valid/invalid bare suffixes, multi-label hosts, explicit URLs, and dotted non-domain identifiers

Testing

  • npm run transpile-client
  • npm run test-browser-no-install -- --browser chromium --grep "TerminalSandboxService - network domains"
  • gulp hygiene (fails on unrelated pre-existing/generated file: extensions/mermaid-chat-features/chat-webview-out/codicon.css: Missing or bad copyright statement)

Fixes #308785

Restrict bare host detection to a conservative set of coding-related domain suffixes while continuing to treat explicit URLs and SSH remotes as domains.

Add regression coverage for valid and invalid bare suffixes, multi-label hosts, explicit URLs, and dotted non-domain identifiers.
Copilot AI review requested due to automatic review settings April 9, 2026 23:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Reduces false positives in TerminalSandboxService’s heuristic domain extraction so sandbox prompts aren’t triggered by arbitrary dotted identifiers (eg session.completed), while still treating explicit URLs and SSH remotes as network domains.

Changes:

  • Add a conservative allowlist of “well-known” domain suffixes for bare host detection.
  • Keep treating URL authorities and SSH remotes as domains even when the suffix looks uncommon/file-like.
  • Add regression tests for unknown bare suffixes, multi-label hosts, and explicit URL authorities.
Show a summary per file
File Description
src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalSandboxService.ts Tightens bare-host normalization by requiring a well-known suffix (when not parsed from a URL/SSH remote).
src/vs/workbench/contrib/terminalContrib/chatAgentTools/test/browser/terminalSandboxService.test.ts Adds tests validating the new bare-host heuristic and ensuring explicit URLs still trigger domain checks.

Copilot's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 2

@dileepyavan dileepyavan merged commit 0a11ecd into main Apr 10, 2026
30 checks passed
@dileepyavan dileepyavan deleted the DileepY/308785 branch April 10, 2026 00:52
@vs-code-engineering vs-code-engineering bot added this to the 1.116.0 milestone Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sandbox URL detection seems to trip on any “foo.bar” string

3 participants