Repository navigation
agentHost: grant sandbox read access to application contents - #348433
Merged
Dileep Yavanmandha (dileepyavan) merged 4 commits intoNov 16, 2026
Merged
Dileep Yavanmandha (dileepyavan) merged 4 commits into
Dileep Yavanmandha (dileepyavan) merged 4 commits into
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The recursive sandbox grant includes portable Windows/Linux user-data directories, allowing sandboxed processes to read profile storage and other sessions’ databases.
1 open issue
What changed in this PR
This PR addresses #346105 by adding application-content read roots to Agent Host sandboxes so plugin canvases can load VS Code resources without disabling sandboxing.
Changes:
- Adds a memoized, platform-aware
appBundleRoot, including versioned Windows layouts and non-packaged fallbacks. - Passes the root to Copilot SDK and custom-terminal sandbox read grants.
- Adds path-derivation, create/resume, and policy-composition coverage, plus documentation.
| File | Description |
|---|---|
src/vs/platform/environment/test/node/environmentService.test.ts |
Tests packaged layouts and fallback paths. |
src/vs/platform/environment/common/environmentService.ts |
Derives and memoizes the application bundle root. |
src/vs/platform/environment/common/environment.ts |
Adds appBundleRoot to the native environment interface. |
src/vs/platform/agentHost/test/node/sandboxConfigForSdk.test.ts |
Tests application contents among shared read roots. |
src/vs/platform/agentHost/test/node/copilotAgentSession.test.ts |
Covers application grants during create/resume and policy changes. |
src/vs/platform/agentHost/node/copilot/sandboxConfigForSdk.ts |
Updates documentation for extra read-only paths. |
src/vs/platform/agentHost/node/copilot/copilotSessionSandbox.ts |
Supplies the application root to SDK sandbox configuration. |
src/vs/platform/agentHost/node/copilot/agentHostSandboxEngine.ts |
Supplies the application root to the custom-terminal sandbox. |
src/vs/platform/agentHost/common/vscodeSandboxPaths.ts |
Includes application contents in shared sandbox read roots. |
src/vs/platform/agentHost/AGENTS.md |
Documents application-root behavior and SDK policy restrictions. |
Review effort: Balanced
Dmitriy Vasyura (dmitrivMS)
previously approved these changes
Nov 16, 2026
Derive the application bundle root from the native environment and include it in host sandbox read defaults. Preserve explicit denies and managed read-only restrictions. Fixes microsoft#346105 Co-authored-by: Copilot <[email protected]>
Register the application bundle root in launcher fixtures and limit the permission-error fixture to omitting the Copilot home service. Co-authored-by: Copilot <[email protected]>
Grant application resources and individual runtime files instead of recursively exposing Windows and Linux installation directories. Apply the same bounded roots to both Agent Host sandbox backends and cover portable and versioned layouts. Co-authored-by: Copilot <[email protected]>
Dileep Yavanmandha (dileepyavan)
force-pushed
the
DileepY/canvas-sandboxing
branch
from
November 16, 2026 04:00
2eef66e to
39e08f6
Compare
Supply the native environment app root and bundle root required by the terminal sandbox adapter. Keep production read-grant validation unchanged. Co-authored-by: Copilot <[email protected]>
roblourens
approved these changes
Nov 16, 2026
Dileep Yavanmandha (dileepyavan)
deleted the
DileepY/canvas-sandboxing
branch
November 16, 2026 05:39
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 #346105.
Summary
Sandboxed canvases need read access to VS Code's application contents, not only its JavaScript application directory. Manually granting the macOS application's
Contentsdirectory allows the canvas to work with sandboxing enabled.INativeEnvironmentService.appBundleRootgetter derived from the running host'sappRootand product configuration.appRootand individual regular runtime files instead of recursively granting the installation directory. This keeps sibling portabledata/user-data, other sessions' databases, and portable extensions outside the application grant.appRootinstead of granting an arbitrary ancestor.<application>.app/Contents<installation>\resources\appand individual regular files directly inside<installation><installation>\<version>\resources\appand individual regular files directly inside<installation>and the active<version>directory<installation>/resources/appand individual regular files directly inside<installation>Windows/Linux installation directories themselves are not recursively granted. No new user setting, write permission, or network permission is introduced.
Validation
Validation already completed for the current head; reused for this description/review-thread update because no code changed:
corepack pnpm run build-fast --client-only— passed.corepack pnpm run typecheck-client— passed.npm run -s precommit— passed through the normal commit hook, including oxlint and hygiene checks.Code OSS CI for the current head passed, including Compile & Hygiene, both Linux Electron-Unit jobs (node and electron), and PR Gate. This supplies Linux verification for the shell-tool cases skipped locally on Windows.
The new getter and generated read-only policy were also checked against a versioned Windows Insiders installation. The manually tested macOS permission is documented in #346105 (comment). End-to-end canvas launches with the new default have not been verified across macOS, Windows, and Linux.
Manual verification
datadirectory or recursively grant its installation-directory ancestor.