Skip to main content

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:
  1. Defense in Depth: Multiple layers of security controls
  2. Least Privilege: Minimal permissions by default
  3. Isolation First: Complete separation between sandboxes
  4. Zero Trust Network: Explicit network access controls
  5. 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:
Isolation Boundaries:
  • 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
  • Separate network namespace per sandbox
  • Independent network stack and routing
  • Isolated iptables rules
  • No direct inter-sandbox communication
  • Separate filesystem per sandbox
  • Union filesystem (overlay2) prevents host access
  • Read-only base layers
  • Volumes mounted with specific permissions
  • 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 Controls:
Always set appropriate resource limits when running untrusted code to prevent denial-of-service attacks against your infrastructure.

Network Security

Network Isolation Modes

Daytona provides fine-grained network access controls:

1. Full Network Access (Default)

Only use full network access for trusted code. AI-generated code should run with network restrictions.

2. Network Block All

Blocked:
  • All outbound internet connections
  • DNS resolution to external servers
  • Connection to other sandboxes
Allowed:
  • 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

Use Cases:
  • Access to internal APIs
  • Database connections
  • Specific third-party services
CIDR Notation:

Network Rule Implementation

Network rules are enforced using iptables:
Network Rules Manager:
  • 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:
Encrypted Channels:
  • 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:
API Key Security:
  • Unique per user/organization
  • Can be rotated without downtime
  • Can be scoped to specific permissions
  • Stored encrypted at rest
  • Transmitted only over HTTPS
Never commit API keys to version control or expose them in client-side code. Use environment variables or secure secret management.

Organization Isolation

Sandboxes and resources are isolated by organization:
Organization Boundaries:
  • Sandboxes
  • Snapshots (except general snapshots)
  • Volumes
  • API keys
  • Metrics and logs

Role-Based Access Control (RBAC)

API keys can have different permission levels:

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
Snapshots:
  • Stored in container image registry
  • Image layers encrypted
  • Access controlled via registry authentication
  • Scanned for vulnerabilities (optional)
Configuration:
  • 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
Volumes:
  • Persist until explicitly deleted
  • Can be backed up to external storage
  • Subject to organization retention policies
Logs:
  • 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

Security Measures:
  • Never logged or displayed
  • Encrypted in transit
  • Isolated per sandbox
  • Cleared on sandbox deletion

Secrets Best Practices

  1. Never hardcode secrets in code or configuration files
  2. Use environment variables for passing secrets to sandboxes
  3. Rotate secrets regularly using automated tools
  4. Use network isolation to limit secret exposure
  5. Monitor access to detect unauthorized usage

Vulnerability Management

Container Scanning

Snapshots and base images can be scanned for vulnerabilities:
Scanning Includes:
  • 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:
Logged Events:
  • Sandbox lifecycle (create, start, stop, delete)
  • Code execution and commands
  • File operations
  • Network connections (if monitoring enabled)
  • Authentication attempts
  • Permission changes
Audit Log Format:

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
Alerting:

Containment

If a security issue is detected:

Recovery

  1. Isolate affected resources
  2. Investigate audit logs for root cause
  3. Remediate by updating configurations
  4. Verify security controls are working
  5. 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