2026-01-10 20:28:34 +01:00
|
|
|
|
---
|
|
|
|
|
|
title: Sandbox vs Tool Policy vs Elevated
|
2026-01-12 02:49:55 +00:00
|
|
|
|
summary: "Why a tool is blocked: sandbox runtime, tool allow/deny policy, and elevated exec gates"
|
2026-01-10 20:28:34 +01:00
|
|
|
|
read_when: "You hit 'sandbox jail' or see a tool/elevated refusal and want the exact config key to change."
|
|
|
|
|
|
status: active
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
|
|
# Sandbox vs Tool Policy vs Elevated
|
|
|
|
|
|
|
2026-01-30 03:15:10 +01:00
|
|
|
|
OpenClaw has three related (but different) controls:
|
2026-01-10 20:28:34 +01:00
|
|
|
|
|
|
|
|
|
|
1. **Sandbox** (`agents.defaults.sandbox.*` / `agents.list[].sandbox.*`) decides **where tools run** (Docker vs host).
|
|
|
|
|
|
2. **Tool policy** (`tools.*`, `tools.sandbox.tools.*`, `agents.list[].tools.*`) decides **which tools are available/allowed**.
|
2026-01-12 02:49:55 +00:00
|
|
|
|
3. **Elevated** (`tools.elevated.*`, `agents.list[].tools.elevated.*`) is an **exec-only escape hatch** to run on the host when you’re sandboxed.
|
2026-01-10 20:28:34 +01:00
|
|
|
|
|
|
|
|
|
|
## Quick debug
|
|
|
|
|
|
|
2026-01-31 21:13:13 +09:00
|
|
|
|
Use the inspector to see what OpenClaw is _actually_ doing:
|
2026-01-10 20:28:34 +01:00
|
|
|
|
|
|
|
|
|
|
```bash
|
2026-01-30 03:15:10 +01:00
|
|
|
|
openclaw sandbox explain
|
|
|
|
|
|
openclaw sandbox explain --session agent:main:main
|
|
|
|
|
|
openclaw sandbox explain --agent work
|
|
|
|
|
|
openclaw sandbox explain --json
|
2026-01-10 20:28:34 +01:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
It prints:
|
2026-01-31 21:13:13 +09:00
|
|
|
|
|
2026-01-10 20:28:34 +01:00
|
|
|
|
- effective sandbox mode/scope/workspace access
|
|
|
|
|
|
- whether the session is currently sandboxed (main vs non-main)
|
|
|
|
|
|
- effective sandbox tool allow/deny (and whether it came from agent/global/default)
|
|
|
|
|
|
- elevated gates and fix-it key paths
|
|
|
|
|
|
|
|
|
|
|
|
## Sandbox: where tools run
|
|
|
|
|
|
|
|
|
|
|
|
Sandboxing is controlled by `agents.defaults.sandbox.mode`:
|
2026-01-31 21:13:13 +09:00
|
|
|
|
|
2026-01-10 20:28:34 +01:00
|
|
|
|
- `"off"`: everything runs on the host.
|
|
|
|
|
|
- `"non-main"`: only non-main sessions are sandboxed (common “surprise” for groups/channels).
|
|
|
|
|
|
- `"all"`: everything is sandboxed.
|
|
|
|
|
|
|
|
|
|
|
|
See [Sandboxing](/gateway/sandboxing) for the full matrix (scope, workspace mounts, images).
|
|
|
|
|
|
|
2026-01-12 22:06:17 +00:00
|
|
|
|
### Bind mounts (security quick check)
|
|
|
|
|
|
|
2026-01-31 21:13:13 +09:00
|
|
|
|
- `docker.binds` _pierces_ the sandbox filesystem: whatever you mount is visible inside the container with the mode you set (`:ro` or `:rw`).
|
2026-01-12 22:06:17 +00:00
|
|
|
|
- Default is read-write if you omit the mode; prefer `:ro` for source/secrets.
|
|
|
|
|
|
- `scope: "shared"` ignores per-agent binds (only global binds apply).
|
|
|
|
|
|
- Binding `/var/run/docker.sock` effectively hands host control to the sandbox; only do this intentionally.
|
|
|
|
|
|
- Workspace access (`workspaceAccess: "ro"`/`"rw"`) is independent of bind modes.
|
|
|
|
|
|
|
2026-01-10 20:28:34 +01:00
|
|
|
|
## Tool policy: which tools exist/are callable
|
|
|
|
|
|
|
|
|
|
|
|
Two layers matter:
|
2026-01-31 21:13:13 +09:00
|
|
|
|
|
2026-01-13 06:28:15 +00:00
|
|
|
|
- **Tool profile**: `tools.profile` and `agents.list[].tools.profile` (base allowlist)
|
2026-01-13 09:59:36 +00:00
|
|
|
|
- **Provider tool profile**: `tools.byProvider[provider].profile` and `agents.list[].tools.byProvider[provider].profile`
|
2026-01-10 20:28:34 +01:00
|
|
|
|
- **Global/per-agent tool policy**: `tools.allow`/`tools.deny` and `agents.list[].tools.allow`/`agents.list[].tools.deny`
|
2026-01-13 09:59:36 +00:00
|
|
|
|
- **Provider tool policy**: `tools.byProvider[provider].allow/deny` and `agents.list[].tools.byProvider[provider].allow/deny`
|
2026-01-10 20:28:34 +01:00
|
|
|
|
- **Sandbox tool policy** (only applies when sandboxed): `tools.sandbox.tools.allow`/`tools.sandbox.tools.deny` and `agents.list[].tools.sandbox.tools.*`
|
|
|
|
|
|
|
|
|
|
|
|
Rules of thumb:
|
2026-01-31 21:13:13 +09:00
|
|
|
|
|
2026-01-10 20:28:34 +01:00
|
|
|
|
- `deny` always wins.
|
|
|
|
|
|
- If `allow` is non-empty, everything else is treated as blocked.
|
2026-01-26 22:18:36 +00:00
|
|
|
|
- Tool policy is the hard stop: `/exec` cannot override a denied `exec` tool.
|
|
|
|
|
|
- `/exec` only changes session defaults for authorized senders; it does not grant tool access.
|
2026-01-31 21:13:13 +09:00
|
|
|
|
Provider tool keys accept either `provider` (e.g. `google-antigravity`) or `provider/model` (e.g. `openai/gpt-5.2`).
|
2026-01-10 20:28:34 +01:00
|
|
|
|
|
2026-01-12 21:51:26 +00:00
|
|
|
|
### Tool groups (shorthands)
|
|
|
|
|
|
|
2026-01-13 06:28:15 +00:00
|
|
|
|
Tool policies (global, agent, sandbox) support `group:*` entries that expand to multiple tools:
|
2026-01-12 21:51:26 +00:00
|
|
|
|
|
|
|
|
|
|
```json5
|
|
|
|
|
|
{
|
|
|
|
|
|
tools: {
|
|
|
|
|
|
sandbox: {
|
|
|
|
|
|
tools: {
|
2026-01-31 21:13:13 +09:00
|
|
|
|
allow: ["group:runtime", "group:fs", "group:sessions", "group:memory"],
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
2026-01-12 21:51:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
Available groups:
|
2026-01-31 21:13:13 +09:00
|
|
|
|
|
2026-01-12 21:51:26 +00:00
|
|
|
|
- `group:runtime`: `exec`, `bash`, `process`
|
|
|
|
|
|
- `group:fs`: `read`, `write`, `edit`, `apply_patch`
|
|
|
|
|
|
- `group:sessions`: `sessions_list`, `sessions_history`, `sessions_send`, `sessions_spawn`, `session_status`
|
|
|
|
|
|
- `group:memory`: `memory_search`, `memory_get`
|
2026-01-13 06:28:15 +00:00
|
|
|
|
- `group:ui`: `browser`, `canvas`
|
|
|
|
|
|
- `group:automation`: `cron`, `gateway`
|
|
|
|
|
|
- `group:messaging`: `message`
|
|
|
|
|
|
- `group:nodes`: `nodes`
|
2026-01-30 03:15:10 +01:00
|
|
|
|
- `group:openclaw`: all built-in OpenClaw tools (excludes provider plugins)
|
2026-01-12 21:51:26 +00:00
|
|
|
|
|
2026-01-12 02:49:55 +00:00
|
|
|
|
## Elevated: exec-only “run on host”
|
2026-01-10 20:28:34 +01:00
|
|
|
|
|
2026-01-12 02:49:55 +00:00
|
|
|
|
Elevated does **not** grant extra tools; it only affects `exec`.
|
2026-01-31 21:13:13 +09:00
|
|
|
|
|
2026-01-22 05:32:13 +00:00
|
|
|
|
- If you’re sandboxed, `/elevated on` (or `exec` with `elevated: true`) runs on the host (approvals may still apply).
|
|
|
|
|
|
- Use `/elevated full` to skip exec approvals for the session.
|
2026-01-10 20:28:34 +01:00
|
|
|
|
- If you’re already running direct, elevated is effectively a no-op (still gated).
|
2026-01-15 04:41:38 +00:00
|
|
|
|
- Elevated is **not** skill-scoped and does **not** override tool allow/deny.
|
2026-01-26 22:18:36 +00:00
|
|
|
|
- `/exec` is separate from elevated. It only adjusts per-session exec defaults for authorized senders.
|
2026-01-10 20:28:34 +01:00
|
|
|
|
|
|
|
|
|
|
Gates:
|
2026-01-31 21:13:13 +09:00
|
|
|
|
|
2026-01-10 20:28:34 +01:00
|
|
|
|
- Enablement: `tools.elevated.enabled` (and optionally `agents.list[].tools.elevated.enabled`)
|
|
|
|
|
|
- Sender allowlists: `tools.elevated.allowFrom.<provider>` (and optionally `agents.list[].tools.elevated.allowFrom.<provider>`)
|
|
|
|
|
|
|
|
|
|
|
|
See [Elevated Mode](/tools/elevated).
|
|
|
|
|
|
|
|
|
|
|
|
## Common “sandbox jail” fixes
|
|
|
|
|
|
|
|
|
|
|
|
### “Tool X blocked by sandbox tool policy”
|
|
|
|
|
|
|
|
|
|
|
|
Fix-it keys (pick one):
|
2026-01-31 21:13:13 +09:00
|
|
|
|
|
2026-01-10 20:28:34 +01:00
|
|
|
|
- Disable sandbox: `agents.defaults.sandbox.mode=off` (or per-agent `agents.list[].sandbox.mode=off`)
|
|
|
|
|
|
- Allow the tool inside sandbox:
|
|
|
|
|
|
- remove it from `tools.sandbox.tools.deny` (or per-agent `agents.list[].tools.sandbox.tools.deny`)
|
|
|
|
|
|
- or add it to `tools.sandbox.tools.allow` (or per-agent allow)
|
|
|
|
|
|
|
|
|
|
|
|
### “I thought this was main, why is it sandboxed?”
|
|
|
|
|
|
|
2026-01-31 21:13:13 +09:00
|
|
|
|
In `"non-main"` mode, group/channel keys are _not_ main. Use the main session key (shown by `sandbox explain`) or switch mode to `"off"`.
|