Exec Tool — Administrator Guide
Exec approvals are the guardrail for letting a sandboxed agent run commands on a real host (gateway or node). Commands are allowed only when policy + allowlist + optional user approval all agree. Approvals are in addition to tool policy and elevated gating (unless elevated is set to full, which skips approvals). Effective policy is the stricter of tools.exec.* and exec-approvals.json; omitted approvals fields fall back to tools.exec values.
Where it applies
- gateway host → enforced by the
openclawgateway process - node host → enforced by the node runner (macOS companion app or headless node host)
- Gateway-authenticated callers are trusted operators for that gateway.
- Paired nodes extend that trusted operator capability to the node host.
- Exec approvals reduce accidental execution risk; they are not a per-user auth boundary.
- The node host service forwards
system.runto the macOS app over local IPC. - The macOS app enforces approvals + executes the command in UI context.
exec-approvals.json
Approvals live in a local JSON file on the execution host: Location:~/.openclaw/exec-approvals.json
Full schema:
Policy knobs
security
deny(default) — block all host exec requests.allowlist— allow only commands matching the allowlist.full— allow everything (equivalent to elevated; use only for trusted operator setups).
ask
off— never prompt.on-miss(default) — prompt only when allowlist does not match.always— prompt on every command.
askFallback
When a prompt is required but no UI is reachable:
deny(default) — block.allowlist— allow only if allowlist matches.full— allow.
autoAllowSkills
When enabled, executables referenced by known skills are treated as allowlisted on nodes. This uses skills.bins over the Gateway RPC. Intended for trusted operator environments where Gateway and node are in the same trust boundary. Keep false for strict explicit trust.
Global vs per-agent config
Settings can be applied globally (inopenclaw.json) or per-agent (in exec-approvals.json under agents.<agentId>). Per-agent overrides replace the default for that agent. Agent-level exec-approvals.json entries replace defaults; global tools.exec.* config provides the baseline.
In openclaw.json:
exec-approvals.json (runtime override, hot-reloaded):
Allowlists
Allowlists are per agent. Patterns are case-insensitive glob matches against the resolved binary path (basename-only entries are ignored). Examples:~/Projects/**/bin/peekaboo~/.local/bin/*/opt/homebrew/bin/rg
agents.default entries are migrated to agents.main on load.
Approval forwarding to chat channels
Forward exec approval prompts to any chat channel, approved via/approve:
mode:
"session"— deliver to the originating chat session."targets"— deliver to explicit targets."both"— both.
Security posture recommendations
- Prefer allowlists over
security: "full"when possible. - Per-agent allowlists prevent one agent’s approvals from leaking into others.
askkeeps you in the loop while still allowing fast approvals./exec security=fullis a session-level convenience for authorized operators; it does not persist to config.- To hard-block host exec, set
security: "deny"or deny theexectool via tool policy (tools.deny: ["exec"]).
Safe bins configuration
tools.exec.safeBins — stdin-only binaries allowed without allowlist entries. Add your own narrow stream filters here. Custom entries require an explicit profile in tools.exec.safeBinProfiles.
tools.exec.safeBinTrustedDirs — additional trusted directories for safe-bin path checks. System defaults are /bin and /usr/bin. Add package-manager paths (e.g. /opt/homebrew/bin) explicitly.
Do not add interpreter/runtime binaries (python3, node, bash) to safeBins. Use explicit allowlist entries for those.
openclaw security audit warns when interpreter/runtime bins appear in safeBins without explicit profiles.
openclaw doctor --fix can scaffold missing safeBinProfiles entries.
PATH handling
host=gateway: merges your login-shellPATHinto the exec environment.env.PATHoverrides are rejected.- macOS minimal PATH:
/opt/homebrew/bin,/usr/local/bin,/usr/bin,/bin - Linux minimal PATH:
/usr/local/bin,/usr/bin,/bin
- macOS minimal PATH:
host=sandbox: runssh -lcinside the container;tools.exec.pathPrependapplies after profile sourcing.host=node:env.PATHoverrides are rejected. Configure the node host service environment (systemd/launchd) for additional PATH entries.
tools.exec.pathPrepend prepends directories to PATH for gateway + sandbox exec.
macOS IPC flow
- Unix socket mode
0600, token stored inexec-approvals.json. - Same-UID peer check.
- Challenge/response (nonce + HMAC token + request hash) + short TTL.
Approval flow
When a prompt is required, the gateway broadcastsexec.approval.requested to operator clients. The Control UI and macOS app resolve it via exec.approval.resolve, then the gateway forwards the approved request to the node host.
When approvals are required, the exec tool returns immediately with an approval id. System events (Exec finished / Exec denied) arrive after the node reports the result. If no decision arrives before the timeout (default 120 s), the request is treated as a timeout denial.
Elevated default
agents.defaults.elevatedDefault controls the default elevated level when no /elevated directive is present:
"off"— elevated is off by default."on"— elevated is on by default (host exec when sandboxed)."ask"— ask per command."full"— elevated + skip approvals.
All exec config keys
Control UI
Control UI → Nodes → Exec approvals — edit defaults, per-agent overrides, and allowlists. Pick a scope (Defaults or an agent), tweak policy, add/remove allowlist patterns, then Save. Shows last-used metadata per pattern. Target selector: Gateway (local approvals) or a Node. If a node does not advertise exec approvals yet, edit its local~/.openclaw/exec-approvals.json directly.
CLI: openclaw approvals (see Approvals CLI).
Related: Exec Tool (user) · Elevated Mode · Sandboxing (admin)