maka-sandbox

简体中文

maka-sandbox translates Host filesystem and network policies into OS-level command isolation. Call admission and receipt recording live in the Host; child process I/O and lifetime live in maka-process.

Backends

  • macOS — Seatbelt profiles (sandbox-exec). allowed networking permits the system mDNSResponder socket while keeping other Host Unix sockets blocked; restricted networking routes DNS and outbound connections through an execution-owned local proxy.
  • Linux — bubblewrap (/usr/bin/bwrap 0.11+) paired with unprivileged network namespaces.
  • Windows — Prefers Microsoft MXC per-command security environments, requiring no UAC prompt, dedicated local user, ACL rewrites on existing files, or maka sandbox setup. Read-only carve-outs inside writable trees use crash-recoverable placeholder guards. Policies that MXC cannot express fall back to the low-privilege job-account + WFP backend (configured explicitly via maka sandbox setup --root <path>). Failed MXC launches surface an error directly and never silently downgrade to another backend or run unsandboxed.

Across all platforms, unsupported policy rules fail before launch. Destination-restricted policies route outbound traffic through a Host-owned proxy that enforces allowed (host, port) pairs, and redirects require matching destination grants.

CLI and testing

Run a command under an explicit policy JSON file:

maka sandbox run --policy policy.json --cwd /absolute/workspace --command 'your command'

Example read-only, offline policy:

{"kind":"managed","filesystem":{"default":"read","rules":[],"denyGlobs":[]},"network":"denied"}

To run the standalone Windows MXC acceptance harness (without building V8):

cargo build -p maka-host-runtime --example windows_mxc --target x86_64-pc-windows-msvc

Run windows_mxc.exe as a standard user on a local volume; it verifies filesystem guards, pipe/ConPTY streams, child-tree cleanup, and loopback/outbound networking.

Source provenance

src/seatbelt/{base,network}.sbpl are copied unchanged from Codex's base policy and network policy, revision d1e3f9dfe3d5f6105b7e4c3958b9bf2ac6c32818. Copyright OpenAI; Apache-2.0. The upstream source comments are retained.

src/windows/mxc.rs and src/windows/mxc/{availability,policy}.rs adapt native capability probing, networking, filesystem aliases, volume expansion and startup handling from Codex's MXC sandbox adapter, revision 4610b573e59b211bf9430cf6ffb97cfb84623090. Copyright 2025 OpenAI; Apache-2.0. Maka maps its own filesystem policy, checks unsupported rules before execution, preserves its command environment contract, and retains the native owner through process settlement. The Microsoft MXC SDK is a separate pinned MIT-licensed dependency.