Skip to content

fix(exec): restore V2 approvals UI and argument binding - #1108

Closed
bkudiess wants to merge 1 commit into
openclaw:mainfrom
bkudiess:bkudiess-investigate-exec-policy-regression
Closed

bkudiess wants to merge 1 commit into
openclaw:mainfrom
bkudiess:bkudiess-investigate-exec-policy-regression

Conversation

@bkudiess

@bkudiess bkudiess commented Aug 6, 2026 •

Copy link
Copy Markdown
Collaborator

Depends on #1109

Important

This draft is the upper layer for #1109. Because #1109 is cross-fork, GitHub cannot create a true stacked base relationship. Merge #1109 first, then rebase this PR and adapt argPattern generation to its ExecReusableCommand.Argv before marking ready.

Summary

  • replace the stale V1-shaped Permissions editor with the file-backed V2 policy model used by runtime, MCP, and the Gateway
  • expose Defaults, All agents (*), main, and existing agent scopes with security, ask, askFallback, autoAllowSkills, and executable-path allowlists
  • show explicit guidance for rejected V1 command patterns, preserve input on failure, reload safely after CAS conflicts, and surface durable read/write errors
  • add upstream-compatible generated approval identity: source: "allow-always" plus a length-delimited SHA-256 argPattern of the exact argv tail
  • require path and argument matches for generated grants, ignore legacy generated path-only grants, preserve intentionally broad manual path rules, and protect complete authority tuples during currency checks and remote CAS updates
  • keep generated argument metadata private: the UI shows Arguments restricted to the approved command. rather than plaintext arguments or hashes

Intentionally excluded as #1109 overlap

  • reusable Windows cmd transport binding and direct execution
  • file-backed Gateway baseHash response compatibility
  • cmd built-in/quote/code-host hardening
  • Gateway/MXC reusable-wrapper proof

Those now belong to #1109 and were removed from this branch.

Architecture ownership

  • Old owner: PermissionsPage.xaml.cs directly read, mutated, and persisted exec approval state for main only.
  • New owner: PermissionsPageViewModel plus IExecApprovalsPolicyStore own snapshot projection, exact scope selection, validation, CAS mutation/retry, rollback, and tuple preservation.
  • New security owners: ExecArgPattern plus ExecAllowlistRuleIdentity own generated durable (pattern,argPattern,source) authority.
  • Preserved invariant: the UI, system.run, system.execApprovals.get/set, local MCP, and Gateway relay share one authoritative ExecApprovalsStore.

Validation

  • ./build.ps1 ✅
  • dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj --no-restore ✅ 3,427 passed, 32 skipped
  • dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj --no-restore ✅ 2,167 passed
  • dotnet test ./tests/OpenClaw.WinNode.Cli.Tests/OpenClaw.WinNode.Cli.Tests.csproj --no-restore ✅ 126 passed
  • ./scripts/validate-mxc-e2e.ps1 ✅ 2/2 current-main Gateway → Windows node → MXC proofs passed
  • focused real-process WinUI proof ✅ 1 passed; Axe.Windows found 0 violations

Real behavior proof

  • entering legacy hostname is rejected with visible executable-path guidance and associated UIA HelpText
  • **/where.exe saves under All agents, survives navigation/reload, and exposes a named removal control
  • generated entries preserve source and argPattern across UI policy edits and display Arguments restricted to the approved command.
  • exact generated argv-tail hashes match; changed argument count, order, boundaries, or values miss
  • legacy generated path-only entries are ignored; explicit manual path-only rules remain intentionally broad
  • remote CAS updates cannot mutate a stored rule's path, source, or argPattern
  • current-head UI screenshot captured as exec-approvals-v2.png (148,783 bytes); not attached to this draft

Review

  • security-sensitive read-only review found case-sensitive scope, accessible validation, tuple removal, legacy manual-conversion, and Unicode whitespace issues during the broader investigation; all findings relevant to this reduced layer were fixed
  • the structured autoreview helper failed closed because full localization-file snapshots exceeded its 180 KB bundle limit; no limit bypass was used

Rebase / stack plan

Remaining parity and deferred security design

  • explicit per-command/executable deny rules remain absent from both current file-backed implementations and need a separate design
  • canonical cwd filesystem identity and mutable script-content launch revalidation remain follow-up hardening
  • detached approval binding to session/request/device provenance and trusted-skill auto-allow runtime remain follow-up parity
  • hand-authored regex argPattern is not enabled; generated SHA-256 patterns are supported and manual path-only rules remain intentionally broad

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. labels Aug 6, 2026
@clawsweeper

clawsweeper Bot commented Aug 6, 2026 •

Copy link
Copy Markdown

Codex review: found issues before merge. Reviewed August 6, 2026, 4:22 AM ET / 08:22 UTC.

ClawSweeper review

What this changes

The PR moves the tray Permissions page to the shared V2 execution-approval policy and binds new “Always Allow” approvals to an exact command argument list.

Merge readiness

⛔ Blocked by patch quality or review findings - 8 items remain

Keep this collaborator-authored draft open: its argument-binding fallback leaves pre-upgrade generated approvals broad, so a security and upgrade policy decision is required before merge.

Priority: P1
Reviewed head: d725e0eb631e260cbee4289200d5f89fdbf39928
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) PR readiness rating was derived from proof quality, review findings, security review, and reviewer confidence.
Proof confidence 🌊 off-meta tidepool Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🧂 unranked krab (1/6) Security review found an item that needs attention.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Evidence reviewed 4 items Current-main persistence shape: Current main's Allow Always persistence calls the two-argument store method, which writes only an id and path pattern. Those entries have neither source nor argument metadata.
Current-main generated-entry provenance: The V2 approval-store behavior dates to the merged V2 replacement work, so existing source-less entries are a real upgrade population rather than an unsupported file shape.
Proposed fallback remains broad: The PR matcher treats any path-matching entry without argPattern as a manual path-only match unless it already carries source=allow-always. That cannot distinguish a current-main generated entry from a deliberately broad manual one.
Findings 1 actionable finding [P1] Handle source-less V2 grants before treating them as manual
Security Needs attention Source-less generated grants remain path-only: Existing generated grants lack provenance, but the matcher treats source-less entries as manual broad rules. A changed argument tail can therefore inherit earlier Always Allow authority after upgrade.

How this fits together

Execution approvals govern whether Windows node commands run. The tray editor writes the same persisted V2 policy consumed by runtime matching, MCP, and gateway-mediated command execution.

flowchart LR
A[Tray permissions page] --> B[Persisted V2 approval policy]
C[MCP and gateway updates] --> B
D[Executable path and arguments] --> E[Approval matcher]
B --> E
E --> F[Allow prompt or deny]
F --> G[Windows node command]
Loading

Decision needed

Question Recommendation
How should source-less V2 allowlist entries already written by current main be upgraded when provenance cannot distinguish a generated Always Allow grant from a deliberately broad manual path rule? Require legacy confirmation or fail closed: Migrate source-less entries into a disabled or explicitly confirmed state before argument-bound authorization is claimed.

Why: The proposed matcher must choose between silently retaining broader authority and disabling or requiring confirmation for existing approvals; source inspection shows there is no provenance field available to infer that choice safely.

Before merge

  • Handle source-less V2 grants before treating them as manual (P1) - Current main writes Allow Always rules with only id and pattern, so they arrive here without source or argPattern. This fallback therefore accepts a prior generated approval for any new argument tail. Add the maintainer-chosen migration or confirmation behavior and a regression test that creates the entry through the current-main store path.
  • Resolve security concern: Source-less generated grants remain path-only - Existing generated grants lack provenance, but the matcher treats source-less entries as manual broad rules. A changed argument tail can therefore inherit earlier Always Allow authority after upgrade.
  • Resolve merge risk (P1) - Existing users can have source-less path-only entries produced by current main; classifying them as manual preserves authority for changed argument tails after upgrade.
  • Resolve merge risk (P1) - The draft depends on fix: honor exec allowlists for Windows node commands #1109, so its argument identity must be reconciled and re-proven against the merged runtime binder.
  • Complete next step (P2) - A concrete security defect exists, but the safe repair depends on maintainer intent for indistinguishable legacy approval records.
  • Improve patch quality - Resolve the security review concern or explain why the changed path is safe.
  • Improve patch quality - Address the highest-priority review finding and re-run the changed-surface validation.

Findings

  • [P1] Handle source-less V2 grants before treating them as manual — src/OpenClaw.Shared/ExecApprovals/ExecAllowlistMatcher.cs:37-45
  • [high] Source-less generated grants remain path-only — src/OpenClaw.Shared/ExecApprovals/ExecAllowlistMatcher.cs:37
Agent review details

Security

Needs attention: The proposed legacy fallback can retain broader command authority than the new argument-bound approval model promises.

Review metrics

Metric Value Why it matters
Change surface 44 files, +3,351 / -704 lines This is a broad authorization, UI, documentation, and test change rather than an isolated editor repair.

Merge-risk options

Maintainer options:

  1. Add a safe legacy-grant migration (recommended)
    After maintainers choose the legacy policy, add upgrade coverage using an entry created by current main and ensure changed arguments cannot reuse generated authority.
  2. Accept broad legacy authority explicitly
    Document and test that source-less entries remain intentionally broad if maintainers prioritize uninterrupted existing approvals.

Technical review

Best possible solution:

Adopt a maintainer-approved, fail-safe migration or confirmation flow for source-less V2 grants, then rebase onto the runtime binder and prove both upgrade and fresh-install behavior.

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

Yes. Current main can create a source-less entry through Allow Always, and the proposed matcher then accepts that entry as a broad path-only rule for a different argument tail.

Is this the best way to solve the issue?

No. Argument-bound grants are the right destination, but treating unmarked current-main grants as manual cannot safely preserve both the new security guarantee and existing users’ broad manual rules.

Full review comments:

  • [P1] Handle source-less V2 grants before treating them as manual — src/OpenClaw.Shared/ExecApprovals/ExecAllowlistMatcher.cs:37-45
    Current main writes Allow Always rules with only id and pattern, so they arrive here without source or argPattern. This fallback therefore accepts a prior generated approval for any new argument tail. Add the maintainer-chosen migration or confirmation behavior and a regression test that creates the entry through the current-main store path.
    Confidence: 0.97

Overall correctness: patch is incorrect
Overall confidence: 0.97

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P1: The unresolved upgrade path can authorize a changed command argument tail under a prior generated approval.
  • merge-risk: 🚨 compatibility: The PR changes interpretation of persisted approval rules written by existing releases.
  • merge-risk: 🚨 security-boundary: The PR changes durable authorization from path-only matching to path-and-argument matching.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🌊 off-meta tidepool and patch quality is 🧂 unranked krab.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.

Evidence

Security concerns:

  • [high] Source-less generated grants remain path-only — src/OpenClaw.Shared/ExecApprovals/ExecAllowlistMatcher.cs:37
    Existing generated grants lack provenance, but the matcher treats source-less entries as manual broad rules. A changed argument tail can therefore inherit earlier Always Allow authority after upgrade.
    Confidence: 0.97

What I checked:

Likely related people:

  • Barbara Kudiess: Authored the merged V2 approvals replacement that established the current persisted entry shape. (role: introduced V2 approval storage behavior; confidence: high; commits: 4806eaac7c24; files: src/OpenClaw.Shared/ExecApprovals/ExecApprovalsStore.cs)
  • Scott Hanselman: Recent history credits execution-approval hardening work adjacent to the resolver and persistence boundary. (role: recent execution-approval hardening contributor; confidence: medium; commits: 261ba11aaad6; files: src/OpenClaw.Shared/ExecApprovals/ExecApprovalsCoordinator.cs, src/OpenClaw.Shared/ExecApprovals/ExecCommandResolution.cs)
  • AlexAlves87: History attributes the approval persistence write path to this contributor. (role: approval-store write-path contributor; confidence: medium; commits: cfca9f59c6fc; files: src/OpenClaw.Shared/ExecApprovals/ExecApprovalsStore.cs)

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 (3 earlier review cycles)
  • reviewed 2026-08-06T05:48:41.866Z sha 747aedb :: needs maintainer review before merge. :: none
  • reviewed 2026-08-06T07:05:41.470Z sha b4223c0 :: found issues before merge. :: [P1] Handle existing generated grants before treating path-only rules as manual
  • reviewed 2026-08-06T07:11:33.927Z sha dba7302 :: found issues before merge. :: [P1] Migrate source-less generated grants before treating them as manual

@bkudiess
bkudiess force-pushed the bkudiess-investigate-exec-policy-regression branch from 747aedb to b4223c0 Compare August 6, 2026 07:01
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 6, 2026
Replace the stale V1-shaped Permissions editor with the file-backed V2 policy model, explicit validation, scoped rules, and CAS-safe persistence. Add upstream-compatible argument-bound generated grants so changed argv no longer reuses Allow Always authority.

Co-authored-by: Copilot App <[email protected]>
@bkudiess
bkudiess force-pushed the bkudiess-investigate-exec-policy-regression branch from dba7302 to d725e0e Compare August 6, 2026 08:18
@bkudiess bkudiess changed the title fix(exec): restore V2 approval parity fix(exec): restore V2 approvals UI and argument binding Aug 6, 2026
@clawsweeper clawsweeper Bot added P1 Urgent regression or broken agent/channel workflow affecting real users now. and removed P2 Normal priority bug or improvement with limited blast radius. labels Aug 6, 2026
@bkudiess

bkudiess commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator Author

Closing this draft while we pause and let the focused runtime work in #1109 settle. The validated UI and argument-policy work remains preserved on the branch for possible future reuse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. P1 Urgent regression or broken agent/channel workflow affecting real users now. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant