A Docker VM with network policy sits alone with a relay container on an internal network of its own (inhibit_ipv4). The relay, devvm's own Linux build in an empty imported image (read-only, every capability dropped), copies the VM's connections to a unix socket of devvm's proxy on the host, so tokens, the Keychain, the CA key and agents' logins never enter Docker. On and off is docker network connect/disconnect at the next start. Desktop builds run on a network and relay of their own, through a host proxy allowing any host on ports 80 and 443. - every Docker VM drops NET_RAW; it's in the config hash, so containers are made again from their commit - confined: the start's ID, the VM alone on its network with the relay by its recorded container ID, the network still internal; a foreign member is docker_network_shared, at start and on removal - proxy: -listen-unix, -relay/-relay-to; a lifeline pid file written after the proxy started whose process has gone ends it - macOS fetches the release's Linux build on first use, checked against a SHA-256 the two-pass release.sh bakes in; builds without the pin use devvm-linux-<arch> beside devvm or refuse - the build proxy is stopped through the process devvm started - reviewed: design notes and threat check in design.md; e2e on the Linux engine and Desktop: dropped capabilities, network members and options, no IPv6 beyond the bridge's link-local, no DNS query leaving (captured, with an unconfined control), direct connections refused Co-Authored-By: Claude Opus 5.5 <[email protected]>
internal/proxy
The network policy proxy: one process per VM with network policy, on the host, run as devvm _proxy. Go, standard library only (depguard enforces it).
The VM can reach nothing but this proxy (on macOS its Lima hostagent runs under a Seatbelt profile, on Linux QEMU's network is restricted, on smolvm the proxy decides each connection). Other programs on the host can reach the port too, so the port alone doesn't identify the VM: every request must carry the VM's password (Proxy-Authorization, user devvm; the VM's proxy URL has it), and the VM's placeholders end in a random value of its own (not the password), so no other VM's or program's placeholder gets a token. It refuses to start without -auth-file. For each connection it:
- answers
407without the VM's password; - checks
CONNECT host:portand absolute-form requests (GET http://host/…) against the VM's policy files, then tunnels or forwards allowed ones untouched; - resolves names itself, and refuses the host's own addresses and internal ones (loopback, private, link-local, multicast, unspecified, CGNAT
100.64.0.0/10) unless a rule names the address; - requires a TLS ClientHello in a tunnel to name the CONNECT host (SNI);
- for hosts with a bound secret, swaps the placeholder in one header for the real value: it intercepts their
:443tunnels, and does the same for absolute-formhttps://requests (everything else passes unread); - logs every decision as JSON lines.
On smolvm, the VM's allow list is the host alone and smolvm asks the proxy about each connection before making it (mediated egress): with -decider, the proxy is that decider too, on a loopback port of its own. It takes over connections to its own address in the VM (-decider-to), which it then serves as any other, password and policy included, and refuses the rest, logged as blocked. A connection without the token smolvm was started with (-decider-token-file) gets no answer.
On Docker, whose VMs can't reach the host's loopback, it also listens on a unix socket (-listen-unix), only the user's: a relay (devvm _proxy -relay, in a container on the VM's own network) passes each connection the VM makes to it there, unread, and the proxy serves it as any other.
It returns when the VM's hostagent is gone.
Files
| File | What |
|---|---|
proxy.go |
Main and the flags, the listener, CONNECT and absolute-form handling, the address floor, the log (Event, AllowRule: devvm log reads it), the devvm.proxy endpoints, -init-ca |
policy.go |
the rule syntax and matching (ValidRule: devvm policy takes only these); policy files are re-read when they change |
sni.go |
reads a tunnel's ClientHello to check its server name |
decider.go |
-decider: smolvm's mediated-egress protocol (version 2), connections taken over or refused |
relay.go |
-listen-unix, and -relay: Docker's relay, bytes passed unread to the proxy's socket |
secrets.go |
interception for hosts with a bound secret: certificates from devvm's CA, header substitution, values from -secret-cmd (cached briefly, never logged) |
logins.go |
Codex and opencode logins, and Claude Code's MCP secrets (~/.claude.json): the VM's copy with placeholders, bindings, and OAuth refresh on the host |
redact.go |
agents' settings files (settings.json, config.toml, opencode's config) for VMs with network policy: values under secret-looking keys replaced |
*_test.go |
unit tests, and fuzz targets for policy rules (FuzzParseRule), request targets (FuzzRequest), ClientHellos (FuzzClientHello) and the decider's preludes (FuzzPrelude) |
How devvm runs it
internal/cli/proxy.go is the hidden devvm _proxy command: it hands its arguments to Main with the run UI's streams (IO: the event log and data on its Stdout, the proxy's own log lines on its Stderr), warns through it about logins copied as they are (IO.Kept, secrets.LoginKept), and ends an error with its Die. The package itself prints nothing.
devvm _proxy -listen 127.0.0.1:PORT -vm NAME -policy FILE,FILE,… -log LOG.jsonl -lifeline HA.pid \
-ca ca.pem -cakey ca.key -secrets BINDINGS.json -secret-cmd PATH/TO/devvm -auth-file KEY \
[-decider 127.0.0.1:PORT -decider-to 100.96.0.1:PORT -decider-token-file TOKEN] [-listen-unix SOCKET]
Flags take one dash or two.
| Flag | What |
|---|---|
-listen |
the VM's proxy port, on loopback |
-listen-unix |
Docker only: also listen on this unix socket, mode 600; a socket left there is replaced, anything else refused |
-vm |
the VM's name, for the log |
-policy |
the policy files, comma-separated, in order; a missing file has no rules |
-log |
the JSON-lines event log; default stdout |
-lifeline |
the hostagent's pid file: return when that process is gone |
-ca, -cakey |
devvm's CA, for interception |
-secrets |
the VM's secret bindings (JSON, no values), re-read when they change |
-secret-cmd |
the devvm binary, run as devvm secret get NAME for a value |
-auth-file |
a file (mode 600) with the VM's key: requests need it as the proxy password, user devvm (in a file because a process's arguments are visible to other users) |
-decider |
smolvm only: also decide each connection the VM opens, on this loopback address |
-decider-to |
with -decider: the proxy's address in the VM, the only destination taken over |
-decider-token-file |
with -decider: a file (mode 600) with the token smolvm proves itself with, 64 hex digits, new at each start |
Other modes, each doing one thing and returning:
-init-ca DIR |
write a new CA (ca.pem, ca.key, each written whole; valid 30 days; no host name in it) into DIR unless one with over a week left is there |
-login claude -login-file F -login-secrets |
print the MCP servers in ~/.claude.json whose settings hold env values or headers |
-login codex|opencode|claude -login-file F -login-vm |
print the VM's copy of the login file, with placeholders (-login-salt KEY, or $DEVVM_LOGIN_SALT, which keeps it out of the arguments: the VM's random salt, which ends them) |
-login … -login-bindings |
print the login's secret bindings (JSON, no values; -login-salt as above); with -login-hosts, their hosts as allowlist lines (host:443) |
-login … -login-get NAME |
print one value, refreshing an OAuth token when it's due |
-redact json|toml |
copy stdin to stdout with values under secret-looking keys replaced by devvm-redacted, their paths on stderr |
-relay ADDR -relay-to SOCKET |
listen on ADDR and pass each connection, both ways and unread, to the proxy's socket, until stopped (Docker's relay containers) |
Inside the VM, http://devvm.proxy/blocked lists recent blocks, /blocked/new those since the last prompt, and /ca.pem serves the CA certificate.
Testing
go test ./internal/proxy runs the unit tests and the fuzz targets' seeds; go test -fuzz FuzzRequest ./internal/proxy fuzzes one. testdata/script/proxy.txtar runs devvm _proxy itself.