-
Notifications
You must be signed in to change notification settings - Fork 0
Implement subprocess sandbox for file and git tools (DESIGN_SPEC §11.1.2) #131
Copy link
Copy link
Closed
Labels
prio:highImportant, should be prioritizedImportant, should be prioritizedscope:medium1-3 days of work1-3 days of workspec:securityDESIGN_SPEC Section 12 - Security & Approval SystemDESIGN_SPEC Section 12 - Security & Approval Systemspec:toolsDESIGN_SPEC Section 11 - Tool & Capability SystemDESIGN_SPEC Section 11 - Tool & Capability Systemtype:featureNew feature implementationNew feature implementation
Milestone
Description
Context
Tool execution requires safety boundaries proportional to risk. The MVP uses a subprocess sandbox for file system and git tools — lighter weight than Docker but sufficient for workspace isolation. This implements the SandboxBackend protocol with a subprocess-based backend.
Note: Docker/WASM/Firecracker sandboxing for code execution is a separate M7 issue (#50).
Acceptance Criteria
SandboxBackend Protocol
-
SandboxBackendprotocol defined (execute, cleanup, health_check) - Protocol is pluggable — new backends can be registered via config
Subprocess Sandbox Backend
- Tools execute in subprocess with restricted environment
- Workspace boundary enforcement — agents cannot escape their assigned directory
- Path validation: prevent directory traversal (../ attacks)
- Configurable resource limits: timeout per execution, memory cap
- Environment variable filtering (no secrets leakage to subprocess)
- Stdout/stderr capture and structured result return
- Cleanup after execution
Integration with Tool System
-
ToolInvokerroutes file/git tools through the subprocess sandbox - Sandbox backend selection configurable per tool category
- Sandbox failures surface as
ToolError(not raw subprocess errors)
Testing
- Unit tests for SandboxBackend protocol
- Unit tests for subprocess sandbox with path traversal attempts
- Integration test: tool execution through sandbox with workspace boundaries
Dependencies
- Design and implement basic tool system (registry, invocation, results) #15 — Tool system (done)
- Implement built-in tools: file system operations #18 — File system tools
- Git tools issue (sibling M3 issue)
Design Spec Reference
- §11.1.2 — Sandbox Backends (Subprocess row)
- §15.3 — tools/sandbox/ directory structure
- §15.5 — Engineering Conventions (sandboxing row)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
prio:highImportant, should be prioritizedImportant, should be prioritizedscope:medium1-3 days of work1-3 days of workspec:securityDESIGN_SPEC Section 12 - Security & Approval SystemDESIGN_SPEC Section 12 - Security & Approval Systemspec:toolsDESIGN_SPEC Section 11 - Tool & Capability SystemDESIGN_SPEC Section 11 - Tool & Capability Systemtype:featureNew feature implementationNew feature implementation