Using Security Levels
Security Level Comparison
The level also selects the globals a script may use (
STRICT has no parseInt, parseFloat, isNaN, isFinite and URI functions; console without a consoleHandler exists only at PERMISSIVE), what the runtime refuses on every value (secureProxyConfig), and the defaults of the worker pool, the reference sidecar and the Babel transform. memoryLimit is 1 MB at every level.
sanitizeStackTraces concerns errors made outside the sandbox: an error made inside it has no stack at any level (see Configuration).
The exported
SECURITY_LEVEL_CONFIGS table also has the fields blockTimingAPIs, allowUnboundedLoops and unicodeSecurityCheck. The enclave does not act on them: Date is available at every level, the agentscript preset refuses while and do...while loops at every level, and the Unicode checks are those of the validator’s pre-scanner, which do not depend on the level.When to Use Each Level
STRICT
Use for maximum security with untrusted code:- AI-generated scripts from external sources
- User-submitted code
- Third-party plugin code
- Any code where you cannot verify the source
SECURE
Balanced security for semi-trusted scenarios:- Internal automation scripts
- Validated AI-generated code
- Scripts from authenticated users
STANDARD
Default level for trusted internal use:- Internal workflow automation
- Development and testing
- Scripts you control
PERMISSIVE
Minimal restrictions for controlled environments:- Internal testing
- Performance benchmarking
- Trusted scripts where you need maximum flexibility
Customizing Security Levels
You can start with a preset and override specific settings:Defense-in-Depth
Security levels configure multiple defense layers:- AST Validation - The allowed globals vary by level
- Resource Limits - Timeout, iterations, tool calls
- Output Controls - Console rate limiting, output size, the depth and size of sanitized values
- Stack Sanitization - For the errors that carry a stack
Related
- Configuration - All configuration options
- Worker Pool - OS-level isolation presets
- Double VM - Enhanced security layer