Skip to content

ProcessContainer (BaseContainer): GetFinalPathNameByHandleW(VOLUME_NAME_DOS) always fails — Mount Manager unreachable, breaks git's cwd and Node's realpath.native #1464

Open

Description

@laurentftech

Relevant area(s)

Windows

Brief description of your issue

Under the tier 1 BaseContainer runner, a sandboxed process cannot translate an NT path back to a drive-letter path. GetFinalPathNameByHandleW fails with ERROR_ACCESS_DENIED (5) for every VOLUME_NAME_DOS request, on a handle the process just opened successfully, while the same call with VOLUME_NAME_NT succeeds. GetVolumeNameForVolumeMountPointW("C:\\") is refused too. So the Mount Manager seems to be out of reach from the container, and the NT→DOS translation needs it.

No filesystem policy changes this: it fails with the working directory inside readwritePaths, and also with C:\ itself in readonlyPaths.

Ordinary developer tools depend on this call:

  • Node.js: fs.realpathSync.native / fs.promises.realpath (libuv uv_fs_realpath) fail with EPERM on any path, the cwd included. npm and many CLIs resolve paths this way.
  • Git for Windows (native mingw64\bin\git.exe): mingw_getcwd calls GetFinalPathNameByHandleW, then falls back to GetLongPathNameW. That fallback has to list every ancestor folder by name, so every command that needs the work tree (init, status, rev-parse, ...) dies with fatal: unable to get current working directory: Permission denied unless the drive root is readable. Making C:\ readable means falling back to a deny list of everything beside the project, which defeats an allow-only policy.

git --version, cmd, PowerShell and NUL all work under tier 1, so this looks like the last thing between tier 1 and a usable git-based workflow.

Environment:

  • Windows 11 Home 24H2, build 26100.9457, x64
  • @microsoft/mxc-sdk 1.0.0, wxc-exec.exe (x64); --debug shows selected isolation tier: base-container, runner BaseContainer
  • Node 26.4.0, Git for Windows 2.45.1
  • Run from the interactive console session

Steps to reproduce

  1. Make a working folder, e.g. C:\mxc-lab\app.
  2. Config (ui.disable: false so that console tools start):
{
  "version": "1.0.0",
  "containment": "processcontainer",
  "process": {
    "commandLine": "node -e \"console.log(require('fs').realpathSync.native('.'))\"",
    "cwd": "C:\\mxc-lab\\app",
    "timeout": 30000
  },
  "filesystem": { "readwritePaths": ["C:\\mxc-lab\\app"] },
  "ui": { "disable": false }
}
  1. wxc-exec.exe config.json
  2. Same config with "commandLine": "git init -q repo".
  3. To isolate the call, a small probe that calls GetFinalPathNameByHandleW with each flag, GetLongPathNameW and GetVolumeNameForVolumeMountPointW on the cwd: https://github.com/laurentftech/pi-outpost/blob/feat/confined-terminal/scripts/probes/path-apis.cs (csc.exe from .NET Framework builds it; no SDK needed).

Expected behavior

realpathSync.native('.') prints C:\mxc-lab\app, git init creates the repository, and GetFinalPathNameByHandleW(h, ..., VOLUME_NAME_DOS) returns \\?\C:\mxc-lab\app, as it does outside the container. Resolving a path the process may already open should not need any extra grant.

Actual behavior

node realpath.native   EPERM: operation not permitted, realpath 'C:\mxc-lab\app'
git init               fatal: unable to get current working directory: Permission denied
                       (it leaves an empty `repo` folder behind)

path-apis.exe inside the container, cwd C:\mxc-lab\app:

GetVolumeNameForVolumeMountPointW(C:\)      ERROR 5
GetLongPathNameW                            ERROR 5   (OK once C:\ is in readonlyPaths)
CreateFileW(access=0, BACKUP_SEMANTICS)     OK
  GetFinalPathNameByHandleW(normalized, DOS) ERROR 5
  GetFinalPathNameByHandleW(opened, DOS)     ERROR 5
  GetFinalPathNameByHandleW(normalized, NT)  OK \Device\HarddiskVolume3\mxc-lab\app
  GetFinalPathNameByHandleW(opened, NT)      OK \Device\HarddiskVolume3\mxc-lab\app

Outside the container, every line succeeds. With C:\ added to readonlyPaths, the DOS variants still fail. Only git starts working, through its GetLongPathNameW fallback.

Related: #1061 (MSYS2 runtimes); this one affects native, non-MSYS tools.

Activity

  1. added
    Needs-Triage
    Issue-Bug
    OS-Windows
    on Oct 10, 2026
  2. Ahlabeeb commented on Oct 13, 2026

    @Ahlabeeb

    Additional repro on Windows 11 25H2 (build 26200.9457), via OpenAI Codex CLI 0.162.1 with [windows] sandbox = "mxc" (PSEC path).

    Inside the container, I opened a workspace file with CreateFileW(path, 0, FILE_SHARE_ALL, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL). The open itself succeeds. Then:

    Call Result
    GetFinalPathNameByHandleW(h, ..., VOLUME_NAME_DOS) ERROR_ACCESS_DENIED (5)
    GetFinalPathNameByHandleW(h, ..., VOLUME_NAME_GUID) 5
    GetFinalPathNameByHandleW(h, ..., VOLUME_NAME_NT) / VOLUME_NAME_NONE OK
    CreateFileW("\\\\.\\MountPointManager", 0, ...) 5
    QueryDosDeviceW("C:", ...) 5

    Because QueryDosDeviceW is also denied, Rust std's NT-path fallback in get_path_fallback cannot help either.

    The DACL of \\.\MountPointManager read on the host is D:(A;;FX;;;WD)(A;;FA;;;SY)(A;;FA;;;BA)(A;;FX;;;RC). It has no ALL APPLICATION PACKAGES or container-SID entry. Under a restricted (non-AppContainer) token, all of the calls above succeed.

    Impact beyond Node fs.realpathSync.native (libuv uses VOLUME_NAME_DOS):

    • Deno 2.9.6 is unusable with scoped permissions. Unless every permission is granted, its permission checker canonicalizes each path. So Deno.readFileSync(p) fails with Access is denied. (os error 5) under --allow-read but works under -A, and deno test and deno eval fail at startup.
    • Vite 5 build and Vitest 3 fail with EPERM ... realpath in rollup's commonjs resolver and the config loader.

    Minimal repro, from inside the container:

    node -e "require('fs').realpathSync.native('package.json')"
    

    Result: EPERM. fs.realpathSync (the JS implementation) works.

    Expected: a supported way for BaseContainer/PSEC processes to resolve DOS volume names, either by default or through a policy capability.

  3. added
    Backend-ProcessContainer
    Priority2
    and removed
    Needs-Triage
    on Oct 14, 2026
  4. nilleb commented on Oct 18, 2026

    @nilleb

    Another data point: GitHub Copilot CLI 1.0.90 itself can't run inside a BaseContainer because of this.

    Environment: Windows 11 25H2, build 26200, x64; tier base-container (allowDaclMutation: false), unelevated. mxc-sdk at fda29ac (Rust, via spawn_container_json). The whole Copilot CLI process runs in the container, with the project in readwritePaths and its install and package cache in readonlyPaths.

    Probe inside the container, on an open handle to a granted file:

    GetFinalPathNameByHandleW flag Result
    VOLUME_NAME_DOS (0) ret=0, error 5
    VOLUME_NAME_GUID (1) ret=0, error 5
    VOLUME_NAME_NT (2) ok: \Device\HarddiskVolume4\Users\<user>\dev\<project>\README.md
    VOLUME_NAME_NONE (4) ok

    Reading files and listing granted folders work. processContainer.filesystem.enumeratePaths is refused on this build ("not supported by this version of Windows"), so the #1109 route isn't available either.

    What breaks in Copilot CLI 1.0.90:

    • The JS side: fs.realpathSync fails with EPERM lstat 'C:\', and so does fs.realpathSync.native. I could shim the JS side by falling back to path.resolve on EPERM, after which the CLI starts and signs in.
    • The native runtime (runtime.node, Rust canonicalize) can't be shimmed, and it makes the CLI unusable:
      • Every prompt fails: Execution failed: Error: Request session.send failed with message: Shared writer storage I/O failed.
      • Failed to initialize MCP host: Shared writer storage I/O failed., so there are no MCP servers, including the built-in GitHub one.
      • -p mode exits with Error: Directory does not exist or cannot be accessed: <cwd>, as does --add-dir <granted path>.
      • Could not resolve instruction import '@AGENTS.md' from '<project>\CLAUDE.md': Access is denied. (os error 5)
      • git root lookup failed ... fatal: Unable to read current working directory: Permission denied

    I ruled out the DACL Copilot puts on its writer lock files (D:P(A;;FA;;;OW)(A;;FA;;;SY)(A;;FA;;;BA)): the container can create a file with that exact protected descriptor, reopen it and write to it.

    Copilot CLI's own experimental --sandbox runs on BaseContainer too, but it only contains the commands Copilot runs, not the CLI process itself, so it doesn't hit the runtime failures above. Its commands still hit the git and Clippy cases already reported in #694.

  5. removed
    Priority2
    on Oct 26, 2026
  6. added
    Needs-Attention
    Backend-ProcessContainer-Filesystem
    and removed
    Backend-ProcessContainer
    on Oct 26, 2026
  7. nilleb commented on Oct 27, 2026

    @nilleb

    #694 reported this same failure in AppContainer, and rsc found a workaround there. Granting the container capability read access to four objects makes GetFinalPathNameByHandleW(VOLUME_NAME_DOS) succeed:

    Object Access
    \GLOBAL?? DIRECTORY_QUERY | DIRECTORY_TRAVERSE | READ_CONTROL
    \GLOBAL??\C: (and each other drive) SYMBOLIC_LINK_QUERY | READ_CONTROL
    \GLOBAL??\MountPointManager SYMBOLIC_LINK_QUERY | READ_CONTROL
    \\.\MountPointManager FILE_GENERIC_READ

    #694 was closed because Tier 3 is being deprecated, not because it was fixed. rsc said there that they believed Tier 1 was affected too and asked for a Tier 1 test before closing. This issue shows that it is: BaseContainer fails the same way. Ahlabeeb's DACL dump above shows why: \\.\MountPointManager has no ALL APPLICATION PACKAGES or container-SID entry.

    Questions:

    1. Could BaseContainer add these grants for the container identity by default, since they only allow name lookups and not file access? Or could a policy capability turn them on?
    2. If neither is planned, does BaseContainer give its processes a SID that stays the same across sessions, so the AppContainer cannot execute GetFinalPathNameByHandle #694 grants could be applied once? Or is every container identity per-session, which would make a one-time administrator workaround impossible? We don't have admin rights on our machines, so this would have to come from the product rather than from local configuration.
    3. Windows sandbox fails for workspaces on folder-mounted volumes #1548 (folder-mounted volumes break Node's realpath) looks like the same family of problem with mounted-volume path resolution. It may be worth handling the two together.

    This is the main blocker for running agent CLIs inside a ProcessContainer. git can't read its working directory, Node's realpath.native fails, and Copilot CLI's native runtime (Rust canonicalize) fails. Since #1582 there is no fallback to an older isolation tier, so we have no workaround short of leaving the CLI uncontained.

  8. nilleb commented on Oct 27, 2026

    @nilleb

    Microsoft's own regression test for #694 reproduces this on a public 25H2 build.

    • Windows: 25H2, build 26200.9448. This is a managed Cloud PC without admin rights, so it isn't on the latest cumulative update (26200.9711 / 9725).
    • wxc-exec: v1.0.1, from the release mxc-release-binaries.zip (x64\wxc-exec.exe).
    • Test: tests/regression_tests/test_cases/Invoke-Issue694-GetFinalPathNameByHandle.ps1 from main, i.e. the native BaseContainer version from Remove Tier2 and Tier3 ProcessContainer fallbacks #1558.

    Result:

    wxc-exec.exe : VOLUME_NAME_DOS error: Access is denied
    

    The log confirms the container ran as "tier":"base-container", so this is not a fallback to an older tier.

    Side note: under Windows PowerShell 5.1, the script stops at the probe's stderr (a NativeCommandError under $ErrorActionPreference = 'Stop'), before it reaches its own tier and result checks. pwsh 7 may behave differently.

    Since #1558 now expects this test to pass with no workaround, which Windows build is it expected to pass on? If the fix depends on an OS change, is it planned for a public 24H2/25H2 cumulative update? That's the deciding question for anyone running agent CLIs (git, Node, Copilot CLI) in a ProcessContainer on managed machines.

  9. nilleb commented on Nov 9, 2026

    @nilleb

    Follow-up to my last comment: this is fixed by the October cumulative update.

    • Windows: 25H2, build 26200.9711 (KB5127648, 2026-10-13). Same managed Cloud PC without admin rights that failed on 26200.9448.
    • wxc-exec: v1.0.1 from the release zip. The log shows "tier":"base-container".

    Inside the container, with the repo in readwritePaths and the Node and MinGit install directories in readonlyPaths:

    Probe 26200.9448 26200.9711
    node -e "require('fs').realpathSync.native('.')" (Node 24.21.0) EPERM returns the DOS path
    git rev-parse --show-toplevel (git.exe, no MSYS shell) Unable to read current working directory: Permission denied returns the repo root
    Invoke-Issue694-GetFinalPathNameByHandle.ps1 VOLUME_NAME_DOS error: Access is denied not rerun yet

    This matches your nightly validation, where the #694 test passes on 26100.9711 (24H2) and 26200.9725 (25H2).

    One suggestion: docs/backends/process-container/os-version-support.md lists 26100.9278 / 26200.9278 as the ProcessContainer minimum. On anything between .9278 and .9711, git, Node realpath.native and Rust canonicalize fail inside the container with access denied, and nothing points at the OS build. A note in that table, or a probe warning below .9711, would save the next person some debugging.

    Anything that starts the MSYS runtime (sh.exe, script hooks, Git Bash) still fails. That's #1061 and unrelated to this issue.

  10. mrestrepo95 commented on Nov 19, 2026

    @mrestrepo95

    A related symptom we hit (same family, possibly not the same call): node <script> itself fails inside the container,
    because Node's module loader resolves the main script's real path by looking at every ancestor folder up to the drive
    root, which an allow-only policy does not grant. What we do meanwhile: NODE_OPTIONS=--preserve-symlinks-main --preserve-symlinks for
    every contained process, which makes Node take the path as given.

  11. GenTang commented on Nov 29, 2026

    @GenTang

    For the script-launch symptom above, I'd keep two regression checks: does node script.js reach the script body, and does spawn() return with piped stdio or IPC? In our FinShield comparison with MXC’s AppContainer backend, the file entry failed during drive lookup, and a separate node -e probe worked with inherited stdio but stalled with pipes or IPC. A separate check on the patched BaseContainer would tell you which of those two paths is working there.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Backend-ProcessContainer-FilesystemIssue-BugNeeds-AttentionOS-Windows

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions