fix(sandbox) - Deny write access to sandbox settings file for security#315602
Open
yehsuf wants to merge 5 commits into
Open
fix(sandbox) - Deny write access to sandbox settings file for security#315602yehsuf wants to merge 5 commits into
yehsuf wants to merge 5 commits into
Conversation
The sandbox settings file is written inside the sandbox temp directory, which is on the allowWrite list. This allows sandboxed processes to modify their own sandbox configuration — a potential escape vector. Fix: include the config file path in denyWrite (which takes precedence over allowWrite) so sandboxed processes cannot overwrite it. Fixes microsoft#314354
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request hardens the terminal sandbox configuration by preventing sandboxed processes from overwriting the sandbox settings JSON that controls their own restrictions, closing a potential escape vector.
Changes:
- Always append the generated sandbox settings file path to
filesystem.denyWritewhen producing the sandbox configuration. - Add a browser-unit test that asserts the generated config’s
denyWritearray includes the settings file path.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalSandboxService.ts | Ensures the sandbox settings file path is always denied for writes in generated sandbox config. |
| src/vs/workbench/contrib/terminalContrib/chatAgentTools/test/browser/terminalSandboxService.test.ts | Adds coverage verifying the config file path is present in filesystem.denyWrite. |
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.
This pull request strengthens the security of the terminal sandbox by ensuring that sandboxed processes cannot modify their own sandbox configuration file. It does this by always adding the sandbox settings file to the list of denied write paths, and adds a test to verify this behavior.
Security improvements:
TerminalSandboxServiceto always include the sandbox settings file path in thedenyWritelist, preventing sandboxed processes from modifying their own configuration (src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalSandboxService.ts).Testing:
denyWritearray in the generated configuration (src/vs/workbench/contrib/terminalContrib/chatAgentTools/test/browser/terminalSandboxService.test.ts).The sandbox settings file is written inside the sandbox temp directory, which is on the allowWrite list. This allows sandboxed processes to modify their own sandbox configuration — a potential escape vector.Fix: include the config file path in denyWrite (which takes precedence over allowWrite) so sandboxed processes cannot overwrite it.
Fixes #314354