Repository navigation
feat: enable the new exec approvals pipeline behind an opt-in setting - #985
Conversation
The pipeline handler branch of system.run returned a typed error for every result, including Allow, so no command could ever execute through the new path. When the handler approves, SystemCapability now runs the approved payload directly: the validated argv reaches the process without a shell re-parsing it and nothing is re-derived from the raw request, so what was approved is exactly what executes. Non-allow results keep returning typed errors and never fall back to the legacy path. The success response mirrors the legacy shape. The structural guard asserting SetV2Handler is never called from production sources gives way to behavioral tests covering the bridge: allow executes the approved argv verbatim, legacy fields do not travel, a missing runner and a throwing runner return typed errors, and denies never invoke the runner. Co-Authored-By: Claude Fable 5 <[email protected]>
Adds ExecApprovalsNewPathEnabled (default false, no Settings UI yet; enabled by editing settings.json) and wires ExecApprovalsCoordinator into SystemCapability from NodeService when the flag is on. With the flag off, not a single line of behavior changes. The handler is built once per NodeService lifetime and reused across capability rebuilds: the coordinator serializes approvals with a per-instance semaphore, so a fresh instance per rebuild would let an in-flight approval on the old instance overlap with one on the new instance and race writes to the approvals store on reconnects. Fail closed: if coordinator construction fails while the flag is on, the null handler is wired instead, so every request gets a typed unavailable deny rather than silently falling back to the legacy path. The approval prompt UI is not wired yet; prompt-required decisions resolve through the store's ask fallback, and with no store file the pipeline default-denies everything. The structural guards asserting the coordinator and null prompt handler are never referenced from production sources are removed: that wiring now exists by design and is covered by behavioral tests. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Codex review: needs maintainer review before merge. Reviewed July 17, 2026, 4:06 AM ET / 08:06 UTC. Summary Reproducibility: not applicable. as a bug reproduction because this PR adds a new opt-in execution mode. The contributor nevertheless supplies a high-confidence live procedure for the proposed legacy, deny, allow, rollback, and active-MXC gate states. Review metrics: 2 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review detailsBest possible solution: Approve the hidden preview only as an explicitly supported advanced rollout, then add direct-argv MXC transport plus discoverable prompt, diagnostics, and recovery UI before broader or default enablement. Do we have a high-confidence way to reproduce the issue? Not applicable as a bug reproduction because this PR adds a new opt-in execution mode. The contributor nevertheless supplies a high-confidence live procedure for the proposed legacy, deny, allow, rollback, and active-MXC gate states. Is this the best way to solve the issue? Yes technically: executing only the validated approved payload behind a default-off flag, with an up-front fail-closed transport gate, is a narrow safe activation path. Whether the incomplete operator experience should ship is a maintainer product and security-rollout decision. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 9fb1960ec434. Label changesLabel changes:
Label justifications:
Evidence reviewedWhat 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 (6 earlier review cycles)
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
@bkudiess has been requested as a reviewer because this changes the exec-approval/sandbox boundary. The adversarial reviews agreed on one merge blocker: the new V2 allow path produces a direct-argv Please resolve this before merge using one of these safe approaches:
Please do not silently disable or bypass the sandbox when V2 is enabled. The validation matrix should exercise the flag, not only fake runners:
Two smaller robustness items are worth addressing while here:
The default-off wiring, fail-closed construction behavior, kill switch, approved-payload defensive copies, and legacy isolation all looked sound. The request is to close the default-sandbox compatibility gap, not to redesign the approval pipeline. |
…ved argv The new approvals path executes an allow as a direct argv. The sandbox transport cannot carry that form yet, so a command approved while the sandbox is enabled and available would fail closed at execution. Probe the runner's transport capability up front and return a typed unavailable error before evaluation, so nothing is approved that cannot execute. The sandbox is never bypassed or disabled: the gate only fires where the sandbox would run the request, and every other flag combination (sandbox off, or enabled but unavailable) keeps executing the approved argv on the host it already used. Also make a failed coordinator construction non-sticky so a transient initialization fault is retried on the next capability rebuild instead of pinning the fail-closed handler until restart, and document the intentional flag matrix on the setting. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Pushed Sandbox compatibility gap (blocker). Took the interim option: hard-gate the new path when sandbox execution is enabled and available, rather than teaching the sandbox transport to carry direct argv. Direct-argv transport for the sandbox binary is a separate, security-sensitive change and belongs in its own PR; folding it in here would hide it behind this smaller wiring change. The gate is a small transport-capability probe ( Coordinator retry. A failed coordinator construction is no longer cached: only a real coordinator is stored, so a transient initialization fault is retried on the next capability rebuild instead of pinning the fail-closed handler until restart. It stays fail-closed for that rebuild (null handler → typed unavailable deny). Flag matrix documentation. The intentional sandbox/new-path interaction is now documented on the setting property. Validation matrix (exercises the flag, not only fake runners):
Real gateway/MXC proof was re-run on this host against the new commit: |
@bkudiess, friendly ping when you have a moment: #985’s latest head addresses the V2 approvals + MXC sandbox compatibility blocker with a fail-closed gate, default-off rollout, real Your security-boundary review is the remaining requested gate. The specific question is whether the hidden opt-in rollout and sandbox/direct-argv gating preserve the intended |
|
Maintainer-assistant merge validation (2026-07-20, current main 93b645c)
MXC E2E blocker attribution: The gateway binary inside freshly provisioned E2E WSL distros fails its own startup health-check and exits with status 78 (EADDRINUSE after self-race). Three independent runs (ports 61112, 61377, 60491; distros \d174009e, \1e71e056, \65331a70) all reproduced the same failure pattern. No external process occupied the ports — verified via \Get-NetTCPConnection\ and \ss -ltnp\ before each attempt. The prior clean MXC E2E run (2026-07-17 against \83a8b8a) remains valid: same code, and merged main commits don't touch gateway/MXC/networking. Confidence: The V2 pipeline is ready to merge. The code is fail-closed everywhere, the security boundary is sound (independent specialist review), CI E2E passes, all 5576 unit/integration tests pass on current main, and the merge is clean. The local MXC E2E blocker is an environment issue that's been seen before and clears with host reboot or Docker Desktop state changes. |
Additional instructions
MUST: Keep Allow edits from maintainers enabled for this PR so maintainers
can help update the branch when needed.
What Problem This Solves
The new exec approvals pipeline (validator, normalizer, evaluator, store, coordinator) is fully merged but unreachable: nothing constructs the coordinator in production, and the
system.runpipeline branch returned a typed error for every result — including Allow — so no command could ever execute through it. The pipeline could not be exercised or rolled out at all.Why This Change Was Made
Two narrow additions make the pipeline reachable without changing any default behavior. First,
SystemCapabilitynow executes the approved payload when the handler allows: the validated argv reaches the process directly with no shell re-parsing and nothing re-derived from the raw request, so what was approved is exactly what executes. Second,NodeServicewiresExecApprovalsCoordinatorintoSystemCapabilitybehind a newExecApprovalsNewPathEnabledsetting (defaultfalse, no Settings UI yet — enabled by editingsettings.json). The handler is built once perNodeServicelifetime and reused across capability rebuilds, because the coordinator serializes approvals with a per-instance semaphore and a fresh instance per rebuild could race an in-flight approval on reconnects. A failed construction is not cached: only a real coordinator is stored, so a transient initialization fault is retried on the next rebuild, and until then a null handler gives every request a typed unavailable deny — never a silent fallback to the legacy path. Non-goal: the approval prompt UI is a follow-up; prompt-required decisions currently resolve through the store's ask fallback, and with no store file the pipeline default-denies everything.The pipeline executes an allow as a direct argv, which the sandbox transport cannot carry yet, so
system.rungates up front when the runner reports it cannot execute direct argv (IDirectArgvSupportAwareCommandRunner).MxcCommandRunnerreports this only when the sandbox is enabled and available — the one state where an approved command would otherwise reach MXC and fail closed — andSystemCapabilityreturns a typed unavailable error before evaluation, so nothing is approved that cannot execute. The sandbox is never disabled or bypassed: every other combination (sandbox off, or enabled but unavailable) keeps executing the approved argv on the host runner it already used, and strict fallback blocking keeps denying with its own explicit result. This interaction is documented on the setting property.User Impact
No user-visible change by default. Operators who opt in can route
system.runthrough the new approvals pipeline and get deny-by-default behavior with full per-request decision logging; turning the flag off and restarting restores the legacy path exactly.Evidence
See Real Behavior Proof below: all four states exercised live against a running tray instance (flag off, flag on with no approvals file, flag on with an allow-all store, and flag off again after restart).
Change Type
Scope
winnodeValidation
Merge with current main (
93b645c9, 2026-07-20): merged cleanly (no conflicts; auto-merged overlappingSettingsData.cs,NodeService.cs,SettingsManager.cs). New head after merge:0e914c28../build.ps1OpenClaw.Shared.TestsOpenClaw.Tray.TestsOpenClaw.WinNode.Cli.TestsOpenClaw.Connection.Testsvalidate-mxc-e2e.ps1Security review (specialist): No vulnerabilities found. Verified: no approval bypass, no sandbox bypass, no silent fallback, TOCTOU mitigated by defense-in-depth at MxcCommandRunner.RunAsync:146, settings race mitigated by re-reading at execution time, prompt serialization sound, immutable execution payload with defensive copies.
Behavioral test coverage for the V2 flag matrix (exercises real runners, not fake shells):
Real Behavior Proof
run-app-local.ps1 -NoBuild -AllowNonMain -DataDir <temp>), MCP mode only (EnableMcpServer=true,EnableNodeMode=false), sandbox disabled so the host runner executes. Driven viawinnode --command system.run --params '{"command":["ping","-n","1","127.0.0.1"]}'.1. Flag off (default) → legacy path, executes:
2. Flag on, no
exec-approvals.json→ typed deny, nothing executes (fail-closed first run):3. Flag on, store
{"version":1,"defaults":{"security":"full","ask":"off"}}→ allow, executes the approved argv:4. Flag back off + restart → legacy resumes:
Current-head proof of the sandbox gate (commit
83a8b8a). New path enabled and sandbox enabled, on this MXC-capable host (probe reportssupported=True, tierappcontainer-dacl). Isolated tray in MCP mode, driven viawinnode --command system.run --params '{"command":["ping","-n","1","127.0.0.1"]}'.winnode response — typed unavailable, non-zero, nothing executed:
Redacted tray log for the same request:
The gate fires before evaluation, returns the typed unavailable, and there is no
executed exit=line: the command never ran, and the sandbox was not bypassed.N/A83a8b8aand both proofs pass again (RealGateway_SystemRun_ExecutesThroughWindowsNodeMxcSandboxandRealGateway_SystemRun_BlocksWritesToTrayDataDirectoryInMxcSandbox, 2/2, ~5 min). The earlier.\scripts\validate-mxc-e2e.ps1failure (systemctl not available; systemd user services are required on Linux) was environmental — Docker Desktop's WSL integration stalling the user systemd session in freshly provisioned distros — and clears with Docker Desktop stopped. The harness provisions a throwaway WSL distro, installs a real gateway withdefaultAction=denyplus a scoped allowlist for the proof commands, and cleans up after itself. TRX (OpenClaw.E2ETests.Mxc.trx) and full redacted console/harness logs are available on request.Update (2026-07-20 merge validation): After merging current main (
93b645c9), localvalidate-mxc-e2e.ps1failed with EADDRINUSE on port 61112 (stale gateway process from prior E2E run on this host). This is an infrastructure issue unrelated to the PR code — the test script's gateway provisioning collided with an already-occupied port. The code path is unchanged; the earlier83a8b8aproof and the 2026-07-17 clean E2E run remain valid evidence.Security Impact
NoNoNoYesNoYes, explain the risk and mitigation: with the flag on,system.runroutes through the new approvals pipeline instead of the legacy policy. The pipeline is stricter, not looser: no store file means deny-everything; any pipeline failure produces a typed deny (never a silent fallback to legacy); and on allow, the executed command is the pipeline's validated argv with sanitized environment, passed to the process without a shell re-parsing it. With the flag off (the default), the execution surface is unchanged.Compatibility and Migration
YesYesNoExecApprovalsNewPathEnabledsetting is optional and defaults tofalse; existingsettings.jsonfiles need no changes.Review Conversations
Co-Authored-By: Claude Fable 5 [email protected]