Skip to main content

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@host are blocked to prevent parser confusion attacks
  • Path traversal prevention: .. segments are normalized, encoded separators (%2F) are rejected
  • Host matching: Case-insensitive with wildcard support
Empty allowlists block all requests. Always specify at least one endpoint pattern.

Credential Injection

Security Model

Credentials flow through a controlled pipeline:
Key Properties:
  1. WASM never sees credentials: Values are injected at the host boundary
  2. Per-host mapping: Credentials are injected only for matching hosts
  3. Leak detection: Responses are scanned for secret patterns before returning to WASM
  4. 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:
When fuel runs out, execution traps with TrapCode::OutOfFuel.

Memory Limits

Memory growth is bounded by a ResourceLimiter:
Exceeding the limit triggers TrapCode::MemoryOutOfBounds.

Execution Timeout

Each tool execution has a wall-clock timeout:
Timeouts are enforced using Tokio’s timeout() wrapper and Wasmtime’s epoch interruption.

Rate Limiting

Per-tool request limits prevent abuse:
Rate limit buckets are per-tool, not per-user. In multi-user deployments, consider adding user-level rate limiting.

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.):
  1. Instance is immediately discarded
  2. Error details are logged
  3. No retry with the same instance
  4. 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:
If the stored hash doesn’t match the loaded bytes, execution is blocked.

Trust Levels

Tools are classified by origin:
Higher trust levels may receive relaxed limits or additional capabilities.

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)

Host functions enforce capability checks before execution. Unauthorized calls return an error, not a trap.

Best Practices

For Tool Developers

  1. Request minimal capabilities: Only request what you need
  2. Validate inputs: Don’t trust data from users or external APIs
  3. Handle errors gracefully: Don’t panic on invalid input
  4. Respect rate limits: Batch requests when possible
  5. Document requirements: Explain why each capability is needed

For System Administrators

  1. Review capabilities: Audit .capabilities.json before enabling tools
  2. Monitor usage: Track credential injection and rate limit hits
  3. Update allowlists: Keep endpoint patterns specific and up-to-date
  4. Rotate secrets: Use short-lived credentials when possible
  5. Enable audit logs: Log all tool executions for forensics