Repository navigation
fix: make Gateway shell execution work on Windows nodes - #972
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2f172d1e4e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| var hasNestedTargets = parseResult.Targets.Count > 0; | ||
| var hasExplicitOuterRule = !string.IsNullOrWhiteSpace(approval.MatchedPattern); | ||
| var evaluateOuter = | ||
| !hasNestedTargets || | ||
| hasExplicitOuterRule || | ||
| approval.Allowed || | ||
| approval.Action == ExecApprovalAction.Prompt; |
There was a problem hiding this comment.
Restrict inner-only approval to shell wrappers
When the full command is denied only by the default policy, this treats any parsed target as enough to skip evaluating the outer command. ExecShellWrapperParser.Expand also creates targets for top-level separators, not just Gateway wrappers, so a direct request like hostname; whoami now bypasses the default deny for the full command and runs because both segments match exact default allow rules. That broadens exact approvals from single commands to shell chains; only commands proven to be wrapper payloads should be allowed to defer the outer denial.
Useful? React with 👍 / 👎.
|
Codex review: needs changes before merge. Reviewed July 11, 2026, 9:42 PM ET / July 12, 2026, 01:42 UTC. Summary Reproducibility: yes. The original Review metrics: 2 noteworthy metrics.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. 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:
Copy recommended automerge instructionNext step before merge
Security Review findings
Review detailsBest possible solution: Preserve literal Windows backslashes while extracting wrapper payloads, add an exact-allow regression using a quoted path such as Do we have a high-confidence way to reproduce the issue? Yes. The original Is this the best way to solve the issue? No, not yet. Deferring an unmatched recognized wrapper to exact inner rules is an appropriate narrow fix, but exact policy matching cannot safely use a payload whose Windows path text was modified. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 622c0e27c6b0. Label changesLabel changes:
Label justifications:
Evidence reviewedSecurity concerns:
Acceptance criteria:
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 (3 earlier review cycles)
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d0c55502e3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| { | ||
| const string reason = "Wrapped commands require an exact allow rule"; | ||
| Logger.Warn($"system.run DENIED: {target.Command} ({reason})"); | ||
| return Error($"Command denied by exec policy: {reason}"); |
There was a problem hiding this comment.
Raise auto-deny events for wrapper exact-allow rejections
When this new guard rejects a wrapper whose inner command matched only a broad allow rule (for example, the default-deny policy with echo * and cmd.exe /c echo ok), it returns an error directly instead of going through EnsureApprovedAsync/RaisePolicyAutoDenied. NodeService relies on PolicyAutoDecided to drive OnLocalExecApprovalDecided denial notifications, so these new policy denials are silent in the tray even though other auto-denies still raise the event.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c98e695e83
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (!evaluateOuter && | ||
| innerApprovalCheck.PromptDecisionKind == null && | ||
| !IsExactAllowRuleForCommand(innerApproval, target.Command)) |
There was a problem hiding this comment.
Preserve Windows paths before exact inner approval
When the Gateway sends an argv wrapper such as cmd.exe /d /s /c "dir C:\Users", FormatExecCommand quotes the payload because it contains a space, but ExecShellWrapperParser.Tokenize treats backslashes inside double quotes as escapes and strips them before target.Command reaches this new exact-rule check. As a result, an operator's exact allow rule for common Windows path commands like dir C:\Users or type C:\... still fails through the Gateway path because the parsed inner command is compared as dir C:Users.
Useful? React with 👍 / 👎.
|
Land-ready proof for exact head
Real behavior proof from the exact-head Release app (
The mandatory isolated |
|
Landed as |
Summary
system.runwraps Windows commands ascmd.exe /d /s /c <command>, but the Hub rejected the unmatched outer wrapper before checking the exact approved command. The MXC sandbox also treated an administrator-group ACL as usable by its restricted token, omitted a safe default cwd, and returned nosuccessfield for the agent exec projection.hostname, receive the correct stdout and exit code from the live Surface, yet the agent still saw a failed command.WRITE_DAC; default omitted cwd to the writable MXC scratch directory; return the sharedsystem.run.successcontract.Change Type (select all)
Scope (select all touched areas)
winnodeLinked Issue/PR
Validation
./build.ps1on Surface ARM64 — Shared, CLI, WinNode CLI, SetupEngine, and WinUI built.dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj -c Debug --no-build— 2,739 passed, 31 skipped, 0 failed.dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj --no-restore— 1,669 passed, 0 failed../scripts/validate-mxc-e2e.ps1 -Configuration Release— blocked before either MXC assertion: the isolated unpackaged WinUI host exited during startup with0xC000027B. Debug and Release both reproduce the pre-MCP harness crash; the production-data Release host runs and completes the real Gateway scenario below.Real behavior proof
10.0.26200; live Gateway onclawmac.c98e695e.Windows Node (STEIPETESURFACE)to the live Gateway with its production node identity and an exacthostnameallow rule.node.invoke system.runusing Gateway argvcmd.exe /d /s /c hostnamereturnedstdout: steipetesurface,exitCode: 0,timedOut: false,success: true.a42d77a0-848d-489b-95e5-c91b2859a32busedexec host=node; result:Hostname: steipetesurface,Exit status: Success, one tool call, zero failures.success.Security Impact (required)
WRITE_DACgrant and respects every token SID deny.Compatibility / Migration
Review Conversations