Skip to content

fix(sandbox) - Deny write access to sandbox settings file for security#315602

Open
yehsuf wants to merge 5 commits into
microsoft:mainfrom
yehsuf:fix/sandbox-settings-denywrite
Open

fix(sandbox) - Deny write access to sandbox settings file for security#315602
yehsuf wants to merge 5 commits into
microsoft:mainfrom
yehsuf:fix/sandbox-settings-denywrite

Conversation

@yehsuf
Copy link
Copy Markdown

@yehsuf yehsuf commented May 11, 2026

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:

  • Updated TerminalSandboxService to always include the sandbox settings file path in the denyWrite list, preventing sandboxed processes from modifying their own configuration (src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalSandboxService.ts).

Testing:

  • Added a test to confirm that the sandbox settings file path is included in the denyWrite array 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

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
Copilot AI review requested due to automatic review settings May 11, 2026 05:41
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

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.denyWrite when producing the sandbox configuration.
  • Add a browser-unit test that asserts the generated config’s denyWrite array 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.

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 Settings are written into a write allowed location.

3 participants