Security
AIO Sandbox implements multiple layers of security to ensure safe code execution and protect the host environment while providing powerful development capabilities.
Security Architecture
Container Isolation
AIO Sandbox runs in a Docker container providing:
- Process isolation: Contained processes cannot access host system
- Network isolation: Controlled network access
- File system isolation: Limited access to host file system
- Resource limits: CPU, memory, and disk usage restrictions
Sandbox Fusion Runtime
Code execution is further secured through Sandbox Fusion:
- Memory limits: Per-execution memory restrictions
- CPU time limits: Prevent infinite loops and resource abuse
- Import restrictions: Limited access to system libraries
- File system boundaries: Restricted file access within container
Access Controls
File System Security
File operations respect standard Unix permissions:
- User permissions: Regular user access by default
- Sudo access: Optional elevated privileges (configurable)
- Path validation: Prevents directory traversal attacks
- Content sanitization: Input validation and sanitization
{
"file": "/safe/path/file.txt",
"sudo": false,
"content": "Sanitized content"
}
Network Security
Network access is controlled at multiple levels:
- Container networking: Isolated network namespace
- Outbound filtering: Optional egress restrictions
- Port binding: Controlled service exposure
- Proxy isolation: Internal proxy for development preview
Authentication & Authorization
Development Mode
Default configuration for development environments:
- No authentication: Direct access for development
- Local access: Typically bound to localhost
- Temporary sessions: Terminal sessions with timeout
Production Considerations
For production deployments, implement additional security:
# Docker Compose with security
version: '3.8'
services:
aio-sandbox:
image: ghcr.io/agent-infra/sandbox:v1
security_opt:
- no-new-privileges:true
read_only: true
tmpfs:
- /tmp
- /var/tmp
cap_drop:
- ALL
cap_add:
- CHOWN
- DAC_OVERRIDE
Configuration Security
Environment Variables
Secure configuration through environment variables:
# Disable sudo access
SANDBOX_ENABLE_SUDO=false
# Enable rate limiting
SANDBOX_RATE_LIMIT=true
# Restrict network access
SANDBOX_NETWORK_RESTRICTED=true
# File operation limits
SANDBOX_MAX_FILE_SIZE=10MB
SANDBOX_MAX_FILES_PER_REQUEST=100
Resource Limits
Configure resource restrictions:
# Memory limits
SANDBOX_MAX_MEMORY=1GB
# CPU limits
SANDBOX_MAX_CPU_TIME=30s
# Disk space limits
SANDBOX_MAX_DISK=5GB
# Process limits
SANDBOX_MAX_PROCESSES=50
API Security
Rate Limiting
Built-in rate limiting protects against abuse:
- File operations: 100 requests per minute
- Code execution: 10 requests per minute
- Terminal connections: 5 concurrent sessions
- Browser operations: 20 requests per minute
Input Validation
All API endpoints perform input validation:
- Path validation: Prevent directory traversal
- Content sanitization: Remove malicious content
- Size limits: Prevent resource exhaustion
- Type validation: Ensure correct data types
Error Handling
Secure error handling prevents information disclosure:
- Generic error messages: Don't reveal system details
- Sanitized stack traces: Remove sensitive paths
- Rate limit responses: Prevent enumeration attacks
- Logging security: Sensitive data not logged
Browser Security
VNC Security
VNC access is configured for development security:
- Password protection: Optional VNC password
- Local binding: Bind to localhost by default
- Session timeout: Automatic disconnect after inactivity
- Screen locking: Optional screen lock when idle
Chrome DevTools Protocol
CDP access is secured:
- Local access only: Not exposed externally
- Session management: Isolated browser contexts
- Resource limits: Memory and CPU restrictions
- Extension restrictions: Limited browser extensions
Monitoring & Auditing
Security Logging
AIO Sandbox logs security-relevant events:
- Authentication attempts: If authentication is enabled
- File access: Sensitive file operations
- Command execution: Shell commands and code execution
- Network connections: Outbound connection attempts
Health Monitoring
Monitor security status:
# Check security status
curl http://localhost:8080/v1/sandbox/security
# Monitor active sessions
curl http://localhost:8080/v1/shell/sessions
# Check resource usage
curl http://localhost:8080/v1/sandbox/resources
Best Practices
Deployment Security
- Network Isolation: Deploy in isolated network segments
- Reverse Proxy: Use authenticated reverse proxy for external access
- TLS Termination: Implement HTTPS at load balancer/proxy level
- Firewall Rules: Restrict network access to necessary ports only
Development Security
- Code Review: Review any code executed in sandbox
- Dependency Scanning: Scan dependencies for vulnerabilities
- Regular Updates: Keep container image updated
- Backup Strategy: Regular backups of important data
Runtime Security
# Example: Secure file operations
def safe_file_operation(file_path, content):
# Validate file path
if not is_safe_path(file_path):
raise SecurityError("Invalid file path")
# Validate content size
if len(content) > MAX_FILE_SIZE:
raise SecurityError("File too large")
# Sanitize content
clean_content = sanitize_content(content)
# Perform operation
return write_file(file_path, clean_content)
Compliance & Standards
Security Standards
AIO Sandbox follows industry security standards:
- OWASP Guidelines: Web application security best practices
- Container Security: CIS Docker Benchmark compliance
- Secure Coding: SANS secure coding standards
- Privacy Protection: Data minimization principles
Audit Trails
Maintain audit logs for compliance:
- User actions: All API calls and operations
- System events: Security-relevant system events
- Data access: File and data access logging
- Configuration changes: Security setting modifications
Incident Response
Security Monitoring
Monitor for security events:
- Unusual activity: Unexpected API usage patterns
- Resource abuse: Excessive resource consumption
- Access attempts: Unauthorized access attempts
- System anomalies: Unusual system behavior
Response Procedures
- Detection: Automated monitoring and alerting
- Assessment: Evaluate security impact
- Containment: Isolate affected containers
- Recovery: Restore from clean state
- Lessons Learned: Update security measures
Security Updates
Container Updates
Keep AIO Sandbox updated:
# Pull latest security updates
docker pull ghcr.io/agent-infra/sandbox:latest
# Check for vulnerabilities
docker scan ghcr.io/agent-infra/sandbox:latest
Vulnerability Management
- CVE Monitoring: Track security vulnerabilities
- Patch Management: Apply security patches promptly
- Dependency Updates: Keep dependencies current
- Security Testing: Regular security assessments
Reporting Security Issues
If you discover a security vulnerability:
- Do not create a public GitHub issue
- Email security concerns to: security@agent-infra.com
- Include detailed information about the vulnerability
- Allow reasonable time for response and fix
Next Steps