feat: support configurable command sandboxing via sandbox-runtime#11773
Draft
roomote[bot] wants to merge 1 commit intomainfrom
Draft
feat: support configurable command sandboxing via sandbox-runtime#11773roomote[bot] wants to merge 1 commit intomainfrom
roomote[bot] wants to merge 1 commit intomainfrom
Conversation
Adds support for running agent commands in an isolated environment using Anthropic's sandbox-runtime `srt` CLI tool, addressing #11771. Changes: - Add sandbox configuration settings to package.json (commandSandboxEnabled, commandSandboxNetworkPolicy, commandSandboxWritePolicy, commandSandboxAllowedPaths, commandSandboxDeniedPaths) - Create SandboxManager abstraction with SrtSandbox and NoOpSandbox implementations in src/integrations/terminal/sandbox/ - Integrate sandbox command wrapping into executeCommandInTerminal - Add comprehensive tests (23 tests across 3 test files)
2 tasks
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.
Related GitHub Issue
Closes: #11771
Description
This PR attempts to address Issue #11771 by adding configurable command sandboxing support using Anthropic's sandbox-runtime (
srt) CLI tool. Feedback and guidance are welcome.Key implementation details:
SandboxManager (
src/integrations/terminal/sandbox/SandboxManager.ts): Singleton that reads VS Code configuration and returns either anSrtSandbox(when sandboxing is enabled) or aNoOpSandbox(passthrough when disabled). Caches the sandbox instance and invalidates when config changes.SrtSandbox (
src/integrations/terminal/sandbox/SrtSandbox.ts): Wraps commands withsrt execto provide network/filesystem isolation via Linux namespaces. Uses thesrtCLI tool as recommended in the issue discussion (rather than the library), which works for both VSCode shell integration terminals and execa terminals since it wraps at the command string level.NoOpSandbox (
src/integrations/terminal/sandbox/NoOpSandbox.ts): Passthrough that returns commands unchanged when sandboxing is disabled.Integration point:
executeCommandInTerminal()inExecuteCommandTool.tswraps commands throughSandboxManager.wrapCommand()before passing them toterminal.runCommand().Configuration settings added to
package.json:commandSandboxEnabled(boolean, default: false) - toggle sandboxingcommandSandboxNetworkPolicy("allow" | "deny", default: "deny") - network accesscommandSandboxWritePolicy("allow" | "deny", default: "allow") - filesystem writescommandSandboxAllowedPaths(string[]) - bind-mounted pathscommandSandboxDeniedPaths(string[]) - denied pathsTest Procedure
SrtSandbox,NoOpSandbox, andSandboxManagerexecuteCommandtests continue to pass (23 tests)cd src && npx vitest run integrations/terminal/sandbox/__tests__/cd src && npx vitest run core/tools/__tests__/executeCommand.spec.ts core/tools/__tests__/executeCommandTool.spec.tsPre-Submission Checklist
srt).Documentation Updates
Interactively review PR in Roo Code Cloud