Skip to content

Virtio-Vsock transport boundary

Sandbox Loom supports an authenticated host/guest transport for deployments that need to remove ordinary IP networking from an execution environment. The transport is intentionally provider-neutral: a VM or hypervisor attaches the virtio-vsock device, while Sandbox Loom supplies the message framing and host-side broker boundary.

Why this boundary matters

An isolated agent still needs a controlled way to return results, request approved operations, and report lifecycle events. Giving that agent an IP interface creates a second path that the policy engine must constrain. A misconfigured route, resolver, bridge, or firewall can expose more of the host environment than the workflow requires.

The VSOCK boundary reduces that exposure by giving the guest one explicit host-facing channel. The guest can send a request to the configured broker port. The broker can reject unauthenticated or unsupported messages before they reach a policy evaluator, gateway, credential broker, or evidence store. This makes the communication path visible in the architecture and testable in runtime acceptance checks.

The security impact depends on the complete deployment. VSOCK does not grant authorization, encrypt application payloads, or prevent a compromised host broker from making an unsafe decision. Sandbox Loom still needs authenticated messages, least-privilege policy, approval checks, secret isolation, bounded frames, audit records, and a runtime configuration with no unintended network device.

Impact on Sandbox Loom operations

Area Impact
Network exposure A no-IP guest profile can omit virtio-net and expose one VSOCK route to the host broker.
Policy enforcement Every request enters the existing policy and gateway path before an external effect.
Credential handling Credentials remain in the host-side broker or protected provider boundary. The guest receives a short-lived transport token instead of provider credentials.
Evidence The run can record the selected transport, broker authorization result, request correlation, and rejection reason.
Failure handling A missing device, closed broker, invalid token, oversized frame, or denied operation fails the request and becomes a visible runtime result.
Portability The executor message contract remains stable while Firecracker, QEMU, or another VM backend supplies the VSOCK device.

This changes the default design question for high-risk workloads. The operator can choose whether a task needs ordinary network access at all. Tasks that only need to exchange bounded results with the host can use a VSOCK profile and avoid provisioning an IP network interface.

Security model

The preferred VM shape is:

flowchart LR
  Guest[Guest executor<br/>No virtio-net]
  Transport[AF_VSOCK transport]
  Broker[Host VSOCK broker<br/>CID 2]
  Policy[Policy evaluator and gateway<br/>Approved operations only]

  Guest --> Transport --> Broker --> Policy

The guest can address the host VSOCK CID, normally 2, and a configured port. It does not receive an ordinary network interface through this transport. The host broker must still authenticate every request, apply the normal Sandbox Loom policy and gateway checks, and record the operation in the audit trail. VSOCK is a reachability boundary, not an authorization mechanism and does not provide application-level encryption by itself.

Protocol

Executor::VsockTransport sends one bounded JSON envelope per connection:

{
  "version": "0.1",
  "message": {"type": "session.register"},
  "auth": "<hex HMAC-SHA256>"
}

The HMAC covers the exact JSON representation of message. The shared token must be provisioned outside the disposable project and must not be placed in source control or in generated project artifacts. Responses are also bounded and contain either {"ok":true,"result":...} or an error response.

Executor::VsockBroker is a one-request-per-connection host-side broker. Its handler is expected to delegate to the existing policy/gateway path; it must not become a bypass around approvals, credentials, evidence, or audit state.

Runtime responsibilities

Sandbox Loom does not automatically create a VM, attach a Firecracker VSOCK device, or configure a guest kernel. The selected VM backend owns those runtime-specific operations. A backend integration should provide:

  1. a guest VSOCK device and a stable guest-to-host port mapping;
  2. no virtio-net device when the no-IP profile is selected;
  3. token delivery through an out-of-band secret mechanism;
  4. lifecycle cleanup for the broker and VM;
  5. evidence showing the selected network mode and broker authorization result.

The current implementation is therefore usable as a transport and broker contract now, while Firecracker or another microVM backend can be integrated without changing the executor message boundary.

Verification

The unit tests cover sockaddr construction, authenticated framing, rejection of invalid tokens, and broker handoff without requiring a VM. A runtime backend acceptance test must additionally prove that an agent with no virtio-net device can reach only the intended VSOCK broker and cannot reach an IP endpoint.