agentHost: Separate local resource identity - #327936
Draft
roblourens wants to merge 3 commits into
Draft
Conversation
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>
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>
Contributor
There was a problem hiding this comment.
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
Contributor
Screenshot ChangesBase: Changed (6)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>
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.
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
localaddresses a distinct URI authority. It also adds regression coverage for authorization, permission prompts, and URI routing.(Written by Copilot)