Skip to content

test(dispatch-wrapper): preserve utility operand boundaries - #98657

Merged
obviyus merged 1 commit into
openclaw:mainfrom
zhangLei99586:fix/flock-dashdash-separator
Aug 30, 2026
Merged

obviyus merged 1 commit into
openclaw:mainfrom
zhangLei99586:fix/flock-dashdash-separator

Conversation

@zhangLei99586

@zhangLei99586 zhangLei99586 commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

Related: #98964

What Problem This Solves

The original patch treated unsupported post-lock flock -- syntax as a transparent command and treated BSD script -- as if it removed the transcript-file operand. Both assumptions could make approval analysis inspect a process that the utility does not execute.

Root cause

The candidate inferred wrapper grammar from -- alone. The utilities keep positional operand rules after option parsing ends.

Fix

  • Remove both production parser changes from the candidate.
  • Prove the valid flock -- <lock> <command> form still resolves and persists the inner executable.
  • Prove flock <lock> -- <command> remains blocked because util-linux executes -- as its command.
  • Prove BSD script -- <transcript> <command> keeps the transcript operand before the command.

Evidence

  • util-linux 2.41 runs flock -- <lock> /usr/bin/printf ... and prints the inner marker.
  • The same runtime rejects flock <lock> -- /usr/bin/touch <marker> with exit 69; the marker remains absent.
  • The production approval pipeline resolves the valid form to /usr/bin/printf and emits that persistent pattern.
  • The same pipeline blocks the invalid post-lock form and emits no persistent pattern.
  • util-linux 2.41 source sets the command vector to the first token after the lock operand.
  • FreeBSD 15 script(1) defines [file [command ...]] and says a command cannot be specified without a script file.
  • Focused tests: 162 wrapper tests passed.
  • Sibling tests: 130 allow-always tests passed.
valid-flock-inner
invalid-post-lock-status=69 marker-exists=false
valid: execution=/usr/bin/printf policyBlocked=false persistedPatterns=[/usr/bin/printf]
invalid: execution=flock policyBlocked=true persistedPatterns=[]

Change size

  • Production: no change.
  • Tests: +18 lines across the existing table and owner boundary.

@zhangLei99586
zhangLei99586 force-pushed the fix/flock-dashdash-separator branch from 15228cc to 4fdea0c Compare July 1, 2026 14:06
@clawsweeper

clawsweeper Bot commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 30, 2026, 2:20 AM ET / 06:20 UTC.

ClawSweeper review

What this changes

The PR makes the dispatch-wrapper resolver skip a post-lock-target -- for flock and adds parser coverage for that form plus BSD script transcript parsing.

Merge readiness

⛔ Blocked until stronger real behavior proof is added - 5 items remain

Keep open with a P1 finding: the new flock parsing accepts an argument form that util-linux flock does not support, so approval matching can target an executable that flock never launches.

Priority: P1
Reviewed head: 6c8ecdbe3d76ab955eb112a3922a2db658ea0107

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The patch is narrowly scoped, but its central command grammar is contradicted by the inspected flock implementation and the claimed final-effect proof is not independently observable.
Proof confidence 🦪 silver shellfish (2/6) Needs stronger real behavior proof before merge: Authority-chain proof required: the PR body describes an allowlist trace, but provides no inspectable after-fix trace of a working flock invocation; the reviewed util-linux probe fails before the claimed inner process, so marker absence cannot prove rejection before I/O. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🦐 gold shrimp (3/6) Security review found an item that needs attention.

Verification

Check Result Evidence
Real behavior Needs proof Needs stronger real behavior proof before merge: Authority-chain proof required: the PR body describes an allowlist trace, but provides no inspectable after-fix trace of a working flock invocation; the reviewed util-linux probe fails before the claimed inner process, so marker absence cannot prove rejection before I/O. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 5 items Introduced authorization mismatch: The PR skips a -- after the lock target and returns the following executable as the effective command.
Flock contract and observed behavior: Installed util-linux 2.39.3 documents flock [options] FILE COMMAND; the exact proposed form flock /dev/null -- /usr/bin/printf exits 69 with failed to execute --, rather than launching printf.
Approval owner: The resolver’s trust plan becomes the effective argv used by executable allowlist matching, so the incorrect unwrap changes the authorization target before dispatch.
Findings 1 actionable finding [P1] Reject flock's post-target separator form
Security Needs attention Authorization target diverges from flock execution: Skipping the post-target -- allows policy matching against the subsequent executable, while util-linux flock attempts to execute -- instead; this is unsafe authorization-model drift.

How this fits together

OpenClaw resolves transparent command wrappers before matching an allow-always rule and before dispatching the original command. The resolved effective executable feeds approval policy, while the original wrapper command remains the process actually launched.

flowchart LR
  A[Agent command] --> B[Wrapper resolver]
  B --> C[Effective executable]
  C --> D[Allow-always policy]
  D --> E[Original wrapper process]
  E --> F[Inner command or error]
Loading

Before merge

  • Add real behavior proof - Needs stronger real behavior proof before merge: Authority-chain proof required: the PR body describes an allowlist trace, but provides no inspectable after-fix trace of a working flock invocation; the reviewed util-linux probe fails before the claimed inner process, so marker absence cannot prove rejection before I/O. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Reject flock's post-target separator form (P1) - flock does not treat this -- as a separator after the lock target: util-linux 2.39.3 documents FILE COMMAND, and the exact argv fails attempting to execute --. This makes allowlist matching target bash even though flock never launches it; keep this form blocked.
  • Resolve security concern: Authorization target diverges from flock execution - Skipping the post-target -- allows policy matching against the subsequent executable, while util-linux flock attempts to execute -- instead; this is unsafe authorization-model drift.
  • Resolve merge risk (P1) - Merging would make durable allowlist evaluation treat an invalid util-linux flock command as though it executed the inner program; the real command instead locks its target and fails attempting to execute --.
  • Complete next step (P2) - The P1 finding invalidates the PR’s central behavior, so there is no safe automated repair that preserves its claimed flock change.

Findings

  • [P1] Reject flock's post-target separator form — src/infra/dispatch-wrapper-resolution.ts:283-284
  • [medium] Authorization target diverges from flock execution — src/infra/dispatch-wrapper-resolution.ts:283
Agent review details

Security

Needs attention: The authorization target introduced by the resolver no longer matches the command the inspected flock implementation executes.

PR surface

Source 0, Tests +14. Total +14 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 3 3 0
Tests 1 14 0 +14
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 17 3 +14

Review metrics

Metric Value Why it matters
Production versus tests production +3/-3 (net 0); tests +14 The net-neutral edit nevertheless changes the executable used for authorization, while the added parser cases do not demonstrate real flock execution.

Merge-risk options

Maintainer options:

  1. Restore fail-closed flock parsing (recommended)
    Remove the post-lock-target separator unwrap and its fixture, because the documented util-linux command grammar treats that token as the executable.
  2. Pause this repair
    Close or pause this PR if no supported flock implementation can demonstrate that the post-target separator form launches the claimed inner command.

Technical review

Best possible solution:

Retain the current fail-closed handling for a post-target --; pursue a new focused repair only if a documented supported flock implementation and real OpenClaw execution trace establish a valid missing form.

Do we have a high-confidence way to reproduce the issue?

No. A direct util-linux 2.39.3 probe of the proposed argv fails while trying to execute --; current main correctly blocks that wrapper form rather than treating the following token as the command.

Is this the best way to solve the issue?

No. The patch generalizes a separator convention into a flock argument position not supported by the inspected flock contract, so retaining the current fail-closed parser is safer.

Full review comments:

  • [P1] Reject flock's post-target separator form — src/infra/dispatch-wrapper-resolution.ts:283-284
    flock does not treat this -- as a separator after the lock target: util-linux 2.39.3 documents FILE COMMAND, and the exact argv fails attempting to execute --. This makes allowlist matching target bash even though flock never launches it; keep this form blocked.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.99

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 63f265c0ddb9.

Labels

Label changes:

  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🦪 silver shellfish, so this older rating label is no longer current.
  • remove proof: 📸 screenshot: Current real behavior proof evidence kind is none.

Label justifications:

  • P1: The introduced parser change affects the allow-always authorization path and misidentifies the executable for the proposed flock invocation.
  • merge-risk: 🚨 security-boundary: The PR changes the executable identity used to authorize process dispatch without matching util-linux flock's actual executed command.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: Authority-chain proof required: the PR body describes an allowlist trace, but provides no inspectable after-fix trace of a working flock invocation; the reviewed util-linux probe fails before the claimed inner process, so marker absence cannot prove rejection before I/O. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

Security concerns:

  • [medium] Authorization target diverges from flock execution — src/infra/dispatch-wrapper-resolution.ts:283
    Skipping the post-target -- allows policy matching against the subsequent executable, while util-linux flock attempts to execute -- instead; this is unsafe authorization-model drift.
    Confidence: 0.99

What I checked:

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Remove the unsupported post-target flock -- unwrap and its fixture.
  • If another valid flock form needs support, attach redacted production-path proof showing that form executes and that a substituted executable is rejected before I/O; updating the PR body should trigger re-review, or a maintainer can request @clawsweeper re-review.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-02T04:19:20.531Z sha 5ad14d2c05fd92f2862968e79a8f63013ffc596b :: needs real behavior proof before merge. :: [P1] Preserve script's transcript argument after --

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. labels Jul 1, 2026
@zhangLei99586
zhangLei99586 force-pushed the fix/flock-dashdash-separator branch from 4fdea0c to fe5e06d Compare July 1, 2026 14:34
@zhangLei99586

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@zhangLei99586

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

4 similar comments
@zhangLei99586

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@zhangLei99586

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@zhangLei99586

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@zhangLei99586

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@openclaw-barnacle openclaw-barnacle Bot added triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. and removed triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Jul 2, 2026
@zhangLei99586

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper clawsweeper Bot added the proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. label Jul 2, 2026
@zhangLei99586

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 2, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added status: 🛠️ actively grinding The PR author has acted after the latest ClawSweeper review and work remains. and removed proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 2, 2026
@zhangLei99586

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper clawsweeper Bot added status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed status: 🛠️ actively grinding The PR author has acted after the latest ClawSweeper review and work remains. labels Jul 3, 2026
@zhangLei99586

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Command router queued. I will update this comment with the next step.

@zhangLei99586

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper clawsweeper Bot added the proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. label Jul 16, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Aug 27, 2026
@obviyus obviyus changed the title fix(dispatch-wrapper): fix flock separator and script command detection fix(dispatch-wrapper): unwrap flock command after separator Aug 30, 2026
@obviyus
obviyus force-pushed the fix/flock-dashdash-separator branch from 5ad14d2 to 6c8ecdb Compare August 30, 2026 06:06
@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Aug 30, 2026
@obviyus obviyus changed the title fix(dispatch-wrapper): unwrap flock command after separator test(dispatch-wrapper): preserve utility operand boundaries Aug 30, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. labels Aug 30, 2026
@obviyus
obviyus force-pushed the fix/flock-dashdash-separator branch from 6c8ecdb to 43a454b Compare August 30, 2026 06:21
@openclaw-barnacle openclaw-barnacle Bot removed the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Aug 30, 2026
@obviyus

obviyus commented Aug 30, 2026

Copy link
Copy Markdown
Collaborator

Thanks @zhangLei99586!

Proof: util-linux 2.41 runs flock -- <lock> <command>, rejects flock <lock> -- <command> with exit 69 before the later command starts, and 162 focused wrapper tests preserve the same policy boundary.

  • Bug: The original patch could make durable approval analysis trust an executable that flock does not run and could skip the BSD script transcript operand.
  • Fix: Production behavior stays fail-closed, while new regressions cover both flock separator positions and the BSD script operand order.

Example

Before After
The PR treated unsupported post-lock -- as transparent. Unsupported post-lock -- stays blocked.
The PR treated the first BSD script operand as the command. The transcript operand remains before the command.

@obviyus
obviyus merged commit 136eab0 into openclaw:main Aug 30, 2026
121 of 123 checks passed
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 31, 2026
…#98657)

Keep durable exec approval analysis aligned with the utility operand that actually runs.

Add regression coverage for valid and invalid flock separator placement and the BSD script transcript operand.

Co-authored-by: Ayaan Zaidi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: XS stale Marked as stale due to inactivity status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants