Overview
IronClaw executes untrusted tools in isolated WebAssembly (WASM) containers using Wasmtime. Each tool runs in a fresh instance with explicit opt-in permissions, preventing unauthorized access to system resources, network endpoints, and credentials.Security Architecture
Capability-Based Permissions
Default Policy: Deny All
By default, WASM tools have NO access to anything. Every capability must be explicitly granted:Available Capabilities
WASM tools can check if a secret exists, but never read its value. Secrets are injected at the host boundary during HTTP requests.
HTTP Endpoint Allowlisting
Pattern Matching
HTTP requests are validated against explicit patterns before execution:Validation Rules
- HTTPS required by default (HTTP only with explicit opt-in)
- Userinfo rejected: URLs with
user:pass@hostare blocked to prevent parser confusion attacks - Path traversal prevention:
..segments are normalized, encoded separators (%2F) are rejected - Host matching: Case-insensitive with wildcard support
Credential Injection
Security Model
Credentials flow through a controlled pipeline:- WASM never sees credentials: Values are injected at the host boundary
- Per-host mapping: Credentials are injected only for matching hosts
- Leak detection: Responses are scanned for secret patterns before returning to WASM
- Usage tracking: Every injection is logged with timestamp and count
Injection Locations
Secrets can be injected into different parts of the request:Credential mappings are configured per-tool in
.capabilities.json files. The global credential registry aggregates mappings from all installed tools.Resource Limits
Fuel Metering
CPU usage is limited via Wasmtime’s fuel system:TrapCode::OutOfFuel.
Memory Limits
Memory growth is bounded by aResourceLimiter:
TrapCode::MemoryOutOfBounds.
Execution Timeout
Each tool execution has a wall-clock timeout:timeout() wrapper and Wasmtime’s epoch interruption.
Rate Limiting
Per-tool request limits prevent abuse:Isolation Guarantees
Fresh Instance Per Execution
- Compile once, instantiate fresh: Tools are validated and compiled at registration time
- No instance reuse: Each execution creates a new instance, preventing state pollution
- Side channel mitigation: Fresh instances eliminate timing side channels from previous executions
Trap Recovery
When a WASM tool traps (panic, OOM, etc.):- Instance is immediately discarded
- Error details are logged
- No retry with the same instance
- User receives a sanitized error message
File System Isolation
WASM tools have no WASI filesystem access. The only file operations allowed are:workspace_read: Read-only access to allowlisted paths- Path validation: No
.., no/prefix, no absolute paths
Threat Mitigation
Binary Integrity
Hash Verification
WASM binaries are hashed with BLAKE3 during registration:Trust Levels
Tools are classified by origin:Configuration
Runtime Configuration
Per-Tool Capabilities
Capabilities are defined in{tool_name}.capabilities.json:
The capabilities schema supports OAuth refresh tokens, custom auth headers, and rate limit overrides. See
capabilities_schema.rs for the full specification.Host Functions
WASM tools can call these host-provided functions:Available Functions (V2 API)
Best Practices
For Tool Developers
- Request minimal capabilities: Only request what you need
- Validate inputs: Don’t trust data from users or external APIs
- Handle errors gracefully: Don’t panic on invalid input
- Respect rate limits: Batch requests when possible
- Document requirements: Explain why each capability is needed
For System Administrators
- Review capabilities: Audit
.capabilities.jsonbefore enabling tools - Monitor usage: Track credential injection and rate limit hits
- Update allowlists: Keep endpoint patterns specific and up-to-date
- Rotate secrets: Use short-lived credentials when possible
- Enable audit logs: Log all tool executions for forensics
Related Sections
- Credential Protection - Secrets encryption and injection
- Prompt Injection Defense - Input sanitization and validation
- Data Protection - Local storage and encryption
