fix(exec): allow known safe shell builtins in allowlist mode#79363
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed May 31, 2026, 8:32 AM ET / 12:32 UTC. Summary PR surface: Source +40, Tests +148. Total +188 across 3 files. Reproducibility: yes. source inspection gives a high-confidence path for the merge blocker: Review metrics: 1 noteworthy metric.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Keep cwd-mutating Do we have a high-confidence way to reproduce the issue? Yes, source inspection gives a high-confidence path for the merge blocker: Is this the best way to solve the issue? No. Removing the earlier config surface is better, but default-allowing Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against 1e54e908e2e4. Label changesLabel justifications:
Evidence reviewedPR surface: Source +40, Tests +148. Total +188 across 3 files. View PR surface stats
Security concerns:
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
83471c1 to
d4189a8
Compare
|
@clawsweeper recheck |
|
@clawsweeper re-review |
1 similar comment
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
[P2 security] safeBuiltins config now fails closed to a closed supported set. `normalizeSafeBuiltins` filters entries against `SUPPORTED_SAFE_BUILTINS` (`:`, `cd`, `export`, `false`, `pwd`, `true`, `unset`), silently dropping anything else — including code-evaluating builtins like `eval`, `source`, and `.` that the original implementation would have accepted as-is and allowlist-bypassed. The conservative `DEFAULT_SAFE_BUILTINS` remains the stateless subset (`:`, `false`, `pwd`, `true`). [P3 docs] Align the documented "conservative default set" with the actual `DEFAULT_SAFE_BUILTINS` (`:`, `false`, `pwd`, `true`). Surface the wider supported set (`cd`, `export`, `unset`) as an explicit opt-in with the cwd/env-mutation trade-off documented inline, instead of presenting all seven as the conservative default. [P3 type comment] Drop the "from the SDK" claim — `DEFAULT_SAFE_BUILTINS` is not exported through the plugin SDK. Inline the literal supported names in the JSDoc so config writers can copy them directly without chasing a nonexistent SDK export. Addresses clawsweeper review findings on openclaw#79363.
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
This pull request has been automatically marked as stale due to inactivity. |
66e94ec to
9315a34
Compare
9315a34 to
05679bc
Compare
Treat a closed set of pathless POSIX shell builtins as internally safe in exec allowlist evaluation. This keeps cd/pwd/no-op shell segments from requiring approval while leaving environment-mutating builtins and unknown binaries gated. Fixes openclaw#46056.
05679bc to
db0b7c8
Compare
Summary
Treat a closed internal set of POSIX shell builtins as safe during exec allowlist evaluation. This avoids approval prompts for harmless shell segments like
cd /tmp && git statuswhen the real executable segment is already allowlisted.No new config surface is added. The earlier
tools.exec.safeBuiltinsproposal was removed; the behavior is default-only and limited to:,cd,false,pwd, andtruein shell-command allowlist analysis. Environment-mutating builtins such asexportandunset, code-evaluating builtins such aseval,source, and., unknown commands, and direct argv execution remain approval-gated unless separately allowlisted.Fixes #46056.
What changed
src/infra/exec-safe-builtins.tswith the closed internal safe-builtin classifier.src/infra/exec-approvals-allowlist.tsso only shell-command allowlist evaluation can satisfy a segment through that classifier.src/infra/exec-safe-builtins.test.tsfor the reporter case, unknown binaries, environment-mutating builtins, Windows behavior, and direct argv evaluation.src/infra/exec-approvals-analysis.tsmetadata typing for the new satisfaction kind.src/agents/bash-tools.exec.security-floor.test.tsto keep auto-review security-floor coverage on a non-safe command.What did not change
tools.exec.safeBuiltinsconfig key.safeBinsbehavior changes.Real behavior proof
Behavior addressed: Allowlist mode previously gated shell chains like
cd /tmp && git statuson the pathlesscdsegment even whengitwas allowlisted.Real environment tested: Local macOS source checkout, Node via repo pnpm wrapper; remote Testbox changed gate attempted twice.
Exact steps or command run after this patch:
pnpm test src/infra/exec-safe-builtins.test.ts src/agents/bash-tools.exec.security-floor.test.ts -- --reporter=verbose pnpm changed:lanes --json pnpm check:no-conflict-markers pnpm lint:core pnpm check:changed pnpm check:changedEvidence after fix: Focused Vitest passed 10 tests in
src/infra/exec-safe-builtins.test.tsand 13 tests insrc/agents/bash-tools.exec.security-floor.test.ts.pnpm changed:lanes --jsonreported core/coreTests only for the three touched files.pnpm check:no-conflict-markerspassed.git diff --check origin/main...HEADpassed.Observed result after fix:
cd ~/andcd /tmp && git statussatisfy shell allowlist evaluation throughsafeBuiltinsplus the existing allowlist match.cd /tmp && curl evil.com,export PATH=/tmp/bin:$PATH && git status, and direct argvpwdremain gated.What was not tested:
pnpm check:changeddid not reach checks in either Testbox attempt. Both runs failed during remote dependency install before executing the gate, with missing postinstall modules for@matrix-org/matrix-sdk-crypto-nodejs/https-proxy-agentandesbuild.pnpm lint:core,pnpm tsgo:prod, andpnpm check:test-typesalso failed on an unrelated current-main Discord boundary dts error inextensions/discord/src/monitor/gateway-plugin.ts, which this PR does not touch.