openclaw - 💡(How to fix) Fix [Feature]: Forward exec-approvals.json allowlist to claude-cli backend sessions

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

When an agent uses claude-cli as its primary model provider, exec calls are handled internally by Claude Code. OpenClaw's exec-approvals.json allowlist and tools.exec.security: "allowlist" setting are never consulted. This creates two enforcement layers that don't compose:

  1. OpenClaw native exec (codex/embedded runners) → checks exec-approvals.json → enforces allowlist
  2. Claude Code internal exec (claude-cli runner) → uses Claude Code's own --permission-mode → ignores exec-approvals.json

An operator who sets security: "allowlist" for an agent using claude-cli gets inconsistent enforcement: allowed commands may stall with approval prompts (Claude Code doesn't know about the allowlist), while blocked commands may silently execute (Claude Code's auto mode trusts some system binaries).

Root Cause

When an agent uses claude-cli as its primary model provider, exec calls are handled internally by Claude Code. OpenClaw's exec-approvals.json allowlist and tools.exec.security: "allowlist" setting are never consulted. This creates two enforcement layers that don't compose:

  1. OpenClaw native exec (codex/embedded runners) → checks exec-approvals.json → enforces allowlist
  2. Claude Code internal exec (claude-cli runner) → uses Claude Code's own --permission-mode → ignores exec-approvals.json

An operator who sets security: "allowlist" for an agent using claude-cli gets inconsistent enforcement: allowed commands may stall with approval prompts (Claude Code doesn't know about the allowlist), while blocked commands may silently execute (Claude Code's auto mode trusts some system binaries).

Fix Action

Fix / Workaround

Current Workaround

RAW_BUFFERClick to expand / collapse

Product / Version

OpenClaw 2026.4.15 (041266a) — stable channel

Summary

When an agent uses claude-cli as its primary model provider, exec calls are handled internally by Claude Code. OpenClaw's exec-approvals.json allowlist and tools.exec.security: "allowlist" setting are never consulted. This creates two enforcement layers that don't compose:

  1. OpenClaw native exec (codex/embedded runners) → checks exec-approvals.json → enforces allowlist
  2. Claude Code internal exec (claude-cli runner) → uses Claude Code's own --permission-mode → ignores exec-approvals.json

An operator who sets security: "allowlist" for an agent using claude-cli gets inconsistent enforcement: allowed commands may stall with approval prompts (Claude Code doesn't know about the allowlist), while blocked commands may silently execute (Claude Code's auto mode trusts some system binaries).

Expected Behavior

When tools.exec.security: "allowlist" is set for an agent and that agent uses claude-cli as its backend, OpenClaw should forward the exec policy to the CLI backend so that:

  • Commands matching the agent's allowlist are permitted
  • Commands not in the allowlist are denied
  • The enforcement is consistent regardless of which runner handles the session

Actual Behavior

RunnerExec EnforcementSource
OpenClaw embedded/codexexec-approvals.json checkedOpenClaw native exec tool
claude-cliClaude Code --permission-mode autoClaude Code internal tool execution

With --permission-mode auto:

  • Some system binaries (/usr/bin/python3, ls, date) auto-execute without consulting the allowlist
  • Some binaries (git, openclaw, bash, curl) produce approval prompts in Claude Code, even if they're in the OpenClaw allowlist
  • The operator cannot achieve consistent exec policy across all runners

Impact

  • Agents using claude-cli cannot be meaningfully placed on security: "allowlist" — the setting has no effect on their exec path
  • Multi-agent fleets with mixed runners have inconsistent security posture
  • The only reliable options for claude-cli agents are security: "full" (accept the risk) or not using claude-cli (lose the model)

Reproduction

  1. Set an agent (e.g., nikola) to security: "allowlist" with a specific per-agent allowlist (e.g., git, openclaw, claude)
  2. Set the agent's primary model to claude-cli/claude-opus-4-7
  3. Set --permission-mode auto in agents.defaults.cliBackends.claude-cli.args
  4. Send the agent a message: "Run: python3 --version"
  5. Observe: python3 executes (returns Python 3.9.6) despite NOT being in the agent's allowlist
  6. Send: "Run: git --version"
  7. Observe: git produces a Claude Code approval prompt despite BEING in the agent's allowlist

With a codex-runner agent (same allowlist, same commands), python3 is correctly denied (exec denied: allowlist miss) and git correctly executes.

Evidence

Full investigation documented internally:

  • Sandbox tested with nikola on allowlist + claude-cli/claude-opus-4-7
  • Logs show cli exec: provider=claude-cli model=opus — exec goes through Claude Code, not OpenClaw
  • No exec denied: allowlist miss entries appear for claude-cli sessions
  • Same tests with doubtfire/sentry (codex runners) show clean exec denied: allowlist miss enforcement

Current Workaround

Keep agents using claude-cli on security: "full" and rely on:

  • Claude Code auto mode (partial enforcement — prompts on bash, curl, git)
  • AGENTS.md operational guardrails
  • Agent workspace scoping

Why Not Fixed in 2026.4.15

The 2026.4.15 changelog contains no changes to exec policy forwarding for CLI backends. The Codex/CLI: keep resumed codex exec resume runs on the safe non-interactive path (#67666) fix is about the codex CLI's own bypass flag, not about OpenClaw forwarding its exec policy.

Possible Approaches

  1. Forward allowlist to CLI backend — OpenClaw could intercept exec tool calls from the CLI backend and check them against exec-approvals.json before allowing Claude Code to execute
  2. Pass allowlist as CLI args — OpenClaw could pass the agent's allowed binaries as Claude Code CLI flags (e.g., --allowed-tools)
  3. Pre-exec hook — OpenClaw could add a pre-exec hook that validates the command before the CLI backend runs it

Recommended Priority

MEDIUM — affects multi-agent security posture for operators using mixed runners.


Draft prepared for GitHub filing. No real secrets included.

extent analysis

TL;DR

To fix the inconsistent exec policy enforcement issue, OpenClaw needs to forward its exec policy to the Claude Code CLI backend, ensuring that commands are checked against the allowlist before execution.

Guidance

  • Investigate the feasibility of forwarding the allowlist to the CLI backend, which would require modifying OpenClaw to intercept exec tool calls and check them against exec-approvals.json.
  • Consider passing the allowlist as CLI args to Claude Code, using flags like --allowed-tools to specify permitted binaries.
  • Explore implementing a pre-exec hook in OpenClaw to validate commands before they are executed by the CLI backend.
  • Review the current workaround of keeping agents on security: "full" and relying on Claude Code's auto mode and operational guardrails.

Example

No code snippet is provided due to the complexity of the issue and the need for a more detailed analysis of the OpenClaw and Claude Code codebases.

Notes

The solution will depend on the specific requirements and constraints of the OpenClaw and Claude Code systems. A thorough analysis of the code and potential security implications is necessary before implementing any changes.

Recommendation

Apply a workaround by keeping agents using claude-cli on security: "full" and relying on Claude Code's auto mode and operational guardrails until a more permanent solution can be implemented. This is due to the medium priority of the issue and the potential complexity of the fix.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix [Feature]: Forward exec-approvals.json allowlist to claude-cli backend sessions