IronClaw runs all untrusted tools in WebAssembly (WASM) sandboxes powered by Wasmtime. This provides strong isolation without the overhead of Docker containers or VMs.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/nearai/ironclaw/llms.txt
Use this file to discover all available pages before exploring further.
Architecture
Security Guarantees
Memory Isolation
WASM tools run in linear memory completely isolated from the host:- Default limit: 10 MB per tool
- No heap access: Cannot read host memory
- No pointers: Cannot access arbitrary addresses
- Bounds checking: All memory accesses validated by WASM runtime
ResourceLimiter:
CPU Metering
WASM execution is fuel-metered to prevent infinite loops and CPU exhaustion:- Fuel: Virtual “gas” consumed per WASM instruction
- Default limit: Configurable per tool (typically millions of instructions)
- Epoch interruption: Periodic checks for timeouts
- Tokio timeout: Hard wall-clock limit (default 30s)
No System Access
WASM tools have zero system access by default:- ❌ No filesystem (no WASI FS imports)
- ❌ No raw sockets
- ❌ No subprocess spawning
- ❌ No environment variable access
- ❌ No system clock (host provides
now_millis())
Fresh Instances
Each tool execution creates a fresh WASM instance:- Compile once: WASM binary validated and compiled at load time
- Instantiate per execution: New memory, new store, new state
- No state reuse: Previous execution’s memory is discarded
- Side-channel prevention: No shared state between executions
Capability System
All WASM tools start with zero capabilities. Each must be explicitly granted:Available Capabilities
| Capability | Purpose | Risk Level |
|---|---|---|
| HTTP | Make HTTP requests to allowlisted endpoints | Medium-High |
| Secrets | Check if secrets exist (not read values) | Low |
| Workspace | Read files from workspace (read-only) | Low-Medium |
| ToolInvoke | Call other tools via aliases | Medium |
Capability Configuration
Capabilities are defined in*.capabilities.json files:
HTTP Capability
The most sensitive capability. Enforces:- Host allowlisting: Only approved domains
- Path restrictions: Specific API endpoints only
- Method controls: GET/POST/etc. per endpoint
- Rate limiting: Requests per minute/hour
- Size limits: Max request/response body sizes
- HTTPS enforcement: No plaintext HTTP
- Credential injection: Secrets added by host, not WASM
Secrets Capability
Tools can check existence but never read plaintext:Workspace Capability
Read-only access to workspace files with prefix restrictions:ToolInvoke Capability
Indirect tool access via aliases (prevents direct tool enumeration):Security Constraints
| Threat | Mitigation | Implementation |
|---|---|---|
| CPU exhaustion | Fuel metering | store.add_fuel(), epoch interrupts |
| Memory exhaustion | ResourceLimiter | 10MB default, growth denied |
| Infinite loops | Timeout + epochs | tokio::time::timeout() |
| Filesystem access | No WASI FS | Only workspace_read host function |
| Network access | Allowlist only | AllowlistValidator |
| Credential exposure | Injection boundary | Secrets never enter WASM memory |
| Secret exfiltration | Leak detector | Scan requests/responses |
| Log spam | Entry limits | Max 1000 entries, 4KB per message |
| Path traversal | Path validation | No .., no / prefix |
| Trap recovery | Discard instance | Never reuse after trap |
| Side channels | Fresh instance | New memory per execution |
| Rate abuse | Per-tool limits | RateLimiter per capability |
| Binary tampering | BLAKE3 hashing | Hash verification on load |
Host Functions (V2 API)
WASM tools interact with the host via these functions:Logging
Time
Workspace Read
HTTP Request
Secret Exists
Tool Invoke
Failure Modes
WASM Trap
If WASM code traps (invalid memory access, division by zero, etc.):- Execution stops immediately
- Instance is discarded (never reused)
- Error returned to caller
- No host state corruption
Fuel Exhaustion
Memory Limit Exceeded
Capability Denied
Best Practices
For Tool Authors
- Request minimal capabilities: Only what you need
- Use tight allowlists: Specific hosts and paths
- Handle errors gracefully: Capability denials, rate limits
- Avoid secrets in logs: Use
secret_exists()checks - Respect fuel limits: Optimize expensive operations
For System Administrators
- Audit capabilities.json: Review all granted permissions
- Monitor logs: Watch for denied requests (potential attacks)
- Rotate secrets: Use
expires_atfor temporary credentials - Set conservative limits: Start with low fuel/memory, increase if needed
- Keep allowlists tight: Only domains you trust
Source Code References
- WASM runtime: src/tools/wasm/runtime.rs
- Capabilities: src/tools/wasm/capabilities.rs:1-200
- Resource limits: src/tools/wasm/limits.rs
- Host functions: src/tools/wasm/host.rs
- Allowlist validation: src/tools/wasm/allowlist.rs:74-164
See Also
- Network Security - HTTP allowlisting and rate limiting
- Credential Management - Secret injection at boundary
- Security Overview - Complete security architecture