Skip to main content

Defense in Depth

IronClaw implements multiple security layers that work together to protect your data and prevent misuse.
Each layer operates independently. Even if one layer fails, others provide protection.

WASM Sandbox

All untrusted tools run in isolated WebAssembly containers.

Security Constraints

Threat: Infinite loops or CPU-intensive operationsMitigation:
  • Fuel metering (Wasmtime’s gas system)
  • Epoch interruption for long-running tasks
  • Per-tool execution timeout
  • Automatic termination on fuel exhaustion
Threat: Unbounded memory allocationMitigation:
  • ResourceLimiter enforces hard memory cap
  • Default 10MB limit per tool
  • Memory growth tracking
  • Automatic instance cleanup on overflow
Threat: Reading sensitive files, path traversalMitigation:
  • No WASI filesystem access
  • Only host-provided workspace_read function
  • Path validation (no .., no / prefix)
  • Scoped to user’s workspace only
Threat: Unauthorized API calls, data exfiltrationMitigation:
  • Endpoint allowlisting (opt-in per tool)
  • Host/path pattern matching
  • Query parameter validation
  • Rate limiting per endpoint
Threat: Secrets leaked to WASM code or logsMitigation:
  • Credentials never exposed to WASM
  • Injection at host boundary only
  • Leak detection scans all outputs
  • Automatic redaction of detected secrets

Capability-Based Security

Features are opt-in via explicit capability grants:
Default: WASM tools have zero capabilities. Every privilege must be granted explicitly.

Prompt Injection Defense

External content passes through multiple protection layers.

Safety Layer

Detection Patterns

Pattern: External data attempting to override system instructions
Detection:
  • System keyword patterns (SYSTEM:, ADMIN:, OVERRIDE:)
  • Command-like phrases in unexpected positions
  • Role confusion attempts
Mitigation:
  • Wrap external content with security notice
  • XML/delimiters for structural separation
  • Explicit warning in LLM context

Content Wrapping

External data is wrapped with security context:

Policy Enforcement

Configurable rules with severity levels:
Example Policies:

Credential Protection

Secrets are never exposed to untrusted code.

Storage

Implementations:
  • System keychain (macOS Keychain, Windows Credential Manager, Linux Secret Service)
  • Encrypted database storage (AES-256-GCM)
  • Environment variables (for CI/CD)

Injection Boundary

Credentials are injected at the orchestrator boundary, never passed to tools:
WASM tools never see actual credential values. They only reference credential names (e.g., "OPENAI_API_KEY").

Leak Detection

All outputs are scanned for accidentally leaked secrets:
Detection Patterns:
  • API key formats (OpenAI, Anthropic, AWS, etc.)
  • JWT tokens
  • Private keys (PEM, SSH)
  • Database connection strings
  • OAuth tokens
Example:

Endpoint Allowlisting

HTTP requests are restricted to approved destinations.

Pattern Matching

Validation Logic

Request Flow:
  1. Parse request URL
  2. Check host against allowlist
  3. Validate path prefix (if specified)
  4. Verify HTTP method (if specified)
  5. Scan for suspicious query params
  6. Allow or deny
Use the most specific pattern possible. host + path + method is more secure than just host.

Rate Limiting

Prevents abuse through request throttling.

Per-Tool Limits

Example:

Shared Rate Limiter

All tools share a global rate limiter:

Data Protection

All data stays local and encrypted.

Local Storage

PostgreSQL

  • Job history
  • Workspace documents
  • Vector embeddings
  • User sessions

Keychain

  • API keys
  • OAuth tokens
  • Encrypted secrets
  • Per-tool credentials

Encryption

Audit Logging

All tool executions are logged:
Audit logs contain tool calls and results, but never contain raw credentials.

Docker Sandbox Security

Container isolation for code execution.

Container Constraints

Per-Job Authentication

Token Lifecycle:
  1. Orchestrator creates job
  2. Generate random bearer token
  3. Store in memory (never persisted)
  4. Pass to container via environment
  5. Container uses for all API calls
  6. Token auto-expires after job completion
Tokens are ephemeral. They exist only in orchestrator memory and are destroyed when the job completes.

Credential Grants

Fine-grained permission model:
Container can only access explicitly granted credentials.

Security Best Practices

1

Minimal Capabilities

Grant only the capabilities a tool needs. Start with Capabilities::none() and add incrementally.
2

Specific Allowlists

Use exact endpoint patterns. Prefer host + path + method over just host.
3

Rate Limiting

Set conservative rate limits for all tools. Adjust based on monitoring.
4

Audit Logs

Review job_actions table periodically for suspicious patterns.
5

Secrets Rotation

Rotate API keys regularly. Use short-lived tokens when possible.

Threat Model

In Scope

Prompt injection from external sources
Malicious WASM tools
Credential theft/leakage
Data exfiltration attempts
Resource exhaustion (CPU, memory, network)
Unauthorized API access

Out of Scope

Physical access to host machine
Compromised LLM provider
Side-channel attacks
Social engineering of end users

Next Steps

WASM Sandbox

Deep dive into WASM security model

Credential Management

Managing secrets and API keys