mxc icon indicating copy to clipboard operation
mxc copied to clipboard

Blocked file reads say "No such file" in Hyperlight/WSLC but "Permission denied" in process container

Open trevotai-amd opened this issue 3 weeks ago • 1 comments

Relevant area(s)

Windows

Brief description of your issue

When sandboxed code opens a host file outside its granted paths, the error depends on the backend:

processcontainer:  PermissionError: [Errno 13] Permission denied: '...\\secret.txt'
hyperlight / wslc: FileNotFoundError: [Errno 2] No such file or directory: '...\\secret.txt'

The file is protected in every case. But "not found" is misleading for users and for AI agents: in our agent runs on WSLC the model treated it as a wrong path and kept searching instead of recognising a policy block. For VM/container backends the path genuinely doesn't exist inside the guest, so this may be by design; if so, a docs note per backend would help, and a consistent "blocked by policy" signal across backends would be better for agents.

Versions: MXC 1.0.0 and 1.0.1, Windows 11 26300.9711.

Steps to reproduce

Work in one folder. In the configs, replace <DIR> with that folder and <PY> with the folder that holds python.exe (in JSON, double each backslash). None of the configs grants <DIR>.

  1. Create secret.txt (any text).
  2. Process container, wxc-exec pc.json:
    {"version": "1.0.0", "containment": "processcontainer",
     "process": {"commandLine": "python -c \"open(r'<DIR>\\secret.txt')\"", "timeout": 60000},
     "filesystem": {"readonlyPaths": ["<PY>"]}}
    
  3. Hyperlight, wxc-exec --experimental hl.json:
    {"version": "1.1.0-alpha", "containment": "hyperlight", "hyperlight": {"runtime": "python"},
     "process": {"commandLine": "open(r'<DIR>\\secret.txt')", "timeout": 60000}}
    
  4. WSLC, wxc-exec wslc.json:
    {"version": "1.0.0", "containment": "wslc", "containerId": "repro-1",
     "wslc": {"image": "python:3.12-alpine"},
     "process": {"commandLine": "python3 -c \"open(r'<DIR>\\secret.txt')\"", "timeout": 60000}}
    

Expected behavior

A consistent, recognisable "denied by policy" error across backends, or documentation of the per-backend behaviour.

Actual behavior

Process container: PermissionError: [Errno 13] Permission denied. Hyperlight and WSLC: FileNotFoundError: [Errno 2] No such file or directory.

trevotai-amd avatar Nov 05 '26 14:11 trevotai-amd

This is expected for the VM-namespace backends. The Hyperlight/WSLC guest has its own filesystem, so an ungranted host path just doesn't exist there → ENOENT. Process-container shares the host FS and hits an ACL → EACCES. There's no per-path "denied" signal at this layer to return instead.

danbugs avatar Nov 05 '26 16:11 danbugs