Skip to content

agentHost: Separate local resource identity - #327936

Draft
roblourens wants to merge 3 commits into
mainfrom
roblou/agents/fix-vscode-agent-host-vulnerability
Draft

agentHost: Separate local resource identity#327936
roblourens wants to merge 3 commits into
mainfrom
roblou/agents/fix-vscode-agent-host-vulnerability

Conversation

@roblourens

Copy link
Copy Markdown
Member

Fixes a bug where remote Agent Host addresses could collide with the trusted local resource identity.

The change uses an explicit identity for trusted local resource access and assigns remote local addresses a distinct URI authority. It also adds regression coverage for authorization, permission prompts, and URI routing.

(Written by Copilot)

Keep trusted local resource access distinct from remote host addresses and give a remote host named local a collision-free authority.\n\n(Written by Copilot)\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 29, 2026 00:11
Resolve Agent Host protocol client and local service conflicts.\n\n(Written by Copilot)\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

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.

Pull request overview

Note

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Separates the trusted in-process “local agent host” resource identity from remote agent host addresses to prevent a remote "local" address from colliding with the trusted local resource access path.

Changes:

  • Introduces an explicit AgentHostResourceIdentity (string for remotes, symbol sentinel for trusted-local) and updates resource gating to use it.
  • Reserves/escapes the remote "local" address in URI authority encoding (agentHostAuthority) to avoid collisions with the ambient local authority.
  • Adds regression tests covering authorization decisions, permission prompting, and URI routing for "local" vs trusted-local.
Show a summary per file
File Description
src/vs/workbench/services/agentHost/test/common/agentHostResourceService.test.ts Adds regression tests ensuring remote "local" cannot spoof trusted local identity and follows normal permission prompts.
src/vs/workbench/services/agentHost/common/agentHostResourceService.ts Switches gating APIs to AgentHostResourceIdentity and ensures trusted-local identity is handled distinctly from remote addresses.
src/vs/platform/agentHost/test/electron-browser/remoteAgentHostService.test.ts Extends parsing tests to include "local" and "ws://local".
src/vs/platform/agentHost/test/electron-browser/remoteAgentHostProtocolClient.test.ts Adds protocol client regression tests for trusted-local vs remote "local" permission behavior; updates stubs to identity-based API.
src/vs/platform/agentHost/test/common/agentHostFileSystemProvider.test.ts Verifies remote "local" address produces a non-ambient authority and wraps file URIs correctly.
src/vs/platform/agentHost/electron-browser/localAgentHostService.ts Constructs the local protocol client using the trusted-local resource identity sentinel.
src/vs/platform/agentHost/common/agentHostUri.ts Reserves "local" by encoding it to a distinct remote authority (remote_local).
src/vs/platform/agentHost/common/agentHostResourceService.ts Defines the trusted-local identity sentinel and the AgentHostResourceIdentity type; updates public resource service interface accordingly.
src/vs/platform/agentHost/browser/remoteAgentHostProtocolClient.ts Plumbs resource identity through protocol client so permission checks use identity while connection authority/address remain unambiguous.

Review details

  • Files reviewed: 9/9 changed files
  • Comments generated: 1
  • Review effort level: Low

Comment thread src/vs/platform/agentHost/common/agentHostResourceService.ts
@github-actions

github-actions Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Screenshot Changes

Base: e07c4023 Current: ac9cd7fc

Changed (6)

agentsVoice/voiceModeOnboarding/Voice Mode onboarding (panel)/Dark
Before After
before after
agentsVoice/voiceModeOnboarding/Voice Mode onboarding (panel)/Light
Before After
before after
agentsVoice/voiceModeOnboarding/Voice Mode onboarding (wide)/Dark
Before After
before after
agentsVoice/voiceModeOnboarding/Voice Mode onboarding (wide)/Light
Before After
before after
agentsVoice/voiceModeOnboarding/Voice Mode onboarding (narrow)/Dark
Before After
before after
agentsVoice/voiceModeOnboarding/Voice Mode onboarding (narrow)/Light
Before After
before after

2 insignificant change(s) omitted (≤20 px, Δ≤2). See CI logs for details.

Make the trusted local sentinel explicitly narrow for control-flow checks.\n\n(Written by Copilot)\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

2 participants