mxc README

The project's README from github.com/microsoft/mxc. As one markdown file: README.md.

Microsoft eXecution Container (MXC)

MXC is a sandboxed code execution system for running untrusted code (model output, plugins, and tools) on Windows, Linux, and macOS. It provides multiple containment backends, from OS-native process sandboxes to full VMs, behind a unified containment model and typed SDKs.

Features

What is MXC?

MXC is an SDK dependency that builds into your app.

flowchart LR
    App["Your application<br/>Launch API"] --> SDK["MXC SDK<br/>Rust / .NET / Node<br/>(in process)"]
    SDK --> Backend["Selected backend<br/>(in process)"]
    Backend --> Container["Isolated workload<br/>ProcessContainer / WSLC / Bubblewrap / ..."]

Your application specifies:

MXC validates the request, selects the backend, and launches the workload in the resulting container.

What container types are supported?

MXC runs workloads through platform-appropriate container backends on Windows, Linux, and macOS.

Runtime platform Default backend Other backends Minimum host OS
Windows 11 x64 / ARM64 processcontainer windows_sandbox*, wslc, microvm*, hyperlight*, isolation_session Windows OS-version support
Linux x64 / ARM64 bubblewrap lxc, microvm, hyperlight -
macOS ARM64 / x64 seatbelt - -

* These backends are experimental.

How do I use MXC?

Install an SDK through your package manager. You do not need to clone this repository.

SDK Package
Rust https://crates.io/crates/mxc-sdk
.NET https://www.nuget.org/packages/Microsoft.Mxc.Sdk
Node https://www.npmjs.com/package/@microsoft/mxc-sdk

The Node and .NET packages include the native runtime assets. The Rust crate builds the MXC SDK, engine, and selected backends into the consuming application.

Non-SDK consumption: Platform-specific executor binaries, such as wxc-exec.exe, accept JSON container-creation requests defined by the stable schema. Use for testing or when the SDK cannot be embedded in your app.

Running a contained workload

For complete SDK samples, see the Rust, .NET, and Node samples.

Sample Node snippet

import { spawn, type ContainerRequest } from '@microsoft/mxc-sdk/v1';

const request: ContainerRequest = {
  command: 'node -e "console.log(\'hello from container\')"',
  network: { egress: { default: 'deny' } },
  timeoutMs: 30_000,
};

const child = await spawn(request);

See the runnable streaming standard-I/O sample and the SDK API reference.

My application won't run in the sandbox!

Your application will hit access issues when running in a sandbox, until you've had time to tune your containment rules. We're here to help.

Debug console mode

Native executors normally reserve standard input, output, and error for the workload. Use --debug for MXC diagnostic output:

wxc-exec.exe --debug config.json

See MXC diagnostics for the complete developer reference.

Audit mode

Warning: --audit turns off all sandbox security for the workload being analyzed. Never use it to run untrusted code.

Audit mode helps a policy author find access-denied failures and reconstruct a ProcessContainer policy that grants the files and capabilities a trusted tool actually needs. On supported Windows releases, run:

wxc-exec.exe --audit policy.json

MXC records the observed accesses and produces policy-authoring artifacts. See logging access denied for safe deny-and-record diagnostics, audit outputs, and supported workflows.

Telemetry

Official Microsoft builds can send optional diagnostic telemetry to Microsoft. Telemetry is off unless the individual run opts in, the Windows user has explicitly consented, administrative policy permits collection, and your application enables the telemetry option in a contained workload request. An administrator can block telemetry but cannot grant consent for the user.

Local open-source builds are not configured to route telemetry to Microsoft, and telemetry is a no-op on non-Windows platforms. See telemetry policy and consent for controls and privacy details.

Building from source

Build from source when developing MXC, changing the native runtime, or using the standalone executor binaries instead of a packaged SDK. Repository builds produce the platform-native runtime and executors and stage the native assets used by the Node SDK.

Build prerequisites are:

Build

Windows

build.bat --all             # Release build for current architecture

Linux

./build.sh --all            # Release build

macOS

./build-mac.sh --all        # Release build for native architecture

Documentation

Consumer documentation

Document Repository location Purpose
Terminology docs/glossary.md Plain-English definitions of consumer terms
SDK samples samples/ Runnable Rust, .NET, and Node scenarios
SDK API reference docs/api-reference/ Supported V1 operations and types
Container lifecycle docs/container-lifecycle.md Persistent container lifecycle overview
Logging access denied docs/logging-access-denied.md Diagnose blocked accesses and author policy
Telemetry docs/telemetry.md Consent and administrative controls
Backend guides docs/backends/ Platform and backend prerequisites and behavior

Repository contributors should start with the MXC development documentation.

Contributing

See CONTRIBUTING.md for contribution guidelines.

License

See LICENSE.md for details.

mxc (microsoft/mxc)

sandbox
Searching Database…

2.9K ·GitHub
What is this?MXC (Microsoft eXecution Container) is a sandboxed code execution system for running untrusted code - model output, plugins, and tools - on Windows, Linux, and macOS, using containment backends ranging from OS-native process sandboxes to full VMs.
Is this a standalone app or an SDK I embed in my code?It is an SDK dependency that builds into your application. You specify the container type, containment rules, and workload command, and MXC validates the request, selects a backend, and launches the workload.
How do I add MXC to a project?Install the SDK through your package manager - Rust crate, .NET package, or Node package - without needing to clone the repository. There are also platform-specific executor binaries like wxc-exec.exe for non-SDK, JSON-based usage.
What happens if my app's actions get blocked by the sandbox?You'll hit access-denied failures until you tune the containment rules; MXC offers a debug console mode for diagnostics and an audit mode that disables all sandbox security to help reconstruct the needed policy, so audit mode must never be used on untrusted code.
Which container backends are used on each OS?Windows defaults to ProcessContainer with experimental alternatives like Windows Sandbox, WSLC, MicroVM, Hyperlight, and IsolationSession; Linux defaults to Bubblewrap with LXC, MicroVM, and Hyperlight as options; macOS uses Seatbelt.
Does MXC send telemetry about what I run?Official Microsoft builds can send optional diagnostic telemetry, but it is off unless the run opts in, the user consents, admin policy allows it, and the app enables it; local open-source builds don't route telemetry to Microsoft, and it's a no-op on non-Windows platforms.
What SDKs does MXC provide?MXC ships Rust, .NET, and Node SDKs with versioned APIs for one-shot and state-aware execution; the Node and .NET packages bundle the native runtime assets.
Can containers persist with state, or only run once?MXC supports state-aware lifecycle management, letting you provision, start, execute, stop, and deprovision persistent containers rather than just one-shot runs.
What kind of policies can I set for a sandboxed workload?Policies cover filesystem access (read-only, read-write, denied paths), network access (proxy, outbound controls, host filtering), and UI access (clipboard, display, GUI controls).
Why would I use MXC instead of just running untrusted code directly?MXC is built specifically to contain untrusted code such as LLM/model output, plugins, and tools, so a misbehaving or malicious workload can't access files, network, or UI it wasn't explicitly granted.
Creator
microsoft
Size
36.9 MB
Stars
2.9K
Age
8mo
Commits · 90 Days