openclaw-windows-node icon indicating copy to clipboard operation
openclaw-windows-node copied to clipboard

MXC 0.7 processContainer: granted filesystem paths unusable — absolute paths doubled to C:\C:\..., writes false-succeed

Open samanthamsong opened this issue 3 months ago • 4 comments

Summary

On the Windows Node (MXC 0.7 processContainer backend, Bind Filter/BFS), folders granted as read/write in the sandbox settings page (e.g. Downloads, Documents) are unusable inside the container. Root cause appears to be a path-normalization bug, not a policy/allowlist choice. Writes report false success, risking silent data loss.

Environment

  • Host: Windows Node paired to a WSL gateway (gateway has no /mnt/c; all FS work routes to node)
  • Backend: Windows MXC 0.7 processContainer (wxc-exec.exe, Bind Filter/BFS)
  • Sandbox settings: Downloads granted read/write

Verified, reproducible symptoms

  1. Absolute-path doubling (100% repro): attrib "C:\Users\<user>\Downloads" returns Path not found - C:\C:\Users\<user>\Downloads. Same for Documents, Desktop, and C:\Windows. The backend prepends container root C:\ to already-absolute paths.

  2. Granted folder, three different failures: for %USERPROFILE%\Downloads: if exist reports MISSING; echo x > ...\t.txt returns exit 0; type ...\t.txt returns "syntax is incorrect"; dir ... returns "Access is denied".

  3. Relative write false-success: echo hi > rel.txt returns exit 0, but attrib rel.txt returns "Path not found" for the container CWD path.

  4. PowerShell output swallowed: cmd /c echo HELLO works; powershell -NoProfile -Command "Write-Output 'X'" returns only DACL-recovery stderr, no stdout. Source appears to be wxc-host-prep.exe / filesystem_dacl.rs managing the \Device\Null descriptor and erroring with GetNamedSecurityInfoW: WIN32_ERROR(2) on its own temp dirs.

  5. Hard timeout on \\?\-prefixed and forward-slash (C:/...) paths.

Config model (from wxc-exec.exe strings)

Keys: readwritePaths, readonlyPaths, deniedPaths, least_privilege_mode, containment. Filesystem is default-deny ("Paths are denied by default unless granted via readwritePaths or readonlyPaths"). Binary also carries a pwsh caveat ("add ... to readonlyPaths ... or upgrade to pwsh 7.7+") and a ReFS/Dev Drive warning ("Bind Filter (BFS) does not work correctly on ReFS volumes"). Intended behavior: granted folders go into readwritePaths and become usable. The defect is that they don't.

Root cause (hypothesis)

Path-normalization/prefix-join bug in the processContainer Bind Filter: already-absolute C:\... paths get re-rooted against the container root (C:\C:\...), and granted mounts aren't registered for stat/read even when writes are redirected. Net: readwritePaths grants never resolve inside the container.

Impact

  • Granted folders (Downloads/Documents) silently inaccessible.
  • Writes return exit 0 but data isn't retrievable at the expected path: silent data-loss risk.
  • Agents can't distinguish "file absent" from "path mangled"; PowerShell node work returns no output.

Requested fixes

  1. Stop re-rooting already-absolute C:\... paths (fix C:\C:\... doubling).
  2. Make readwritePaths/readonlyPaths grants actually stat/list/read/write inside the container.
  3. Make writes to unmounted paths fail loudly instead of exit 0.
  4. Fix DACL-recovery noise so PowerShell stdout returns like cmd.
  5. Handle \\?\ / forward-slash paths without hanging.
  6. Confirm settings-page grants are written into MXC readwritePaths/readonlyPaths and surface active mounts.

Repro (single-line cmd on node; MXC 0.7 rejects CR/LF in commands)

  1. attrib "C:\Users\<user>\Downloads" - observe C:\C:\... in error.
  2. echo x > "%USERPROFILE%\Downloads\t.txt" (exit 0), then type / dir same path - syntax error / access denied.
  3. echo hi > rel.txt then attrib rel.txt - write ok, stat "Path not found".
  4. cmd /c echo HELLO vs powershell -NoProfile -Command "Write-Output 'X'" - cmd works, powershell stdout swallowed.

samanthamsong avatar Aug 11 '26 00:08 samanthamsong

Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed September 4, 2026, 3:34 PM ET / 19:34 UTC.

Summary Keep open for maintainer-owned native verification. Current main forwards folder grants and ships MXC SDK 0.8.0, but the available source and tests do not prove that the reported native mount, absolute-path, and false-success behavior is resolved; the collaborator-authored security-boundary report also has recent active maintainer ownership.

Reproducibility: no. high-confidence current-main reproduction is available. The report provides a concrete MXC 0.7 command matrix, while current main uses MXC 0.8.0 and requires a native Windows MXC-capable gateway run to establish present behavior.

Root-cause cluster Relationship: canonical Canonical: https://github.com/openclaw/openclaw-windows-node/issues/1146 Summary: This issue remains the canonical report for filesystem-grant resolution and false-success writes; the related PowerShell repair addressed only an adjacent output symptom.

Members:

  • partial_overlap: https://github.com/openclaw/openclaw-windows-node/pull/1147 - The merged PR proved an opt-in fix for PowerShell and Win32k-dependent command output, but its stated scope did not resolve positive filesystem grant resolution.

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Ways to help us reproduce this

  • Add a screenshot or short recording showing the behavior.
  • Add expected vs actual behavior.

Maintainer decision needed

Question Recommendation
After native MXC 0.8.0 verification establishes whether emitted grants work, should OpenClaw add a temporary fail-closed guard for unreliable user grants or route the demonstrated failure directly to MXC? Verify before changing policy: Run the native grant matrix with emitted policy paths and host-side file checks, then select the smallest response supported by the trace.

Why: The choice affects filesystem containment, user data safety, and whether an OpenClaw compatibility change is justified when current source already forwards grant paths unchanged.

Next step A current native MXC trace and a filesystem-containment decision are required before a safe repair boundary can be selected; the issue is collaborator-authored, security-labeled, and actively landing.

Security Needs attention: The report raises a plausible filesystem-containment and silent-write safety concern that needs current native verification before its owner or remedy can be determined.

Review details

Best possible solution:

Capture a native Windows MXC 0.8.0 gateway trace for a granted read-write folder, a granted read-only folder, and an ungranted-write control; if emitted paths are unchanged and the grant still fails, preserve containment with a narrow fail-closed response while filing the backend defect with that trace.

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

No high-confidence current-main reproduction is available. The report provides a concrete MXC 0.7 command matrix, while current main uses MXC 0.8.0 and requires a native Windows MXC-capable gateway run to establish present behavior.

Is this the best way to solve the issue?

Unclear. Source shows grants are forwarded without drive-root rewriting, but only a real native trace can determine whether a narrow OpenClaw repair is needed or the remaining defect belongs to MXC.

AGENTS.md: found and applied where relevant.

Remaining risk / open question:

  • A native MXC 0.8.0 run has not yet demonstrated that a selected host grant can list, read, write, and verify content while an ungranted write fails loudly. Treating the SDK upgrade or source serialization as a fix could leave silent write loss or unclear containment behavior unresolved.

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

Label changes

Label changes:

  • remove clawsweeper:needs-product-decision: Current issue advisory state no longer selects this label.

Label justifications:

  • P0: The report describes successful-looking writes that cannot be retrieved at their expected granted path, a potential silent data-loss path in core command execution.
  • impact:data-loss: The reported exit-zero write followed by missing or unreadable content is directly a potential data-loss symptom.
  • impact:security: The behavior concerns correctness of sandbox filesystem grants and denial boundaries.
Evidence reviewed

Security concerns:

  • [medium] Verify filesystem-grant enforcement on current MXC An exit-zero write that cannot be observed at the granted host path would conceal a failed side effect and make containment behavior unreliable; current source evidence does not yet settle native MXC enforcement. Confidence: 0.82

What I checked:

  • Current grant projection: The policy builder resolves Documents, Desktop, Downloads, and custom-folder settings into readonly or readwrite path lists, then filters only denied overlaps. This supports the reported configuration path but cannot prove native MXC mount behavior. (src/OpenClaw.Shared/Mxc/MxcPolicyBuilder.cs:75, 4206611f2b2e)
  • Current configuration emission: The config builder copies policy grant paths into filesystem.readonlyPaths and filesystem.readwritePaths without adding a drive root, then appends only the per-invocation scratch directory. (src/OpenClaw.Shared/Mxc/MxcConfigBuilder.cs:101, 4206611f2b2e)
  • Existing positive-grant test contract: The MXC integration matrix expects a custom read-write folder to write and read successfully, a read-only folder to read successfully, and a read-only write to fail. It can skip when MXC is unavailable, so it is not current native proof. (tests/OpenClaw.Shared.Tests/Mxc/MxcCommandRunnerIntegrationTests.cs:203, 4206611f2b2e)
  • MXC SDK upgrade provenance: Current package metadata pins @microsoft/mxc-sdk to 0.8.0; commit 911f368 upgraded the SDK after the report's MXC 0.7 environment. (package.json:7, 911f36860b2d)
  • Release containment check: The MXC 0.8.0 upgrade commit is contained in released tags v2026.7.1-2, v2026.7.1-3, and v2026.7.1-4. Release inclusion does not establish that the reported native filesystem behavior was exercised. (911f36860b2d)
  • Required native proof remains narrower than the report: The documented gateway MXC E2E proves contained execution, PowerShell output, and a denied write. It does not document a current native positive test of a user-selected Documents, Downloads, or custom grant. (docs/WINDOWS_NODE_TESTING.md:186, 35cb92dcf28d)

Likely related people:

  • Scott Hanselman: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vitor Cepeda Lopes: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
How this review workflow works
  • 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.

clawsweeper[bot] avatar Aug 11 '26 00:08 clawsweeper[bot]

Maintainer investigation update against current origin/main at bc518f7bd1581c69ffc7967ba2ce301b8e2f777a:

  • The Hub-side path projection still appears correct. MxcPolicyBuilder resolves Documents, Desktop, Downloads, and custom-folder selections and places each unchanged path into the requested read-only/read-write list (source).
  • MxcConfigBuilder copies those policy lists unchanged, adds only the per-invocation scratch directory to readwritePaths, filters configured denies, and does not prepend C:\ to granted paths (source).
  • The existing real-runtime matrix has the right observable contract: write and read the granted path inside MXC, verify the output file exists at the requested host path, and verify a read-only write remains absent (source). An exit code alone is intentionally not accepted.
  • The PowerShell/empty-output portion of the original report has since been addressed separately by merged PR #1147 through the explicit Windows UI API opt-in. This investigation remains focused on granted-path resolution and false-success writes.

Native proof could not be completed in this run:

  • Azure Crabbox provisioning failed before a lease was created because the subscription's approved LowPriorityCores quota was below the requested Windows VM size.
  • Brokered AWS did create native-Windows lease cbx_19cf22b3a598 (pearl-lobster, run run_ce051d7c51ff), but the stock image is Windows Server build 20348. That OS cannot exercise the MXC 0.7 processContainer/AppContainer path required by this issue. The image also lacked the repository's Node/npm prerequisites, but installing those would not make this OS MXC-capable.
  • The attempted lease release is currently timing out at the Crabbox coordinator; cleanup has been requested repeatedly and remains an infrastructure follow-up.

Therefore I am not claiming that the upstream MXC backend is proven to be the root cause, and I am not opening a speculative Hub fix or weakening containment/host-fallback policy. The next required step is a real native MXC-capable Windows repro on this exact head that records: requested grant path, emitted readwritePaths/readonlyPaths, in-container list/read/write output, observable host path/content, and a denied-write control. If that fails while the emitted path is unchanged, we will have evidence for a source-backed microsoft/mxc report and can decide whether a narrow fail-closed Hub guard is warranted.

clawsweeper avatar Aug 13 '26 17:08 clawsweeper

This issue has been automatically marked as stale due to inactivity. Please add updated OpenClaw Windows details or it will be closed.

github-actions[bot] avatar Aug 28 '26 05:08 github-actions[bot]

Resolved by merged PR #1327. OpenClaw now admits Node Sandbox only for exact, unaugmented MXC BaseContainer, adds safe non-cascading read-only drive-root grants so granted subfolders work, rejects BFS/DACL tiers, and skips the native MXC probe entirely on Windows Server. The historical MXC 0.7 path-doubling symptom is not part of the supported MXC 0.8 path; the remaining upstream BaseContainer contract issue is tracked at microsoft/mxc#1109.

shanselman avatar Sep 05 '26 01:09 shanselman