Skip to content

AppContainer cannot execute GetFinalPathNameByHandle #694

Closed

Description

@rsc

Relevant area(s)

Windows

Brief description of your issue

GetFinalPathNameByHandle with VOLUME_NAME_DOS fails inside AppContainers and therefore fails in Tier 3 MXC. I can't run Tier 1 MXC but I have tried using BFS.sys directly in a kind of crude simulation of Tier 1, and I observe the same problems even in that mode. Using VOLUME_NAME_NT works fine.

If I modify the DACLs on the following paths to add the AgenticAppContainer capability with the listed permissions, then that fixes the problem, and GetFinalPathNameByHandle starts working.

  • \GLOBAL?? - DIRECTORY_QUERY | DIRECTORY_TRAVERSE | READ_CONTROL
  • \GLOBAL??C: (and other drives) - SYMBOLIC_LINK_QUERY | READ_CONTROL
  • \GLOBAL??\MountPointManager - SYMBOLIC_LINK_QUERY | READ_CONTROL
  • \\.\MountPointManager - FILE_GENERIC_READ

All four seem to be necessary to make it work. Running a separate program to grant those makes wxc-exec's containers happy.

Steps to reproduce

go build mytest.go
wxc-exec config.json
(lightly edited from example)

Expected behavior

Same as 'go run mytest.go': call succeeds in both modes:

C:\Users\rsc\pub\mxc\src\target\x86_64-pc-windows-msvc\release>go run mytest.go
VOLUME_NAME_DOS: \\?\C:\Users\rsc\pub\mxc\src\target\x86_64-pc-windows-msvc\release\config.json
VOLUME_NAME_NT: \Device\HarddiskVolume4\Users\rsc\pub\mxc\src\target\x86_64-pc-windows-msvc\release\config.json

Actual behavior

C:\Users\rsc\pub\mxc\src\target\x86_64-pc-windows-msvc\release>wxc-exec config.json
VOLUME_NAME_DOS error: Access is denied.
VOLUME_NAME_NT: \Device\HarddiskVolume4\Users\rsc\pub\mxc\src\target\x86_64-pc-windows-msvc\release\config.json

Activity

  1. added
    Issue-Bug
    Needs-Triage
    on Jul 28, 2026
  2. added
    OS-Windows
    on Jul 28, 2026
  3. removed
    Needs-Triage
    on Jul 28, 2026
  4. github-actions commented on Jul 28, 2026

    @github-actions

    Triage summary:

    • Labels applied: Container-Process, Area-SDK-Configuration (in addition to existing Issue-Bug, OS-Windows)
    • Assigned to: @jsidewhite, @mgudgin (AppContainer / process isolation)

    This is a Windows AppContainer DACL issue: GetFinalPathNameByHandle with VOLUME_NAME_DOS fails inside AppContainers (Tier 3, and simulated Tier 1 via BFS.sys) because the AgenticAppContainer capability lacks access to \GLOBAL??, the drive symlinks, and MountPointManager. The reporter identified the four specific DACL grants needed to fix it.

    Maintainers: Comment /investigate to check whether this issue or bug is valid against the most current code. Copilot will also produce a report with the changes that will be needed. For a small, unambiguous documentation or test fix, it may also create one draft PR.

    Generated by 🏷️ Issue Triage for #694 · 24 AIC · ⌖ 5.72 AIC · ⊞ 6.6K · ◷

  5. huzaifa-d commented on Aug 7, 2026

    @huzaifa-d
    Contributor

    /investigate

  6. github-actions commented on Aug 7, 2026

    @github-actions

    Investigation

    Assessment: confirmed
    Classification: bug

    Evidence:

    The reporter's findings are accurate and reproducible against the current codebase. GetFinalPathNameByHandle with VOLUME_NAME_DOS internally resolves the NT device path back to a DOS path by traversing the NT object namespace (\GLOBAL??) through the MountPointManager symlink chain. Inside an AppContainer, the AgenticAppContainer capability SID (which MXC always adds — appcontainer_runner.rs, line 640) is not granted access to:

    • \GLOBAL?? — DIRECTORY_QUERY | DIRECTORY_TRAVERSE | READ_CONTROL
    • \GLOBAL??\C: (and other drive symlinks) — SYMBOLIC_LINK_QUERY | READ_CONTROL
    • \GLOBAL??\MountPointManager — SYMBOLIC_LINK_QUERY | READ_CONTROL
    • \\.\MountPointManager — FILE_GENERIC_READ

    MXC's existing wxc-host-prep prepare-system-drive only patches the Win32 filesystem root (C:\) via SetNamedSecurityInfoW for the ALL APPLICATION PACKAGES / ALL RESTRICTED APPLICATION PACKAGES SIDs — it does not touch the NT object namespace.

    Additionally, MXC's own internal path canonicalization (wxc_common::filesystem_canonical::canonicalize_path, used for deniedPaths enforcement) also calls GetFinalPathNameByHandleW with VOLUME_NAME_DOS — so this bug can silently cause MXC to fall back to PathCanonical::Unknown inside AppContainers, potentially weakening deniedPaths policy enforcement.

    The fix requires:

    1. A new wxc-host-prep subcommand (e.g. prepare-object-namespace / unprepare-object-namespace) that grants the AgenticAppContainer capability SID (computed via DeriveCapabilitySidsFromName) the four object-namespace ACEs using NT APIs (NtOpenDirectoryObject, NtOpenSymbolicLinkObject, NtSetSecurityObject) — not SetNamedSecurityInfoW, which only covers Win32-accessible paths.
    2. A --probe-time check that warns when these ACEs are absent.
    3. Updated docs/host-prep.md documentation.

    Information requested: N/A

    Recommended next step: Implement a prepare-object-namespace subcommand in wxc-host-prep using the four-path list from the reporter as the authoritative grant specification; update probe warnings and docs/host-prep.md.

    Draft PR: Not created — the fix requires new NT object namespace security infrastructure (NT API usage beyond the current Win32 SetNamedSecurityInfoW layer), probe warning changes, and multi-file documentation updates; outside the documentation/test-only scope for a draft PR.

    Generated by 🔎 Issue Investigation for #694 · 49.5 AIC · ⌖ 4.67 AIC · ⊞ 7.1K · ◷
    Comment /investigate to run again

  7. added
    Priority1
    on Aug 17, 2026
  8. letmaik commented on Sep 13, 2026

    @letmaik
    Member

    I hit this with Rust in the Copilot CLI Windows sandbox.  std::fs::canonicalize()  fails with  PermissionDenied (os error 5)  for any existing directory I tried, including the current working directory.

    This breaks Clippy because it canonicalizes the directory used to search for its config file. Clippy exits before linting with:

    error finding Clippy's configuration file: Access is denied. (os error 5)

  9. jsidewhite commented on Sep 13, 2026

    @jsidewhite
    Member

    Per Gudge (@MGudgin), Tier 3 support for process containment is being deprecated.

  10. letmaik commented on Sep 13, 2026

    @letmaik
    Member

    Per Gudge (@MGudgin), Tier 3 support for process containment is being deprecated.

    Sorry, can you explain what this means relative to the issue I'm seeing?

  11. rsc commented on Sep 13, 2026

    @rsc
    Author

    I don’t have access to the system anymore but I believe I reproduced this in Tier 1 with the developer preview Windows release as well. The problem is that you still need permission to the paths that I listed. I was using BFS directly and did not try to grant those via BFS though.

    I suggest at least adding a test that this works in Tier 1 before closing this issue.

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

Metadata

Metadata

Labels

Backend-ProcessContainerIssue-BugOS-WindowsPriority1

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions