Harden macOS shell wrapper allowlist parsing [AI]#78518
Conversation
|
Codex review: needs changes before merge. Summary Reproducibility: yes. Current-main source shows the wrapper parser only checks exact POSIX inline flags while the validator already handles combined Real behavior proof Next step before merge Security Review findings
Review detailsBest possible solution: Land a maintainer-reviewed version that preserves Swift/TypeScript parser parity and blocked-wrapper fail-closed behavior, adds the Do we have a high-confidence way to reproduce the issue? Yes. Current-main source shows the wrapper parser only checks exact POSIX inline flags while the validator already handles combined Is this the best way to solve the issue? Mostly yes. Sharing the inline parser between Swift and TypeScript paths and denying unbindable startup/env shell wrappers is a narrow maintainable fix; the remaining issue is the missing changelog entry plus normal maintainer and CI gating. Full review comments:
Overall correctness: patch is correct Acceptance criteria:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 95a1c915312a. Re-review progress:
|
|
Not applicable; changelog is handled at merge time. Quoted comment from @clawsweeper:
|
b26c6db to
cbedc1b
Compare
276d314 to
06e9592
Compare
* fix: harden shell wrapper allowlist parsing * fix: harden shell wrapper approval binding * docs: add changelog entry for PR merge --------- Co-authored-by: Ishaan <[email protected]>
* fix: harden shell wrapper allowlist parsing * fix: harden shell wrapper approval binding * docs: add changelog entry for PR merge --------- Co-authored-by: Ishaan <[email protected]>
* fix: harden shell wrapper allowlist parsing * fix: harden shell wrapper approval binding * docs: add changelog entry for PR merge --------- Co-authored-by: Ishaan <[email protected]>
* fix: harden shell wrapper allowlist parsing * fix: harden shell wrapper approval binding * docs: add changelog entry for PR merge --------- Co-authored-by: Ishaan <[email protected]>
* fix: harden shell wrapper allowlist parsing * fix: harden shell wrapper approval binding * docs: add changelog entry for PR merge --------- Co-authored-by: Ishaan <[email protected]>
* fix: harden shell wrapper allowlist parsing * fix: harden shell wrapper approval binding * docs: add changelog entry for PR merge --------- Co-authored-by: Ishaan <[email protected]>
Summary
Describe the problem and fix in 2-5 bullets:
-cforms such asbash -xc '<payload>'as direct shell executable invocations, so an allowlist entry for the shell could satisfy the guard while the inline payload was not evaluated.security: "allowlist"guarantee on the macOS Swift exec path and related node-host approval/allow-always binding paths.-cforms, keeps payload parsing aligned across allowlist and system-run validation, and fails closed for startup/login/interactive/fish/env-modified shell wrappers that cannot be safely bound to an inner payload.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Real behavior proof (required for external PRs)
External contributors must show after-fix evidence from a real OpenClaw setup. Unit tests, mocks, lint, typechecks, snapshots, and CI are supplemental only. Screenshots are encouraged even for CLI, console, text, or log changes; terminal screenshots and copied live output count. Be mindful of private information like IP addresses, API keys, phone numbers, non-public endpoints, or other private details when providing evidence.
-cforms as wrappers and exposes the inline payload to allowlist resolution instead of matching only the shell executable.[/bin/bash, -c, /usr/bin/printf safe_marker]and[/bin/bash, -xc, /usr/bin/printf safe_marker].-cform now resolves to/usr/bin/printf safe_marker, so allowlist evaluation sees the payload executable instead of matching only/bin/bash; unbindable startup/login/env-modified shell wrapper shapes fail closed rather than minting payload-only allowlist or approval entries.combined isWrapper=false command=nilfor/bin/bash -xc /usr/bin/printf safe_marker.Root Cause (if applicable)
For bug fixes or regressions, explain why this happened, not just what changed. Otherwise write
N/A. If the cause is unclear, writeUnknown.-c/-lc, while valid combined short option forms containingcwere treated as ordinary shell invocations.Regression Test Plan (if applicable)
For bug fixes or regressions, name the smallest reliable test coverage that should catch this. Otherwise write
N/A.apps/macos/Tests/OpenClawIPCTests/ExecAllowlistTests.swiftapps/macos/Tests/OpenClawIPCTests/ExecSystemRunCommandValidatorTests.swiftsrc/infra/shell-inline-command.test.tssrc/infra/exec-approvals-allow-always.test.tssrc/infra/system-run-command.test.tssrc/node-host/invoke-system-run-plan.test.tstest/fixtures/system-run-command-contract.json-cforms parse to the inline payload for allowlist resolution; startup/login/env-modified wrappers and positional carriers do not bypass allowlist/allow-always approval binding.-c/-lc; this PR adds combined-form and blocked-wrapper regressions.User-visible / Behavior Changes
Exec allowlist mode is stricter for shell-wrapper commands. Combined POSIX
-cforms are evaluated against their inline payloads, and unsafe startup/login/env-modified shell wrappers may require explicit approval instead of being satisfied by a shell executable or payload-only allow-always entry.Diagram (if applicable)
Security Impact (required)
Yes/No) NoYes/No) NoYes/No) NoYes/No) YesYes/No) NoYes, explain risk + mitigation: command execution approval and allowlist parsing is tightened. The compatibility risk is that previously accepted shell-wrapper shapes may now prompt or fail closed; mitigation is preserving safe generated legacysh -lcraw-payload binding and adding focused Swift/TS regression coverage.Repro + Verification
Environment
system.runsecurity: "allowlist"; allowlist includes a POSIX shell executable for the original bypass scenario.Steps
[/bin/bash, -c, /usr/bin/printf safe_marker]and[/bin/bash, -xc, /usr/bin/printf safe_marker].ExecAllowlistTestsandExecSystemRunCommandValidatorTests.codex review --base origin/main.Expected
-cand combined POSIX-cforms both expose the inline payload for allowlist evaluation.Actual
isWrapper=false command=nil.isWrapper=true command=/usr/bin/printf safe_markerfor the combined form.Evidence
Attach at least one:
Human Verification (required)
What you personally verified (not just CI), and how:
-cmacOS parser behavior; Swift allowlist/system-run validator tests; TypeScript shell parser, allowlist/allow-always, command explainer/risk, system-run, and node-host approval-plan behavior;codex review --base origin/main.-xc,-ec,-euxc,-cx, options with separate values such as-O/-o, rawlesssh -lc, legacy generatedsh -lcraw-payload binding, env-modified shell wrappers, login/interactive wrappers, fish init/attached command forms, and positional carriers.Review Conversations
If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.
Compatibility / Migration
Yes/No) Yes, with stricter approval prompts for unsafe shell-wrapper forms.Yes/No) NoYes/No) NoRisks and Mitigations
sh -lcraw-payload binding and cover blocked forms with focused Swift/TS tests.