mxc icon indicating copy to clipboard operation
mxc copied to clipboard

How to limit a sandboxed agent to one endpoint in production? (request: packaged proxy sample)

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

Description of the new feature / enhancement

Use case: an AI agent loop runs inside an MXC sandbox and must reach exactly one endpoint, a local model server on the host (e.g. 127.0.0.1:8080), and nothing else.

What we found while evaluating MXC 1.0.0 / 1.0.1 on Windows 11 26300.9711:

  • On the process container backend, only proxy mode (runtimeConfig.networkProxy) restricts the sandbox to that endpoint; our tests confirm it blocks other ports and direct connections.
  • docs/networking.md describes this simple proxy form as a development / testing setup. The production form (allowedProxyPeer) needs a packaged proxy with its own identity. There is a minimal manifest example in docs/backends/process-container/examples/0.8.0-schema.md, but no runnable sample proxy to build from.
  • The other backends (Hyperlight, microvm, WSLC) offer all-or-nothing networking, and for WSLC a proxy on host loopback is not reachable (and the proxy is cooperative, per #947). So whole-agent containment with model-only access is possible only on the process container.

Related: #1633 asks a similar "which policy should I use for agent network access" question (OpenClaw, internet access); #1462 / #1625 / #1679 propose and start a built-in WSLC proxy.

Questions:

  1. What is the recommended production configuration for this use case today?
  2. Could a runnable packaged-proxy sample (the allowedProxyPeer path) be added to samples/?
  3. Is proxy-style "one endpoint only" planned for the VM backends (the NVX microvm docs on main suggest networkProxy may work there)?

Proposed technical implementation details

A sample under samples/ with a minimal packaged forwarding proxy (manifest + build steps) and a policy that uses allowedProxyPeer, plus a short section in networking.md comparing the dev/test and production proxy forms.

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

The Hyperlight backend actually used to support this–allowedHosts /blockedHosts mapped to the guest's allow/block lists, and default-allow mapped to full access. That wiring was dropped in #1397 (retiring pre-v0.9 vestiges, in v1.0.1); the underlying hyperlight-unikraft library still supports it, so we could look at restoring it on the backend.

One caveat for the loopback case specifically: the library reaches host loopback only under "allow all" (intended for intra-guest servers) and deliberately refuses it under an allow/block list, since a guest socket is a real host socket. So an allow-list can pin a single remote endpoint, but "only 127.0.0.1:8080 and nothing else" would need either allow-all (which opens everything) or a change on our side. Lmk.

danbugs avatar Nov 05 '26 17:11 danbugs

Thanks @danbugs, that answers the Hyperlight side. No change needed there.

Remaining question for the process container team: our agent-containment tests used networkProxy without allowedProxyPeer, which networking.md describes as development/testing only. The production path is allowedProxyPeer with a packaged proxy, but there's no sample for it in samples/.

For a local model server (llama-server, LM Studio), what's the recommended setup: package the model server itself, or put a packaged forwarding proxy in front of it? A runnable sample would help.

trevotai-amd avatar Nov 06 '26 20:11 trevotai-amd