Overview
Vectra Guard’s sandbox provides isolated execution environments for commands, protecting your system from potentially harmful operations. The sandbox system is highly configurable with multiple modes, security levels, and performance optimizations.By default, Vectra Guard runs all commands in sandbox with intelligent caching for 10x speedup.
Sandbox Modes
Thesandbox.mode setting controls when commands are sandboxed:
- always
- auto
- risky
- never
Maximum Security (Default)Behavior:
- ✅ Every command runs in sandbox
- ✅ Maximum security and isolation
- ✅ 10x faster with comprehensive caching
- ✅ 30+ package manager caches auto-mounted
- Production environments
- CI/CD pipelines
- Untrusted code execution
- Maximum protection
Security Levels
Thesandbox.security_level setting controls how strict the sandbox isolation is:
permissive
Fastest Performance
- Shares host network
- Standard capabilities
- Minimal restrictions
- Best for trusted local dev
balanced
Recommended Default
- Own network namespace
- Outbound network allowed
- Standard capabilities
- Good isolation + usability
strict
Strong Isolation
- Restricted network access
- Dropped capabilities
- Read/write restrictions
- For sensitive operations
paranoid
Maximum Security
- No network access
- Read-only root filesystem
- All capabilities dropped
- Production environments
Security Level Comparison
- Configuration
- Capabilities
permissive
balanced (Recommended)
strict
paranoid
Cache Configuration
Caching dramatically improves performance by sharing package manager caches between sandbox and host.Enable Caching (Default)
Node.js / JavaScript
Node.js / JavaScript
~/.npm- npm cache~/.yarn- Yarn cache~/.pnpm- pnpm cachenode_modules/.cache- Build caches
Python
Python
~/.cache/pip- pip cache~/.cache/pip3- pip3 cache__pycache__- Python bytecode
Rust
Rust
~/.cargo- Cargo registry~/.rustup- Rust toolchainstarget/- Build artifacts
Go
Go
~/go/pkg- Go packages~/.cache/go-build- Go build cache
Java
Java
~/.m2- Maven cache~/.gradle- Gradle cache
Ruby
Ruby
~/.gem- Gem cachevendor/bundle- Bundler cache
PHP
PHP
~/.cache/composer- Composer cache
Other
Other
~/.cache/nuget- NuGet (.NET)~/.cache/bazel- Bazel build cache~/.ccache- C/C++ compiler cache
Custom Cache Directories
Add your own cache directories:Disable Caching
Network Modes
Control network access for sandboxed commands:- restricted
- full
- none
Recommended for most use casesAllows:
- ✅ Outbound connections (download packages)
- ✅ DNS resolution
- ✅ HTTPS/HTTP requests
- ❌ Inbound connections
- ❌ Port listening
- ❌ Network sniffing
- Package installations
- CI/CD builds
- Development environments
Runtime Selection
Vectra Guard supports multiple sandbox runtimes:- auto (Recommended)
- docker
- bubblewrap
- podman
Automatically selects the best available runtime:
- Bubblewrap (fastest, native performance)
- Docker (most compatible)
- Podman (rootless alternative to Docker)
- Namespace (fallback, basic isolation)
Advanced Options
Resource Limits
Control CPU, memory, and process limits:Seccomp Profiles
Filter dangerous system calls:Seccomp Levels
Seccomp Levels
moderate:
- Blocks fork bombs
- Blocks kernel module loading
- Allows most development operations
- Blocks all dangerous syscalls
- Restricts ptrace, perf_event_open
- Production-ready filtering
- Provide your own JSON profile
- Full control over allowed syscalls
Capability Management
Drop Linux capabilities for enhanced security:Environment Variables
Control which environment variables pass through to sandbox:Read-Only Root Filesystem
Mount root filesystem as read-only:Complete Example
A production-grade sandbox configuration:vectra-guard.yaml
Disabling Sandbox
If you need to disable sandboxing:Performance Tips
Enable Caching
Use
enable_cache: true for 10x speedup on package installsUse Bubblewrap
Install bubblewrap for native performance on Linux
Permissive Level
Use
security_level: permissive for local devAuto Mode
Use
mode: auto to sandbox only risky commandsTroubleshooting
Sandbox is too slow
Sandbox is too slow
Solutions:
- Enable caching:
enable_cache: true - Use bubblewrap runtime:
runtime: auto - Lower security level:
security_level: balanced - Use auto mode:
mode: auto
Network access blocked
Network access blocked
Solutions:
- Change network mode:
network_mode: restricted - Enable network:
allow_network: true - Check security level (paranoid blocks network)
Permission denied errors
Permission denied errors
Solutions:
- Disable read-only root:
read_only_root: false - Lower security level:
security_level: balanced - Add cache directories to
cache_dirs
Docker daemon not available
Docker daemon not available
Solutions:
- Install Docker or Podman
- Use bubblewrap:
runtime: bubblewrap - Use auto-detection:
runtime: auto
Next Steps
Guard Levels
Configure auto-detection and protection levels
Presets
Use pre-configured sandbox settings