Repository navigation
fix(exec): auto-approve recognized read-only boolean flags on default safe bins - #88953
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 5, 2026, 7:21 PM ET / 23:21 UTC. Summary PR surface: Source +81, Tests +81, Docs +2. Total +164 across 5 files. Reproducibility: yes. source-reproducible: current main has no boolean allowlist for wc/tr/uniq and the short-cluster parser returns -1 when a cluster has no value-consuming flag. The PR body also supplies before/after live output at the real isSafeBinUsage decision boundary. 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:
Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review detailsBest possible solution: Land this built-in-only allowlist if maintainers accept the expanded default safe-bin boundary, while keeping custom safe-bin config unchanged and leaving configurable long-flag work to the separate related PR. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: current main has no boolean allowlist for wc/tr/uniq and the short-cluster parser returns -1 when a cluster has no value-consuming flag. The PR body also supplies before/after live output at the real isSafeBinUsage decision boundary. Is this the best way to solve the issue? Yes, the patch is the narrow maintainable fix shape: keep the new boolean allowlist internal to built-in profiles, update the existing validator, and preserve fail-closed handling. The remaining question is policy acceptance, not a better code location. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 9d2d51729699. Label changesLabel justifications:
Evidence reviewedPR surface: Source +81, Tests +81, Docs +2. Total +164 across 5 files. View PR surface stats
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
Review history (2 earlier review cycles)
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Addressed the [P2] config-type/schema mismatch ( Root cause: Fix: keep Tests (
Verification: |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
The four red CI lanes on the current head (
Safe-bin change is clean on its own surface: targeted With the config-type-leak finding resolved (Proof diamond lobster, Patch quality platinum hermit), the remaining gate is a maintainer decision on the curated no-prompt boolean-flag expansion for the six default safe-bins, with |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
d6fe493 to
8efc8b4
Compare
a6e2bd1 to
361b540
Compare
361b540 to
cb7aa15
Compare
cb7aa15 to
91a8b36
Compare
91a8b36 to
57999bd
Compare
f00fa17 to
b1162a6
Compare
|
Land-ready at Maintainer fixups broaden the built-in read-only boolean-flag policy for Exact proof:
An earlier sanitized AWS run ( |
… safe bins Default safe bins (cut, head, tail, tr, uniq, wc) auto-approve stdin-only text-filter invocations, but the short-option validator only had an accept path for value-consuming flags: a cluster of pure boolean short flags fell through to a terminal reject, so common read-only forms like 'wc -l', 'tr -d', 'uniq -c' and 'sort -n' were force-routed to manual approval even though the bins are stdin-only and the dangerous flags are already denied. Add an allowedBooleanFlags allowlist to the safe-bin profile model and populate it for the default bins with their read-only boolean flags. The short-cluster validator now accepts recognized boolean flags and the long validator reuses its existing boolean-flag accept branch (previously unreachable). Unrecognized short flags (e.g. 'tr -S') stay fail-closed, and denied flags are still rejected first.
…xture type The boolean-flag allowlist for default safe bins leaked onto SafeBinProfileFixture, the type used for tools.exec.safeBinProfiles, while the strict zod schema and the config normalizer never accepted or preserved the key. Move allowedBooleanFlags to an internal BuiltinSafeBinProfileFixture used only for the curated built-in profiles; custom config profiles keep the allowedValueFlags/deniedFlags model. Adds tests proving built-in profiles still honor the boolean allowlist and that a custom profile cannot widen it.
b1162a6 to
fb60cb8
Compare
|
Merged via squash.
|
… safe bins (openclaw#88953) * fix(exec): auto-approve recognized read-only boolean flags on default safe bins Default safe bins (cut, head, tail, tr, uniq, wc) auto-approve stdin-only text-filter invocations, but the short-option validator only had an accept path for value-consuming flags: a cluster of pure boolean short flags fell through to a terminal reject, so common read-only forms like 'wc -l', 'tr -d', 'uniq -c' and 'sort -n' were force-routed to manual approval even though the bins are stdin-only and the dangerous flags are already denied. Add an allowedBooleanFlags allowlist to the safe-bin profile model and populate it for the default bins with their read-only boolean flags. The short-cluster validator now accepts recognized boolean flags and the long validator reuses its existing boolean-flag accept branch (previously unreachable). Unrecognized short flags (e.g. 'tr -S') stay fail-closed, and denied flags are still rejected first. * fix(exec): keep safe-bin allowedBooleanFlags off the config-facing fixture type The boolean-flag allowlist for default safe bins leaked onto SafeBinProfileFixture, the type used for tools.exec.safeBinProfiles, while the strict zod schema and the config normalizer never accepted or preserved the key. Move allowedBooleanFlags to an internal BuiltinSafeBinProfileFixture used only for the curated built-in profiles; custom config profiles keep the allowedValueFlags/deniedFlags model. Adds tests proving built-in profiles still honor the boolean allowlist and that a custom profile cannot widen it. * fix(exec): keep tail follow approval-gated * test(exec): stabilize safe-bin trust fixtures * test(exec): isolate safe-bin argv fixtures --------- Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
OpenClaw's default safe bins are stdin-only text filters, but their validator only recognized flags that consume values. Common read-only forms such as
wc -l,tr -d, anduniq -ctherefore fell through to manual approval. The same parser could also let an unknown short flag precede a recognized value flag, allowing mixed forms such astail -fn 1past the intended fail-closed boundary.Why This Change Was Made
This change adds an internal boolean-flag allowlist to the six built-in default profiles:
cut,head,tail,tr,uniq, andwc. The validator now accepts only recognized boolean short flags, clusters, and long forms while continuing to reject attached values, unknown or ambiguous flags, file operands, and explicitly denied options.Tail follow and retry modes are explicitly denied, including
-f,-F,--follow, and--retry. The new field remains built-in-only and cannot be enabled through custom safe-bin profile configuration. Argument-policy table cases use the existing injected trust seam for host-independent results, while dedicated tests retain real path-trust coverage.User Impact
Recognized read-only commands such as
wc -l,wc --words,tr -d abc,uniq -c,cut -s -f 1,head -q, andtail -qcan be auto-approved.Unknown flags, values attached to boolean options, denied file-oriented options, and tail follow/retry modes remain approval-gated. In particular,
tail -fn 1is rejected instead of allowing-fto precede-n.sort,grep,jq, and custom safe-bin profiles are unchanged.Evidence
Exact head:
fb60cb8475b66fa48e5210b210fc09e10d843603Proof exercises the real safe-bin approval boundary. A full model-to-Gateway exec round trip is not required for this policy-layer change.
An earlier sanitized AWS run exposed host-dependent realpath behavior in the synthetic test fixture (
/usr/bin/headresolved into a Cargo coreutils directory). The production argv validator and tail denial passed; the final test isolates argv policy through the existing injected trust seam while dedicated tests retain real path-trust coverage.