On an OpenClaw Gateway host, how do exec approvals decide whether a shell command runs, and what does a fresh install do?
answer
- the fresh-install posture
- two policy layers merged
- security, ask, askFallback
- the stricter one wins
- no approver reachable
basics
~20 sAs of OpenClaw 2026.9.9, host exec defaults to security full and ask off, so commands run without a prompt. With an allowlist and ask on-miss, unmatched commands wait for approval, and if no approver is reachable, askFallback (default deny) blocks them.
solid answer
~40 sExec approvals govern `exec` on a **real host**, the Gateway machine or a paired node. Two layers merge: the requested policy in `openclaw.json` (`tools.exec.mode`: `deny`, `allowlist`, `ask`, `auto` or `full`) and the **host approvals document** in the state database, with `security`, `ask`, `askFallback` and a per-agent allowlist. In an ordinary session the **stricter** of the two applies, so approvals can only tighten config. As of 2026.9.9 the defaults are `security: full` and `ask: off`: a fresh install runs host commands **without asking**. `openclaw exec-policy preset cautious` sets allowlist plus `on-miss` plus `askFallback: deny`; a miss then raises a request you resolve in the Control UI, the macOS app or with `/approve <id> allow-once|allow-always|deny`. With no reachable approver, `askFallback` (default `deny`) decides. Approvals reduce accidents; they are not a per-user auth boundary.
code
bash · 4 linesopenclaw exec-policy preset cautious
openclaw approvals allowlist add --agent main "/usr/bin/uptime"
openclaw approvals get --gateway
openclaw approvals pendinggo deeper
Remember that out of the box, host exec runs without asking; approvals only prompt after you tighten the policy.
Explain the two layers, config tools.exec.mode and the host approvals document, and that the stricter one wins, along with security, ask and askFallback.
Show the operational edges: askFallback when nobody is online, allow-always bound to argv and directory, strictInlineEval for interpreters, and approvals skipping sandboxed exec.
Weigh approval friction against autonomy: decide which agents may run unattended on the host and which need allowlists, and own the prompt fatigue that follows.
## Where exec approvals apply In OpenClaw the `exec` tool runs a shell command on one of three targets: inside a **sandbox**, on the **Gateway host**, or on a paired **node** (for example the macOS companion app). **Exec approvals** are the guardrail for the two real hosts. They are enforced locally on the machine that executes the command, and they stack **on top of** tool policy and elevated gating. Commands that run inside a sandbox are contained by the sandbox instead; the host approvals document is not consulted for them. ## The two layers and how they merge 1. **Requested policy** in `openclaw.json`: `tools.exec.mode` (or the per-agent `agents.entries.<id>.tools.exec.mode`). Older configs used `tools.exec.security` and `tools.exec.ask`; `openclaw doctor --fix` migrates pairs that have an exact `mode` equivalent. 2. **Host approvals document**, stored in the host's state database (`~/.openclaw/state/openclaw.sqlite`, row `exec_approvals_config`). It holds `defaults` and per-agent entries with `security`, `ask`, `askFallback`, `autoAllowSkills` and an `allowlist`. Outside a full-access session, **the effective policy is the stricter of the two**: approvals can tighten what config requests and never loosen it. `openclaw approvals get` shows the requested policy, the host policy and the merged result. | Knob | Values | Default | | --- | --- | --- | | `security` | `deny`, `allowlist`, `full` | `full` on gateway and node hosts | | `ask` | `off`, `on-miss`, `always` | `off` | | `askFallback` | `deny`, `allowlist`, `full` | `deny` | | `tools.exec.strictInlineEval` | `true` / `false` | `false` | ## What a fresh install does With those defaults, **host exec runs without any approval prompt**. That is the documented trusted-operator posture of a personal assistant, not a bug. Two things are easy to confuse here: - `tools.exec.host` (default `auto`) decides **where** exec runs: the sandbox when one is active, otherwise the gateway. - Security and ask decide **how** host exec is approved. Default `full` plus `off` is the "YOLO" posture. ## Tightening it - `openclaw exec-policy preset cautious` sets `host=gateway`, `security=allowlist`, `ask=on-miss`, `askFallback=deny` in both local config and the local approvals document; `deny-all` blocks host exec entirely. - `openclaw approvals allowlist add --agent main "/usr/bin/uptime"` adds a pattern. Patterns are globs over a resolved binary path or a bare command name; `argPattern` restricts arguments. Every segment of a chain such as `a && b` must match. - An **Always allow here** decision is bound to the exact arguments and the working directory where you approved it. - `strictInlineEval: true` makes forms like `python -c` or `node -e` need explicit approval even for an allowlisted interpreter. In allowlist mode a heredoc segment always needs approval. ## What happens on a miss 1. The Gateway broadcasts `exec.approval.requested` to operator clients. 2. You resolve it in the Control UI, the macOS app, a chat with `/approve <id> allow-once`, `allow-always` or `deny`, or with `openclaw approvals resolve`. 3. If no approval surface is reachable, or the prompt times out, **`askFallback`** decides; omitted, it is `deny`. ## What approvals are not - **Not a per-user boundary.** Gateway-authenticated callers are trusted operators; approvals guard against accidental or injected commands, not against a hostile co-operator. - **Not a read-only policy.** Once approved, a command can change anything the host filesystem permits. - **Not a substitute for tool policy.** If `exec` should never run for an agent, deny it; approvals only gate an `exec` that exists. ## Scheduled runs and approvals Approvals raised by a cron job on the Gateway host go only to connected approval clients: the Control UI, the companion apps, or API clients that declare the approvals capability. Chat channels never receive them. While a reviewer surface is connected the run waits for a decision; with none connected the request is **denied immediately** and the run's error names the policy fix. An **Always allow** answer on such a card mints a standing grant bound to that agent, job and exact command, which you can list with `openclaw approvals grants list` and revoke with `openclaw approvals grants revoke <grant-id>`. ## Questions to ask of any install - What does `openclaw approvals get --gateway` say the merged policy is? - Is anyone actually reachable to approve, or will every miss fall back to `askFallback`? - Are interpreters allowlisted without `strictInlineEval`?
- Do OpenClaw exec approvals apply to commands that run inside the sandbox?No. Approvals are enforced on the execution host, meaning the Gateway machine or a paired node, and the host approvals document is not consulted for sandboxed exec. Inside the sandbox, containment comes from the container and the sandbox tool policy; approvals matter again when elevated mode sends exec back to the host.
- What does tools.exec.strictInlineEval add when interpreters such as python are allowlisted?It treats recognized inline-eval forms (`python -c`, `node -e`, `ruby -e`, `osascript -e` and similar) as needing explicit approval even though the interpreter binary is allowlisted, and `allow-always` will not persist them. It defaults to `false`.
- If I set ask to on-miss in openclaw.json but the host document says always, which applies?Outside a full-access session the stricter one does, so `always` wins and every command prompts. Approvals can only tighten config-derived policy, and a durable allow-always entry does not suppress prompts while the effective ask is `always`.
- A fresh OpenClaw install asks before every host shell command.
- A looser setting in openclaw.json overrides a stricter host approvals document.
- When no approver is online, the command runs once the prompt times out.
- Allow-always on one command trusts that binary everywhere with any arguments.
- Exec approvals are a per-user authorization boundary between operators.
Assumes OpenClaw 2026.9.9, where tools.exec.mode is the preferred exec policy key and host exec defaults to security full with ask off; older configs used tools.exec.security and tools.exec.ask.