Overview
Daytona is designed with security as a foundational principle, enabling safe execution of AI-generated and untrusted code. The platform employs multiple layers of isolation, strict network controls, and granular permissions to ensure that code execution cannot compromise the host system or access unauthorized resources.Security Principles
Daytona’s security model is built on these core principles:- Defense in Depth: Multiple layers of security controls
- Least Privilege: Minimal permissions by default
- Isolation First: Complete separation between sandboxes
- Zero Trust Network: Explicit network access controls
- Secure by Default: Security features enabled out of the box
Daytona is specifically designed to run AI-generated code safely, providing isolated execution environments that protect your infrastructure from potentially malicious or buggy code.
Isolation Architecture
Container Isolation
Each sandbox runs in a separate Docker container with complete isolation:Process Isolation
Process Isolation
- Each sandbox has its own process namespace
- Processes cannot see or signal processes in other sandboxes
- PID 1 isolation prevents process escape
- Resource limits enforced per sandbox
Network Isolation
Network Isolation
- Separate network namespace per sandbox
- Independent network stack and routing
- Isolated iptables rules
- No direct inter-sandbox communication
Filesystem Isolation
Filesystem Isolation
- Separate filesystem per sandbox
- Union filesystem (overlay2) prevents host access
- Read-only base layers
- Volumes mounted with specific permissions
User Namespace Isolation
User Namespace Isolation
- User namespace mapping
- Root in container ≠ root on host
- Privilege escalation prevention
- Capabilities dropped by default
Resource Isolation
Strict resource limits prevent resource exhaustion attacks:| Resource | Control Mechanism | Default Limit |
|---|---|---|
| CPU | cgroups CPU quota | Configurable |
| Memory | cgroups memory limit + OOM killer | Configurable |
| Disk | Disk quota enforcement | Configurable |
| Network | Traffic shaping & iptables | Bandwidth limits |
| Processes | PID cgroup limit | 1024 processes |
| File Descriptors | ulimit | 1024 FDs |
Network Security
Network Isolation Modes
Daytona provides fine-grained network access controls:1. Full Network Access (Default)
2. Network Block All
- All outbound internet connections
- DNS resolution to external servers
- Connection to other sandboxes
- Localhost communication (127.0.0.1)
- Communication with daemon services
This is the recommended mode for executing AI-generated code, as it prevents data exfiltration and unauthorized network access.
3. Network Allow List
- Access to internal APIs
- Database connections
- Specific third-party services
Network Rule Implementation
Network rules are enforced using iptables:- Creates rules when sandbox starts
- Updates rules if configuration changes
- Removes rules when sandbox stops
- Persistent across container restarts
Traffic Encryption
All communication with sandboxes can be encrypted:- HTTPS for API requests
- WSS for WebSocket connections
- SSH for terminal access
- TLS for proxy connections
Authentication and Authorization
API Key Authentication
All API requests require valid API keys:- Unique per user/organization
- Can be rotated without downtime
- Can be scoped to specific permissions
- Stored encrypted at rest
- Transmitted only over HTTPS
Organization Isolation
Sandboxes and resources are isolated by organization:- Sandboxes
- Snapshots (except general snapshots)
- Volumes
- API keys
- Metrics and logs
Role-Based Access Control (RBAC)
API keys can have different permission levels:| Role | Permissions |
|---|---|
| Admin | Full access to all resources |
| Developer | Create/manage sandboxes, snapshots, volumes |
| Read-Only | View resources, cannot modify |
| CI/CD | Limited to automated operations |
Data Security
Data at Rest
Volumes:- Stored in S3-compatible object storage
- Encrypted using server-side encryption (SSE)
- Access controlled via IAM policies
- Automatic backup and versioning
- Stored in container image registry
- Image layers encrypted
- Access controlled via registry authentication
- Scanned for vulnerabilities (optional)
- Environment variables encrypted in transit and at rest
- Secrets never logged or exposed
- Labels and metadata encrypted
Data in Transit
All data encrypted in transit:- TLS 1.2+ for API connections
- Encrypted WebSocket connections
- SSH for terminal access
- S3 uses HTTPS for volume access
Data Retention
Sandbox Data:- Ephemeral by default
- Deleted when sandbox deleted
- Can be persisted via volumes
- Persist until explicitly deleted
- Can be backed up to external storage
- Subject to organization retention policies
- Retained for configurable period
- Can be exported to external systems
- Automatically rotated and cleaned up
Use volumes for data that must persist beyond sandbox lifecycle. Never store sensitive data in sandbox filesystem.
Secrets Management
Environment Variables
- Never logged or displayed
- Encrypted in transit
- Isolated per sandbox
- Cleared on sandbox deletion
Secrets Best Practices
- Never hardcode secrets in code or configuration files
- Use environment variables for passing secrets to sandboxes
- Rotate secrets regularly using automated tools
- Use network isolation to limit secret exposure
- Monitor access to detect unauthorized usage
Vulnerability Management
Container Scanning
Snapshots and base images can be scanned for vulnerabilities:- Operating system packages
- Language-specific dependencies
- Known CVEs
- Malware signatures
Dependency Management
Control what can be installed in sandboxes:Security Updates
Daytona components are regularly updated:- Base Images: Updated with security patches
- Daemon: Auto-updated with latest security fixes
- Runner: Rolling updates with zero downtime
- Dependencies: Continuously monitored and updated
Compliance and Auditing
Audit Logging
All operations are logged for audit purposes:- Sandbox lifecycle (create, start, stop, delete)
- Code execution and commands
- File operations
- Network connections (if monitoring enabled)
- Authentication attempts
- Permission changes
Compliance Standards
Daytona is designed to support compliance with:- SOC 2: Security controls and monitoring
- GDPR: Data privacy and deletion
- HIPAA: Healthcare data protection (with proper configuration)
- PCI DSS: Payment card data security
Compliance depends on proper configuration. Consult with your security team to ensure Daytona is configured to meet your specific compliance requirements.
Security Best Practices
For Running AI-Generated Code
For Production Workloads
Security Checklist
- Use network isolation for untrusted code
- Set appropriate resource limits
- Rotate API keys regularly
- Enable audit logging
- Use TLS/HTTPS for all connections
- Scan snapshots for vulnerabilities
- Implement least privilege access
- Monitor sandbox activity
- Use environment variables for secrets
- Enable auto-delete for temporary sandboxes
- Review and update base images regularly
- Implement backup strategies for volumes
- Use organization isolation
- Configure alerting for security events
- Document security configurations
Incident Response
Detecting Security Issues
Monitor for:- Unusual resource consumption
- Failed authentication attempts
- Unexpected network connections
- Sandbox errors and crashes
- Privilege escalation attempts
Containment
If a security issue is detected:Recovery
- Isolate affected resources
- Investigate audit logs for root cause
- Remediate by updating configurations
- Verify security controls are working
- Document incident and lessons learned
Advanced Security Features
Custom Security Policies
Runtime Monitoring
Next Steps
Architecture
Understand the system architecture
Sandboxes
Learn about sandbox management
Best Practices
Follow security best practices
Compliance
Learn about compliance features