Network tiers
This page explains how devvm confines a VM to its proxy on each tier, what the proxy does with each connection, and how your secrets get into the VM’s requests without the VM holding them. Network tiers covers choosing a tier, the allowlists and their rules, the secrets and the logs as you use them.
Starting a VM on its tier
A VM’s state records its tier in its net section, as "tier": open, internet, allowlist or none (network tiers). A section without a tier reads as allowlist, and one with a tier devvm doesn’t know can’t be read, so devvm refuses the VM rather than take it as open. The tier decides the VM’s confinement: on every tier but open, the VM starts confined to its proxy, and an open VM starts on its backend’s own network with its proxy’s port and password in its confinement, so its guest’s proxy settings name the proxy all the same (how a backend plugs in). A running VM keeps the confinement it started with until its next start.
When devvm starts a VM on a confined tier, it takes these steps in order:
- It readies the VM’s own CA and the next one (the VM’s CA), and on macOS it keeps them out of Time Machine.
- It writes the VM’s secrets as the VM’s proxy sees them.
- It starts the VM’s proxy on a free port on the host’s loopback, and waits for the proxy to say it’s listening.
- It starts the VM confined, with the VM’s proxy settings pointing at the proxy.
- It runs the self-check before the VM’s setup and before its shell.
- It sets the VM up, as the VM’s setup describes. The setup puts the VM’s CA and the next one in the VM, points the tools that don’t read the environment at the proxy, and writes the VM’s placeholders and its agents’ logins and settings with your keys taken out.
An open VM’s start takes the same steps, but it starts the VM unconfined and runs the open self-check. Its proxy has the VM’s CAs and its secrets as any VM’s does, and applies no rules. Its setup installs both CAs in the VM, points the same tools at the proxy, and writes the same placeholders and copies of the agents’ logins and settings, so an open VM holds no real secret either. The VM reaches its proxy directly, through the HTTPS_PROXY that names it (Lima), and a request that goes around the proxy carries only the placeholder.
So an open VM runs on its backend’s own network, and it reaches this machine and your LAN directly, as a VM without a proxy would. Its environment names its proxy all the same (HTTP_PROXY, HTTPS_PROXY and their lowercase forms), and the proxy reaches every host and address for it, this machine’s localhost and your LAN included, so a tool behaves the same through the proxy as it does directly. Its NO_PROXY names the VM itself and this machine as the VM reaches it, host.lima.internal, so requests to those go directly. Every launch checks that an open VM’s proxy is set in the VM and answers it, and when it doesn’t, devvm warns you and opens the VM all the same. An open VM gets a placeholder for each secret it may use, as every VM does, and only its proxy puts the real value in, so a request that goes around the proxy, directly from the VM, carries only the placeholder, and the secret’s host refuses it.
VMs that can’t be confined
A VM whose backend can’t confine it to its proxy (egress-proxy) can only be open: devvm refuses to make it on any other tier, unasked, in one line that names the backend and --network open (net_tier_backend), and the registry’s check refuses devvm network with a confined tier.
The proxy
One proxy runs for each VM. It runs on the host as devvm _proxy, a hidden command, and listens on a loopback port. The VM reaches nothing else over its network, so every connection the VM makes goes through its proxy.
The proxy is two processes. devvm _proxy, the broker, does what only the host should do. It looks up each bound value, sends the token requests of logins made in the VM, connects to the VM’s links’ sockets, reads the files that change while the proxy runs, relays the VM’s SSH agent, follows the VM’s lifeline, and looks up the names and opens the connections that the child asks for. Its child, devvm _proxy-child, does everything this section describes with the VM’s requests, and asks the broker over a socketpair for each of those, by something the broker finds in its own config, so a child that a VM took over can’t make the broker act for another VM, another secret or another file. No byte of the VM’s requests crosses that socket, because the broker hands the child each connection, so the broker adds a hop to opening a connection but none to what it carries. On Linux, before it reads a byte of the VM’s, the child confines itself with Landlock and a seccomp filter to its logs and the Nix cache, with no connection of its own, no unix socket and no program to run, and on macOS a Seatbelt profile does the same (the child’s sandbox). So a child that a VM took over can’t read your files, reach an ssh master’s socket or connect to this machine’s loopback. Processes has what each holds, reads and writes, and the proxy’s broker has the protocol and its threat check. The one other way out of the VM is the links you add to it, which this machine carries over ssh to the ports your other VMs publish, so they don’t use the VM’s network. The proxy is a second entrance to those links, for the VM’s HTTP clients (links through the proxy).
Other programs on the host can also reach that port, so the port alone doesn’t identify the VM. Every request must carry the VM’s password in Proxy-Authorization, with the user devvm, or it gets 407. Each VM has its own random password in its proxy settings. The proxy reads the password from its config, a file only you can read, never from its arguments, which other users can see, and it refuses to start without one (devvm _proxy). The VM’s settings also get the password through files (Lima).
For each connection, the proxy does the following:
- It sends a request for one of the VM’s own links to that link before any rule, and passes its bytes on as they are (links through the proxy).
- It checks
CONNECT host:portand absolute-form requests (GET http://host/…) against the VM’s policy files, and then tunnels or forwards the allowed ones untouched. - It takes only host names, made of letters, digits,
-,_and., and addresses. It lowercases a name and drops one trailing dot, and the name that’s left may have no empty label, soevil.test..,evil..testand.evil.testget400too, because a company proxy that drops trailing dots would otherwise reach a host that a deny ofevil.testnever matched. It lowercases only ASCII, so a name with any other character keeps that character and gets400, because Unicode’s case folding turns some letters into ASCII ones, such as the Kelvin sign intok, so the host it judged wouldn’t be the one the VM named. An address is bare, or an IPv6 address in one pair of brackets, so[evil.com]:443,[1.2.3.4]:443and a stray bracket get400too. An IPv6 address with a zone, such as[fe80::1%en0], gets400, and so does one with an empty zone. An address keeps its trailing dot, because the dot can only be its zone’s, and dropping it would leave an empty zone, which Go’s address parser reads as no address but a resolver may read as the address alone. Anything else gets400before the policy or the log sees it. Everything else that reads a host reads it in the same form: a rule’s host, a secret’s hosts,NO_PROXY,devvm network lock’s risks and ticks, a secret’s--host, an MCP server’s host,--from’s registry and a partial clone’s remotes. - It refuses
devvm.proxy, its own domain, and any name under it, in aCONNECTand as a host, with403, before the links, the policy or a company proxy see the name, on every tier. Only a request in absolute form forhttp://devvm.proxy/itself reaches its endpoints, andCONNECT transparent.devvm.proxy:PORTis transparent mode’s. It refuses the stand-in address,198.18.0.1, with a reason that says the tool resolved the name itself. - It resolves names itself and dials the addresses it checked, through its broker, which checks each address again before it connects (the child’s sandbox). It looks each name up absolute, with a trailing dot, so this machine’s resolver never adds its DNS search domain, which macOS takes from the network’s settings and Linux from
/etc/resolv.conf’ssearch. Otherwise, withapi.corp.example.comdenied and**allowing the rest,CONNECT api:443would reachapi.corp.example.com, a name that no rule judged, and so wouldapi.eureachapi.eu.corp.example.comwhenapi.euitself has no address. It refuses the host’s own addresses and internal ones unless a rule names the address. Internal addresses are loopback, private, link-local, multicast, unspecified, CGNAT100.64.0.0/10and the other ranges that aren’t the public internet, among them IPv4’s documentation ranges192.0.2.0/24,198.51.100.0/24and203.0.113.0/24and the old 6to4 relays’192.88.99.0/24, and IPv6’s Teredo2001::/32, documentation2001:db8::/32and3fff::/20, discard-only100::/64, benchmarking2001:2::/48, ORCHID2001:10::/28and ORCHIDv22001:20::/28, SRv65f00::/16and IPv4-translated::ffff:0:a.b.c.d. An address with an IPv6 zone is also internal, whatever its address, because a zone ties it to one of this machine’s links. An address with an IPv4 address in it counts as that IPv4 address, both a NAT64 address64:ff9b::a.b.c.dand a 6to4 address in2002::/16, such as2002:a00:1::1for10.0.0.1, and the 6to4 network, a/48, of one of the host’s own 6to4 addresses counts as the host’s, because the machines on its LAN share it. A deny for an IPv4 address covers both forms. An allow for an IPv4 address covers its NAT64 form, which this network’s own translator carries, but not its 6to4 form, because 6to4 traffic goes through relays that anyone may run, so a 6to4 address is allowed only by a rule that names it. A Teredo address holds its IPv4 addresses scrambled, and the proxy doesn’t read them, so a broad IPv6 allow such as::/0lets in the Teredo form of a denied IPv4 address. - It requires a TLS ClientHello in a tunnel to name the
CONNECThost in its SNI, in ASCII, letters’ case aside. The proxy doesn’t see theHostinside the encrypted traffic, so a CDN that routes by it can reach other sites it serves. - For a host with a bound secret, it replaces the placeholder in one header with the real value, as how the proxy puts them in describes.
- For a host whose rules narrow it to some methods or paths, it decrypts the host’s HTTPS and checks each request, as requests by method and path describes. Everything else passes unread.
- It carries at most 1024
CONNECTtunnels, holds at most 2048 connections of every kind and has at most 2048 requests to hosts under way at once for the VM, as described below. - It logs every decision (log files).
A CONNECT tunnel meets the proxy’s checks in this order:
A tunnel that the proxy doesn’t intercept carries the bytes both ways as they are. When the VM finishes sending, the proxy closes its side of the connection to the far end, so the far end sees the end of what the VM sent and can still answer. The tunnel ends when the far end’s bytes end, or when the proxy can’t pass them on because the VM’s connection has gone, and then the proxy closes both connections. In a tunnel to a host the policy allows, the far end’s bytes reach the VM at once, so a protocol whose server speaks first, such as SMTP, gets its greeting before the VM sends anything. The VM’s bytes wait until the proxy has checked them: when the first one starts a TLS record, the proxy reads the whole ClientHello and checks its SNI before any of it reaches the far end, and any other first byte passes at once. The VM may wait as long as it likes before its first byte, as on any open tunnel, but once a ClientHello starts, it must arrive whole, in one record of at most 16 KiB and 256 bytes, within 10 seconds, or the proxy closes the tunnel and logs why. The proxy reads no record past that length, so a VM can’t make it hold 64 KiB for each of its tunnels, nor hold a slot by sending its ClientHello a byte at a time.
The proxy carries at most 1024 CONNECT tunnels for the VM at once, including tunnels to links and intercepted ones, from the request until the tunnel ends. That’s four times the 256 connections a browser such as Chrome keeps open at most, and many times what a package manager opens, such as npm’s 15 sockets or uv’s 50 downloads, so several installs and builds at once fit. Each tunnel holds two of the proxy’s file descriptors, so the limit keeps a VM that opens tunnels without end from taking them all. A CONNECT past the limit gets 503, which a client may retry, and the reason 1024 tunnels open already, logged as a refused block, so neither the VM’s prompt nor devvm network log suggests an allow rule. The proxy’s own log, proxy.log, says when the VM reaches the limit, once until a tunnel ends.
The proxy also holds at most 2048 of the VM’s connections at once, of every kind, which counts plain HTTP requests in absolute form, idle kept-alive connections and a request that goes on after its client has gone, as well as tunnels. That’s twice the tunnels’ limit, so a CONNECT past the tunnels’ limit still gets its 503 first. A connection counts from its first request with the VM’s password, and a request on a connection past the limit gets 503, after which the proxy closes the connection. On a Linux host, the limit of 256 connections that QEMU carries to the proxy at once comes first, and a connection past it gets a 503 before it reaches the proxy (the QEMU wrapper).
Every program on this machine can reach the proxy’s port, an open VM’s included, so a connection that hasn’t sent the VM’s password yet never takes the VM’s room. Such connections wait in a pool of their own, at most 128 at once, and one more closes the one that has waited longest, which a real client rarely is, because it sends its request at once. Holding connections open can’t take the VM’s room, but a program that opens connections as fast as this machine accepts them still slows the proxy for the VM, through the system’s queue of connections waiting to be accepted (design).
The proxy also has at most 2048 requests to hosts under way at once, plain HTTP’s and those inside intercepted tunnels together. Each is a connection of its own to the host, so the tunnels’ HTTP/2 requests, 100 at once in each, can’t add up to more connections than the proxy can open. A request past the limit gets 503, which a client may retry.
proxy.log says when the VM reaches either limit, once a minute at most (attack vectors).
Nothing bounds how long a request or a tunnel lasts, so a long download, a WebSocket, a model’s slow stream and server-sent events go on for as long as they take. The proxy bounds what a connection makes it hold instead:
- A connection to the proxy waits at most 10 minutes for its next request, as the HTTP inside an intercepted tunnel or a transparent connection does, which is longer than a client keeps one idle.
- A request without the VM’s password gets
407, and the proxy closes its connection after it, so nothing without the password keeps a connection open. - A request takes at most 64 KiB of headers, including in an intercepted tunnel, a transparent connection and the
403page’s TLS connection. - HTTP/2 inside an intercepted tunnel or a transparent connection carries at most 100 requests at once, which is what most servers allow, and each is a request the proxy makes to the host.
- A plain HTTP request in absolute form goes on when its client half-closes after sending, because some clients do, so the proxy can’t tell from that alone that the client has gone. The request goes on while its answer keeps coming, and once its client has stopped sending and a minute passes with nothing to pass on, the proxy ends it, so a client that went away doesn’t leave a request waiting on a host that never answers.
Links through the proxy
A VM’s NO_PROXY names only the VM itself, so an HTTP client that uses the VM’s proxy settings sends a request for a link, such as http://db:5432/, to the proxy. A running VM can’t take a new environment, so the proxy carries those requests itself, and a link added while the VM runs works for every HTTP client at once.
devvm _links writes every link the VM has, carried or not, to a list, links.json in the VM’s run folder, ~/.local/share/devvm/vms/<hash>/run/, mode 600 in a folder of mode 700, whenever they change or the file is gone. Each entry has the link’s names (NAME and NAME.devvm.internal), its address and port in the VM, its target, and its socket on this machine. The list stays when devvm _links ends, and devvm removes it with the VM, so a link that isn’t carried, which has no socket, is refused rather than asked of the rules. devvm puts the list’s path in the proxy’s config as links, and its run folder, where the links’ sockets are, as link_sockets. The proxy checks the list for every request and reads it again when it has changed, as it does the policy files. A list it can’t read has no links, which its log says once. The list must be a regular file, not a symbolic link, that only you can write, and at most 1 MiB.
The proxy checks a request’s host against the list after the VM’s password and before any rule, as it does for devvm.proxy. It lowercases the host and drops one trailing dot, and then a host and port match only an entry that names them exactly, so DB.:5432 matches db:5432, while db..:5432, db.devvm:5432 and 127.77.0.1:5432 don’t. The request names a host and a port, never a socket. An entry counts only when its socket is the one that devvm _links names for this VM’s link at that address and port, in the run folder of devvm’s data folder, so the proxy never connects to another VM’s link or to any other socket, whatever the list holds. Its address must also be in 127.77.0.0/16. Any other name under devvm.internal is refused with 403 and logged as a refused block, whatever the rules allow, so the rules, the host’s resolver and a company proxy never see one. A host and port on no entry are otherwise the policy’s, as before.
For a match, the proxy’s broker finds the host and port in its own read of the list again, connects to that link’s socket and hands the connection to the child, so the child never reaches devvm’s run folder, where every VM’s link sockets are. It’s the same socket that the link’s remote forward reaches, so devvm _links checks the connection as it checks every other (each connection), and the 256-connection cap counts both. A CONNECT is tunneled as it is, with no SNI check and no interception, and an absolute-form request, such as GET http://db:5432/, goes to the socket in origin form, without Proxy-Authorization or Proxy-Connection, over a new connection for each request, which ends when the client gives up the request. A kept-alive connection to the proxy that asks for a link and then for another host has each request handled on its own. HTTPS in absolute form gets 400, because CONNECT carries it. The proxy puts no secret into a link’s connection, even when a secret’s hosts would match the link’s name, and its rules don’t apply, so devvm network deny db doesn’t stop the link db.
The proxy logs nothing for a link’s connection that it passes on, because devvm _links logs it as link, once. When the socket doesn’t answer, because the link was removed since the proxy read the list or devvm _links isn’t running, the proxy answers 502 and logs link_refused with the reason not carried. A socket whose backlog is full refuses a connection, so the proxy tries again for under a second.
Through a company proxy
When devvm starts a VM’s proxy, it reads HTTPS_PROXY, HTTP_PROXY and NO_PROXY from its own environment, each in capitals first and then in lowercase, as Go’s clients do. When its environment sets neither HTTPS_PROXY nor HTTP_PROXY, it reads config.toml’s [proxy] table instead, its https, http and no-proxy, and never a mix of the two. It writes them into the proxy’s config, proxy.json in the VM’s run folder, ~/.local/share/devvm/vms/<hash>/run/, as upstream, so a password in the environment’s URL is in a file only you can read and in no process’s arguments. devvm checks the settings first: a proxy URL is http://user:password@host:port, or host:port alone, and a proxy without a port is on port 80. devvm refuses an https:// or socks5:// proxy (upstream_proxy_scheme) and a setting it can’t read (upstream_proxy_invalid), so a VM doesn’t start until you change it.
A config.toml URL never holds a password (proxy_password_in_config, as it’s read), because people copy that file between machines and keep it with their dotfiles. When its URL names a user, upstream gets "secret": "proxy", and the proxy looks the proxy secret up as it starts, through the same lookup as the secrets it puts in, the Keychain or ~/.local/share/devvm/secrets/proxy, and uses it as the password of each URL that names a user and none of its own. So proxy.json never holds that password. A proxy whose lookup fails doesn’t start, and devvm checks that the secret is saved before it makes a new VM, starts a VM’s proxy, or builds an image or the shared tools (proxy_password_missing), and before it stops a running VM to start it again, as devvm restart does, so a refused restart leaves the VM running. It also checks before it changes a running VM’s tier between internet, allowlist and none, which the VM’s proxy applies at once, so the VM’s state never names a tier that its proxy doesn’t enforce. Each of these is one check of the company proxy’s settings, which devvm runs with the check of your CAs before a VM is made, stopped to start again, or given another confined tier while it runs (the packages).
devvm’s own requests on this machine go through the same company proxy. They are the download of its own mise, the list of Ubuntu’s cloud images, and the registries --from asks for digests. When the environment sets the proxy, their clients use Go’s own environment proxy. When config.toml sets it, devvm’s route to the company proxy is their transport’s proxy. At the first request, the route looks the proxy secret up and puts it in each URL that names a user and none of its own. It routes each request as a VM’s proxy does: HTTPS_PROXY’s for HTTPS, HTTP_PROXY’s for plain HTTP, and directly for NO_PROXY’s hosts, localhost and loopback addresses. Go sends the user and password only to the company proxy, in Proxy-Authorization. A missing password fails the request without a retry. The mise that devvm runs on this machine inherits devvm’s environment, so it uses the environment’s proxy as it is. With config.toml’s proxy, devvm adds HTTPS_PROXY, HTTP_PROXY and NO_PROXY to mise’s environment, in capitals and in lowercase, with the password in each URL that names a user. mise takes a proxy’s password only in its URL, so its environment is the one place it can go. It’s never in mise’s arguments or in a file.
A VM’s proxy refreshes Codex’s and opencode’s OAuth logins through the company proxy it sends the VM’s requests through, its upstream, whether that came from the environment or from config.toml. As it starts, it makes that upstream’s route for its own requests, with the proxy secret it looked up as the password, as devvm makes the route for its own requests. It carries the route in each lookup’s context, and the login’s refresh takes it from there as its transport’s proxy. A VM’s proxy without an upstream sends the refresh directly, as it does the VM’s requests.
An open VM’s proxy goes through the company proxy as a confined VM’s does. Its guest gets no proxy settings of devvm’s environment: Lima’s propagateProxyEnv is off for every VM whose guest names devvm’s proxy, so neither the shell’s nor config.toml’s password reaches the guest.
devvm warns (upstream_proxy_gone) when the config the VM’s proxy last started with has an upstream and the one it starts it with now has none, as happens when a shell without the settings starts it.
The proxy decides each request as it does without a company proxy, by the host name the VM asked for, and only then picks the way out:
- A host that
NO_PROXYnames,localhost, a name under.localhostand a loopback or unspecified address go directly, through the checks above. - A tunnel, and the connection the proxy makes to a bound host to put a secret in, go through
HTTPS_PROXY’s proxy. The proxy sendsCONNECT host:portwith the name the VM asked for, andProxy-Authorization: Basicfrom the URL’s user and password, and it reads the answer. Anything but200refuses the VM’s request, naming the company proxy by its host and port. Over that tunnel, the proxy’s TLS connection to a bound host checks the server’s certificate against the system’s roots and the CAs in your CA folder, as it does directly. - A plain HTTP request goes to
HTTP_PROXY’s proxy in absolute form, with itsProxy-Authorizationin place of the VM’s. The company proxy’s address in the request has no password, so no error the proxy logs holds one. - Without
HTTPS_PROXYorHTTP_PROXY, those requests go directly.
NO_PROXY is a comma-separated list, which the proxy reads as Go’s clients read it. In it, * matches every host, and an address or a CIDR matches addresses. A name matches itself and its subdomains, while a name with a leading . or *. matches only its subdomains. Any entry can end in a port, which limits it to that port, and an entry whose port no request has, such as git.test:0, or whose port isn’t in plain decimal, such as git.test:080, matches nothing. The proxy reads a name in NO_PROXY as it reads the host of every request, lowercased in ASCII alone and without one trailing dot, so a name with a character that isn’t printable ASCII matches no host, because Unicode’s case folding would turn the Kelvin sign into k.
The company proxy resolves the names it’s sent, so the proxy can’t hold it to the addresses it checked, and the floor changes for those requests. An address in the VM’s request is checked as before, and a host whose last label is all digits or starts with 0x, such as 127.1, gets 400, because a company proxy may read it as an address. For a name, the proxy asks this machine’s resolver, for at most three seconds, and refuses the request when any answer is internal or denied, unless a rule names the address. A name this machine can’t resolve, which is common behind a company proxy, goes to the company proxy unchecked when a rule names it, as itself or under *.domain. When only ** allows it, the proxy refuses it with 403, and the event log says that this machine can’t resolve it and only ** allows it. The proxy reads at most 64 KiB of the company proxy’s answer to CONNECT. The design note explains what that leaves open, which Attack vectors lists, and how builds reach the company proxy through a proxy of their own.
The event log’s upstream field names the company proxy, by host and port, for each tunnel and request that went through it, and devvm network log adds through host:port to the line. The proxy’s own log names both company proxies by host and port when it starts. Neither holds the user or the password.
How long a proxy runs
The proxy exits when the VM’s Lima hostagent does, which it learns from the hostagent’s pid file, the VM’s lifeline (lifeline in its config). The proxy starts before the VM, so it waits for the lifeline to name a process that runs. What the file held when the proxy started is an earlier start’s, and the proxy waits past it, but when a new start writes the file and its process is already gone, the proxy exits. Once it follows a start, it runs while the file holds what it held then and that process runs, so a VM started again gets a new proxy. If the hostagent never appears, the proxy exits 15 minutes after it started, and devvm stop stops it at once. It’s the broker that follows the lifeline, and its child ends with it, as processes describes. The broker closes the socket between them, the child stops listening, closes its connections and exits, and the broker kills a child that hasn’t ended 6 seconds later. A child that ends ends its broker, and neither starts the other again, so the VM has no network until devvm’s next command starts its proxy again, as after any proxy’s crash. devvm stop, devvm rm and devvm gc --orphans also stop a child that outlived its broker, by run/proxy-child.pid and its arguments.
A VM that starts again gets a new proxy on the same port. A running VM also gets a new proxy when the config devvm would start it with differs from the one it started with, which devvm tells by the SHA-256 of each. The config holds everything that, changed, starts the proxy again: the VM’s list of policies, the VM’s CA and the next one, by the SHA-256 of each certificate, so a CA that was replaced counts, the SHA-256 of devvm’s binary, so a proxy from another devvm binary counts, the CAs in your CA folder, the company proxy settings in devvm’s environment and the shared Nix cache’s cap. A config that’s gone, or that the proxy wouldn’t read, counts as one that differs. To start a new proxy, devvm stops the old one with SIGTERM, and with SIGKILL when it’s still running two seconds later. The old proxy counts as stopped only once its process is gone, not once its arguments can no longer be read, because an ending process loses its memory before its files, and for that moment its port still looks taken by another program, which would fail the launch with proxy_port_taken. SIGKILL goes only to a process whose arguments devvm can still read as the proxy’s, so a proxy still ending gets none, and neither does another process given its pid since, even one whose arguments devvm can’t read. If it still runs two seconds after that, devvm stops with proxy_stop_failed and starts nothing, because the old proxy would go on with its old settings.
devvm counts a proxy as started only once the proxy says it’s listening on the VM’s port and is still running, because a program that took the port first would otherwise get the VM’s traffic. The proxy says so in a status file of its own in the VM’s run folder (vms/<hash>/run/proxy.status), which devvm names to it when it starts it and removes before each start. The file holds the proxy’s pid and the address it listens on, so a status that an earlier proxy left, or that another program wrote, never counts. While devvm waits, the proxy counts as running as long as its pid file still names it, it hasn’t ended, and its arguments are the VM’s proxy’s, _proxy -config with the VM’s proxy.json, or still devvm’s own, or can’t be read yet. On Linux, a process that has just started shows devvm’s own arguments for a moment, then none, because the kernel lets devvm go on as the new program begins to replace devvm’s copy, and shows the program’s arguments only once it has loaded. If the proxy doesn’t start, devvm stops and names the proxy’s log (proxy_start_failed). When a stopped VM’s port was taken by another program, devvm chooses a new free port. A running VM’s backend holds the port it started with, so when a running VM’s proxy is gone and another program took its port, devvm can’t start the proxy again (proxy_port_taken). devvm then stops the VM (net_proxy_down_stopped), and it does the same when the proxy fails to start for any other reason once the old one was stopped, or when none of the VM’s runs, because a confined VM never runs on without its proxy. The next devvm starts both. A running VM’s old proxy has the VM’s port, so it can’t be kept while the new one starts. On a launch, a link’s change or a devvm network change, what can refuse the proxy’s start is checked before the old one stops: the company proxy and its password, your CAs, and the VM’s CA and secret files. A refusal there leaves the VM and its old proxy running as they were, and devvm says so (net_proxy_kept), but only while the old proxy enforces what the VM’s state asks for now: the same built-in policies, policy files and deny files for the VM’s tier, open or not, from the same devvm binary. An old proxy with a looser tier than the state’s, or from another devvm binary, whose built-in policies’ rules may differ, is stopped with the VM, because it would fail open. The comparison leaves out the company proxy and your CAs that the old proxy started with, so an old proxy kept this way still goes through the company proxy, and trusts the CAs, of its own start. devvm restart checks only the company proxy and your CAs before it stops the VM, and its start checks the rest. An interrupt during the start of a confined VM stops the VM and its proxy too (interrupted_start, a cleanup that the start registers around the backend’s start), because a backend can leave the VM running while its start still waits for it. Lima’s hostagent keeps running the VM after limactl start ends, and devvm records the confined start only once limactl start returns. Without the stop, the VM would run with no record of its confined start, so devvm ls would show it as unenforced and its next launch would offer to restart it.
The child’s sandbox
The child makes no connection of its own, on either system. It asks its broker to look up each name the floor judges, and to open each connection, to an address the child’s floor kept or to a company proxy, and the broker hands it the connection, as it hands it a link’s. The broker connects to an address only once its own read of the VM’s policy files and of this machine’s addresses allows it, as the floor does, and it looks at the policy files at each connection, so a rule such as devvm network allow 127.0.0.1:5432 applies from the next connection. So even a child that a VM took over reaches this machine’s loopback, its own addresses and the private and link-local ranges only where a rule names the address, as the VM does. It still reaches the internet, a host on this machine’s network whose address is public, such as a printer’s global IPv6 address, and whatever a company proxy reaches, which it speaks to with its password, this machine’s loopback included when the company proxy runs here. The broker connects to the company proxy at the address in its own config, so one on this machine’s loopback, such as a VPN client’s, works. It looks names up through this machine’s resolver, whatever its address, so the child sends no DNS. The broker carries at most 256 lookups and 1024 connections at once for the child, each lookup within 20 seconds and each connection within 15, and the child cancels one whose request has gone. The child also holds at most 8448 open files, a limit it sets on itself before it’s confined, so it can’t keep every connection the broker hands it (the design note).
On macOS, the broker starts its child through /usr/bin/sandbox-exec, with a Seatbelt profile that denies everything the child doesn’t need, so the child is confined from its first instruction, before it reads a byte of the VM’s. The broker writes the profile for each start from what the child needs, and passes it to sandbox-exec as an argument, so it’s never a file on disk. It runs devvm’s binary by its real path, with its links resolved, because Seatbelt matches real paths. The profile allows the child the following, and nothing else:
- devvm’s binary: running it and reading it, for its SHA-256, and the metadata of its folder, which CoreFoundation looks at for the program’s bundle before Security checks a certificate.
- The system: the rules that the system’s own
dyld-support.sbprofile gives a program to start, reading the system’s libraries in/usr/liband/System/Libraryand the time zone, the metadata of the links/etc,/varand/tmp, through which those paths lead, and readingsysctl, which the floor reads the host’s addresses with, except the process table’skern.procnames. - Its folders: reading and writing in the VM’s logs folder and the shared Nix cache, where it can make only regular files, and change their mode and times, but not their flags, ACLs, owner, set-id bits or extended attributes, and can remove no folder. It makes no hard link anywhere. The broker makes the cache’s folders before the child starts, as the child can’t make a folder. A build’s child gets its own
logs/folder. - The files that change: the metadata of your policy files, the VM’s bindings and the links’ list, which the child looks at with
statalone, and of their targets when they’re links, and of every link on the way to any of those files or folders. - Checking certificates: the mach services
com.apple.trustdandcom.apple.trustd.agent, which check certificates for Go’scrypto/x509. - The network: accepting on the listener the broker gave it, and reading and writing the connections it accepted and those the broker handed it, which need no rule of their own. The profile allows no network out at all, so the child connects nowhere and sends no datagram itself, because Seatbelt checks every
connectand every send with an address. - Signals and processes: signals to itself, and looking only at itself.
So the child can’t read your home folder or devvm’s other folders, its run folder, its config and the other VMs’ among them, and can’t reach the Keychain, whose service com.apple.SecurityServer the profile never allows, nor any unix socket, such as an ssh master’s control socket or an SSH agent’s. It can’t bind a port, fork or run a program, signal another process, list the processes, or read another process’s path, details or arguments (process-info, kern.proc). macOS answers a process’s arguments (kern.procargs2) to a sandboxed process only within its own process group, and the child runs alone in a session of its own, so it can read only its own. A policy file that’s a link to another file is looked at where it pointed as the proxy started, and when it points elsewhere later, the child’s stat is refused, so the child asks the broker for the file at every request instead, which reads it as before.
On Linux, the child confines itself once it has opened its logs and the Nix cache and loaded the system’s roots and its time zone. It does so before it says it’s ready, so before it reads a byte of the VM’s. It sets no_new_privs on every thread, restricts every thread with Landlock, and installs a seccomp filter on every thread. Landlock and prctl change only the thread that calls them, and Go’s runtime runs the child on several threads, so the child makes each call on every thread at once through Go’s call for all of a process’s threads, which works only in a binary without cgo, as devvm’s releases are. From Landlock’s ABI 8 it restricts every thread in one call instead (LANDLOCK_RESTRICT_SELF_TSYNC), and the filter goes on every thread in one call (SECCOMP_FILTER_FLAG_TSYNC). Landlock holds the child to these files, whatever their permissions:
- Its folders: the VM’s logs folder, and for a VM with the nix layer the shared Nix cache, where it reads, writes, lists, makes, deletes, renames and empties regular files, from Landlock’s ABI 2, which lets the cache rename a file from its top folder into
nar/. It makes no folder, link, FIFO, socket or device there, and nothing in them runs. - Nothing else: it can’t read, write or list any other file, your home folder, devvm’s folders and
/etcincluded, or run a program. Landlock doesn’t restrictstat, so the child still looks at the changing files, and learns whether a file of yours exists, its size and when it changed, but not what it holds. Landlock also doesn’t restrict a file’s mode, owner, extended attributes or times, or, below ABI 3, a truncation by path, so the seccomp filter refuses those.
From ABI 4 Landlock also refuses the child a TCP port’s bind and every TCP connection, from ABI 6 a signal to any process outside it and a connection to an abstract unix socket that isn’t its own, from ABI 9 a connection to a named unix socket, and from ABI 10 every UDP bind and datagram. On a kernel at ABI 6 or 7 without Landlock’s fix for signals between a process’s threads, the child leaves its signals unscoped, because Go’s runtime signals each of its threads to restrict itself in turn, and those signals would be refused and hang the start. Landlock’s network rules match only ports, so they can’t refuse an address alone, and the seccomp filter refuses the child every connection of its own on every kernel.
The seccomp filter refuses the child, with EPERM:
- Sockets: every socket but a netlink route socket (
AF_NETLINKwithNETLINK_ROUTE), which the floor reads the host’s addresses through and which reaches the kernel alone, a socketpair,connect,listen, andsendto,sendmsgandsendmmsgwithMSG_FASTOPEN, which would connect a TCP socket as it sends, such as its listener once ashutdownhas closed it. So the child has no socket of its own to connect, and can’t connect one it holds again. Below Landlock’s ABI 9, the filter is also what keeps it from the ssh masters’ control sockets,docker.sockand your SSH agent’s socket. - Calls around the filter: the three
io_uringcalls, whose operations wouldn’t pass it. - Other processes:
ptrace,process_vm_readv,process_vm_writevandpidfd_getfd, which reach another process’s memory or descriptors, and what changes how another process runs, which Landlock’s scope of signals doesn’t cover:prlimit64other than on the child itself, as a limit such asRLIMIT_CPUcan kill a process,setpriority,ioprio_set,sched_setaffinity,sched_setscheduler,sched_setparamandsched_setattr. - Watching files:
inotify_init,inotify_init1,inotify_add_watch,fanotify_initandfanotify_mark, which would tell it the names of files outside its folders as they change. - A file’s metadata by its path:
chmod,fchmodatandfchmodat2,chown,lchownandfchownat, the extended attributes’setxattr,lsetxattr,removexattr,lremovexattr,setxattratandremovexattrat,truncate, and the times’utime,utimes,futimesat, andutimensatwith a path. The calls on a descriptor that the child opened, which Landlock checked as it opened it, stay:fchmod,fchown,ftruncateandutimensaton a descriptor, which its logs and the Nix cache use. - The kernel’s keyrings:
add_key,request_keyandkeyctl. - What it never does: running a program (
execve,execveat), a process of its own (forkandvfork, andclonefor anything but a thread), a namespace (unshare,setns, andclonewith a namespace’s flag),bpf,userfaultfdandperf_event_open.clone3getsENOSYS, as a kernel without it answers, because its flags are behind a pointer that the filter can’t read, so a caller falls back toclone, whose flags it can.
It kills the child for a system call of any architecture but its own, and on amd64 for the x32 numbers, so the 32-bit calls, socketcall among them, can’t get around it. The child needs none of these, because the broker looks up its names, the listener and the socket to the broker were open before, every connection it opens comes from the broker, and Go’s runtime starts its threads with clone and the thread’s flag. The broker sets itself undumpable (PR_SET_DUMPABLE), so on a kernel without Landlock, where nothing else would, the child can’t read the broker’s memory or open its descriptors through /proc. Other processes of yours stay readable through /proc there, unless the kernel’s Yama restricts ptrace, as Ubuntu’s does. Once confined, the child checks that it lists its own folders, that it fails to list / and to read /etc/hosts with Landlock, and that it fails to make a unix or an IPv4 socket, to connect, to listen and to send with MSG_FASTOPEN with the filter. It also reads the host’s own addresses again, through a netlink socket, and a read that fails or finds none fails the start, because the floor would refuse none of them without it. The confinement takes at most 2 seconds, within the broker’s 4, and a confinement or a check that fails fails the start, which devvm reports as the proxy failing to start (proxy_start_failed). A kernel without Landlock, below ABI 2, or without seccomp filters, leaves that part out, and the child runs with what there is, which it says.
On both systems, the child checks that what confines its files holds before it says it’s ready. It opens its broker’s config, the file named in its arguments, which the profile or Landlock must refuse it, and closes it unread if it opens. Its ready message says how it’s confined, and the broker writes that to run/proxy.confined as one line of a level, full, partial or none, then what confines it and, for a child that isn’t fully confined, why, from a fixed set of words, so devvm never prints what a child wrote:
run/proxy.confined | What |
|---|---|
full seatbelt | the profile confines the child, and its check held |
none seatbelt check-failed | the child ran under the profile, but could open its broker’s config |
none sandbox-exec-missing | there’s no /usr/bin/sandbox-exec, so the broker started the child unconfined |
none sandbox-exec-failed | sandbox-exec failed to start the child under its profile, so the broker started it again unconfined |
none unsupported | devvm doesn’t confine the child on this system, or this devvm, built with cgo as the tests’ race detector is, can’t reach its threads |
full landlock | on Linux, Landlock from ABI 6 with its signals scoped, and the seccomp filter, confine the child, and its check held. Below ABI 9 the filter alone refuses it a unix socket, and below ABI 10 a UDP socket |
partial landlock landlock-signals | this kernel’s Landlock is ABI 4 or 5, or 6 or 7 without its fix for signals between threads, so the child can also signal your other processes |
partial landlock landlock-below-abi4 | this kernel’s Landlock is ABI 2 or 3, which refuses no TCP of the child’s, though the filter refuses it every socket and connection of its own |
partial landlock no-seccomp | this kernel has no seccomp filters, so only Landlock confines the child, which below ABI 4 can connect anywhere itself, this machine’s loopback included |
partial seccomp no-landlock | this kernel has no Landlock, or only ABI 1, so only the filter confines the child, which can read and write your files |
none no-landlock-or-seccomp | this kernel has neither, so the child runs with the broker’s access, and can connect anywhere itself |
none landlock check-failed | the child confined itself, but could open its broker’s config |
The broker starts the child again unconfined only when sandbox-exec failed before devvm’s code ran. That’s when the child had already ended before it answered, either with sandbox-exec’s own exit status, 65 for a profile it refused or 71 for a program it couldn’t run, or killed by SIGABRT or SIGKILL, as the system kills a program that a profile refuses what it needs to load. The broker decides that before it stops the child itself, so a child that its own stop ended never counts. Nothing of a VM’s can cause those failures, so the second start, which has what’s left of the broker’s 4 seconds, never trades a confined child for an unconfined one at a VM’s request. A program of yours that sent the child one of those signals in that moment could, and the proxy’s log and devvm doctor then say the child runs unconfined. A child that answers failed, ends any other way, or doesn’t answer in time fails the start, as it would unconfined, because what it read by then could be a VM’s. A ready that names a sandbox the broker didn’t start the child under, or another than the one it did, breaks the protocol’s rules, so a child can’t claim more than it was given. The broker writes a warning in proxy.log for each child that isn’t fully confined, and devvm doctor warns of each running VM whose proxy says so (the proxy runs without a sandbox). A proxy that hasn’t written run/proxy.confined yet, such as one still starting or one that a devvm from before the broker started, gets no warning.
Policy files
On the allowlist tier, a VM’s proxy reads these policies, in this order, as one list. Allowlists describes what they allow and the rules they hold. The other tiers read fewer, and one list of devvm’s makes each tier’s:
- internet: one built-in policy,
network/internet.policy, which holds**:*, every host and address on any port, thensecrets.policy, then your files below, whose denies alone apply. The proxy’s config lists those files indeny_policies, and the proxy drops their allows as it reads them, keeping their denies and a broken deny.**lifts no floor, so internal addresses and this machine’s stay refused. - none: the built-in policies of the VM’s agents, each agent’s
shared-tools/<agent>.policy, such asshared-tools/claude.policy, and no other built-in one, thensecrets.policy, then your files as denies alone. The VM’s links come before every rule, as on every tier. - open: no policy at all. The proxy’s config has
"open": true, which allows every host and address on every port, internal ones and this machine’s included, and a config withopenand any policy is refused. The floor doesn’t apply, and a name that the host can’t resolve goes to the company proxy unjudged, as it does for a build.
| Policy | Read for |
|---|---|
layers/base.policy (built in) | every VM |
shared-tools/<name>.policy (built in) | each shared tool in the VM’s image |
layers/<name>.policy (built in) | each built-in layer in the VM’s image |
~/.config/devvm/layers/<name>.policy | each of your layers in the VM’s image |
~/.config/devvm/policy | every VM |
~/.local/share/devvm/vms/<hash>/policy | that VM only |
~/.local/share/devvm/vms/<hash>/run/secrets.policy | every VM, which devvm writes with the hosts of the VM’s secrets and logins and of its agents’ token endpoints |
The built-in policies are paths in devvm’s own files, which are built into the binary, and no copy of them is ever on disk. The same list holds both kinds for a VM: the built-in ones go in the proxy’s config as names in builtin_policies, and your files as paths in policies. The proxy reads the built-in ones from the binary once, as it starts, ahead of your files in the list, and never again, so only an upgrade of devvm changes them, and an upgrade starts every VM’s proxy again because the binary changed. A built-in policy that’s missing, or that holds a line that isn’t a rule, is a bug in devvm, so the proxy refuses to start rather than run with fewer rules than devvm meant, and devvm stops the VM as for any proxy that doesn’t start. A missing file of yours, on the other hand, has no rules. devvm network reads the built-in policies from the binary too, and it labels each with its name (# devvm: layers/base.policy, and "builtin" with --json) where it shows your files’ paths. Both lists are in the config that a proxy started with, so a change to either starts the proxy again.
The proxy, devvm network and devvm doctor read every policy with one parser, which returns each line that holds more than a comment, with its number and whether it’s a rule. A line is a rule only when one check takes it, which is exactly what devvm network allow and deny take (the packages). Each time the proxy reads a file, it logs each line that isn’t a rule, with its file, number and text, quoted, to its own log, proxy.log in the VM’s logs/ folder. It skips such a line, unless the line starts with !, which makes it a broken deny. A broken deny fails closed: while any of the VM’s policy files has one, the proxy’s policy denies every name and every address, and each request gets 403 and a refused block whose reason names the file and the line, so neither the VM’s prompt nor devvm network log suggests an allow rule. The VM’s links and the proxy’s own answers at devvm.proxy come before the rules, so they still work, and tunnels already open stay open, as they do for any new deny. Fixing the line lifts it at the proxy’s next read of the file, which is the next connection. The proxy reads a file again when its mtime, size or inode changes, or when it comes back after it was missing, whatever its mtime. It also reads a file again at every connection while its mtime is less than 2 seconds old, because some filesystems keep mtimes only to the second or two, so a second write within that time could leave the stamp as it was. A change of a file’s mode or owner alone, with chmod or chown, changes none of the three, so the proxy doesn’t see it until the file’s next write. The same goes for the bindings file and the links list, so one that you make readable or writable by others after the proxy read it keeps its last contents until it changes, and the proxy refuses it then. A file the proxy refused is read again at the next connection, so fixing its mode works at once. An error other than a missing file keeps its last rules and its broken deny, which the proxy’s log says once. The proxy, devvm network and devvm doctor read a policy file only when it’s a regular file, through a symbolic link if it’s one, of at most 1 MiB, through devvm’s one reader of files a VM can write or swap. They open it without blocking and check the file they opened, so a FIFO or a link to /dev/zero in a policy file’s place can’t hang them, and each refuses it with a named error, one for a file that isn’t regular and one for a file that’s too long. A leading byte-order mark isn’t part of the first line. devvm warns about each line that isn’t a rule, with policy_broken_deny for a broken deny and policy_not_rule for the others. A launch of a confined VM warns about the VM’s policy files as it readies the VM’s proxy, devvm network allow, deny and rm about the file they change, and devvm doctor about the files you edit: ~/.config/devvm/policy, your layers’ and each VM’s own. devvm network also marks the line, and --json lists it in not_rules. A unit test parses every policy file that devvm ships and fails on any line that isn’t a rule.
Each change that devvm network allow, deny or rm makes rewrites the file whole, through a link if the file is one, so a proxy never reads half of it.
Quiet hosts
A built-in policy can hold quiet HOST or quiet HOST:PORT lines, for one exact host name, never *.name or **, so a quiet line can’t hide a whole domain’s blocks (quiet hosts). The policy parser returns such a line as one that isn’t a rule, marked as a quiet line, so the check of a rule and devvm network allow never take one. The proxy’s read of its built-in policies keeps it as a rule marked quiet, which allows and denies nothing, so the proxy leaves it out of the rules a decision reads. It matches a host and port against the built-in quiet rules alone, as it matches any rule, but only while no rule covers that host and port, whether an allow, a deny or one that narrows, and never on an open policy or one with a broken deny. The proxy drops a quiet line in any other file and logs it, and devvm warns about it with policy_quiet_not_own. A quiet host is blocked as any host no rule allows, and an allow of yours still lifts it. The proxy marks a block’s event quiet only when its reason is the one for a host no rule allows, it isn’t refused whatever the rules say, and a quiet rule matches, for the proxy’s path and the transparent one alike, so a block for another reason, such as an internal address, a failed connection or a deny of yours, keeps its notice. A quiet event is logged with "quiet": true but never counted among the blocks that /blocked and /blocked/new serve, so neither the VM’s prompt nor devvm-why sees it, and the proxy’s block page writes no allow command for it. devvm network log gives it no allow command and a row of its own apart from the same host’s other blocks, and ends its line , quiet, and devvm network lock leaves it out of what it offers, judging it with the proxy’s own match of quiet rules. devvm network marks a built-in quiet line, its --json lists the hosts in quiet, and the agents’ table on the coding agents page leaves quiet lines out. Each quiet line in devvm’s files has a comment that names the host’s use and the maker’s page that documents it.
Requests by method and path
A rule for a host name or *.name can have its methods and then its path after it, each after spaces or tabs, such as api.github.com GET,HEAD /repos/ (rules by method and path). The policy parser reads such a line as one rule, whose text is its canonical form: the host as before, the methods in capitals in the order of the proxy’s list of methods, and the path as written, joined by one space. That’s what devvm network allow, deny and rm write from --method and --path, and what they compare a line by, so HEAD,get and GET,HEAD are the same rule. A method outside that list, CONNECT among them, an address, a CIDR or ** with methods or a path, and a path that isn’t a pattern aren’t rules, so a typo in a deny is a broken deny, which denies everything, rather than a deny of nothing.
The proxy judges a host in two steps. For the connection, CONNECT host:port or an absolute-form request, a deny that narrows doesn’t refuse the host, and an allow that narrows allows it, so a host that only rules by method and path allow is reached. Its requests are then judged one by one when a rule that narrows covers the host and either it’s a deny or no rule allows the whole host. Both come from one read of the policy files, the rules that cover the host, so a file that changes between the two can’t give the connection one rule’s verdict and another’s way through. Such a host’s CONNECT on a port the proxy intercepts, :443, is intercepted with the VM’s CA, as a bound host’s is, and on any other port, or without a CA, it’s refused with 403, logged as a refused block, because the proxy can’t see the requests in it. An absolute-form request, plain HTTP on any port or https://, is judged before it’s forwarded.
Inside an intercepted tunnel, the proxy’s own HTTP server reads each request, HTTP/1.1 kept alive or HTTP/2, and calls one handler for each, which checks that the request names the host (421 otherwise), then judges it with the rules as they are then, then forwards it. So every request on a connection is judged, not just the first, and a rule added or removed applies from the tunnel’s next request. A WebSocket is judged by its upgrade request, after which the proxy passes its bytes as they are, so for a host that rules narrow, an Upgrade to any other protocol, such as h2c, whose requests would pass the same way, is refused, and so is a CONNECT inside the tunnel. A refused request gets 403, and the event log gets a blocked event with its method and path. A deny’s refusal is marked refused, so neither the VM’s prompt nor devvm network log --blocked suggests an allow, and a request that no allow covers suggests the allow of the whole host. An allowed request’s forward event names the rule that allowed it, as its rule.
The proxy’s judge of a request takes the rules that cover the host and port in order. A whole deny refuses, then a CONNECT and an upgrade to a protocol other than WebSocket are refused when a rule narrows the host, and so is, when a rule narrows it by method, a method that the request names besides its own that isn’t exactly one of the proxy’s methods, then each deny that narrows refuses what it matches, and then the first allow that matches lets the request through. One matcher judges both rules and secrets’ bindings (the packages):
- A path in plain form: the path as the proxy forwards it starts with
/, has nothing percent-encoded, no\or;, and is clean, with no.or..segment and no doubled slash. The query is no part of it. These are the forms that servers read apart, by decoding an encoded slash or dot, reading\as/, dropping;and what follows it, or not cleaning the path, so a request in any of them could reach a path that the proxy didn’t judge. - A pattern: its segments are split at
/,*matches any run of characters within one, and**as a whole segment matches one segment or more. A pattern’s last/stands for/**, so/api/is/api/**, which is a binding’s path below which the value goes in. A path’s one trailing/may be there or not. Matching is a table over the pattern’s and the path’s segments, linear in the path for each of the pattern’s at most 32 segments, so a VM’s long path can’t make it slow. - The methods a request names: besides its own, each value of a header that some servers take the method from,
X-HTTP-Methodor any withmethod-overridein its name, read in any case and with_for-, as Rack’s and CGI’s servers turn-into_, and each_methodparameter of the query, in any case of its name. A value that isn’t exactly one of the proxy’s methods, trimmed, is odd: a list such asDELETE, GET, which servers read apart, lower case or nothing. The proxy reads no body, so a form’s_methodfield is thePOST’s. - An allow, and a binding, match strictly: the request’s method, and every method it names besides, as written, must be among the rule’s methods, with none odd, and its path must be plain and match the pattern in its own case. A request the matcher can’t judge alike for every server is never allowed by a rule with a path.
- A deny matches broadly: the method, or any method the request names besides, every word of a list among them, in any case, or any odd one; and the path in any case, any path that isn’t plain, the path above a pattern that ends with
/or/**, the path with its last segment cut at its first., which frameworks that take a format from a suffix (Rails, Spring) route to the same handler, and the path with each segment’s trailing dots dropped, as servers that drop a trailing dot read it. - A query servers read apart: while a rule narrows the host by method, a query with a
;, which some servers split pairs at and Go’s query parser skips the pair around, or with an escape that doesn’t decode, which Go’s parser drops, is odd, so a_methodhidden in it can’t pass.
In a user’s terms, the methods a request names work like this. Some servers take a request’s method from a header or a parameter instead of the request itself, so the proxy judges a request by every method it names. It reads the X-HTTP-Method-Override and X-HTTP-Method headers and every header with method-override in its name, in any case and with _ for -, as some servers read X_HTTP_METHOD_OVERRIDE, and the _method parameter of the query. While a rule by method covers a host, a request there whose header or parameter isn’t exactly one of those methods in capitals, such as DELETE, GET, delete or nothing at all, is refused, because servers could read it either way, and so is a request whose query has a ; in it, which some servers split the query at, or a query with an escape that doesn’t decode. Otherwise an allow needs the request’s own method and every one it names to be among its methods, so an allow of GET refuses a GET that says it’s a DELETE, and a deny refuses a request that names any of its methods. The proxy doesn’t read a request’s body, so a _method field in a form that a POST sends, which some frameworks take as the method, is judged as the POST it is: a deny of POST refuses it, and an allow of POST lets it through whatever the field says.
Paths work like this. Servers don’t all read a request’s path alike, so a rule’s path matches only a path that every server reads the same way: one with nothing percent-encoded, no \ or ;, no . or .. part and no doubled slash. An allow matches exactly, its method and its path in their own case, and no path in any other form. A deny matches broadly instead. It matches in any case and every path that isn’t in that plain form, a deny whose path ends with / also matches the path above it, a path’s last segment matches with what follows its first . cut off too, as frameworks that take a format from a suffix route /admin.json to /admin, and every segment matches with its trailing dots dropped, as some servers drop them, so a deny of /config.json refuses /config.json..
Judging a request costs the policy files’ stat, which every connection already has, and a scan of the host’s rules. Decrypting the tunnel costs a TLS handshake with a certificate from the VM’s CA, which the proxy keeps for the 1024 hosts it used most recently, and another to the host, so the proxy decrypts only the hosts whose rules need it: a host that a whole allow covers, with no deny that narrows, stays a tunnel that the proxy doesn’t read.
The VM’s setup
On every launch, the VM’s setup does the following:
- It installs the VM’s own CA and the next one into the VM’s trust store, as
devvm-proxy.crtanddevvm-proxy-next.crt, so the proxy’s certificates for hosts with a bound secret verify, in this VM only. It never gets their keys. - It points the programs that ignore the proxy variables at the proxy. Those are apt, sudo (which keeps the variables), every ssh connection, Docker’s daemon and containers with the docker layer, and Nix’s daemon with the nix layer. Under systemd, each daemon gets a drop-in,
devvm-proxy.conf, that holds the VM’s own proxy address and nothing else, and without systemd, Docker’s settings in/etc/conf.d/dockerget a block instead, and Nix’s daemon gets/etc/conf.d/nix-daemon. Every VM has a proxy, an open one’s included, so every VM gets them, and the setup restarts a daemon whose settings changed. An ssh connection gets aProxyCommandthat tunnels through the proxy, and the proxy checks its host and port against the allowlist. - It writes
devvm-local-proxy, a proxy on the VM’s loopback that adds the VM’s password to each request, for browsers, which ask for a proxy’s password rather than take it from the proxy variables. The desktop layer starts it and points the desktop’s session at it (the local proxy). - With the nix layer, it points Nix at the shared Nix cache first:
/etc/nix/devvm-cache.conf, which/etc/nix/nix.confincludes with!include, setssubstituters = http://devvm.proxy/nix https://cache.nixos.org. Every VM gets that file, an open one’s included, and the setup restarts Nix’s daemon when the file changed. - It sets
NO_PROXYandno_proxyto the VM itself,localhost,127.0.0.1,::1, in the daemons’ settings above and in Docker’s client settings (~/.docker/config.json), as the VM’s backend does in the environment it sets at each start. The VM’s links aren’t in it, because HTTP clients reach them through the proxy, so a change of links changes no daemon’s settings and restarts nothing. - It puts the VM’s placeholders in
~/.config/devvm/env, which login shells read, asCLAUDE_CODE_OAUTH_TOKENandGH_TOKEN. Whengithubis bound, it also sets up git’s credential helper for GitHub over HTTPS. - It adds
devvm-why, the note before each prompt, and the notes for Claude Code and Codex (inside the VM).devvm-whyprints the proxy’s/blocked, and when that list is empty, the proxy’s answer adds that a connection refused, or a DNS error, for an allowed host comes from a tool that skipped the proxy where devvm can’t send it there, with a link to troubleshooting. With transparent mode,devvm-whythen printsdevvm-transparent statusas root, throughsudo -n. The notes, a block between<!-- devvm-proxy -->markers in~/.claude/CLAUDE.mdand~/.codex/AGENTS.md, say to rundevvm-whyafter a connection error or a403from the proxy, that a tool that ignores the proxy settings still reaches the proxy by name over HTTPS, HTTP and the ports the rules name, and that a refused connection on another port, or a DNS error, whiledevvm-whyshows nothing blocked means the tool skipped the proxy and needs its own proxy setting or$HTTPS_PROXY. The setup writes them only when the VM has a proxy address, and replaces the block on every launch. - On a VM that runs confined to its proxy, with transparent mode on, it sets up transparent mode, and on any other VM it takes transparent mode out.
Each placeholder ends in a random value of the VM’s own, its salt, which isn’t its password.
Tools that skip the proxy
On a confined VM, transparent mode sends a tool that ignores the proxy settings to the VM’s proxy by the names it looks up (what it covers). Nothing new runs or listens on the host, and the backends don’t change: the VM reaches its proxy over the path its proxy settings use, and the proxy judges each connection as it judges CONNECT host:port. Every piece in the VM is a program that devvm configures, dnsmasq, nftables and socat, which base installs, and one script, devvm-transparent, which each launch sends. A tool that looks up api.example.com and connects to it goes this way:
- Its lookup reaches dnsmasq in the VM. glibc and musl both ask
127.0.0.1:53themselves, which is where Lima’s DNS setting for a confined VM points (the VM’s resolver). An nftables rule sends127.0.0.1:53to dnsmasq, which listens on the stand-in address,198.18.0.1, alone. That rule takes every connection to127.0.0.1:53in the VM, so a DNS server of the user’s own there, or a forward of port 53 to it, gets nothing. - dnsmasq answers the A query with
198.18.0.1, with a time to live of 0, and every other type, AAAA and HTTPS included, with an empty answer, neverREFUSED, which musl waits 5 seconds on. It has no upstream server, so no query leaves the VM, and it reads/etc/hostsfirst, solocalhost, the VM’s hostname,host.lima.internaland the links’ names keep their own addresses. Names underdevvm.internalthat aren’t a link’s don’t exist, and neither does a name without a dot, nor a name under the search domains that the VM’s resolver appends to one, which Lima takes from this machine’s network and dnsmasq reads from/etc/resolv.confas it starts. So a single-label name that isn’t in/etc/hostsdoesn’t resolve, rather than turning into a name of this machine’s network. dnsmasq can’t tell a name the resolver made that way from one a tool names whole, so every name under those domains gets no answer, such asgit.corp.example.comundercorp.example.com. - The tool connects to
198.18.0.1:443. The address is on the VM’s loopback interface, so the connection stays in the VM, and an nftables rule sends it to a socat listener on198.18.0.1:61443. Nothing binds port 443 or 80 itself, so your own servers keep them. - socat opens an ordinary
CONNECT transparent.devvm.proxy:443to the VM’s proxy, with the VM’s password, which it reads from a file, never from its arguments. Each port has a listener of its own, so the port reaches the proxy in the target, and nothing the VM sends can change it. - The proxy checks the password, takes one of the VM’s 1024 tunnel slots, and reads the connection’s first bytes for at most 10 seconds. A TLS record is read whole, and its ClientHello’s server name (SNI) is the host. An HTTP/1.x request line or HTTP/2’s preface makes each request’s
Hostthe host, judged on its own. Anything else is refused and logged as a refused block oftransparent.devvm.proxy, with why: no SNI, an address as the SNI, a name with anything but ASCII, a name underdevvm.proxy, or bytes that name no host, such as SSH’s, Postgres’sSSLRequestor a server that speaks first. - From there the connection is
CONNECT host:443: the links, the policy and the floor, interception for a bound host, the tunnel and its SNI check, the log, and/blocked, in the orderCONNECThas them. The ClientHello goes on to whatever serves it first, so the far end gets it byte for byte. The proxy dials the host it judged, by name, so the VM can’t name one host and reach another. Its events carry"via": "dns".
A blocked TLS host gets a TLS handshake with a certificate for its SNI name from the VM’s own CA, signed as interception signs, then the proxy’s 403 text for every request on the connection, over HTTP/1.1 or HTTP/2. The proxy resolves nothing and dials nothing for it. Without a CA, or once it has ended, the connection closes, and the block is logged all the same. A plain HTTP request is always forwarded as http://, whatever its request line says, so no secret goes into it, and a Host that names another port than the connection’s gets 400, as does a CONNECT inside it. A link’s name gets a refused block on both ways, because dnsmasq never gives a link’s name the stand-in address. Its name in /etc/hosts reaches it. A Host of devvm.proxy reaches /blocked alone and gets 403 for every other endpoint, the CA, the ports and the Nix cache, because socat adds the password for any client, a container without the proxy settings included.
The ports. The proxy serves the ports to redirect at http://devvm.proxy/transparent/ports: 80 and 443, then each port an allow rule names for hosts by name, **:8443 included, the lowest first, at most 32 of them. It leaves out :*, address rules’ ports, 22 and 53, and every port but 80 and 443 while a deny is broken. The proxy’s own log names the ports past 32, once each time they change. devvm-transparent fetches the list every 10 seconds and at each launch, and takes it only when it’s 2 to 34 ports, each once, with 80 and 443 and neither 22 nor 53. A new port gets the lowest free listener from 61100 to 61131, and a port that stays keeps its own. The list shows the VM the ports its rules name, never their hosts, which it can’t read otherwise. That’s a small disclosure, and it gives the VM nothing to reach: each connection is still judged by its own host and port.
The nftables table. The table inet devvm_transparent is loaded whole, in one transaction, and devvm-transparent loads it again within 10 seconds when something removes it, such as nft flush ruleset. Its NAT chains run at priority -110, before Docker’s at -100, and the first NAT chain that gives a connection a mapping is the only one that does, so they give every TCP and UDP port of the stand-in address one: a redirected port goes to its listener, DNS to dnsmasq, and every other port to port 61079, where nothing listens, so the kernel refuses it at once with a reset, or for UDP, QUIC included, with a port-unreachable. Docker’s chains, which would send a published port’s traffic to a container, so never see the stand-in address, and neither a VM process nor a container that connects to db.example.com:5432 reaches a container that publishes 5432. The refused connections are logged in the kernel’s log, five a second at most, which devvm-transparent status reads. DNS to any public server goes to dnsmasq too, from the VM and from Docker’s bridges (docker0 and br-*), so Docker’s fallback servers, 8.8.8.8 and 8.8.4.4, and resolvers that tools hard-code reach it. So does DNS to the VM’s own name servers but loopback’s, as /etc/resolv.conf and systemd-resolved’s list name them, such as the one Lima’s DHCP adds beside 127.0.0.1, which Docker gives its containers once it drops the loopback one; devvm-transparent reads them again every 10 seconds. Other loopback addresses, private, link-local and CGNAT ones are left alone, so a DNS server on a container’s or the LAN’s address still answers, and Lima’s DNS addresses that aren’t the VM’s name servers answer nothing, as the host’s confinement has it. Two filter chains run before every NAT chain, at priority -150: one drops traffic to the stand-in address from any interface but the loopback and Docker’s bridges, such as Podman’s or LXD’s bridges and Lima’s network, and both drop anything to it but TCP, UDP and ICMP, such as SCTP, which no NAT rule maps. So neither reaches Docker’s DNAT of a published port through the stand-in address. An input rule keeps the same interfaces off it again, and only connections the NAT rules translated, and DNS, reach it. The listeners’ ports, 61080, 61443 and 61100 to 61131, and the dead port, 61079, are above Linux’s range for outgoing connections, 32768 to 60999, so no connection out is given one.
The service. devvm-transparent run is the service, under systemd or OpenRC, as root: it adds 198.18.0.1/32 to lo, loads the table, starts dnsmasq and a socat listener for each port, and then restarts any of them that ends within a second, sends dnsmasq SIGHUP when /etc/hosts changes, and fetches the ports every tenth second. dnsmasq runs as the user devvm-transparent, and so does each socat connection’s process, which reads the password file through its group. When the service stops, it removes the table, the address and what it started, so names stop resolving, and a stopped or broken service never leaves a way out. It starts at each boot, before any launch, with the last ports and settings, and each launch’s setup turns it on, off, or restarts it when its settings changed, such as a new proxy port or password. Its files are root’s, in /etc/devvm/transparent, and the VM’s password, which every program in the VM has in its environment already, is in files only, never in a process’s arguments. On an open VM, and with transparent mode off, the setup stops and removes all of it, and flushes systemd-resolved’s cache. The setup decides by the confinement the VM runs with, so a VM whose tier changed into or out of open keeps what it had until its next start.
What doesn’t change. The host’s confinement is the boundary: root in the VM can change or stop all of this, and then names stop resolving, or a query to Lima’s DNS goes nowhere, as for a VM without transparent mode. The self-check’s direct connection is to an address on port 443, so transparent mode never answers it. The VM’s names never reach the host’s resolver for a blocked host, because the proxy asks the policy before it resolves anything. Design notes has the threat check.
The VM’s resolver
On a confined VM, Lima’s DNS setting gives the guest one name server, its own 127.0.0.1, and each launch’s setup makes the system’s resolver ask it directly. systemd-resolved’s stub, 127.0.0.53, would ask 127.0.0.1 in turn, and when nothing listens there, because transparent mode is off or stopped, the stub can keep retrying it over UDP and TCP without answering, so a lookup through glibc waits out its own timeout instead of failing. So the setup replaces /etc/resolv.conf, which on Ubuntu is a link to the stub’s file, with a file of its own that names 127.0.0.1 alone, with the stub’s search line and a timeout of one second, tried twice, which is plenty because dnsmasq answers in the VM itself. glibc then gets a refusal at once when nothing listens, and dnsmasq’s answer through the nftables rule when transparent mode runs, as musl on Alpine does.
systemd-resolved still runs, so resolvectl and the programs that ask it over D-Bus still go through it. Docker reads /etc/resolv.conf and finds only a loopback server there, so on its default bridge it gives containers its fallback servers, and on a network of their own, such as Compose’s, its embedded DNS server asks 127.0.0.1 from the VM’s side. The nftables table sends both to dnsmasq. The setup writes its file only on a guest with systemd that has the stub’s file and whose /etc/resolv.conf is the stub’s link or the setup’s own file, so a file or link of your own stays, and it copies the search line again at each launch. When it can’t write the file, it says so in one line and the launch goes on. systemd-resolved reads a file that isn’t its own link as servers and search domains of its own, so while the VM is confined it takes 127.0.0.1 from the setup’s file, and a search line of . sends every name there. It keeps them after the file is a link again, until it restarts. So on an open VM, the setup puts the stub’s link back and restarts systemd-resolved, which then asks Lima’s DNS. Going back needs only the setup’s own file, which it writes nowhere else, and when the stub’s file is missing afterwards, the setup says that names may not resolve.
The shared Nix cache
VMs with the nix layer share their downloads from Nix’s binary cache, so each package comes from cache.nixos.org once per machine instead of once per VM. Each VM keeps its own Nix store and daemon, and only the host writes the cache, so no VM can change what another VM gets. The design note says why it’s a cache that the host fills rather than a shared store.
In the VM. devvm starts the VM’s proxy with nix_cache set to ~/.local/share/devvm/cache/nix-cache in its config when the VM’s image has the nix layer, and the VM’s setup puts http://devvm.proxy/nix before https://cache.nixos.org in Nix’s substituters (the VM’s setup). It leaves trusted-public-keys as Nix has it, which is cache.nixos.org’s key alone. Nix’s daemon reaches devvm.proxy through its own proxy settings, so its requests are absolute-form GETs with the VM’s password, and the proxy answers them itself, as it does /blocked and /ca.pem, and never forwards them. When the cache answers with anything but a file, Nix goes on to cache.nixos.org, through the proxy as any other download.
What a VM can ask for. The proxy takes only GET and HEAD requests with no query, for three kinds of path under /nix/. These are nix-cache-info, a narinfo named <hash>.narinfo with a 32-character hash in Nix’s base 32, and a NAR named nar/<hash>.nar with a 52-character hash and no suffix or .xz, .zst or .bz2. Anything else gets 400. The proxy makes up nix-cache-info itself, with priority 30, so Nix asks the cache before cache.nixos.org, whose priority is 40. It serves the other files from the folder, or fetches them from https://cache.nixos.org when the VM’s policy allows cache.nixos.org:443 and, when rules by method and path narrow that host, a GET of the file’s path there. That’s the only host it fetches from, and its fetches go through the same address floor and company proxy as the VM’s own requests. It follows no redirect, and nothing of the VM’s request goes with it, so nothing a VM sends is ever stored.
What the host checks. Before it keeps a narinfo, the proxy checks that its StorePath is the path the VM asked for, and that cache.nixos.org-1, whose Ed25519 key devvm pins, signed its fingerprint, 1;StorePath;NarHash;NarSize;References. The signature doesn’t cover the NAR’s URL, so the proxy also checks that the URL is named by the narinfo’s own NarHash or FileHash, and no narinfo can put a file in another NAR’s place. It fetches a NAR only after it checked a narinfo that names it, never for a HEAD, and it keeps the NAR only when its SHA-256 and size are that narinfo’s FileHash and FileSize. The host can’t check a NAR’s NarHash, which is the hash of the archive before compression, because the proxy uses Go’s standard library alone, and that has no xz or zstd. Each VM’s Nix checks the signature and the NarHash again, so a narinfo with an added reference, or a corrupted NAR, fails there too. A file that fails a check, a not-found and an error all get 404, and the proxy keeps nothing of them, so Nix goes to cache.nixos.org itself.
The folder and its cap. The proxy writes each file whole into a temporary file in the folder, then renames it into place, mode 600 in folders of 700. The cache’s cap is the nix-cache.size retention setting, 10 GiB when it’s off, which devvm puts in the proxy’s config as nix_cache_max when the proxy starts. The cap counts the disk each file takes, in whole blocks, and a NAR being fetched counts at its full size from the start. When a new file would take the cache past its cap, the proxy deletes the least recently used files, down to nine tenths of the cap, and when the NARs being fetched leave no room, it refuses the fetch. One proxy fetches each NAR once, however many requests ask for it, and at most four at once. A request that missed the cache looks again once it’s its turn to fetch, so a fetch that ended in between is served from the cache, not downloaded and counted against the cap a second time. A hit marks a file used by setting its modification time. Every VM’s proxy and devvm gc take one lock on the folder before they change it, so the cap holds while many VMs fill it, and a running total in the folder saves counting it for each file. Each tries the lock without waiting, again and again for at most 5 seconds, because a proxy’s child that a VM took over could hold it for ever. Past that, the request gets 404, so Nix goes to cache.nixos.org itself, and devvm gc skips the trim and says so (nix_cache_locked). devvm gc and the daily retention run also trim the cache to its cap, and devvm gc --nix-cache empties it.
What a child could leave there. A VM’s proxy’s child writes the cache, so devvm reads it as it reads a file a VM can write. Its trim and its count of the cache open the folder as a root that no link leads out of, take nar/ only when it’s a folder and never a link, count and delete only regular files, and delete a link as itself, never what it leads to, so a link a child leaves never leads devvm to your files. Each proxy makes nar/ and sets the cache’s folders to yours alone through the folders it opened, never by their paths. The proxy deletes anything at nar/ that isn’t a folder, such as a link, as itself, makes a folder in its place and warns of it in its log, so its change of mode never reaches a folder of yours. Every proxy reads a cached file only when it’s a regular file, never through a link and without waiting on a FIFO, and takes the lock only on a regular file with one link.
Logs. Each request is a nix-cache event in the VM’s own log, with its path and what came of it: hit, fetched, or why it wasn’t found or was refused. devvm network log shows these as cache.
Open VMs have their proxy too, so they share the cache. An open proxy allows cache.nixos.org as it allows every host.
What stays open. What one VM can learn of another through the cache, and how it can push other VMs’ files out, is under Attack vectors. Private caches, such as Cachix or one behind a netrc, are never shared, because only root in a VM can add a substituter, and Nix reaches it directly through the proxy’s allowlist.
A company’s CA
The CA certificates in ~/.config/devvm/ca (a company’s CA) reach every project VM, whatever its tier, and the VM’s proxy. Builds trust them too, as Images and caching describes, and so does the mise that resolves the shared tools’ versions on this machine, which on macOS trusts them for every connection but its Sigstore client’s, as the host’s mise below explains.
Reading them. devvm reads the folder’s *.pem and *.crt files at each launch, each build, each proxy start and each run of the host’s mise, and nothing outside the folder. It looks at the folder and each of those files itself, never at what a link leads to, and follows no link: a folder that is a link fails with ca_folder_link, and a file that is one, dangling or not, with ca_link. A link into a project folder would otherwise let that project’s VM write the CA that every VM, build and proxy trusts. A file or folder that it can’t read fails with ca_unreadable or ca_folder_unreadable, which name it and carry the error. It decodes every PEM block and refuses a block that isn’t CERTIFICATE (ca_not_certificate), a certificate that crypto/x509 can’t parse (ca_invalid) and a certificate without CA basic constraints (ca_not_ca). It also refuses a file with no certificate in it. It tells a private key apart by its PEM type, not by the file’s name, and a refusal fails the whole launch or build. What leaves the host is each certificate encoded again from its parsed bytes, once each, so the text around a block never does.
Installing them. devvm’s guest script ca.sh DIR runs as root and makes devvm’s CAs in /usr/local/share/ca-certificates exactly DIR’s devvm-*.crt files: the VM’s own CA and its next one, devvm-proxy.crt and devvm-proxy-next.crt, and the user’s devvm-extra-N.crt. When anything changed, it runs update-ca-certificates --fresh, so a CA that went leaves neither the bundle nor its hashed link. update-ca-certificates tells the hooks in /etc/ca-certificates/update.d only about the CAs it links, never about a file that was deleted, so ca.sh tells them itself. It runs each hook that run-parts would run, with a -/etc/ssl/certs/NAME.pem line on its input for each CA it removed, as Debian’s update-ca-certificates does for a CA it deselects. That way Java’s cacerts (ca-certificates-java’s jks-keystore hook) and Mono’s store drop a removed CA, in a project VM and in an image whose layer installed Java. A hook that rebuilds its store from the bundle ignores that input. A hook that fails stops nothing, and ca.sh says so in the run log. It also writes them all to /etc/ssl/devvm.pem, for Node. In a system without update-ca-certificates, such as a container image before its ca-certificates package, it adds them to /etc/ssl/certs/ca-certificates.crt itself. It keeps the bundle as it was in /var/lib/devvm-ca, or a mark that there was none, and puts it back once they go, and a package that arrives in between makes the bundle again from the same folder. Run without DIR, ca.sh removes every one of devvm’s files. Its unit tests run it in a folder that stands for / (DEVVM_CA_ROOT).
Project VMs. The setup that devvm sends at each launch carries ca.sh and the certificates in ca/, and sync.sh runs it, so a change applies at the next launch and a running VM needs no restart. Every project VM starts with the CAs’ variables below in its environment, whatever its tier and whether there are CAs or not, so adding a CA changes nothing that its backend sets at a start. On Lima, the clone that makes the VM sets the environment too, and the VM’s first start adds its proxy’s address to it in the one edit before its first boot. The variables are NODE_EXTRA_CA_CERTS=/etc/ssl/devvm.pem, which is empty when there are none (Node warns only about a missing file), SSL_CERT_FILE, REQUESTS_CA_BUNDLE and PIP_CERT, set to the system’s bundle, and UV_SYSTEM_CERTS=1.
The proxy. As devvm readies a VM’s proxy, it reads the folder too, and writes the bundle into the proxy’s config, proxy.json in the VM’s run folder, as upstream_cas, which the proxy adds to the system’s roots for its own TLS connections. Each secret lookup’s context carries those roots, and an agent’s OAuth refresh on the host takes them from there and sets them on its client, so it goes through a company proxy that inspects TLS as the VM’s own requests do. devvm’s other host requests, such as registry digests and Ubuntu’s image check, use the host’s own store, as the host’s other programs do. A VM can’t change that file or the folder, so the proxy’s roots grow only by what you put there. A proxy whose bundle differs from the folder’s starts again, as one whose CA was replaced does.
The host’s mise. The client that downloads devvm’s own mise adds the folder’s CAs to the system’s roots, and a download whose server’s certificate it still doesn’t trust fails with tools_untrusted, in place of mise_download_failed. That mise, a release build, uses rustls with the platform’s verifier, so it trusts the system’s roots, and it falls back to Mozilla’s own only when none load. On Linux it reads the system’s roots from files, as OpenSSL does. When the environment sets neither SSL_CERT_FILE nor SSL_CERT_DIR, it reads the first bundle it finds, such as /etc/ssl/certs/ca-certificates.crt, and the folders /etc/ssl/certs and /etc/pki/tls/certs, and otherwise it reads only what they name. On macOS it asks Security.framework, which trusts what the Keychain trusts and reads no variable. With CAs in the folder, each run of mise gets them in its temporary folder, and MISE_EXTRA_CA_CERTS names them, which mise adds to its roots on both systems. mise’s Sigstore client, which fetches the trust root (tuf-repo-cdn.sigstore.dev) that its lock-time provenance checks need, ignores that setting, so on Linux devvm also writes a bundle of the system’s bundle and the folder’s CAs, and SSL_CERT_FILE names it, which every client in mise reads. The system’s bundle is the file that SSL_CERT_FILE names when devvm’s environment sets it. When devvm’s environment sets neither variable, SSL_CERT_DIR names the system’s folders, so mise still reads them. Otherwise mise reads the folders that devvm’s environment names, and none when it sets only SSL_CERT_FILE, so a bundle of your own keeps mise to the CAs that you chose and the folder’s. On macOS nothing but the Keychain reaches that client, so a CA that a proxy signs that host with has to be trusted there. Each run of mise also logs to a file in its folder (MISE_LOG_FILE). When a failed resolve’s log has rustls’s invalid peer certificate, devvm fails with tools_untrusted, which names the folder, in place of tools_resolve_failed or tools_need_resolve.
End-to-end checks: in project, a VM trusts a test CA from its next launch (openssl verify against the system’s bundle, and curl reaching an HTTPS server on the host that the CA signed), has the variables, fails its launch on a file that isn’t a certificate, and trusts the CA no more once the folder is emptied; in tools, Node fetches from that server.
Secrets
Secrets lists each secret with its hosts and header. This section describes where devvm keeps them and how the proxy puts them into requests.
Where secrets are saved
On macOS, devvm saves a secret in the Keychain, under the service devvm and the account that is the secret’s name, such as claude, github or stripe. It saves it through security -i, giving the value on its input, so the value is in no process’s arguments. DEVVM_SECRET_SERVICE names another service, made of letters, digits, ., _ and - only. On other systems, devvm saves a secret in ~/.local/share/devvm/secrets/<name>, a file only you can read.
A secret of your own keeps its value under custom.<name>, as its Keychain account or its file’s name, which no known secret’s name can be, so a known secret that devvm adds later never finds a value of yours. Its definition is in ~/.local/share/devvm/custom-secrets.json: its name, an ID of 16 random bytes made as it’s first saved, its hosts, header, variable, prefix, scheme, path, methods and whether it may be Basic’s username, as one JSON object of "version": 1, written whole and mode 600, and never its value. A path that devvm writes there has "path_pattern": true, as * in it is a wildcard, and devvm refuses a saved path with a * but without it, which was saved as a prefix whose * was itself, rather than read it as wider than it was saved, so the commands that read the list fail and name the file, as for any entry they refuse. devvm changes the list only while it holds custom-secrets.lock beside it, so two runs of devvm secret set at once never lose one another’s secret. It saves the value before the definition, and when a new secret’s definition can’t be written, it deletes the value again. devvm secret rm unbinds a secret’s VMs and deletes it, and devvm secret use binds a VM to the definition that’s there, each under the same lock, so neither can come between the other’s check and its change. A value devvm can’t save whole is refused before the one saved is touched: security -i reads its commands in lines of 4096 bytes, so a value has at most 3,800 bytes, and devvm checks the whole line before it runs security. Each value is printable ASCII alone, because a header carries nothing else and the Keychain gives what isn’t back in hex.
Inside devvm, a secret’s value has a type of its own from the moment devvm reads it, as you paste it, from the Keychain or its file, or from an agent’s login file, until the place that uses it. The same goes for a VM’s proxy password and the company proxy’s password. Printed in any way, in an error, a warning or devvm’s run log, that type shows <redacted> and never the value, and devvm can’t write it into a file by accident, because only the files that must hold the real value write it: the Keychain or the secret’s file, the proxy’s config, the VM’s state and the agents’ login files (secrets in the code).
Each VM’s state records, for each secret of yours it uses, the definition’s ID and the hosts the secret had when devvm secret use bound it. The VM’s binding has the secret’s hosts that are in that record, so a host the secret gains reaches a VM only once devvm secret use binds it again, and a VM bound to another definition by the name gets no binding at all. The proxy’s lookup checks every secret binding against the secret as it’s saved before it gives a value: its hosts within the secret’s, and its header, scheme, path, methods, Basic username switch, ID and placeholder the secret’s own. A binding that doesn’t match gets nothing, and the proxy logs secret_binding_changed. Writing the bindings of every running VM again goes on past a VM whose files can’t be written and returns every failure together, so one VM never keeps the others’ proxies from dropping a secret. A proxy whose bindings file did change drops every value it has cached at once. One whose file couldn’t be written keeps a cached value for at most its 5 minutes, and only for the hosts it had. devvm checks every entry again each time it reads the list, as devvm secret set checks what you give it, so an entry edited by hand with a wildcard host or a known secret’s name is refused, and a list it can’t read fails the command that reads it, naming the file, rather than leaving a secret out. It reads the list as the proxy reads its own files: a regular file, not a symbolic link, that’s yours and that only you may write. Only a command that needs one of your secrets reads it, so a VM that uses none of them launches whatever the list holds. Your secrets’ names never shadow devvm’s own, nor an agent’s login’s, whose bindings are named after the agent, such as codex-key or pi-openai, and their placeholders have secret- before the name, which no login’s placeholder has. devvm secret rm unbinds a secret of yours from each VM that uses it before it deletes the secret, so a failure part way leaves the secret saved rather than a VM bound to a name that a secret saved later could take.
How the proxy puts them in
A secret’s hosts join the VM’s allowlist on port 443, whether a value is saved or not. A secret of yours has exact host names alone, because a wildcard would reach names that others may own under a shared domain, and devvm can’t tell those domains from the rest without the public suffix list.
For each secret that has a value, devvm writes the VM’s bindings to secrets.json in the VM’s run folder, ~/.local/share/devvm/vms/<hash>/run/, as one JSON object, whole and mode 600. It’s of "version": 1 while every binding has no methods and no path but a prefix longer than / that ends with / and has no *, so a proxy that knows only version 1, still running from before an upgrade, keeps the VM’s bindings, its agents’ logins included. One from after bindings gained paths reads such a file alike. A proxy of devvm 0.1.0 or 0.1.1-rc.1 ignores the path, which for the built-in bindings only widens OpenRouter’s key to all of openrouter.ai, as 0.1.0 bound it, until the VM starts again with a new proxy. A secret of yours saved with the path / has none, as / is every path. A binding with methods or another path makes it "version": 2, which such a proxy refuses, so it puts no value in rather than put one in for every method, and devvm warns about each VM whose proxy is from another devvm binary when it writes one (secrets_other_binary). A binding holds the secret’s name, its kind, its hosts, header and placeholder, sometimes a path and methods, and never its value. The kind is secret for one that devvm keeps and login for one of an agent’s logins, with the agent whose login file holds it, so where a value comes from never depends on its name. The proxy reads the file only when it’s a regular file, not a symbolic link, that only you can read or write, and a file it can’t read that way has no bindings until devvm writes it again. For a bound host, the proxy intercepts :443 tunnels instead of passing them through. It terminates TLS with a certificate from the VM’s own CA. Each certificate it makes for a host lasts a day, but never past the CA’s own end or before its start, because a client checks the whole chain. The proxy keeps the certificates of the 1024 hosts it used most recently and makes a new one for any other, so a binding with a wildcard host such as *.example.com, which needs a certificate for each name the VM asks for, can’t grow the proxy’s memory without end. It then puts the real value in the binding’s header and forwards the request over a new TLS connection. Absolute-form https:// requests get the same.
How the proxy puts the value in depends on the binding’s kind. A secret binding’s placeholder is replaced only when exactly one value of its header holds it, as it is or inside Basic credentials, and that value has one of four shapes. It’s the placeholder alone, or for Authorization, Bearer, Token or the binding’s own scheme in any case, one space and the placeholder, because gh sends the GitHub token after token. It’s also Basic credentials, canonical base64 after one space, whose password is the placeholder, after a username of printable ASCII without a colon and at most 64 characters, because git sends the GitHub token as x-access-token:<token> that way. With the binding’s basic_user, it may be the username instead, before a password of printable ASCII of at most 64 characters, as Stripe takes its key. The proxy then puts the value where the placeholder was and nowhere else. A username, framed bytes, a doubled placeholder and a Digest field are all places that a server can echo when it refuses a request, as Elasticsearch names the user it couldn’t authenticate, so those keep the placeholder. A login binding’s placeholder is replaced only when the header has one value and that value is the placeholder alone, or, for Authorization, Bearer in any case, one space and the placeholder. Every agent sends its logins that way: an API key alone in x-api-key or x-goog-api-key, every other key and every OAuth login’s access token after Bearer, and an MCP server’s header as the whole value that the VM’s copy replaced. Any other value keeps the placeholder, and so does a header that’s sent twice, which a server may join into one value. So code in the VM can’t put text of its own before or after a real API key, and a provider that quotes part of a key it refuses, as xAI’s, OpenAI’s and DeepSeek’s errors do, quotes only the placeholder. The proxy’s own log names the binding and its header when it leaves a placeholder for that reason, without a value.
A binding can also have a path, a pattern as a rule’s is, and methods, and then the proxy puts its value in only for a request that they match as a rule’s allow does, with the one matcher of requests by method and path, so a request with another method, or with a method-override header that names another, keeps the placeholder. Only a secret of yours has methods, from devvm secret set’s --method, and a binding without them goes in for every method. A path that ends with / matches everything below it. OpenRouter’s API keys are bound below /api/, because opencode and pi send them only to openrouter.ai/api/v1/, so the rest of the site gets the placeholder. They’re bound in two headers, each a binding of its own with the same name and placeholder. pi sends the key in x-api-key to /api/v1/messages for OpenRouter’s anthropic/* models, which it calls with Anthropic’s API, and in Authorization after Bearer for every other model. opencode sends it in Authorization today, and in x-api-key for a model whose first API in the models.dev catalog is Anthropic’s Messages API, because it uses a model’s first API. The proxy compares the path as it forwards it, after a token endpoint’s capture has set it, and it takes the path only in a form that every server reads alike: clean already, without a . or .. segment or a doubled slash, with nothing percent-encoded, so no encoded slash or dot can move the request elsewhere after the check, and without a backslash or a ;, which some servers read as a separator or drop with what follows. A request for /api/../settings, /api%2F..%2Fsettings or /%61pi/v1 keeps the placeholder. A bindings file with a path that isn’t a pattern, or with methods that aren’t in their canonical form, has no bindings. Each request must name the bound host, and one that names another host gets 421. The proxy checks the bindings file for every request and reads it again when it has changed, so removing a binding applies to tunnels that are already open.
The proxy’s broker is devvm itself, so it looks a value up in its own process, from the Keychain, devvm’s secrets folder or the agent’s login file, by the binding’s kind, when the child asks for it. The child names the binding by its kind, agent and name alone, and the broker finds that binding in its own read of the VM’s bindings file and looks the value up with its own copy of it, so a child can ask for no value that isn’t bound to its VM. It runs no other devvm for it, no devvm command prints a secret, and no value is in any process’s arguments. On macOS it asks the Keychain through security find-generic-password, whose output is the value. A lookup takes at most 20 seconds, and the broker makes one at a time, so two requests never refresh a login at once. The broker keeps values for 5 minutes, or 30 seconds for agents’ logins, and a failed lookup for 5 seconds, so a child can’t make it run security or try a refresh back to back, and it drops them all when the bindings file changes, so a secret set right after a failure goes in at the next request. The child keeps a value only until the broker’s lookup is that old, and neither logs one. Each keeps a value by its binding’s kind, agent and name together, so a binding never gets the value of another one with the same name. A lookup that fails puts nothing in, and the proxy’s own log says why, without the value, such as agent_refresh_failed when refreshing a Codex login failed. It refuses with 403 the GitHub API calls that would make a credential of their own with the GitHub token, which are adding an account or deploy key, registering a runner and adding a webhook, whether the repo or organization is named or given by its ID. Every HTTPS request it forwards is checked, inside an intercepted tunnel and in absolute form alike, before it goes anywhere.
Tests: the unit tests check what a secret of yours may be and what devvm secret set’s flags change, that every variable the VM’s scripts export, and the proxy’s, is one it can’t take, each shape its value goes in and each that keeps the placeholder, and that a binding’s path and methods let it in only for the requests they match, each request of a kept-alive or HTTP/2 connection on its own. They check that a binding that isn’t the secret’s as it’s saved gets nothing, that a value too long for the Keychain’s line is refused before anything runs, and that every secret’s placeholder has one shape, the VM’s own, and is never taken as a value. They check the list, its mode and its checks on reading, that no value is in it or in a VM’s bindings, and that only a VM that uses the secret gets its binding and hosts, that two bindings of one name are cached apart, and use, a new value and the question that names the VMs before a delete. The CLI tests check every refusal before anything runs, the value on stdin and at a prompt and never in a command’s arguments, the list, --json, the binding and the variable a VM gets and the other VM doesn’t, and the delete (the tests behind it). End-to-end checks (network): a secret of yours bound to a host that the run’s company proxy fakes; the VM’s variable is its placeholder, the host gets the real value in the secret’s header, another host gets only the placeholder, and no log holds the value. Once the section has saved, bound and captured its secrets, and again at its end, no VM’s proxy password and none of the tokens, keys and logins the section used are in devvm’s run logs, its other logs or any VM’s proxy logs, as they are or in Basic credentials, and no VM’s proxy password is in Lima’s logs, ha.stderr.log and the serial logs.
The VM’s CA
Each VM has a CA of its own, whatever its tier, which only its proxy signs with and only that VM trusts, so a copy of one VM’s key can impersonate sites to that VM alone, and no VM’s proxy can make a certificate that another VM accepts. A CA is ECDSA P-256, valid for 30 days from an hour before it’s made, and it names no host. Its common name holds its serial number, so no two CAs share a name. devvm keeps the VM’s CAs in the VM’s run folder, ~/.local/share/devvm/vms/<hash>/run/ca/: the current CA as ca.pem and its key ca.key, and the next CA as next.pem and its key next.key. The folder and both keys are yours alone (modes 700 and 600), devvm writes each file whole, a key before its certificate, and on macOS it keeps the folder out of Time Machine. The keys never leave this machine: the VM gets the two certificates and nothing else. The proxy reads each certificate and key only when it’s a regular file, not a symbolic link, and refuses a key that anybody but you may read or write.
At each launch, devvm readies both CAs before the proxy starts, holding the folder’s lock, lock, so two launches of one VM at once take turns. The current CA stays while it has over a week left. When it has less, or there’s none, the next CA takes its place if it has started and has over a week left, and otherwise devvm makes a new current CA. The next CA starts a week and an hour before the current one ends, and lasts 30 days too. When it doesn’t follow the current one that way, by ending after it and starting by the time it’s replaced, devvm makes it again. A key without its certificate, or a CA that lasts longer than 30 days, is made again too. Each launch’s setup installs both certificates in the VM, so the VM trusts the next CA weeks before the proxy uses it.
The proxy holds both CAs, and it signs with the next one from an hour after that CA’s start, which is a week before the current one ends and the moment from which the next launch would make it the current one. The hour lets a VM whose clock is behind see that the CA has started. The switch needs no launch and no new proxy, because the VM already trusts the next CA, so a VM that you don’t open again keeps verifying the proxy’s certificates until the next CA ends, which is at least 30 days less an hour after its last launch. A proxy keeps the CAs it started with, because the VM trusts no others, and a launch that replaced either one starts the proxy again with the new ones, as how long a proxy runs describes. /ca.pem at devvm.proxy serves both certificates.
A VM that runs past its next CA’s end without a launch can’t verify the proxy’s certificates any more. From then on, its proxy answers each CONNECT to a bound host’s :443 with 403 before any tunnel opens, and it logs a refused block with the reason devvm's CA has ended: open the VM again (devvm in its folder) for a new one, so neither the VM’s prompt nor devvm network log suggests an allow rule. Absolute-form https:// requests involve no certificate for the VM, so they go on getting their secrets. The VM’s other connections work until you open it again. Running devvm in the VM’s folder then makes a new CA and a next one and starts the proxy again with them, which ends the connections open through the old one, and the launch’s setup installs both in the VM.
The CAs live as long as the VM’s folder. A remake keeps the folder, so the VM keeps its CAs, and so does a change of tier. devvm rm, devvm gc --orphans, and devvm deleting a VM whose creation it interrupted or whose folder an earlier VM of the project left, delete the folder, and the CAs and their keys with it.
In a user’s terms: to put a secret in, the proxy shows the VM a certificate from the VM’s own CA, which every VM has, an open one’s included, and which no other VM trusts, so one VM’s proxy can’t make certificates that another VM accepts. Each CA lasts 30 days, and its key stays on this machine. Each launch installs the VM’s current CA and the next one, which starts a week before the current one ends, and the proxy switches to the next CA then on its own, without a launch. So a VM that you don’t open again keeps working for at least 30 days after its last launch with devvm in its folder. Connecting with ssh alone isn’t a launch. When a VM runs past its next CA’s end without a launch, its proxy refuses its HTTPS connections to secrets’ hosts, and devvm network log --blocked gives the reason devvm's CA has ended. The VM’s other requests keep working. Running devvm in the VM’s folder installs new CAs, which also starts the VM’s proxy again and ends the connections open through it (saving and binding secrets). devvm rm deletes a VM’s CAs with the VM, and a VM keeps them when its tier changes.
Tests: the unit tests check the dates, the modes, the switch and each CA that’s made again, that launches at once take turns on the lock, that an open VM’s proxy has the VM’s CAs, salt and secrets file and that a VM keeps its CAs as its tier changes, that a client trusting both CAs verifies the proxy’s certificates before the switch and after it, with the same proxy, that the proxy refuses a key others may read and a symbolic link, and that two proxies’ certificates come from their own CAs. The CLI tests check each VM’s CA files and modes, that two VMs’ CAs differ, that the setup sends both certificates and no key, an open VM’s too, and that a VM turned off and on again keeps its CAs (the tests behind it). End-to-end checks (network): a second confined VM, whose CAs differ from the first’s; each VM trusts its own two and none of the other’s; no key is anywhere in the VM; each proxy serves its own CAs at /ca.pem, and its certificates verify with its own VM’s CAs and not with the other’s; devvm rm deletes a VM’s CA with its folder.
Agents’ logins and settings
Agents’ login files also stay on the host, in devvm’s agent store, which devvm agent import fills, and so do logins made in a VM (devvm’s agent store). devvm never reads an agent’s own login file in the home folder for a VM. When a VM’s image has the agent and the store has a login file for it, the login’s bindings join the VM’s, and their hosts join its allowlist on port 443.
Codex’s login is ~/.local/share/devvm/logins/codex/.codex/auth.json, opencode’s is ~/.local/share/devvm/logins/opencode/.local/share/opencode/auth.json and pi’s is ~/.local/share/devvm/logins/pi/.pi/agent/auth.json, the store’s copies of ~/.codex/auth.json, ~/.local/share/opencode/auth.json and ~/.pi/agent/auth.json. The VM’s copy holds placeholders, shaped like a JWT where the tools read claims, and the bindings put the store’s API key or access token into requests for the provider’s hosts:
- For Codex, those are OpenAI’s hosts,
api.openai.com, andchatgpt.comfor a ChatGPT login. - For opencode, they’re the hosts of the API keys of the providers in API keys the proxy puts in, each in the headers that its row names, and of OpenAI and GitHub Copilot logins, but not Copilot Enterprise. opencode keeps one entry per provider,
{"type":"api","key","metadata"},{"type":"oauth","refresh","access","expires","accountId","enterpriseUrl"}or{"type":"wellknown","key","token"}. A bound key’s entry reaches the VM as{"type","key"}alone, its key the placeholder, so itsmetadatastays on this machine, and a bound OAuth login’s keeps only the fields that name its account beside the placeholders (the packages). - For pi, they’re the hosts of the same providers’ API keys, each in the same headers. Both agents name each of these providers by the same ID, and neither puts a key in a URL, such as Gemini’s
?key=, which the proxy couldn’t fill in, because it swaps the placeholder in a header alone. pi keeps one entry per provider,{"type":"api_key","key","env"}or{"type":"oauth","access","refresh","expires"}, and devvm binds only the first kind, with a key that’s a value rather than a!commandor a$NAMEor${NAME}template, which pi fills in from the entry’senvor the environment ($$is a literal$). A bound entry reaches the VM as{"type","key"}alone, its key the placeholder, so nothing else of it, itsenvincluded, leaves this machine.
The store keeps opencode’s login in the auth.json format of opencode 1: one entry per provider, {"type":"api","key"} or {"type":"oauth","access","refresh","expires"} with its expiry in milliseconds. opencode 2 keeps its logins in the credential table of its SQLite database, ~/.local/share/opencode/opencode.db, and imports auth.json into it once, in the migration that makes the table, so a VM’s opencode gets the VM’s copy when it first runs there. A VM’s placeholders don’t change when the host refreshes a login, so the database’s copies keep working. After that, the store’s opencode logins reach the database through opencode auth import, as auth export entries with the IDs cred_devvm_<provider>: the placeholder of each API key that the proxy puts in, each key that [pass-keys] passes, with its metadata, and the OpenAI login’s placeholders from one of opencode’s Codex logins. The VM’s setup sends these entries on every launch, and devvm agent login opencode --api-key --provider PROVIDER sends them at once, both on the input of devvm’s guest script opencode.sh, never in a command’s arguments. The script keeps the last entries it got in ~/.local/state/devvm/opencode-import.json in the VM. When opencode has made its database and the new entries differ from the record, or the database no longer holds one of their IDs because it was made again, such as after you delete it or a history import replaces it, it logs out of devvm’s entries from the last ones with opencode auth logout, because opencode auth import skips an ID it already has, and then imports the new ones and makes each of them its provider’s active credential with opencode auth switch, so a ChatGPT login for another account or a key saved from another VM reaches every VM at its next launch. Credentials that you added in the VM yourself have other IDs, so they stay in the database, and opencode auth switch makes one of them active again. Before opencode has made its database, the script does nothing and records nothing, because opencode 2.2.5 doesn’t always import auth.json as it makes the database, so the first launch after opencode has run imports every entry. The script imports each entry on its own, so an entry that opencode refuses doesn’t keep the others out, and devvm agent login names the providers that opencode refused. A failed import leaves the record as it was, so the next launch tries again. The script and its record live in the VM rather than in the VM’s state on the host, because only the VM knows whether its database exists and what it last imported, and a VM that is set up again or has its home copied keeps both together.
Each VM’s placeholders end in its own random value, so no other VM’s placeholder gets its secrets. devvm reads a login file only when it’s a regular file, so a FIFO or a device in its place can’t hold devvm. devvm refreshes OAuth logins on the host, one lookup at a time, and writes them back to the store’s file, so a VM never holds the refresh token of a login devvm keeps. Claude Code’s logins to MCP servers that you make in a VM are that VM’s own (Claude Code’s login). A refresh that has started finishes and is written back even when the request that needed it ends, because OpenAI may already have replaced the refresh token. When a refresh fails, or the store’s login no longer has what a binding names, the proxy puts nothing in, and its own log says to log in again with the agent and import the login again (agent_refresh_failed, agent_provider_refresh_failed for one of opencode’s providers, codex_no_key, codex_no_chatgpt), or names the login file it couldn’t read (login_read_failed). The VM’s copy of Codex’s auth.json holds only the fields that devvm knows, as Codex 0.166.0’s login code reads them. Its API key and its tokens are placeholders, and the copy keeps auth_mode and last_refresh, and in tokens, account_id, login_owner_id and the refresh token’s oauth_provenance, its issuer and client_id, each a plain value. devvm leaves every other field out, at the top of the file or in tokens, Codex’s other logins included (agent_identity, personal_access_token, bedrock_api_key and bedrock_access_keys), because the proxy has no binding for them, and warns you, naming a field in tokens by its path, such as tokens.zz (login_fields_withheld). A unit test plants a field that no format knows in every object of each kind’s login file, as a string, an object and a list, and checks that no VM’s copy holds it (the tests behind it). opencode’s and pi’s logins are withheld by default, by the same rule, which each agent’s entry in devvm’s registry of the agents sets. Every entry that devvm doesn’t bind, an API key, an OAuth login or opencode’s well-known login, reaches the VM with only the fields that name its account or how it logs in, type, expires, accountId, enterpriseUrl, projectId, email, scope, scopes and clientId, each a plain value or a list of strings, and devvm warns you (login_withheld). opencode skips an entry that lacks its key or its tokens as it reads auth.json, so it doesn’t use that provider in the VM. The exception is an API-key entry of a provider that config.toml’s [pass-keys] lists under the agent’s name, which goes as it is, and devvm notes it (login_passed). It’s never an OAuth login, whose tokens a VM never gets, and never a provider that devvm binds, whose key is always its placeholder, so binding wins over the table, and devvm notes each bound provider that the table lists (login_pass_bound). The table has one key per agent, so each agent’s withheld keys are passed on their own. If devvm can’t make the VM’s copy of a login, it stops the VM’s setup (login_copy_failed).
Coding agents lists which files each agent shares.
Logins made in a VM
A login that an agent makes inside a VM goes to devvm’s store too, and the VM gets only placeholders for it. The VM’s proxy does this at the agent’s OAuth token endpoint, the one request of a login whose reply holds its tokens. Codex and opencode both log in to OpenAI at auth.openai.com/oauth/token, whether the code comes from a browser’s redirect or from a device code typed into a browser elsewhere. For opencode 2, those are its Codex logins, the methods chatgpt-browser and chatgpt-headless. Its Sign in with ChatGPT, chatgpt-token-sharing, registers a client of its own and gets its tokens from auth.openai.com/api/accounts/oauth/token, then checks the id_token’s signature against OpenAI’s keys, which a placeholder can’t pass, so devvm doesn’t capture that endpoint, and its replies get 502, as the next paragraph says. Every VM’s proxy config lists that endpoint in captures, for Codex and for opencode, whatever the VM’s image holds, because a program in the VM could install either agent itself, and the proxy refuses that agent’s login rather than let its tokens reach the VM. The endpoint’s host joins the VM’s secrets.policy on port 443 only when its image has one of them, so that agent can log in on every tier. The proxy intercepts the host’s :443 tunnels as it does a bound host’s, with a certificate from the VM’s CA, and forwards every request to it. Only a request of the endpoint’s method to its path is captured, a POST for every OAuth token endpoint, and the proxy compares the path once it’s cleaned, each segment without its path parameters, a backslash read as a slash, and in any case, as a host that normalizes paths reads it, so a request for /oauth//token, /OAuth/Token/, /oauth/token;x or /x;/../oauth/token is captured too. A captured request goes to the endpoint’s own path whatever the VM’s spelling of it, and a POST goes without a query. An endpoint can be a GET instead, for a login that the agent polls for, whose request is its query. The proxy then refuses a query that isn’t a form or that names a field twice, which devvm and the endpoint could read apart, and a GET with a body, and the query goes on in a canonical form, its fields sorted, so the endpoint reads what devvm read. Any other successful reply from that host that names an access_token, a refresh_token or an id_token anywhere gets 502, whatever its type, so no other path there, such as another token endpoint’s, hands the VM a login, and so does one that names a field that the endpoint’s agent keeps its tokens in, such as accessToken. The proxy passes only a web page and its parts unread, which are HTML, CSS, JavaScript, images and fonts, and it refuses a reply it can’t read for that, one that’s encoded or longer than 1 MiB, and an upgrade (101). No informational reply (1xx) from the host reaches the VM, because its headers could hold a cookie. When the host serves an API of its own beside the endpoint, which these checks would break, with its streamed, encoded or long replies, the endpoint names a path prefix that the endpoint is below, its guard, and the proxy checks only the replies below it. It checks the reply to any path that isn’t already clean too, such as one with path parameters, encoded characters or .., because the host could read it as below the guard where devvm doesn’t. The API’s replies elsewhere pass as they are, their informational replies, upgrades and encodings included. A path there that handed out tokens would hand them to the VM, and the VM’s requests to that API carry the agent’s real login, which the proxy puts in, so the agent’s section names the paths that could.
The proxy’s child judges a captured request by the VM’s rules as any other, reads its body whole, up to 64 KiB, with at most 64 KiB of headers, and hands it to the broker, which does the rest itself, so a login’s real tokens, a new login’s refresh token among them, and the store’s id_token never reach the child. The broker finds the endpoint in its own config by the request’s host, path and method, and refuses a request that matches none. It names the VM itself and sends the request to the endpoint’s host from its own config, on port 443, through the company proxy when there is one, trusting the system’s roots and your CAs, as a refresh does. It refuses one that names a field twice, or a JSON body with more after its object, which devvm and the endpoint could read apart. It drops the VM’s Accept-Encoding header from every request to the host, so each reply comes as it is, or as gzip that Go’s transport undoes. The request goes on unchanged, with two exceptions. After a code’s login, Codex exchanges the login’s id_token for an API key, with a token-exchange grant that asks for openai-api-key. The VM’s request carries the VM’s placeholder of the id_token, so the proxy puts the store’s id_token in its place, and only when the placeholder is that VM’s for the store’s current login. An error reply to that request reaches the VM with its OAuth error code alone, such as {"error":"invalid_grant"}, in case the endpoint’s message quotes the id_token. A refresh whose refresh token is the VM’s own, devvm-proxy-managed, or for opencode its access token’s placeholder, goes nowhere, and the VM gets the store’s login as placeholders again, because the host refreshes the login itself. devvm refuses any other grant than a code’s, a refresh’s or Codex’s exchange before the request leaves the host, because it couldn’t read the reply. Any other error reply reaches the VM as it is, with the few headers below, up to 1 MiB, and one that’s longer gets 502. The child reads at most 8 requests and replies to and from the host whole at once, and the broker runs at most 8 exchanges at once.
A successful reply never reaches the VM as it is. The broker reads it whole, up to 1 MiB, and saves its tokens in the store’s login file, in the agent’s own format, under the file’s lock, so a refresh on the host never runs at the same time. Codex’s goes in tokens of its auth.json, with the account from the id_token, and the exchange’s API key in OPENAI_API_KEY. opencode’s goes in the openai entry of its auth.json, as an OAuth login with its expiry in milliseconds and its account. A code’s reply replaces the login, and for Codex it also replaces the API key of the login before it. A refresh’s reply adds to the login, so the store keeps only the newest refresh token. Then devvm writes the VM’s bindings again, so its proxy puts the new login into requests at once. When that write fails, the login is still saved, the VM gets its reply, its proxy’s own log says why, and the VM’s next launch writes its bindings.
The VM gets a reply with placeholders in place of the tokens. Its access token’s placeholder is the one the store’s login binds, a JWT with the login’s account claims, its API key’s is the one its binding names, and its refresh token is devvm-proxy-managed, which is no token. The reply keeps only the token type and scope, says that the access token lasts until 2099, and holds nothing else of the endpoint’s reply, so the agent in the VM never refreshes the login itself. Its headers are only Content-Type, Cache-Control, Pragma and Date, so no cookie of the endpoint’s reaches the VM. A reply that’s too long, encoded in another way, or not a login devvm reads, such as one without an access token, gets 502 instead, logged as a refused block, and devvm saves nothing of it. An error reply holds no tokens, so it reaches the VM as it is, with the same headers alone. The event log gets a login event for each login saved, which names the agent, and the proxy’s own log says why a capture failed, without a value.
A VM captures a login only for an agent that its image has, because a capture replaces the login that every VM with that agent uses. So a login at OpenAI’s endpoint is the agent’s that the VM’s image has, of Codex and opencode, and in a VM with both, the request’s User-Agent says whose login it is. Each login format that captures logins names its endpoints and the starts of its agent’s User-Agent, and devvm lists every format’s endpoints in the registry’s order. opencode runs on Bun, so a request whose User-Agent starts with Bun/ or opencode/ is opencode’s, and any other is Codex’s, because Codex’s format names none. When the VM’s image has neither and its tier reaches the host, its request gets 502 before it leaves this machine, devvm saves nothing, and the proxy’s own log says why (login_capture_refused).
Claude Code logs in at platform.claude.com/v1/oauth/token, and older releases at console.anthropic.com/v1/oauth/token, so every VM’s proxy config lists both in captures for Claude Code, and their hosts join the secrets.policy of a VM whose image has it. Anthropic doesn’t document these requests: devvm reads them from Claude Code 2.1’s bundle, so a release that changes them can break the capture, and the network end-to-end section drives the real Claude Code’s login against a fake endpoint to catch that. Claude Code sends JSON with its public client ID, 9d1c250a-e61b-44d9-88ed-5944d1962f5e, and PKCE, without a client secret. A code’s request holds grant_type, code, redirect_uri, client_id, code_verifier and state, and a refresh’s grant_type, refresh_token, client_id and scope. The reply holds access_token, refresh_token, expires_in and scope, with the account and the organization.
claude setup-token also sends a code’s request, with expires_in of a year added, and asks only for the user:inference scope, so devvm tells it apart by that field. Its reply’s access token, which must start with sk-ant-oat01-, is saved as the claude secret, and the VM gets the secret’s placeholder in its place, which claude setup-token then prints. Any other code’s login goes in the store’s .claude/.credentials.json, as Claude Code keeps it on Linux: claudeAiOauth with accessToken, refreshToken, expiresAt in Unix milliseconds and scopes. A new login whose scope lacks user:inference gets 502, because it can’t use the model. Such a login is an Anthropic Console login, which Claude Code would use to make an API key at api.anthropic.com/api/oauth/claude_cli/create_api_key with the access token the VM never gets. A login or a refresh whose scope has org:create_api_key also gets 502, whatever else it has, because the proxy puts the login into every request to api.anthropic.com, so a VM could make an API key with it and get the key itself. The access token must start with sk-ant-oat01- and hold no space, quote, backslash or control character, in a capture’s reply and in the host’s refresh’s. Only a VM whose image has Claude Code captures a Claude Code login, because a capture replaces the login every VM with Claude Code uses, so another VM’s gets 502 and devvm saves nothing. The VM’s reply holds sk-ant-oat01-devvm-proxy-managed-oauth-<salt> as its access token and devvm-proxy-managed as its refresh token, so the Claude login in the VM’s ~/.claude/.credentials.json, which Claude Code writes from it, holds no token. A refresh with devvm-proxy-managed goes nowhere, and the VM gets the placeholders again.
devvm keeps one Claude Code login. Saving the claude secret, captured or with devvm secret set claude, deletes the store’s .credentials.json, and capturing an OAuth login deletes the saved claude secret, so the newest login wins. Both happen under the lock of the store’s logins/claude folder, so two at once never leave devvm with neither login, and a saved token that can’t be deleted is a warning in the proxy’s log, as the login is saved. A CLAUDE_CODE_OAUTH_TOKEN in devvm’s environment wins over both, as it does in Claude Code. A launch gives the VM CLAUDE_CODE_OAUTH_TOKEN with its placeholder when there’s a token, and otherwise the VM’s copy of .credentials.json, with that placeholder, no refresh token and an expiry of 2099, never both. The copy’s claudeAiOauth replaces the VM’s own in its ~/.claude/.credentials.json, and the rest of that file, such as Claude Code’s logins to MCP servers, stays in the VM (Claude Code’s login). The VM’s bindings hold both logins’ placeholders, the claude secret’s and claude-oauth, whenever devvm keeps either login, and the store’s lookup gives each the login devvm keeps now. So a VM that started with the login that the newest replaced keeps working until its next launch gives it the new one. Both put their value into Authorization for api.anthropic.com. Claude Code lists the connectors of the claude.ai account at api.anthropic.com/v1/mcp_servers, which needs the login’s user:mcp_servers scope, and then reaches each connector at mcp-proxy.anthropic.com/v1/mcp/<id>, with the login’s access token too. So the VM gets a third binding, claude-connectors, with claude-oauth’s placeholder, which puts the login into Authorization for mcp-proxy.anthropic.com below /v1/mcp/ alone. It’s a binding of its own because the proxy looks a value up by its binding’s name, and the store’s lookup gives claude-connectors only the OAuth login, never a token. While devvm keeps a token, saved or in its environment, that binding’s lookup fails and puts nothing in. A token in devvm’s environment isn’t checked for its scope, so it could hold the connectors’ scope, and that’s why a token goes to api.anthropic.com alone. Claude Code sends the anthropic-beta header that names oauth-2025-04-20 itself, so the proxy only swaps the placeholder.
The host refreshes the OAuth login when its access token is due, as Codex’s is: a JSON refresh to platform.claude.com/v1/oauth/token with Claude Code’s client ID and the login’s scopes, through the company proxy the VM’s proxy goes through, written back under the file’s lock. When the refresh fails, the proxy’s log says to run devvm agent login claude again (agent_refresh_failed).
devvm agent login claude runs claude auth login --claudeai in the VM, or claude setup-token with --setup-token, without the VM’s CLAUDE_CODE_OAUTH_TOKEN. Claude Code shows the address that comes back to platform.claude.com/oauth/code/callback, which shows the code to paste, so devvm forwards no port. The login runs on your terminal. When devvm’s input and output are both terminals, devvm gives the login its output and errors as the files they are, so Lima’s limactl shell gives it a terminal in the VM with ssh -t, as it does devvm’s shell. claude setup-token draws full-screen, so without that terminal it draws nothing and waits. Without a terminal, such as in a script or most end-to-end checks, the login gets pipes to devvm’s output, and with --setup-token devvm warns first (setup_token_no_terminal). Every agent’s login runs the same way, and either way, the login’s output goes to devvm’s output and never to the run log. On a terminal, ssh holds it in raw mode, so Ctrl-C goes to the login in the VM, which ends, and devvm then says that the login ended or saved nothing, rather than stopping as interrupted. A signal sent to devvm alone, such as kill, ends the login in the VM within 10 seconds, for a VM that ends its login when told, and until then ssh may hold the terminal in raw mode and write the VM’s output to it. devvm saves the terminal’s state before the login starts, and puts it back once the login and its end are done, or in a cleanup if the run ends first, so an ssh that a signal killed in raw mode doesn’t leave your terminal that way. Once the store has a new login of the kind asked for, which devvm tells by the logins’ checksums before and after, devvm sets the VM up again, so its environment and files hold the login devvm keeps now.
Cursor’s CLI logs in by polling: cursor-agent login shows cursor.com/loginDeepControl with a PKCE challenge and a uuid, and asks GET api2.cursor.sh/auth/poll?uuid=…&verifier=… until it answers 200 with accessToken and refreshToken, or gives up. Its endpoint in captures is that GET, as devvm’s format for Cursor’s login names it, checked against the CLI’s Linux package 2026.11.17-f532c45, read but not run). The store’s poll is the request’s query, as a form, with its uuid and its verifier, and nothing else. A pending login’s 404 passes as it is, and the success replaces the store’s ~/.config/cursor/auth.json with the two tokens. The VM gets accessToken as a JWT-shaped placeholder that lasts until 2099, because the CLI reads its exp, with the token’s sub, which the CLI names the repos it indexes by, and refreshToken as devvm-proxy-managed, with the team that the reply chose. A reply without both tokens, such as an xAI sign-in’s, is refused and saves nothing.
The login’s bindings put the token in Authorization only for the methods that the CLI’s package calls, each one by its whole path, /package.Service/Method: on api2.cursor.sh, those of its API’s services, such as DashboardService’s GetMe, never its methods that make API keys, and its traces at /v1/traces. On the agent’s hosts, api5.cursor.sh and *.api5.cursor.sh, which api2.cursor.sh’s server config names, and on api2.cursor.sh, where HTTP/1.1 takes it, only the agent’s stream, Run and RunSSE, and BidiAppend. On repo42.cursor.sh, its indexing, only its five indexing methods. The package checks the agent’s hosts only for being URLs and names none of them, so devvm takes every host below api5.cursor.sh, the one Cursor’s network docs name. On every one of those hosts the proxy refuses, with 403, any request below /auth/ other than the poll it captures, so no other login endpoint there hands the VM tokens. It also refuses the API’s other methods that make, show or exchange a credential, which are the ones that the package defines by name and, in any service, any method whose name has a key, a secret, a token, a login, a session, auth, a cookie, a password, a JWT, an invitation or a link in it. It refuses the methods that change the account in a way that outlasts the VM and acts outside it, as the proxy refuses GitHub’s keys and webhooks, though the CLI calls them on the host: installing, updating and removing plugins and marketplaces, applying, deleting, testing and changing automations, setting and deleting cloud agents’ environments, starting a cloud agent, and checking Bedrock keys, which devvm doesn’t keep. It refuses every method of the agent store’s service, AgentStoreService, and of any service of any package whose name starts with AgentStore, in any case, because the agent store isn’t the VM’s alone. The account’s CLIs on every machine and its cloud agents mount its user store read-write, its cloud agents load the skills in that store as instructions, every member of a team mounts the team’s store, and a path in a store can be shared with the team or the public. The store’s methods also take a token of its own, which MintAgentStoreToken makes and which a VM could send out and use from elsewhere until it expires, so the VM gets neither the token nor the store, and the CLI keeps its sessions in a local database without them. In the services that hold the account’s and its teams’ own state, DashboardService, AutomationsService and BackgroundComposerService, it refuses any method whose name starts with a verb that changes something, such as Set, Install, Start, Commit, Merge, Fork, Write or Pin, as those services define many more. Each verb was checked against every method of those services in the pinned release, and none matches a method the CLI calls. A verb such as Submit, whose SubmitFeedback the CLI calls, or Check or Generate, whose methods also only read, isn’t on the list, so GenerateGrokCollectionDescription, which drafts a description and only returns it, passes. Test matches one method that only reads, TestAutomationFilter, a dry run of an automation’s filter, and stays on the list for TestTeamCustomerTelemetryDestinationConnection, which has Cursor’s servers send a request with any headers to any address. It also refuses every path below /cloud-agent/, where cursor-agent worker, which makes the machine a worker for your cloud agents, gets its identity tokens. That worker connects to api2direct.cursor.sh, which has no bindings, with Host: api2.cursor.sh, so the proxy doesn’t open its tunnel and the login never goes in, and on the allowlist tier the host isn’t allowed either. The list of verbs is defence in depth, because the bindings put the login only into the methods the CLI calls. A changing method whose name starts with a verb that the list doesn’t have, such as ResolveReviewThread, whose verb also starts methods that only read, isn’t refused by the list, but it gets no login from the proxy either. So in a VM, Cursor’s CLI can’t do those, and you do them from Cursor on your machine. It also refuses any path it can’t read as those hosts do, with an escape, path parameters, a backslash, a byte past ASCII’s printable ones, a segment that ends in a dot or a space, or one that cleaning changes, and any request for a part of a reply (Range), as the proxy could then see no more than a part of a token.
api2.cursor.sh also serves the CLI’s API, whose agent replies stream, so the endpoint’s guard is /auth/, with the CLI’s own token fields, such as accessToken, sessionToken and apiKey, and any JWT added to what guard refuses there, and any cookie dropped. The bindings and those refusals are the real control. The rest is a defence in depth. On every one of Cursor’s hosts, the proxy drops the VM’s Accept-Encoding, Connect-Accept-Encoding and Grpc-Accept-Encoding from each request, so each reply comes as it is, or as gzip that Go’s transport undoes. A Connect or gRPC server still compresses a stream’s messages with gzip when the request’s are, as the CLI’s agent stream’s are. It drops any Set-Cookie from the reply, because the CLI keeps no cookies, and it refuses a reply that comes encoded anyway, by HTTP, or by Connect or gRPC in any way but a stream’s gzip, a part of a reply (206), and a reply with a JWT’s start in any header, its name or its value. A Connect or gRPC stream, which its Content-Type names, passes message by message: the proxy reads each message whole, at most 16 MiB as it comes and as it decompresses, gunzips it when its flag says it’s compressed, and checks it for a JWT’s start before any of it passes, as it came. Connect’s end of stream is JSON, and so is every message of a stream whose Content-Type says JSON, so the proxy checks those messages’ strings as they decode, escapes undone. It refuses gRPC-Web’s text variant, a whole body in base64, outright. A token in base64, such as in a -bin header or a protobuf bytes field of a JSON stream, isn’t found, as before. A message with a token, a flag the proxy doesn’t know, a compressed message that isn’t gzip, one over the limit or an envelope cut off ends the stream there, before that message. Every other reply’s body, of any status, length or type, passes through a reader that keeps the last 4 KiB that passed and fails at the read that would complete a JWT’s start, a header and the start of its claims, passing none of that read. The reply then ends there, so the token’s claims and signature never reach the VM, though its header may. At the body’s end the reader checks the reply’s trailers, which HTTP/2 and gRPC send after it, in the same way, and fails before the proxy sends them. Upgrades and informational replies are refused on every path, because the CLI uses neither. A token in another shape, such as an opaque one or one that the reply encodes in a way of its own, could still reach the VM. So could a presigned address that isn’t a JWT, such as one for cloud storage, in the reply of a method the login goes to, and the VM could then use it from anywhere until it expires. Refusing a path stops only the requests the VM makes, so a write that Cursor’s server makes on its own, as a side effect of a method the login goes to, such as one to the agent store, isn’t stopped either. devvm checked the CLI’s behaviour against one release of it by reading its code, not against Cursor’s servers. devvm doesn’t guard Cursor’s other hosts either: if one of them also answered /auth/poll, a VM could finish a login there and keep its tokens, though none is known to. Unauthenticated requests for /auth/poll with an unknown login got 404 Not found from api2.cursor.sh, as a pending login does, and a route-not-found 404 from agent.api5.cursor.sh.
The CLI never refreshes a login with its refresh token: only an API key is exchanged for a token, at /auth/exchange_user_api_key, which the proxy refuses, as devvm keeps no Cursor API key. So the host doesn’t refresh it either, and once the access token’s exp has passed, the lookup fails with agent_refresh_failed, which says to log in again.
Any VM with the agent can replace the store’s login, because the store keeps one login for each agent. A VM you don’t trust can log your other VMs in to an account of its choosing, and their requests then go to that account. Claude Code’s long-lived tokens have the same shape whatever asks for one, so a token that Claude Code mints in a VM for another use, such as claude /install-github-app’s, becomes devvm’s Claude Code login too, and what the VM gets is its placeholder, which works only through its proxy. A VM with Claude Code can also use the login, through its proxy, for whatever else its scopes allow at api.anthropic.com, beyond the model, such as reading the account’s profile, and devvm doesn’t limit the paths it goes to there. At mcp-proxy.anthropic.com, below /v1/mcp/, it can call any of the account’s claude.ai connectors with any method, as Claude Code can, and each connector acts in the service it connects to with the access you gave it, so the VM can read what you connected, such as mail or documents, and send through a connector that sends. A deny of mcp-proxy.anthropic.com in your rules, on every tier but open, keeps connectors from a VM (your claude.ai connectors). devvm doesn’t guard Anthropic’s other hosts either. If one of them also answered /v1/oauth/token, a VM could exchange its code there and keep the login’s tokens, though none is known to. On the open tier, a program in the VM can go around its proxy, and then it gets the login’s tokens itself and devvm saves nothing.
Tests: the unit tests check what goes out and what the VM gets, its headers included, which paths are captured and the one they go to, that tokens from another path are refused, that no 1xx reaches the VM, an answered request and a login saved without its bindings, that an error passes, with its code alone after a real value went out, and that what can’t be read is refused. They check each agent’s file, the VM’s placeholders and copies, the exchange, the VM’s own refresh, a Console login refused, setup-token’s request told apart, the host’s refresh of Claude Code’s login and repeated fields, and that the newest Claude Code login replaces the other, the environment’s token wins, both logins’ bindings get the login devvm keeps while the connectors’ binding gets the OAuth login alone, never a saved token or the environment’s, and the VM’s copy holds placeholders. They also check that every VM’s config has the endpoints on every tier, which agent a capture is, that a VM captures no login for an agent its image doesn’t have, that a capture writes the VM’s bindings, and that an agent’s login gets the terminal’s files only when devvm’s input and output are both terminals, and pipes otherwise (the tests behind it). End-to-end checks (network): a fake token endpoint behind a company proxy of the run’s own, which the VM reaches through its proxy; the store gets the real tokens and the API key, the VM’s replies hold placeholders and no refresh token, no log holds a value, and the VM’s next launch gets the login as placeholders. For Claude Code, the same company proxy fakes Claude’s token endpoint and Anthropic’s API: claude setup-token’s request makes the claude secret and the VM gets its placeholder, the real Claude Code’s claude auth login through devvm agent login claude saves the login in the store and leaves placeholders alone in the VM, devvm agent login claude --setup-token, run in a terminal of its own, shows Claude Code’s address, the API gets the store’s token for the VM’s placeholders, mcp-proxy.anthropic.com gets only placeholders while devvm keeps the claude secret, whichever of the two the VM sends, and a login that’s due makes the host refresh it at Claude’s endpoint through the company proxy, after which both the API and mcp-proxy.anthropic.com get the refreshed access token.
MCP servers
On each launch, devvm merges the settings and MCP servers from the store’s .claude.json, ~/.local/share/devvm/logins/claude/.claude.json, into the VM’s own ~/.claude.json:
- Each of your servers replaces the VM’s server of that name whole.
- devvm removes the servers it copied before that you no longer have.
- Servers added in the VM stay.
The copy holds only your settings, onboarding and account state, and MCP servers. Everything else stays out, such as primaryApiKey, customApiKeyResponses and your per-project entries, which devvm agent import already leaves out of the store, and the VM keeps its own value of each. So the VM keeps its own per-project entries, such as trust and allowed tools, and yours never go in. Your account state, oauthAccount, keeps only the fields that Claude Code 2.1.319 writes there: its profile (accountUuid, emailAddress, organizationUuid, hasExtraUsageEnabled, billingType, accountCreatedAt, subscriptionCreatedAt, claudeCodeTrialEndsAt, claudeCodeTrialDurationDays, seatTier, planDisplayName, displayName, fullName and profileFetchedAt), its roles (organizationRole, workspaceRole and organizationName) and its rate-limit tiers (organizationType, organizationRateLimitTier and userRateLimitTier), each a plain value. Its ccOnboardingFlags stays as an empty object, because Claude Code fetches your profile again while that field is missing, and the flags in it stay out. devvm leaves every other field of oauthAccount out of the VM’s copy and warns you, naming each by its path, such as oauthAccount.zz (login_fields_withheld), and the unit test that plants unknown fields checks ~/.claude.json as it checks the other login files. If devvm can’t read the store’s .claude.json, it stops the VM’s setup (login_copy_failed).
On every tier, an HTTPS server’s headers become bindings for its host, which must be a DNS name on port 443. devvm replaces these with devvm-redacted: env values, plain-HTTP servers’ headers, user info and secret-looking values in URLs, and secret-named or key-shaped arguments. A server’s command and headersHelper, which are shell commands, lose the same words as other text in settings files (keys in settings files).
Keys in settings files
devvm also takes the keys out of the VM’s copies of the agents’ settings files, which are ~/.claude/settings.json, ~/.codex/config.toml, opencode’s .json, .jsonc and .toml files and pi’s settings.json, models.json and mcp.json. Those are JSON, JSONC or TOML, and devvm parses each file whole and writes the VM’s copy from what it parsed, so a JSONC file’s copy is JSON and a TOML file’s copy has no comments. devvm replaces these with devvm-redacted, and names what it replaced (config_redacted):
- Every value under a key that looks like a secret’s (
*key*,*token*,*secret*,*password*,Authorization), and every string in a list or a table under such a key, but key bindings, such as opencode’skeybinds. A name you choose isn’t judged that way, so an MCP server, a plugin or a marketplace namedsecret-scannerortoken-saverkeeps its settings, while its own fields, such as itsenvor anapiKey, are judged as anywhere else. devvm knows the agents’ tables of names from their docs, and reads every agent’s settings files with all of them: Claude Code’smcpServers,extraKnownMarketplaces,pluginConfigs,enabledPluginsandskillOverridesamong them, Codex’smcp_servers,model_providers,marketplaces,plugins,projectsandhooks.state, opencode’smcp,provider,agentandcommand, with their 2.x names, and pi’sprovidersandmcpServers. In most of those tables, only a table under a name escapes the check, so a string right undermcpServerswith a secret-looking key is still replaced. In tables of settings, such as Claude Code’senabledPluginsandskillOverrides, a table and a setting’s word, such asofforname-only, which has only lower-case letters and dashes, aren’t judged by their name either, while any other value is. A name that’s an env or headers table’s key, such as a server namedenv, still gets its values replaced. - Any string that starts like a known key or token, such as
sk-,ghp_oreyJ, wherever it is. - Every value in an env or headers table, whatever its name:
env,environment,headers,http_headers, and Codex’sshell_environment_policy.set. A number of up to five digits,trueandfalsestay, because they’re switches and ports. In Claude Code’s ownenv, the top-level one ofsettings.json, its configuration variables stay too:ANTHROPIC_MODEL,ANTHROPIC_SMALL_FAST_MODEL, theANTHROPIC_DEFAULT_*_MODELandANTHROPIC_CUSTOM_MODEL_OPTIONfamilies,CLAUDE_CODE_*,DISABLE_*,MAX_*and*_TIMEOUT_MS. A variable whose name hasKEY,TOKENas a word,SECRET,PASS,AUTH,CREDENTIAL,COOKIEorHEADERin it is redacted all the same, such asCLAUDE_CODE_OAUTH_TOKEN, and so is its value when it’s a URL. - In a URL anywhere in the file, a string’s whole value or a part of other text, its user info and its secret-looking query values and path segments.
- In every list, the arguments that MCP servers’ arguments in
~/.claude.jsonlose: the value after a secret-named flag, such as--api-key X, the value of--token=X, and any that looks like a key. - In any other string, such as a hook’s command or an argument that holds a header, each word that starts like a known key, and the credential after
BearerorBasic, quoted or not, when it has 16 or more characters, with a digit,+,/or=among them, which words don’t have, and isn’t a path. devvm replaces only those words, socurl -H 'x-api-key: sk-…' URLbecomescurl -H 'x-api-key: devvm-redacted' URL, and a reference such asBearer ${GITHUB_TOKEN}stays. MCP servers’ arguments,commandandheadersHelperin~/.claude.jsonlose the same words.
Values that only name where a secret is stay as they are. Those are an environment variable’s name (env_key = "OPENAI_API_KEY"), {env:X}, ${X} and a path. devvm refuses a file that doesn’t parse as its format, instead of copying any of it unread, so the VM doesn’t get that file (config_not_copied). The VM doesn’t get opencode’s other files in ~/.config/opencode either, such as a .env, because devvm can’t take secrets out of them, apart from its Markdown files, such as AGENTS.md, which hold instructions for the agent (config_not_copied). An MCP server or a provider that needs one of those keys in the VM has to get it another way.
Saving the copies back
devvm agent save reads the VM’s copies back, and they hold devvm-redacted and the proxy’s placeholders where devvm’s agent store has your secrets (saving a VM’s settings). devvm parses the VM’s file whole, and when it holds a placeholder, devvm also makes the copy the VM got from the store’s file again: the same redaction for a settings file, and for ~/.claude.json the copy with the VM’s own salted placeholders. Each placeholder gets the store’s value at the same path, but only when the copy had the same placeholder there, and when the table the placeholder is in and the table above that one, below the file’s top level, are the same as in the copy. Those tables say where the secret goes, such as an MCP server’s url beside its headers, a provider’s baseURL beside its apiKey and an env table’s base URL beside its key, so a VM can’t keep a placeholder and point it at another host. A placeholder that fails the check leaves the whole file out of the save (agent_save_placeholder), and so does a placeholder in a file without a format devvm parses, such as a skill. A file with placeholders put back is written as devvm writes the VM’s copies, as JSON or as TOML without comments, and a file without placeholders is saved as the VM has it.
What stays in the VM’s copies
Taking secrets out of a file works only where devvm can tell a secret from the rest, so some go into the VM on every tier, and keys devvm can’t tell apart lists them among what devvm leaves open:
- The agents’ mounted folders. devvm mounts Claude Code’s
skills,agents,commands,output-stylesandplugins, Codex’spromptsandskills, opencode’s subfolders, and pi’sextensions,skills,promptsandthemeswhole and read-only, so every file in them reaches the VM, a.envin~/.config/opencode/pluginincluded. So does a plugin marketplace’s git config in~/.claude/plugins/marketplaces, which holds a password or a token when you added a private marketplace with one in its URL. These folders hold code that the agent runs, such as plugins, hooks and the scripts that skills call, so a copy with only settings and Markdown, as opencode’s config folder’s files get, would break them. A copy without files whose names look secret, such as.envor*.pem, would miss a key in any other file, and it would need a copy of each folder, which can be large, on every launch, while a mount shows the changes to devvm’s agent store at once. So devvm mounts them as they are, and the coding agents page says to keep secrets out of them. - Free text of an unknown shape. A key in other text, such as a hook’s command, stays when it neither starts like a known key nor follows
BearerorBasic, because devvm can’t tell it from a word. - Logins devvm can’t bind. opencode’s and pi’s keys that devvm can’t bind, a local model server’s among them, are withheld unless
[pass-keys]lists their provider, and then they go as they are (login_passed). - pi’s settings that undo devvm’s. The VM’s copy of pi’s
settings.jsonleaves outhttpProxy,sessionDirandselfUpdateCommand(pi_settings_dropped), and devvm warns when it setsdefaultProjectTrusttoalways(pi_trusts_all). Its other settings stay, with their keys taken out as above.
The self-check
A confined tier holds only while the VM runs on the process that devvm started confined. A process can’t leave its sandbox, but limactl start starts a new Lima process, unconfined. So on every launch, and whenever an export or devvm rm’s check of a --clone VM needs the VM running, whether devvm started the VM or found it running, devvm checks two things, from the host:
- That the VM still runs on the process devvm started. The VM can’t fake this check.
- That a direct connection from the VM to the internet fails. The VM answers this check, so it catches only the honest case.
devvm records the result in the VM’s state, as ok or unenforced in the net section’s made.check. When the check fails, what devvm does depends on why:
- The VM wasn’t started confined, because it was started outside devvm or has been running since before
devvm networkmoved it from open to a confined tier. In a terminal, devvm offers to restart the VM confined (net_unenforced_restart), and if you decline, it warns you and goes on (net_unenforced). Without a terminal, or if the VM is still unenforced after the restart, devvm stops the VM and ends without opening a shell (net_unenforced_stop). The nextdevvmstarts the VM confined. - The VM was started confined, yet it gets out, because it reaches the internet through something devvm didn’t set up, such as a second network. A restart wouldn’t help, so devvm stops the VM and ends (
net_direct_route).
This is the check, and what devvm does when it fails:
An open VM isn’t confined, so its self-check is another one: a command in the VM asks its proxy for http://devvm.proxy/blocked through the proxy that the VM’s /etc/environment names, the variable’s name in the command and never the password. When the proxy doesn’t answer, devvm warns you (net_proxy_unreachable) and goes on, records no result, and the VM keeps running.
devvm ls and devvm network show such a VM’s tier as unenforced. That’s a VM whose last self-check failed, or a running VM that isn’t on the process devvm started confined, which devvm checks on the host each time.
On Lima, “the process devvm started” is the VM’s Lima process, which devvm starts confined.
Log files
The proxy writes every decision (tunnel, intercept, forward, blocked, or nix-cache for a request to the shared Nix cache) as a JSON line in network.jsonl in the VM’s logs folder, ~/.local/share/devvm/vms/<hash>/logs/. A line holds the time, the VM, the host and port, the method and path when the proxy sees them, the rule or the reason, and the names of the secrets it put in, never their values. A connection that transparent mode sent to the proxy, and each request on it, has "via": "dns", which devvm network log shows as , without proxy settings.
The proxy’s own lines, such as what it loaded and what failed upstream, go to proxy.log next to it. An upstream error stays there, because it can name addresses that the VM shouldn’t learn. So when a name doesn’t resolve, or a tunnel can’t connect, the VM’s 403, its http://devvm.proxy/blocked and the event log give only the reason. For a name, that’s this machine's DNS has no address for it when the DNS server says the name has none, with and names resolve without its search domain; use the full name, such as jenkins.corp.example.com after it for a name without a dot, this machine's DNS didn't answer in time; see proxy.log on the host when it doesn’t answer, and can't resolve it; see proxy.log on the host for any other failure. A rule allows the name already, so each of these blocks is marked refused, and neither the 403, nor http://devvm.proxy/blocked/new, nor devvm network log --blocked suggests a devvm network allow command for it. For a tunnel, it’s connect failed; see proxy.log on the host. The error itself, which can name this machine’s DNS server or the company proxy’s address and what it answered, goes to proxy.log alone. After a timeout or another failure that may pass, the proxy asks the DNS server once more before it blocks the name. When the client goes away while its name is still resolving, nothing was refused, so the event log and http://devvm.proxy/blocked record no block. The lookup still went out, though, and a name can carry data, so proxy.log names the host and port with the client went away while its name resolved, for at most 20 such lookups a minute, and then says that it stops until the minute is up. The broker’s own line for each of the child’s lookups and connections that failed, such as one to an address that no rule names, is held the same way, to 20 a minute. A name that resolves to an internal address gets the reason it resolves to an internal address; allow the address itself to reach it, which tells the VM that much and not the address (attack vectors). Only you can read the VM’s logs folder and its run folder, and devvm’s run logs never hold a VM’s password. The VM chose the hosts and paths, so devvm network log drops control characters in them.
The event log also holds the VM’s links’ connections, which devvm _links writes in the same format: link for a connection it carried, and link_refused, link_target_stopped or link_limit for one it refused, with the link’s name as the host and the target VM in target. An open VM’s event log holds its proxy’s events and its links’, but nothing it reached directly.
The proxy’s broker and its child are the only programs that write proxy.log, which is the output of both, each line’s prefix saying whether the broker or the child wrote it. Either may rotate it, through the file devvm opened for them and never by its path. It takes the file’s lock, checks the file’s size again, copies the file to proxy.log.1 and empties it, so the two rotate it once. The event log has the child and devvm _links as its writers.
The child writes the VM’s logs folder, so devvm, devvm _links, devvm network log, devvm network lock and the proxy never open the logs there through a link at their end, and they take only a regular file with one link that’s yours. A start that finds a link, a FIFO or another file’s hard link where a log should be removes that name, never what it leads to, and starts a new log there, and devvm network log refuses such a file without waiting on it. The proxy rotates each log before a line would take it past 10 MiB, and devvm _links writes the event log with the proxy’s own code, so it rotates the log by the same rule and a VM that runs for months keeps at most about 20 MiB of each. A line never spans two files, and lines from the proxy’s connections at the same time are written one after another, so a rotation loses none and splits none. Before each line, each writer checks that the file it has open is still network.jsonl, and when the other writer has rotated it, the writer opens the new network.jsonl and writes there, so its lines go on reaching the file that devvm network log --follow follows. Each writer takes the log’s size from the file, so it counts the other writer’s lines too. A writer rotates the log while it holds a lock on the file and checks the name again first, so when both reach the limit at once, only one renames the file and the other writes to the new one. A rotation renames network.jsonl to network.jsonl.1, which replaces the one that was there, and starts a new network.jsonl. proxy.log is also the proxy process’s output, where its last error goes when it stops, so the proxy copies it to proxy.log.1 and empties it instead, and that error still reaches the current file. The proxy takes proxy.log’s size from the file before each line, so what reached it as the processes’ output counts too, and its HTTP server’s errors, such as a handler’s panic, go through the child’s own lines rather than straight to that output. Every log file and its .1 file is readable only by you (mode 600).
devvm network log reads network.jsonl.1 before network.jsonl, so the history it shows and the blocks that devvm network log --blocked counts carry on across a rotation. devvm network log --follow reads the renamed file to its end and then follows the new one from its start. devvm rm deletes the .1 files with the rest of the VM’s logs.
Learning from the log
A VM that learns the hosts it needs is on the internet tier, and its state’s net section has learning.since, the time it started, which any tier set later clears. Its proxy runs as any internet VM’s does, so nothing else records what it reaches: devvm network lock and each launch’s reminder read the event log, both files. They take each tunnel, intercept and forward event since that time, one row for each host and port, its rule the exact one for that host, which always writes the port, counting its events and the first word of the User-Agent its requests sent most, which a CONNECT’s event records too, when that word is at most 32 of [A-Za-z0-9._/+-]. The proxy caps an event’s path and User-Agent at 512 bytes as it records them, and takes no request headers past 64 KiB, so a VM can’t bloat the log. An address that isn’t public, by the proxy’s one judge of that, and a host the policy doesn’t take are left out. Each host and port is judged once with the policies the VM would have on the allowlist tier, read as the proxy reads them, its built-in policies from the binary included, and with the proxy’s own decisions by its rules, so a host that the allowlist already allows, or that a rule denies, never shows. A host starts ticked when, on port 443, it’s one of devvm’s reviewed registry and vendor names, or under one, each with its reason beside it, and it isn’t risky. Nothing of the VM’s rules, secrets or own policy file makes a host tickable, so a host one lock added never makes its neighbours tick later, and a unit test checks that no name on the list is a shared-hosting domain or under one. The risky hosts, which are marked and start unticked, are an address, a punycode label, a host on its lists of paste and drop sites, storage, tunnels, webhook and OAST services, free hosting and chat endpoints, or under one of them, and the patterns of OAST domains, S3 and API Gateway. Past 30 hosts none starts ticked. The picker reads the terminal’s size, cuts each row to its width and a long name from the left, and scrolls in a window that keeps the same number of lines, so a redraw moves back over exactly what it drew. It refuses a terminal too short for a row and its two “more” lines (pick_too_small), takes a terminal of unknown size as 80 by 24, and on a read that fails, such as the EIO of a terminal that hung up, returns pick_failed and confirms nothing, while the end of the input confirms, as Enter does. The risky hosts are a section of their own under a heading, so their mark never depends on a row’s width, and so are the hosts that only events with "via": "dns" reached, between the others and the risky ones. The lock re-reads the VM’s state under the VM’s lock, in the one update of a VM’s state, before it adds a rule, and changes nothing when its context ended meanwhile or the VM no longer learns since the same time, and it says what it added only once the proxy has the new tier. devvm network learn and devvm group join each check the other’s change under the VM’s lock too, so a learning VM never ends up in a group. A launch’s reminder counts only while both files hold at most 2 MiB. devvm keeps no record of its own beside the log, so a log that rotated twice since the VM started learning has lost its first hosts. As a VM starts learning, devvm writes a learn event into its log with the proxy’s own writer, which devvm network log doesn’t show, and devvm network lock warns when that mark is gone.
devvm _proxy
devvm runs the proxy as itself, devvm _proxy -config FILE, and nothing else is in its arguments. That’s the broker, which runs its child as devvm _proxy-child -for FILE, with the same config’s path, which the child never opens. The path is there so devvm can tell each VM’s child apart, by run/proxy-child.pid and those arguments, and stop one that outlived its broker. Their flags take one dash or two, and their errors end in one line, The VM's proxy failed: … (proxy_failed). Processes has what a VM’s proxy holds, what it reads from the VM and its bounds, and a build’s proxy has the build’s.
The config is one JSON file, which a VM’s proxy and a build’s proxy both run with. For a VM it’s proxy.json in the VM’s run folder, ~/.local/share/devvm/vms/<hash>/run/, and for a build it’s proxy.json in the build proxy’s folder. devvm writes it whole, mode 600, before each start. It holds the VM’s password and the company proxy’s credentials from the environment, though never config.toml’s password, which the proxy looks up itself, so it’s never in a process’s arguments, which other users can see. The proxy reads it once, as it starts, and refuses to start unless it’s a regular file, not a symbolic link, owned by the user the proxy runs as and readable and writable by nobody else, at most 1 MiB, of "version": 1, with no field the proxy doesn’t know. It also refuses a config without a password, one whose listen isn’t a loopback address and port, one with ca and no ca_key or the other way around, and one with a nix_cache_max below 0. A config of another version is never read, so a proxy and the devvm that started it always agree on what each field means.
| Field | What |
|---|---|
version | 1 |
listen | the loopback address and port to listen on, port 0 for any free one |
vm | the VM’s name, for the log |
password | the VM’s password, which every request carries in Proxy-Authorization with the user devvm; required |
builtin_policies | the built-in policies, paths in devvm’s own files, read from the binary once as the proxy starts, ahead of policies; a missing one refuses to start |
policies | your policy files, in order, each read again when it changes; a missing one has no rules |
log | the JSON-lines event log (none: standard output), rotated past 10 MiB |
proxy_log | the file that the proxy’s output goes to, which is its own log, rotated past 10 MiB by copying |
lifeline | the hostagent’s pid file: exit once it no longer holds what it held when the proxy first saw its process running, or that process is gone |
ca, ca_key | the VM’s own CA, for interception: its certificate and key |
ca_next, ca_next_key | with ca: the VM’s next CA, which signs from an hour after its start |
secrets | the VM’s bindings file, read again when it changes, and the broker looks each binding’s value up in its own process, for the child |
upstream_cas | the CAs in your CA folder (PEM), which the proxy’s own TLS connections trust besides the system’s |
upstream | the company proxy: https, http and no_proxy, as HTTPS_PROXY, HTTP_PROXY and NO_PROXY or config.toml’s [proxy] had them, and secret, the secret the proxy looks up as the password of a URL that names a user and none of its own; allowed hosts are reached through it |
upstream_unresolved | with upstream: names this machine can’t resolve go there even when only ** allows them, which builds’ proxies get |
nix_cache | serve the shared Nix cache at http://devvm.proxy/nix/ from this folder, which it makes, only yours (mode 700) |
nix_cache_max | with nix_cache: the cache’s cap, in bytes (none: 10 GiB) |
links | the VM’s links’ list, which devvm _links writes: reach each link through its socket, before any rule (links through the proxy); a missing list has no links |
link_sockets | with links: the folder of the links’ sockets, devvm’s run folder; without it, no link is reached |
vm_logs | the logs that the VM’s backend writes as the VM runs and the VM can drive, such as its serial console’s, which the proxy holds to their cap for as long as it runs (Lima’s hostagent) |
agent, agent_socket | together, as absolute paths: the SSH agent that the VM’s start forwards, your own or devvm’s, and the VM’s own socket in devvm’s run folder, agent-<hash>.sock, on which the proxy relays it and which the VM’s backend forwards instead (the SSH agents). devvm keeps a running VM’s as its start set them |
devvm_sha256, ca_sha256, ca_next_sha256 | the SHA-256 of devvm’s binary, of the VM’s CA certificate and of its next CA’s that the proxy started with; the proxy doesn’t read them, and they’re there so that a new binary or a new CA makes another config (how long a proxy runs) |
-config is the proxy’s only flag, and running the proxy is its only mode. What only this machine does for a VM’s proxy runs inside devvm itself, never through the proxy’s arguments. devvm makes each VM’s CAs, and the VM’s copies of agents’ logins and settings files, their bindings and their values, in its own process (the packages).