Security Model
OneClaw’s security layer (L0) enforces:- Deny-by-default: Unpaired devices are rejected
- Device pairing: One-time codes with TTL
- Workspace scoping: File access limited to workspace directory
- Rate limiting: DoS prevention
- Command authorization: Per-action access control
Basic Configuration
Minimal security configuration:deny_by_default Setting
Thedeny_by_default flag controls the core security posture:
Production Mode (deny_by_default = true)
- All devices must pair before executing commands
- Unpaired devices receive:
Device 'xyz' not paired. Pair first. - System actor (
system) bypasses pairing for internal operations
Development Mode (deny_by_default = false)
- No pairing required (convenience for testing)
- All devices granted access (workspace-only still enforced)
- Use only in trusted environments
Pairing Configuration
Device pairing uses one-time codes with time-to-live (TTL):Pairing Flow
-
Generate code: User runs
paircommand -
Verify code: Device submits code via
verify <code> - Device authorized: Device can now execute commands
Pairing Code Properties
- 6-character alphanumeric (e.g.,
A3F9K2) - One-time use: Code invalidated after verification
- TTL: Expires after 5 minutes (configurable)
- Cryptographically random: No guessable patterns
Persistence Options
SQLite persistence (recommended):- Device ID
- Paired timestamp
- Label (optional)
- Last seen timestamp
Workspace Scoping
Theworkspace_only setting restricts file operations:
- Read/Write operations must be within workspace directory
- Attempting
/etc/passwdaccess:Denied: path outside workspace - Symlinks are resolved and validated
workspace_only = false):
- File operations allowed system-wide (use with caution)
- Still subject to OS-level permissions
Workspace Path
Workspace is the directory where OneClaw is launched:Rate Limiting
OneClaw includes a token-bucket rate limiter to prevent DoS:- CLI channel: 60 requests/minute (1 per second)
- TCP channel: 300 requests/minute (5 per second)
- MQTT channel: 1000 requests/minute (16 per second)
How Rate Limiting Works
- Each request increments counter
- Counter resets every 60 seconds (sliding window)
- Requests over limit are rejected:
Rate limit exceeded
Command Authorization
Each command is checked against security policies:Action Kinds
| Action | Description | Security Check |
|---|---|---|
PairDevice | Device pairing | Always allowed |
Read | File read | Workspace check + pairing |
Write | File write | Workspace check + pairing |
Execute | Command execution | Pairing only |
Network | Network access | Pairing only |
Authorization Flow
- Pairing check: Is device paired? (skip for
PairDevice) - Action-specific check: Path validation, etc.
- Return permit:
{ granted: true, reason: "..." }
Device Management
List Paired Devices
View all paired devices:Remove Device
Unpair a device by prefix:Prefix Matching
Device IDs can be specified by prefix:unpair cli-amatchescli-abc123- Ambiguous prefixes rejected:
Ambiguous: 'cli' matches 2 devices
Example Configurations
Production Edge Device (Raspberry Pi)
Development / Testing
High-Security Industrial IoT
Temporary Edge Device (No Persistence)
Security Best Practices
For Production Edge Devices
- Always enable
deny_by_default = true - Enable
persist_pairing = trueto avoid re-pairing after restarts - Use
workspace_only = trueto limit file access - Store
persist_pathon persistent storage (not tmpfs) - Pair devices on secure network (local access, not over internet)
For Development
- Use
deny_by_default = falsefor convenience - Keep
workspace_only = trueeven in dev mode - Use
persist_pairing = falseto auto-reset between sessions
Device Pairing Security
- Pairing codes expire after 5 minutes
- One-time use: Cannot reuse verified codes
- Generate on trusted interface (e.g., CLI, not MQTT)
- Verify over secure channel (e.g., local console, not public chat)
API Key Security
API keys in config files are never logged in plain text:- File permissions:
chmod 600 config/default.toml - Not committed to git: Add to
.gitignore - Use env vars for CI/CD:
ANTHROPIC_API_KEY=...
Troubleshooting
”Device not paired”
Device must pair before executing commands:“Path outside workspace”
File operation attempted outside workspace directory:Lost pairing after restart
Enable persistence:Pairing code expired
Generate a new code:Security Threat Model
OneClaw’s security is designed for:- Untrusted local networks (home WiFi, etc.)
- Accidental misconfiguration (wrong command target)
- Basic DoS attacks (rate limiting)
- Nation-state adversaries
- Physical access attacks (device compromise)
- Zero-day exploits in Rust/dependencies
- Network firewall (restrict ingress to trusted IPs)
- VPN/WireGuard for remote access
- TLS termination for TCP channels