MXC: A cross-platform sandboxed code execution system for untrusted code
https://github.com/microsoft/mxc
- discussion_url
- https://news.ycombinator.com/item?id=50016489
Article
MXC is an SDK-based sandboxed code execution system for running untrusted code — model output, plugins and tools — on Windows, Linux and macOS. It wraps multiple containment backends behind a unified containment model and typed SDKs, so an application can describe what it wants isolated rather than hand-rolling platform-specific isolation.
Applications specify three things: the container type, the containment rules, and the workload command. MXC validates the request, selects a backend, and launches the workload. Containers are created from versioned JSON container-creation requests and security policies, and support lifecycle operations — provision, start, execute, stop and deprovision — for persistent containers.
Supported backends include ProcessContainer (the default), Windows Sandbox, LXC, Bubblewrap, Seatbelt, MicroVM (Nanvix), Hyperlight, IsolationSession and WSLC. Defaults are platform-appropriate: ProcessContainer on Windows, Bubblewrap on Linux and Seatbelt on macOS; several Windows options (windows_sandbox, microvm, hyperlight) are marked experimental.
Policy is organized into three areas: filesystem policy (read-only, read-write and denied path lists), network policy (proxy support, outbound controls and backend-dependent host filtering) and UI policy (clipboard, display and GUI access controls).
MXC ships Rust, .NET and Node SDKs with versioned APIs; the Node and .NET packages bundle native runtime assets, while the Rust crate builds the SDK, engine and selected backends into the consuming application. It is a dependency that builds into your app rather than a service. SDK packages are on crates.io, NuGet and npm, and you do not need to clone the repository. Platform-specific executor binaries such as wxc-exec.exe accept the same JSON requests for testing or when the SDK cannot be embedded.
Diagnostics include a --debug flag for MXC diagnostic output and a logging access-denied mode for safe deny-and-record analysis. The documentation warns that --audit turns off all sandbox security for the workload being analyzed and must never be used to run untrusted code; it exists to help policy authors reconstruct a ProcessContainer policy granting the files and capabilities a trusted tool actually needs. The source notes that applications will hit access issues until containment rules are tuned.
HN discussion
Based on 10 selected comments and replies.
Commenters were broadly positive about the project. One called it decent even if it is essentially a frontend/SDK over Bubblewrap, Seatbelt and ProcessContainer, arguing that setting those up consistently is far from trivial and hand-rolling isolation is a bad idea; they also liked the learning mode, the MIT license, the telemetry disclosures and the readable docs.
Dissenting or qualifying notes focused on gaps and engineering costs. One commenter flagged that fine-grained networking — allow/deny by hostname or by IP, CIDR, port or protocol — exists for Windows and Linux but is missing on macOS, calling it the general challenge of abstracting over different technologies. Another asked whether any of these sandboxes supports dynamic, revocable permission grants starting from a minimal sandbox, and complained that harnesses block agent execution waiting for decisions; a reply pointed to nono.sh as partly addressing this after a sandboxed command ends.
Others questioned adoption and quality. One said they would stick with their own scripted approach (smolvm launching an instance per task), though a reply claimed smol machines supports the same host and CIDR network controls cross-platform. On size, a commenter cited roughly 350,000 mostly-Rust SLOC as too much to grasp; a reply disputed the figure, saying the counting tool misparses Rust comments and the cited file is closer to 1,465 SLOC plus tests, while also criticizing a single-contributor alternative for basic tests and security bugs. A developer evaluating the Rust SDK said the API looks nice but flagged bundled binaries in the build script, Windows-exclusive build steps running on all platforms, backend feature-gating causing build-script work that may break on future Cargo versions, and heavy dependencies.
Selected comments: dannyw · simonw · neobrain · LeBit · kernc · epage