Skip to content

fix(agents): enforce Claude CLI cron tool policies - #112457

Merged
fuller-stack-dev merged 3 commits into
mainfrom
codex/cron-claude-tool-policy
Jul 22, 2026
Merged

fuller-stack-dev merged 3 commits into
mainfrom
codex/cron-claude-tool-policy

Conversation

@fuller-stack-dev

@fuller-stack-dev fuller-stack-dev commented Jul 22, 2026 •

Copy link
Copy Markdown
Member

Summary

  • translate restricted CLI toolsAllow policies through a backend-owned MCP allowlist
  • isolate restricted Claude runs from user, project, and local hooks, plugins, agents, skills, and CLAUDE.md
  • force native CLI tools off for restricted runs
  • enforce the same grant in Claude config and the Gateway tool list/execution path
  • reject backend translations that expand authority beyond the host-requested MCP grant
  • keep unsupported CLI backends fail-closed

Closes #112454

Testing

  • node scripts/run-vitest.mjs src/agents/cli-runner/prepare.test.ts (77 passed)
  • node scripts/run-vitest.mjs extensions/anthropic/cli-shared.test.ts (40 passed)
  • node scripts/run-vitest.mjs src/gateway/mcp-http.runtime.test.ts focused policy tests (5 passed)
  • node scripts/check-changed.mjs -- docs/gateway/cli-backends.md docs/plugins/cli-backend-plugins.md extensions/anthropic/cli-shared.test.ts extensions/anthropic/cli-shared.ts (Blacksmith Testbox passed)
  • Claude Code 2.1.217 live hook probe: SessionStart user hook ran with native tools disabled and only mcp__openclaw__message allowed; the isolated restricted argv suppressed the hook while retaining explicit MCP config and the exact allowed name. Both probes used an invalid API key and reported duration_api_ms: 0.
  • git diff --check
  • autoreview clean

Security

Restricted runtime caps are host-owned: plugins may select only grant-scoped OpenClaw MCP tools, core rejects authority expansion before minting the loopback grant, Claude customizations are disabled for exact restricted runs, and native backend tools stay disabled.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime agents Agent runtime and tooling extensions: anthropic size: M maintainer Maintainer-authored PR labels Jul 22, 2026
@clawsweeper

clawsweeper Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: fix(agents): enforce Claude CLI cron tool policies This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@clawsweeper

clawsweeper Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: fix(agents): enforce Claude CLI cron tool policies This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@clawsweeper

clawsweeper Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: fix(agents): enforce Claude CLI cron tool policies This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Maintainer decision: resolveRuntimeToolAvailability is intentionally a public CLI-backend SDK hook. Runtime toolsAllow is a generic host policy, while exact native/MCP projection is backend-owned and provider-specific; keeping the hook private to Anthropic would force future CLI backends into core branches or leave them permanently fail-closed. The accepted contract is narrow: a backend may omit requested tools, but core rejects any returned MCP authority outside the normalized allowlist, and Gateway enforces the final grant on list and call.

The final head also isolates Claude customization processes for exact restricted runs. Focused tests, the Blacksmith changed-surface gate, fresh autoreview, and live Claude Code 2.1.217 hook-bypass proof are clean.

@fuller-stack-dev
fuller-stack-dev merged commit 24c20ee into main Jul 22, 2026
124 of 125 checks passed
@fuller-stack-dev
fuller-stack-dev deleted the codex/cron-claude-tool-policy branch July 22, 2026 01:38
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 22, 2026
* fix(agents): enforce Claude CLI tool policies

* fix(agents): bound CLI runtime tool grants

* fix(agents): isolate restricted Claude runs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation extensions: anthropic gateway Gateway runtime maintainer Maintainer-authored PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cron toolsAllow cannot be enforced by claude-cli runtime

2 participants