Repository navigation
fix(agents): honor exec allowlists for Claude native Bash - #141471
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 7, 2026, 3:42 PM ET / 19:42 UTC. ClawSweeper reviewWhat this changesClaude native Bash calls reuse the agent’s exec allowlist, pin approved executable paths, and explain commands that still require approval. Merge readiness✅ Ready for maintainer review This remains a useful fix: current main and the latest release still prompt for allowlisted native Bash commands. No blocking defect was found, and the supplied live evidence demonstrates both successful allowlisted execution and denial of a non-allowlisted command. Priority: P2 Review scores
Verification
How this fits togetherThe Claude CLI backend asks OpenClaw to authorize native tool calls before Claude Code executes them. This change connects Bash requests to the existing exec allowlist while retaining command binding and run-lifecycle checks. flowchart TD
A[Claude native Bash request] --> B[Run and tool policy checks]
B --> C[Exec allowlist evaluation]
C --> D[Command binding checks]
D --> E[Pin allowlisted executable]
D --> F[Prompt or deny other commands]
E --> G[Current authority check]
F --> G
G --> H[Claude executes or rejects]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +40, Tests +208, Docs +37. Total +285 across 10 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep native Bash execution with Claude Code while applying the existing per-agent allowlist, command binding, and current-run authority at OpenClaw’s permission boundary. Do we have a high-confidence way to reproduce the issue? Yes, from source: on current main, a native Bash request under ask on-miss reaches interactive approval even when its executable is allowlisted. This review did not execute a reproduction. Is this the best way to solve the issue? Yes. Reusing the existing evaluator, renderer, binding guard, and grant recorder addresses unattended execution without adding a competing shell parser or exposing mediated exec to ordinary CLI sessions. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against bc79a198dc0d. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
Reuse exec command authorization for native Bash under on-miss prompting. Preserve binding denials, mandatory prompting, current grants, and native execution ownership. Explain allowlist misses without granting standing Bash permission. Related: #140473. Reported by @docfernando.
871c650 to
d5c9059
Compare
|
Merged via squash.
|
…41471) * fix(anthropic): honor native Bash exec allowlists Reuse exec command authorization for native Bash under on-miss prompting. Preserve binding denials, mandatory prompting, current grants, and native execution ownership. Explain allowlist misses without granting standing Bash permission. Related: openclaw#140473. Reported by @docfernando. * test(agents): split native Bash policy coverage
…41471) * fix(anthropic): honor native Bash exec allowlists Reuse exec command authorization for native Bash under on-miss prompting. Preserve binding denials, mandatory prompting, current grants, and native execution ownership. Explain allowlist misses without granting standing Bash permission. Related: openclaw#140473. Reported by @docfernando. * test(agents): split native Bash policy coverage (cherry picked from commit e57e375)
배치 A 체리픽이 이 포크에 없는 중간 리팩터링에 걸린 지점을 포크 코드에 맞춰 정리했다. - 문자열 이스케이프 복구: attempt-prompt-build.ts, attempt-prompt-context.test.ts - openclaw#140859: session-accessor.entry-mutation.ts 의 transcript 헤더 import 복원 - openclaw#141247: runs.ts 에서 포크에 없는 projectSessionActive 조건 제거 - openclaw#141471: execute-plugin.test-support.js 가 없어 native-bash 테스트 파일 제거 - openclaw#141960: quickjs-wasi 3.6.0 의 MAX_STACK_SIZE 를 쓸 수 없어 되돌림(포크는 3.5.0 핀) - openclaw#142130: agents.ts 의 assertCurrent 호출 제거, cleanup-utils 는 선택 인자로 유지 - openclaw#142158: manifest-planner.ts 의 remoteModelIds·manifestModelsById 복원 - openclaw#143308: simple-completion-runtime.ts 에 acquireSimpleCompletionModelForAgent 래퍼 추가 - openclaw#143899: src/infra/file-descriptor.ts 의 fingerprint 비교 헬퍼 이식, backup-shared 의 configCapture 참조 제거 Co-Authored-By: Claude Fable 5.1 <[email protected]>
Related: #140473. Reported by @docfernando.
What Problem This Solves
Fixes an issue where operators using the Claude CLI backend had to approve every native Bash invocation even after allowlisting the binary for their agent. This blocked unattended CLI automation.
Why This Change Was Made
The native permission path previously considered only exec security and ask settings. It now reuses the exec shell evaluator, authorization renderer, and current-grant usage recorder. With
ask: on-miss, fully classified commands whose binaries explicitly match the agent allowlist can auto-allow; the returned native input pins the resolved executable paths. Actual hook cwd and configured exec PATH prepends participate in evaluation. Manual approvals retain the native launch environment for file binding.The existing binding owner still denies pipelines, substitutions, subshells, write redirections, and unparseable commands before prompting. Bindable misses explain the first unmatched segment or classification failure.
ask: always,security: deny, ask-off policy, Bash allow-always refusal, description bounds, and current run authority remain enforced.Ordinary sessions continue to use native Bash. The mediated exec seam remains scoped to its existing restricted runs. This is argument-level policy for the command Claude Code runs; cwd, environment, PATH, and sandboxing remain Claude Code's. Use a paired node or the embedded runtime with sandboxing when sandboxed execution is required.
User Impact
Operators can use an existing per-agent exec allowlist for unattended native Bash calls under
ask: on-miss. Commands requiring manual approval still offer only allow-once or deny for Bash. Both CLI-backend and exec-approval documentation describe the boundary.Evidence
node scripts/check-changed.mjsandgit diff --check: PASS. The changed gate includes formatting, core/plugin and test typechecks, lint, max-lines and other repository guards, and dead-export scans.d5c905919abca6a6720aea8e17bfa46eef6800e8. This is a patch-identical rebase onto repaired main;git range-diffreports both original commits unchanged. The focused tests, live proof, and independent review above were performed before that mechanical rebase; the refreshed head passed required hosted CI.The live proof used an isolated state directory, fresh loopback Gateway, and the committed production build through
node openclaw.mjs. The API-key profile existed before startup and was explicitly selected for the CLI route. A diagnostic preload observed credential-fingerprint creation and the API-key FD selection without logging credentials or changing the returned values. The first probe omitted the client approvals capability; after correcting that fixture, both real native Bash calls completed with the expected policy outcomes. No operator Gateway was touched.Sanitized Gateway/probe excerpts:
Root-cause owner:
src/agents/cli-runner/cli-native-tool-approval.ts; effective policy and PATH composition:src/agents/cli-runner/execute-plugin.ts. Hook cwd comes fromextensions/anthropic/cli.runtime.ts. This deliberately reuses existing evaluator/renderer/binding owners rather than introducing another parser or exposing mediated local exec to ordinary CLI sessions.Focused proof command (105 passed):
The original hosted run was blocked by check-lint-core-2: an unrelated main-file max-lines failure in
ui/src/components/markdown.test.ts. That guard was repaired on main by #141466 in7a1f677e3cb5d4882c0cff0d76dd4af196c27c58. Verified the landed split preserves all original suite bodies, passes all 115 Markdown tests and changed-file lint, and remains below the unchanged 1,000-line limit. The parallel focused repair #141486 was closed as superseded. This PR was then rebased without patch changes to obtain fresh exact-head CI evidence.Native prepare and merge completed successfully. Landed as
e57e375a40266b93fd1c9e66b9f0dc03da7d368a; main ancestry and all ten landed file contents were verified before closing #140473.