Skip to content

fix: require approval for opaque exec wrappers [AI] - #112953

Merged
pgondhi987 merged 2 commits into
openclaw:mainfrom
pgondhi987:fix/fix-877
Jul 24, 2026
Merged

pgondhi987 merged 2 commits into
openclaw:mainfrom
pgondhi987:fix/fix-877

Conversation

@pgondhi987

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where exec approval checks could treat certain passthrough command wrappers as the approved executable instead of gating the command they launch.

Why This Change Was Made

The approval boundary now recognizes additional privilege, namespace, and utility wrappers as opaque dispatch wrappers. Until a wrapper has explicit parser support, the approval path keeps it blocked instead of allowing a broad wrapper rule to authorize a hidden payload.

This PR is AI-assisted.

User Impact

Users and operators get a stricter approval prompt for commands routed through these opaque wrappers. Existing transparent wrappers with tested parsing, such as env, nice, and timeout, keep their current behavior.

Evidence

  • node scripts/run-vitest.mjs src/infra/exec-command-resolution.test.ts src/infra/command-analysis/risks.test.ts
  • git diff --check

@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Jul 23, 2026
@pgondhi987

Copy link
Copy Markdown
Contributor Author

ClawSweeper proof for current head e3f8459

Behavior proved: command approval resolution fails closed for opaque dispatch wrappers instead of treating the wrapper executable itself as sufficient approval for the hidden payload.
Environment: local PR checkout at e3f8459, plus existing GitHub Actions PR CI artifacts for the same head.
Protected boundary and sink/source: the protected boundary is exec approval planning; the protected sink is the planned argv that can be handed to subprocess execution after allowlist approval.
Command/artifact:

  • node --import tsx --eval '<production-adapter proof script>' | tee /tmp/openclaw-877-behavior-proof.json
  • node scripts/run-vitest.mjs src/infra/exec-command-resolution.test.ts src/infra/command-analysis/risks.test.ts
  • GitHub Actions CI run 29986709820; current red rerun is an unrelated timeout in src/system-agent/tui-backend.test.ts, not this command-resolution path.
    Evidence:
  • fixed/denied: /tmp/openclaw-877-behavior-proof.json reports denied.policyBlocked=true, denied.blockedWrapper="bwrap", denied.plannedArgvIsNull=true, and denied.wrapperAllowlistSatisfied=false; protected sink result: the hidden payload was not reached by approval planning; no subprocess exec was reached, no subprocess spawn was produced, and 0 subprocess calls were authorized through the wrapper allowlist.
  • control: the same artifact reports control.policyBlocked=false, control.resolvedExecutableName="rg", control.resolvedPathMatchesTarget=true, and control.targetAllowlistSatisfied=true; intended behavior: transparent env wrapping still resolves and approves the effective executable when the target itself is allowlisted; the approval succeeds for the intended process target.
  • focused tests: 47 tests passed across the two touched Vitest shards; git diff --check origin/main...HEAD produced no output.
    Compatibility/operator note: approval behavior is stricter only for wrappers without transparent parser support; existing transparent wrapper behavior remains covered.
    Live gaps: no external provider or native client was used because this boundary is the local command approval planner. The proof does not spawn a shell payload; it validates the approval decision before subprocess execution, which is the protected boundary for this fix.

@pgondhi987

Copy link
Copy Markdown
Contributor Author

Codex review: needs maintainer review before merge. Reviewed July 23, 2026, 1:19 PM UTC.

Summary
Keep open for normal maintainer review and merge gating. The patch looks correct and well scoped, but it intentionally makes some existing wrapper allowlist entries stop auto-authorizing hidden payloads, and the PR has a protected maintainer label.

PR surface: Source +21, Tests +46. Total +67 across 4 files.

Reproducibility: Yes at source level: current main lacks these wrapper names in the dispatch registry, while the PR routes them through the existing policyBlocked path. I did not execute tests in this read-only review, but the PR includes focused live-output proof and regression coverage.

Review metrics:

  • Opaque wrapper classifications: 17 added, 0 removed - Each new name changes allowlist behavior for users who previously approved that wrapper executable directly.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🐚 platinum hermit
Patch quality: 🐚 platinum hermit
Result: needs maintainer review before merge.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Risk before merge

  • [P0] Merging intentionally makes allowlist entries for wrappers such as bwrap, runuser, su, unshare, and xvfb-run stop authorizing the hidden payload; existing users may see stricter prompts until they approve the actual command or wrapper-specific parser support exists.
  • [P0] Provided PR context reports a current failed CI rerun from an unrelated TUI timeout, so required checks still need normal exact-head green gating before merge.

Maintainer decision needed

  • Question: Should this PR intentionally make allowlisted opaque wrapper executables stop authorizing their hidden payloads until each wrapper has explicit transparent parser support?
  • Rationale: The code path is security-sensitive and the safer behavior is fail-closed, but it is also an intentional compatibility change for existing allowlist users.
  • Likely owner: Peter Steinberger - The current-main registry history points to this author for the affected approval-boundary file.
    Options:
  1. Accept fail-closed wrappers (recommended)
    Land after required checks with the known tradeoff that opaque wrapper allowlists no longer authorize hidden payloads.
  2. Add parser support first
    Preserve selected wrapper workflows by adding narrow transparent parsers and tests before merge.
  3. Narrow the wrapper list
    Block only the wrappers maintainers are ready to treat as compatibility-breaking in this release.

Next step before merge

  • Get required CI green on the exact head before landing.
  • Have the runtime/security owner acknowledge the stricter wrapper-allowlist behavior.

Security
Cleared: No security regression was found; the diff strengthens the exec approval boundary by failing closed for additional opaque wrappers.

Review details

Best possible solution:

Land the fail-closed wrapper classification after maintainer acceptance of the stricter approval behavior and green required checks; add transparent parsers later only for wrappers that can be proven safe.

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

Yes at source level: current main lacks these wrapper names in the dispatch registry, while the PR routes them through the existing policyBlocked path. I did not execute tests in this read-only review, but the PR includes focused live-output proof and regression coverage.

Is this the best way to solve the issue?

Yes, this is the best bounded fix for the approval boundary: it reuses the existing fail-closed wrapper mechanism instead of adding broad new parsing logic. The safer alternative for future compatibility is narrow parser support per wrapper once transparency is proven.

AGENTS.md: found_applied

Codex review notes: model internal, reasoning high; reviewed against 856f534.

Label details

Label justifications:

  • P0: This PR addresses an exec approval security boundary where an allowlisted wrapper could hide the actual subprocess payload.
  • merge-risk: 🚨 compatibility: Existing allowlists for the newly opaque wrappers can stop satisfying automatically after merge and require a new approval path.
Evidence reviewed

PR surface:

Area Files Added Removed Net
Source 2 21 0 +21
Tests 2 46 0 +46
Docs 0 0 0 +0
Config 0 0 0 +0
Generated 0 0 0 +0
Other 0 0 0 +0
Total 4 67 0 +67
  • Root policy read: The repository root AGENTS.md was read fully; its ClawSweeper/security-boundary review guidance applies because this PR touches exec approval behavior.
    • file: AGENTS.md:1
    • command: sed -n '1,140p' AGENTS.md; sed -n '141,280p' AGENTS.md; sed -n '281,420p' AGENTS.md
    • sha: 856f534880e1
  • Current main behavior: Current main's dispatch wrapper registry does not include the newly blocked names such as bwrap, runuser, su, unshare, or xvfb-run.
  • Patch implementation: The PR adds opaque wrapper names without unwrap parsers to DISPATCH_WRAPPER_SPECS; specs without unwrap support are blocked by unwrapKnownDispatchWrapperInvocation.
  • Approval sink: Blocked wrapper resolutions produce null planned argv and evaluateSegments rejects policyBlocked segments before allowlist matching can satisfy them.
  • Runtime entry point: resolveCommandResolutionFromArgv builds CommandResolution from resolveExecWrapperTrustPlan and carries policyBlocked/blockedWrapper into allowlist analysis.
  • Focused regression coverage: The new test table asserts each added opaque wrapper sets policyBlocked, nulls the planned argv, and does not satisfy an allowlist for the wrapper path.
  • Sibling coverage: Adjacent tests still cover transparent env/busybox behavior so this is not a one-sided block of all wrapper handling.
  • Contributor proof: The PR comment reports live-output proof for a denied bwrap path and a control env passthrough path, plus 47 focused Vitest tests and git diff --check.
  • History provenance: Blame on current main ties the existing dispatch wrapper registry to Peter Steinberger in commit 07f6717; local history is shallow, so owner confidence is limited.
  • Read-only diff hygiene: The PR diff against current main is limited to four source/test files and git diff --check produced no output.
    • command: git diff --check 856f534880e1d613e782239011bc20d6118c28b5...HEAD
    • sha: e3f845952ff6

@pgondhi987
pgondhi987 merged commit 7fc9a7c into openclaw:main Jul 24, 2026
40 checks passed
vincentkoc added a commit that referenced this pull request Jul 24, 2026
…omic-publication-20260724

* origin/main:
  refactor(memory-lancedb): remove dead legacy path scan (#113299)
  fix(test): satisfy no-map-spread in exec approvals (#113303)
  fix: keep OAuth refresh failures terminal [AI] (#112957)
  fix: reusable exec approvals apply to approved arguments (#112946)
  refactor(agents): split tool search internals (#113296)
  fix: keep inline eval approvals one-shot [AI] (#112956)
  refactor(normalization): reuse trimmed list helpers (#113295)
  fix(openai): fail fast on invalid TLS certificates (#111818)
  fix: recognize more shell wrappers [AI] (#112955)
  fix(i18n): correct Indonesian seconds labels
  chore(i18n): refresh native locales
  fix: block opaque exec dispatch wrappers (#112953)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant