mirror of
https://github.com/devvmhq/docs-next.git
synced 2026-12-01 21:36:41 -10:00
1835 lines
321 KiB
XML
1835 lines
321 KiB
XML
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>devvm – Staying safe</title><link>https://next.devvm.dev/docs/safety/</link><description>Recent content in Staying safe on devvm</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="https://next.devvm.dev/docs/safety/index.xml" rel="self" type="application/rss+xml"/><item><title>Network tiers</title><link>https://next.devvm.dev/docs/safety/network/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://next.devvm.dev/docs/safety/network/</guid><description>
|
||
<p>Every VM goes through a proxy that devvm runs for it on this machine, and the VM&rsquo;s network tier decides what the proxy lets it reach. New VMs get the allowlist tier by default, so they reach only the hosts on their allowlist, which are devvm&rsquo;s built-in hosts, your secrets&rsquo; hosts and the hosts you add. No VM holds the secrets that devvm saved, whatever its tier, because its proxy puts them into its requests, but code in the VM can still use each secret the VM may use, on that secret&rsquo;s hosts. A secret is a credential devvm keeps on this machine for VMs to use: your GitHub token, Claude Code&rsquo;s token, an agent&rsquo;s login or an API key. An open VM, the one tier that isn&rsquo;t confined to its proxy, reaches anything this machine can, including this machine&rsquo;s own services on <code>localhost</code> and your LAN.</p>
|
||
<div class="devvm-diagram" style="contain-intrinsic-block-size: auto 398px; --devvm-diagram-width: 514px"><svg xmlns="http://www.w3.org/2000/svg" class="pele pele-sequence" viewBox="0 0 514 398" width="514" height="398" style="--_bg:var(--pele-bg,#fff);--_fg:var(--pele-fg,#1f1f1f);--_m:var(--pele-muted,#6e6e6e);--_l:var(--pele-line,#1f1f1f);--_s:var(--pele-surface,#f3f3f3);--_a:var(--pele-surface-alt,#e6e6e6);--_b:var(--pele-border,#8a8a8a);--_c:var(--pele-accent,#5b7bd5);color:var(--_fg);--_r:var(--pele-radius,4px);--_fm:var(--pele-font-mono,&quot;Departure Mono&quot;, monospace);font:14px sans-serif;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;font-family:var(--pele-font,&quot;Departure Mono&quot;, monospace)" fill="var(--_fg)" role="graphics-document document" aria-roledescription="sequence" aria-labelledby="d10b0fcda5ce268dc--title" aria-describedby="d10b0fcda5ce268dc--desc"><title id="d10b0fcda5ce268dc--title">A VM's requests through its proxy</title><desc id="d10b0fcda5ce268dc--desc">The VM sends GET /user with a placeholder to its proxy on this machine, which finds api.github.com on the allowlist and sends the request on with your GitHub token, then passes the response back. A CONNECT to example.com:443 gets a 403, because that host isn't on the allowlist.</desc><g transform="translate(50.73,8)"><g class="pele-lifelines" fill="none" stroke="var(--_b)"><path class="pele-lifeline" data-id="P" d="M0,56V382"/><path class="pele-lifeline" data-id="X" d="M170.55,56V382"/><path class="pele-lifeline" data-id="H" d="M376.73,56V382"/></g><g class="pele-edges" fill="none" stroke="var(--_l)" stroke-linecap="round"><g class="pele-edge pele-message" data-id="i0"><path d="M0,110H163.55"/><path class="pele-marker" d="M170.55,110L162.55,113.36L162.55,106.64Z" fill="var(--_l)" stroke="none"/></g><g class="pele-edge pele-message" data-id="i2"><path d="M170.55,198H369.73"/><path class="pele-marker" d="M376.73,198L368.73,201.36L368.73,194.64Z" fill="var(--_l)" stroke="none"/></g><g class="pele-edge pele-message" data-id="i3"><path d="M376.73,232H177.55" stroke-dasharray="4 4"/><path class="pele-marker" d="M170.55,232L178.55,228.64L178.55,235.36Z" fill="var(--_l)" stroke="none"/></g><g class="pele-edge pele-message" data-id="i4"><path d="M170.55,266H7" stroke-dasharray="4 4"/><path class="pele-marker" d="M0,266L8,262.64L8,269.36Z" fill="var(--_l)" stroke="none"/></g><g class="pele-edge pele-message" data-id="i5"><path d="M0,314H163.55"/><path class="pele-marker" d="M170.55,314L162.55,317.36L162.55,310.64Z" fill="var(--_l)" stroke="none"/></g><g class="pele-edge pele-message" data-id="i6"><path d="M170.55,362H7" stroke-dasharray="4 4"/><path class="pele-marker" d="M0,362L8,358.64L8,365.36Z" fill="var(--_l)" stroke="none"/></g></g><g class="pele-edge-labels" font-size="14"><g class="pele-edge-label" data-id="i0"><text text-anchor="middle" xml:space="preserve"><tspan x="85.27" y="86.2">GET /user, with</tspan><tspan x="85.27" y="102.2">a placeholder</tspan></text>
|
||
</g><g class="pele-edge-label" data-id="i2"><text text-anchor="middle" xml:space="preserve"><tspan x="273.64" y="174.2">GET /user, with</tspan><tspan x="273.64" y="190.2">your GitHub token</tspan></text>
|
||
</g><g class="pele-edge-label" data-id="i3"><text x="273.64" y="223.2" text-anchor="middle">the response</text>
|
||
</g><g class="pele-edge-label" data-id="i4"><text x="85.27" y="257.2" text-anchor="middle">the response</text>
|
||
</g><g class="pele-edge-label" data-id="i5"><text text-anchor="middle" xml:space="preserve"><tspan x="85.27" y="290.2">CONNECT</tspan><tspan x="85.27" y="306.2">example.com:443</tspan></text>
|
||
</g><g class="pele-edge-label" data-id="i6"><text text-anchor="middle" xml:space="preserve"><tspan x="85.27" y="338.2">403: not on</tspan><tspan x="85.27" y="354.2">the allowlist</tspan></text>
|
||
</g></g><g class="pele-notes" font-size="14" fill="var(--_a)" stroke="var(--_b)"><g class="pele-note" data-id="i1"><rect x="89.27" y="120" width="162.55" height="30" style="rx:var(--_r)"/><text class="pele-label" stroke="none" fill="var(--_fg)" x="170.55" y="139.2" text-anchor="middle">on the allowlist</text>
|
||
</g></g><g class="pele-nodes"><g class="pele-node pele-actor pele-actor-participant" data-id="P"><rect x="-42.73" y="15" width="85.45" height="41" fill="var(--_s)" stroke="var(--_b)" style="rx:var(--_r)"/><text class="pele-label" x="0" y="40.4" text-anchor="middle">The VM</text>
|
||
</g><g class="pele-node pele-actor pele-actor-participant" data-id="X"><rect x="87.73" y="0" width="165.64" height="56" fill="var(--_s)" stroke="var(--_b)" style="rx:var(--_r)"/><text class="pele-label" text-anchor="middle" xml:space="preserve"><tspan x="170.55" y="23.9">Its proxy,</tspan><tspan x="170.55" y="41.9">on this machine</tspan></text>
|
||
</g><g class="pele-node pele-actor pele-actor-participant" data-id="H"><rect x="298.36" y="15" width="156.73" height="41" fill="var(--_s)" stroke="var(--_b)" style="rx:var(--_r)"/><text class="pele-label" x="376.73" y="40.4" text-anchor="middle">api.github.com</text>
|
||
</g></g></g></svg></div><p>This page covers what you do with a VM&rsquo;s tier and what you see. <a href="https://next.devvm.dev/docs/internals/network/">How it works › Network tiers</a> explains how devvm confines a VM to its proxy and how the proxy handles each connection.</p>
|
||
<h2 data-hextra-search-id="network-tiers">Network tiers<span class="hx:absolute hx:-mt-20" id="network-tiers"></span>
|
||
<a href="#network-tiers" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>A VM is on one of four tiers, from the lowest to the highest:</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>Tier</th>
|
||
<th>What the VM reaches</th>
|
||
<th>Confined to its proxy</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td><code>open</code></td>
|
||
<td>whatever this machine reaches, its <code>localhost</code> and the LAN included; the proxy applies no rules</td>
|
||
<td>no</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>internet</code></td>
|
||
<td>every public host, on any port, apart from your denies; never this machine&rsquo;s addresses or its networks'</td>
|
||
<td>yes</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>allowlist</code></td>
|
||
<td>only the hosts its <a href="#allowlists">allowlists</a> allow, apart from your denies</td>
|
||
<td>yes</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>none</code></td>
|
||
<td>only its agents&rsquo; hosts, the hosts of its secrets and logins, and its <a href="#links-between-vms">links</a>, apart from your denies</td>
|
||
<td>yes</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm --network internet <span class="c1"># make this folder&#39;s new VM on the internet tier</span>
|
||
</span></span><span class="line"><span class="cl">devvm network none <span class="c1"># give this folder&#39;s VM the none tier</span>
|
||
</span></span><span class="line"><span class="cl">devvm network <span class="c1"># show its tier and its allowlist</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p><code>--network TIER</code> chooses a new VM&rsquo;s tier, and <code>devvm network</code> with a tier changes an existing VM&rsquo;s (<a href="#choosing-a-tier">choosing a tier</a>). A higher tier is stricter, and a VM on any tier but open is confined: it reaches nothing but its proxy, and a direct connection from it fails. A VM can also start on the internet tier while it <a href="#learning-the-hosts-a-vm-needs">learns the hosts it needs</a>, and then go to the allowlist tier with the ones you choose.</p>
|
||
<p>An open VM runs on its backend&rsquo;s own network, so it reaches this machine and your LAN directly, as a VM without a proxy would. It still gets only a placeholder for each secret it may use, so a request that goes around its proxy carries no secret, and every launch checks that its proxy is set in the VM and answers it (<a href="https://next.devvm.dev/docs/internals/network/#starting-a-vm-on-its-tier">an open VM</a>).</p>
|
||
<ul>
|
||
<li><strong>Rules by tier:</strong> on the internet and none tiers, devvm reads only the denies of your policy files, because the internet tier allows every public host itself and the none tier allows only what the VM&rsquo;s agents, secrets and links need. <code>devvm network</code> marks each such file <code>(denies only)</code>, and when you add an allow to a VM on either tier, devvm says that the allow changes nothing until the VM is on the allowlist tier. On the open tier no rule applies at all.</li>
|
||
<li><strong>When a change applies:</strong> a change from one confined tier to another applies at once, because the VM&rsquo;s proxy starts again with the new tier&rsquo;s rules and the VM keeps running. A change into or out of the open tier applies from the VM&rsquo;s next start, as <a href="#choosing-a-tier">choosing a tier</a> describes.</li>
|
||
<li><strong>What you see:</strong> <code>devvm ls</code> and <code>devvm network</code> show a VM&rsquo;s tier, or <code>unenforced</code> when a confined tier isn&rsquo;t in force (<a href="#when-it-isnt-enforced">when it isn&rsquo;t enforced</a>).</li>
|
||
</ul>
|
||
<h2 data-hextra-search-id="choosing-a-tier">Choosing a tier<span class="hx:absolute hx:-mt-20" id="choosing-a-tier"></span>
|
||
<a href="#choosing-a-tier" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>A new VM gets the allowlist tier unless you choose another, and the summary devvm shows before it makes the VM names its tier. When you customize the VM in a terminal, devvm lists the four tiers, each with what it reaches, with <code>learn</code> after <code>internet</code>, and the tier the summary showed is chosen (<a href="https://next.devvm.dev/docs/using/images/#what-a-new-vm-gets">what a new VM gets</a>):</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">Network tier for devvm-some-project-71a99b1076d92c (up/down to choose, enter to confirm):
|
||
</span></span><span class="line"><span class="cl"> ( ) open reaches anything this machine can
|
||
</span></span><span class="line"><span class="cl"> ( ) internet reaches any public host
|
||
</span></span><span class="line"><span class="cl"> ( ) learn reaches any public host while it learns which it needs, until devvm network lock
|
||
</span></span><span class="line"><span class="cl">&gt; (*) allowlist reaches only the hosts you allow (recommended)
|
||
</span></span><span class="line"><span class="cl"> ( ) none reaches only its agents&#39; and secrets&#39; hosts and its links</span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>Up and down move the choice, and enter gives the VM the chosen tier, so pressing enter at once keeps the tier the summary showed. <code>learn</code> gives the VM the internet tier while it <a href="#learning-the-hosts-a-vm-needs">learns the hosts it needs</a>. <code>--network TIER</code> answers the question up front, such as <code>devvm --network internet</code> or <code>devvm --network learn</code>, and when there&rsquo;s no terminal to ask in, or you give <code>--no-input</code>, the VM gets the tier the summary showed. A VM keeps its tier. On an existing VM devvm ignores <code>--network</code> and warns you, naming the <code>devvm network</code> command that changes the tier.</p>
|
||
<p>To give every new VM another tier, save it with <code>devvm network -g</code>, or choose it in <a href="https://next.devvm.dev/docs/using/settings/#devvm-setup">devvm setup</a>:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm network -g none <span class="c1"># every new VM gets the none tier</span>
|
||
</span></span><span class="line"><span class="cl">devvm network -g <span class="c1"># show what new VMs get, and where it came from</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<ul>
|
||
<li>Neither takes <code>learn</code>, because each VM learns the hosts it needs on its own, so <code>devvm network -g</code> refuses it and names <code>devvm --network learn</code> and <code>devvm network learn</code>.</li>
|
||
<li>Each new VM&rsquo;s summary then shows that tier, and customizing the VM still asks, with Enter keeping the saved tier.</li>
|
||
<li><code>devvm network -g</code> shows what new VMs get, <code>allowlist</code> until you save another tier, followed by where it came from after a <code>#</code>, and <code>devvm network -g --json</code> prints it as <code>policy</code>, with <code>source</code>.</li>
|
||
<li>devvm reads the saved tier only when it creates a VM, so the VMs you already have keep their own tier, and <code>--network</code> still chooses for one new VM.</li>
|
||
<li>You can also set it with <code>network</code> in <a href="https://next.devvm.dev/docs/using/settings/#configtoml"><code>config.toml</code></a>, which wins over the saved tier, and then <code>devvm network -g</code> refuses to change it and names the file (<a href="https://next.devvm.dev/docs/using/settings/#where-a-default-comes-from">where a default comes from</a>).</li>
|
||
</ul>
|
||
<p>Lima confines every VM to its proxy, so every VM can be on any tier, the docker layer&rsquo;s included. devvm never starts a VM on a confined tier with an open network, so if a VM&rsquo;s backend couldn&rsquo;t confine it, the VM could only be open: devvm would refuse to make it on any other tier unless you give <code>--network open</code>, and it would refuse to give it any other tier with <code>devvm network</code> (<a href="https://next.devvm.dev/docs/backends/#when-a-backend-lacks-something">when a backend lacks something</a>).</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th></th>
|
||
<th></th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td><code>devvm network</code></td>
|
||
<td>print this folder&rsquo;s VM&rsquo;s tier as <code>devvm ls</code> shows it, <code>open</code>, <code>internet</code>, <code>internet (learning)</code>, <code>allowlist</code>, <code>none</code> or <code>unenforced</code>, and then its <a href="#changing-rules">allowlist</a></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>devvm network open|internet|allowlist|none</code></td>
|
||
<td>change it: between confined tiers at once, and into or out of open from the VM&rsquo;s next start, which <code>devvm restart</code> gives you, and for a running VM, ask in a terminal whether to restart it now</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>devvm network learn</code></td>
|
||
<td>give it the internet tier while it <a href="#learning-the-hosts-a-vm-needs">learns the hosts it needs</a>, from now on</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>devvm network lock</code></td>
|
||
<td>choose which of those hosts it keeps, and give it the allowlist tier (<a href="#locking-it">locking it</a>)</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>devvm network -g [open|internet|allowlist|none]</code></td>
|
||
<td>show or change what new VMs get</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<p>When a change into or out of open finds the VM running, devvm asks in a terminal whether to restart it now, which stops anything running in it:</p>
|
||
<ul>
|
||
<li>If you answer yes, devvm restarts the VM as <code>devvm restart</code> does, so the change applies at once.</li>
|
||
<li>If you answer no, or there&rsquo;s no terminal, or you pass <code>--no-input</code>, the change waits until the VM starts again.</li>
|
||
<li>If you give a running open VM a confined tier, the VM isn&rsquo;t confined yet, so <code>devvm ls</code> shows it as <code>unenforced</code>, and its next launch offers to restart it confined, as it does for a VM started outside devvm.</li>
|
||
<li>If you make a VM open while it runs confined, its launches keep it confined to its proxy, which now applies an open VM&rsquo;s rules, until it next starts, and they warn you that the VM leaves its proxy&rsquo;s confinement when it next starts. In a terminal, each of those launches first asks whether to restart the VM now, with no as the default unless an agent&rsquo;s new folders wait too (<a href="https://next.devvm.dev/docs/using/vms/#restarting-and-stopping">restarting</a>).</li>
|
||
</ul>
|
||
<h3 data-hextra-search-id="when-it-isnt-enforced">When it isn&rsquo;t enforced<span class="hx:absolute hx:-mt-20" id="when-it-isnt-enforced"></span>
|
||
<a href="#when-it-isnt-enforced" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>On every launch devvm checks on this machine that the VM still runs on the process devvm started confined, and that a direct connection from the VM to the internet fails. A VM that fails either check shows as <code>unenforced</code>, and devvm offers to restart it confined or stops it, as <a href="https://next.devvm.dev/docs/internals/network/#the-self-check">the self-check</a> describes.</p>
|
||
<h2 data-hextra-search-id="learning-the-hosts-a-vm-needs">Learning the hosts a VM needs<span class="hx:absolute hx:-mt-20" id="learning-the-hosts-a-vm-needs"></span>
|
||
<a href="#learning-the-hosts-a-vm-needs" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>Finding every host a project needs one block at a time takes a while, so a VM can learn them instead:</p>
|
||
<ol>
|
||
<li>Make the VM learn. For a new VM, choose <code>learn</code> in its tier list when you customize it, or give <code>--network learn</code>, such as <code>devvm --network learn</code>. For an existing VM, run <code>devvm network learn</code>, which gives it the internet tier at once, as <code>devvm network internet</code> does, and starts its learning from now.</li>
|
||
<li>Run the project&rsquo;s installs, builds and tests. The VM has the internet tier&rsquo;s access meanwhile, and its proxy logs each host it reaches, as it does on every tier.</li>
|
||
<li>Run <code>devvm network lock</code>, which lets you choose which of those hosts the VM keeps, and puts it on the allowlist tier with them (<a href="#locking-it">locking it</a>).</li>
|
||
</ol>
|
||
<p>Learning is for one VM at a time, so no default makes new VMs learn: <code>devvm network -g</code>, <code>devvm setup</code> and <code>config.toml</code> don&rsquo;t take <code>learn</code> (<a href="#choosing-a-tier">choosing a tier</a>).</p>
|
||
<div class="devvm-callout devvm-callout-warning">
|
||
<p class="devvm-callout-title"><svg class="devvm-icon" aria-hidden="true" focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12" fill="currentColor" shape-rendering="crispEdges"><path d="M5 1h1v1H5ZM4 2h1v1H4ZM6 2h1v1H6ZM4 3h1v1H4ZM6 3h1v1H6ZM3 4h1v1H3ZM7 4h1v1H7ZM3 5h1v1H3ZM5 5h1v1H5ZM7 5h1v1H7ZM2 6h1v1H2ZM5 6h1v1H5ZM8 6h1v1H8ZM2 7h1v1H2ZM5 7h1v1H5ZM8 7h1v1H8ZM1 8h1v1H1ZM9 8h1v1H9ZM1 9h1v1H1ZM5 9h1v1H5ZM9 9h1v1H9ZM0 10h1v1H0ZM10 10h1v1H10ZM0 11h11v1H0Z"/></svg> Warning</p><p>Learning isn&rsquo;t a tier of its own. While it lasts, the VM is on the internet tier, so it reaches every public host and only your denies apply, and links and groups treat it as an internet VM. That&rsquo;s internet access for as long as the VM learns, and that includes the dependency installs you run to teach it, when packages&rsquo; install scripts run in the VM. So a compromised dependency that you install meanwhile can reach a host of its attacker&rsquo;s choosing, and that host then shows up among the learned hosts. That&rsquo;s why <code>devvm network lock</code> asks, starts with few hosts ticked, and leaves you to read the list before you confirm it. Your secrets stay on this machine as they do on every tier, and the VM still gets only placeholders.</p></div><p>Each launch of a learning VM says that it&rsquo;s learning, since when, and how many hosts it has reached beyond its allowlist, and it names <code>devvm network lock</code>. Once the VM&rsquo;s log holds more than 2 MiB, the launch leaves out the count, so it never reads the whole log each time. <code>devvm ls</code> and <code>devvm network</code> show its tier as <code>internet (learning)</code>, and their <code>--json</code> adds <code>learning_since</code>, the time it started learning.</p>
|
||
<p><code>devvm network internet</code>, <code>none</code> or <code>open</code> end the learning and give the VM that tier. <code>devvm network allowlist</code> refuses while the VM learns, because <code>devvm network lock</code> is how a learning VM goes to the allowlist tier, and <code>devvm network lock --none</code> does it without adding a host. A VM in a <a href="#links-between-vms">group</a> can&rsquo;t start learning or be locked, because a group&rsquo;s VMs are all on one tier, so run <code>devvm group leave</code> first, and for the same reason a learning VM can&rsquo;t join a group until you lock it.</p>
|
||
<h3 data-hextra-search-id="locking-it">Locking it<span class="hx:absolute hx:-mt-20" id="locking-it"></span>
|
||
<a href="#locking-it" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p><code>devvm network lock</code> reads the hosts the VM reached since it started learning from its network log, and it leaves out these:</p>
|
||
<ul>
|
||
<li>what the VM&rsquo;s allowlist tier would allow already, judged by the proxy&rsquo;s own rules: devvm&rsquo;s built-in rules, its shared tools&rsquo; and layers&rsquo;, your own rules for every VM and for this VM, and its secrets&rsquo; and logins&rsquo; hosts</li>
|
||
<li>what your rules deny, which no allow would reach</li>
|
||
<li>blocked requests</li>
|
||
<li>internal and LAN addresses, which the internet tier never reaches</li>
|
||
</ul>
|
||
<p>In a terminal it lists the rest, one row for each host and port, with how many connections each had and the first word of the <code>User-Agent</code> that the requests sent most, in three groups:</p>
|
||
<ol>
|
||
<li>The hosts that the VM&rsquo;s tools reached through its proxy come first.</li>
|
||
<li>The hosts that only tools without proxy settings reached, which <a href="#tools-that-ignore-the-proxy">transparent mode</a> sent to the proxy, come next, under a heading of their own, because background tools&rsquo; telemetry and update checks reach the proxy that way, and you may not want to keep them.</li>
|
||
<li>The risky hosts come last, under a heading of their own, so neither a long name nor a <code>User-Agent</code> can push off the row what makes them risky.</li>
|
||
</ol>
|
||
<p>That <code>User-Agent</code> is the VM&rsquo;s own claim, which any program in it can set to anything, so it&rsquo;s a hint, not proof of which tool made the connection, and devvm shows it only when it&rsquo;s at most 32 letters, digits and <code>._/+-</code>. Which way a connection came is the VM&rsquo;s own doing, as its <code>User-Agent</code> is, so the second group&rsquo;s heading is a hint about the tool, not proof of what it is. A host name that doesn&rsquo;t fit is cut from the left, so its domain shows, and a list longer than the terminal scrolls, with a line above and below that says how many more rows there are. In a terminal too short to show a few rows, devvm refuses rather than draw the list wrong:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">Since 2026-11-08 09:03 the VM could reach any public host, so this list can hold a host that a compromised dependency reached. Only a host on port 443 of a package registry or vendor devvm knows starts ticked, so read the others before you tick them.
|
||
</span></span><span class="line"><span class="cl">Choose the hosts devvm-some-project-71a99b1076d92c keeps. Use up and down to move, space to toggle, a to toggle them all and enter to confirm.
|
||
</span></span><span class="line"><span class="cl">&gt; [x] files.pythonhosted.org:443 2 connections, User-Agent: uv/0.9.2
|
||
</span></span><span class="line"><span class="cl"> [x] static.crates.io:443 1 connection, User-Agent: cargo/1.91.0
|
||
</span></span><span class="line"><span class="cl"> [ ] example.com:8443 1 connection
|
||
</span></span><span class="line"><span class="cl"> [ ] uploads.github.com:443 1 connection, User-Agent: git/2.51.0
|
||
</span></span><span class="line"><span class="cl">Reached only by tools without proxy settings, which the VM&#39;s names sent to its proxy:
|
||
</span></span><span class="line"><span class="cl"> [ ] api.open-meteo.com:443 3 connections
|
||
</span></span><span class="line"><span class="cl">Risky, each an easy way to send data out:
|
||
</span></span><span class="line"><span class="cl"> [ ] 203.0.113.5:443 1 connection
|
||
</span></span><span class="line"><span class="cl"> [ ] docs.google.com:443 1 connection, User-Agent: python-requests/2.32
|
||
</span></span><span class="line"><span class="cl"> [ ] pastebin.com:443 1 connection, User-Agent: curl/8.5.0</span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>A host starts ticked only when it&rsquo;s on port 443 and belongs to a package registry or vendor on a short list that devvm keeps, each name checked so that nobody but its vendor can make a host or post a page under it:</p>
|
||
<ul>
|
||
<li>npm&rsquo;s <code>registry.npmjs.org</code>, PyPI&rsquo;s <code>files.pythonhosted.org</code> and <code>crates.io</code></li>
|
||
<li>Go&rsquo;s <code>proxy.golang.org</code> and <code>sum.golang.org</code>, and NuGet&rsquo;s <code>api.nuget.org</code></li>
|
||
<li>the toolchains&rsquo; own release hosts, such as <code>nodejs.org</code> and <code>static.rust-lang.org</code></li>
|
||
<li>Docker Hub&rsquo;s and GitHub&rsquo;s container registries</li>
|
||
<li>the agents&rsquo; APIs, <code>api.anthropic.com</code> and <code>api.openai.com</code></li>
|
||
</ul>
|
||
<p>A registry&rsquo;s packages are its users&rsquo;, but they only get there through the registry&rsquo;s own upload, with a token. Nothing else makes a host start ticked: not a domain where anyone can get a subdomain or a page, such as <code>github.io</code>, <code>googleapis.com</code>, <code>amazonaws.com</code> or <code>pypi.org</code>, which takes uploads, not a host beside one your rules or your secrets name, and not one beside a host an earlier lock added. So <code>files.pythonhosted.org:443</code> starts ticked, while <code>files.pythonhosted.org:8080</code>, <code>docs.google.com</code> and <code>evil.github.io</code> don&rsquo;t. Every other host starts unticked, and so does every host when the list has more than 30, so read the list, or <code>devvm network lock --json</code>, before you tick them.</p>
|
||
<p>A host that&rsquo;s an easy way to send data out is risky, and it always starts unticked. devvm&rsquo;s own rules leave all of them out too, so tick one only when the project needs it. These are risky:</p>
|
||
<ul>
|
||
<li>an address rather than a host name</li>
|
||
<li>a name with a punycode (<code>xn--</code>) label, which can look like another name</li>
|
||
<li>a paste or file drop site such as pastebin.com, paste.ubuntu.com or gist.github.com, or a log that takes entries from anyone, such as rekor.sigstore.dev</li>
|
||
<li>file storage or file sharing such as transfer.sh, Dropbox, Google Docs, SharePoint or an S3 bucket</li>
|
||
<li>a mail server such as Gmail&rsquo;s</li>
|
||
<li>a tunnel such as ngrok or trycloudflare.com</li>
|
||
<li>a service that records what it&rsquo;s sent, such as webhook.site or an OAST domain</li>
|
||
<li>free hosting such as vercel.app, workers.dev or cloudfront.net</li>
|
||
<li>a chat service&rsquo;s endpoint for bots, such as Discord&rsquo;s, Slack&rsquo;s hooks or Telegram&rsquo;s API</li>
|
||
</ul>
|
||
<p>In the list, these keys choose the hosts:</p>
|
||
<ul>
|
||
<li>Space ticks or unticks the row under the cursor.</li>
|
||
<li><code>a</code> ticks every row, the risky ones and those on other ports too, and again unticks them all.</li>
|
||
<li>Enter adds the ticked hosts to the VM&rsquo;s own policy file. Each is an exact host and port, such as <code>registry.example.com:443</code> or <code>example.com:8443</code>, with the port written even for 443, so it doesn&rsquo;t allow port 80 too, and never a <code>*.</code> wildcard. Then devvm gives the VM the allowlist tier at once, as it does between confined tiers, so a running VM keeps running, and its learning ends.</li>
|
||
</ul>
|
||
<p>When the VM&rsquo;s tier changed while the list was open, such as with <code>devvm network internet</code> in another terminal, <code>devvm network lock</code> changes nothing and says so. When the terminal doesn&rsquo;t let devvm read single keys, or goes away while the list is open, or you press Ctrl+C, <code>devvm network lock</code> changes nothing, rather than lock with the hosts as they were ticked then. Later, <code>devvm network allow</code>, <code>deny</code> and <code>rm</code> change those rules as they change any other (<a href="#changing-rules">changing rules</a>).</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th></th>
|
||
<th></th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td><code>devvm network lock</code></td>
|
||
<td>list the hosts the VM learned, so you choose which it keeps, then give it the allowlist tier</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>--all</code></td>
|
||
<td>keep every host it learned, the unticked ones too, without asking</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>--none</code></td>
|
||
<td>keep none of them, without asking</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>--json</code></td>
|
||
<td>list the hosts it learned, and change nothing</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<p>Without a terminal, or with <code>--no-input</code>, <code>devvm network lock</code> refuses and names <code>--all</code> and <code>--none</code>. When the VM reached no host beyond its allowlist, it locks at once without asking. A VM that isn&rsquo;t learning has nothing to lock, so <code>devvm network lock</code> refuses and names <code>devvm network learn</code>. While the VM links to a target on a lower tier than allowlist, <code>devvm network lock</code> refuses as <code>devvm network allowlist</code> would (<a href="#links-between-vms">links between VMs</a>).</p>
|
||
<p>The proxy keeps each VM&rsquo;s log to its last 10 to 20 MiB (<a href="#logs">logs</a>), so a VM that learns for a long time with a lot of traffic can lose the first hosts it reached. When the log no longer goes back to the time the VM started learning, <code>devvm network lock</code> warns you, and its <code>--json</code> sets <code>partial</code>. A host that&rsquo;s missing then is blocked once the VM is locked, and <code>devvm network log --blocked</code> names the <code>devvm network allow</code> command that allows it.</p>
|
||
<h4 data-hextra-search-id="devvm-network-lock-json">devvm network lock &ndash;json<span class="hx:absolute hx:-mt-20" id="devvm-network-lock-json"></span>
|
||
<a href="#devvm-network-lock-json" class="subheading-anchor" aria-label="Permalink for this section"></a></h4><p><code>devvm network lock --json</code> prints what the VM learned as one JSON object, as <a href="https://next.devvm.dev/docs/using/command-line/#output-for-scripts">output for scripts</a> describes, and changes nothing, so devvm refuses it with <code>--all</code> or <code>--none</code>. The hosts come in the list&rsquo;s order: the tickable ones first, then the others, then those that only tools without proxy settings reached, then the risky ones.</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>Field</th>
|
||
<th>What it holds</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td><code>learning_since</code></td>
|
||
<td>when the VM started learning</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>partial</code></td>
|
||
<td><code>true</code> when the log no longer goes back that far</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>hosts</code></td>
|
||
<td>each host the VM learned, with the fields below</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>rule</code></td>
|
||
<td>the rule that <code>devvm network lock</code> adds for it</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>host</code>, <code>port</code></td>
|
||
<td>its host and port</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>count</code></td>
|
||
<td>the number of its connections</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>last</code></td>
|
||
<td>the last time the VM reached it</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>agent</code></td>
|
||
<td>the <code>User-Agent</code>&rsquo;s first word that reached it most, when devvm shows one</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>tickable</code></td>
|
||
<td><code>true</code> for a host on port 443 of a registry or vendor on devvm&rsquo;s list, which starts ticked unless it&rsquo;s risky</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>risk</code></td>
|
||
<td>for a risky host, <code>address</code>, <code>lookalike</code>, <code>paste</code>, <code>storage</code>, <code>mail</code>, <code>tunnel</code>, <code>webhook</code>, <code>hosting</code> or <code>chat</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>via</code></td>
|
||
<td><code>dns</code> for a host that only tools without proxy settings reached</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;version&#34;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;learning_since&#34;</span><span class="p">:</span> <span class="s2">&#34;2026-11-07T10:00:00Z&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;hosts&#34;</span><span class="p">:</span> <span class="p">[</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;rule&#34;</span><span class="p">:</span> <span class="s2">&#34;files.pythonhosted.org:443&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;host&#34;</span><span class="p">:</span> <span class="s2">&#34;files.pythonhosted.org&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;port&#34;</span><span class="p">:</span> <span class="mi">443</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;count&#34;</span><span class="p">:</span> <span class="mi">48</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;last&#34;</span><span class="p">:</span> <span class="s2">&#34;2026-11-07T10:19:00Z&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;agent&#34;</span><span class="p">:</span> <span class="s2">&#34;uv/0.9.2&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;tickable&#34;</span><span class="p">:</span> <span class="kc">true</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;rule&#34;</span><span class="p">:</span> <span class="s2">&#34;registry.example.com:443&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;host&#34;</span><span class="p">:</span> <span class="s2">&#34;registry.example.com&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;port&#34;</span><span class="p">:</span> <span class="mi">443</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;count&#34;</span><span class="p">:</span> <span class="mi">12</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;last&#34;</span><span class="p">:</span> <span class="s2">&#34;2026-11-07T10:20:00Z&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;agent&#34;</span><span class="p">:</span> <span class="s2">&#34;npm/11.6.2&#34;</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;rule&#34;</span><span class="p">:</span> <span class="s2">&#34;pastebin.com:443&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;host&#34;</span><span class="p">:</span> <span class="s2">&#34;pastebin.com&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;port&#34;</span><span class="p">:</span> <span class="mi">443</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;count&#34;</span><span class="p">:</span> <span class="mi">3</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;last&#34;</span><span class="p">:</span> <span class="s2">&#34;2026-11-07T10:21:00Z&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;agent&#34;</span><span class="p">:</span> <span class="s2">&#34;curl/8.5.0&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;risk&#34;</span><span class="p">:</span> <span class="s2">&#34;paste&#34;</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">]</span>
|
||
</span></span><span class="line"><span class="cl"><span class="p">}</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<h2 data-hextra-search-id="allowlists">Allowlists<span class="hx:absolute hx:-mt-20" id="allowlists"></span>
|
||
<a href="#allowlists" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>The VM&rsquo;s proxy reads devvm&rsquo;s built-in policies first and then your policy files, in order, as one list:</p>
|
||
<ul>
|
||
<li>devvm&rsquo;s own rules for every VM, which allow OS packages, mise&rsquo;s version lists, the Sigstore and GitHub trust roots that mise checks a download&rsquo;s attestations against, Node&rsquo;s downloads for a project&rsquo;s own node, and GitHub;</li>
|
||
<li>devvm&rsquo;s rules for each shared tool in the VM&rsquo;s image (<code>node</code>, <code>claude</code> and the others), which allow its registries, downloads and APIs;</li>
|
||
<li>devvm&rsquo;s rules for each <a href="https://next.devvm.dev/docs/using/images/#built-in-layers">built-in layer</a> in the VM&rsquo;s image, so the <code>docker</code> layer allows Docker&rsquo;s packages and the container registries Docker Hub and ghcr.io, and the <code>nix</code> layer allows Nix&rsquo;s binary cache, channels and flake registry;</li>
|
||
<li><code>~/.config/devvm/layers/&lt;name&gt;.policy</code>, for each of your own layers in the VM&rsquo;s image;</li>
|
||
<li><code>~/.config/devvm/policy</code>, your own rules for every VM, which <code>devvm network allow</code>, <code>deny</code> and <code>rm</code> change with <code>-g</code>;</li>
|
||
<li><code>~/.local/share/devvm/vms/&lt;hash&gt;/policy</code>, the rules for that VM only, in the VM&rsquo;s own folder, which is named by the hash that the VM&rsquo;s name ends with, which <a href="#changing-rules"><code>devvm network allow</code>, <code>deny</code> and <code>rm</code></a> change;</li>
|
||
<li>the hosts of the VM&rsquo;s secrets and logins, and the host its agents log in at, such as Codex&rsquo;s and opencode&rsquo;s <code>auth.openai.com</code> and Claude Code&rsquo;s <code>platform.claude.com</code> and <code>console.anthropic.com</code>, on port 443, which devvm adds.</li>
|
||
</ul>
|
||
<p>The first three are built in: they come with devvm, inside its binary, so you can&rsquo;t edit them, and an upgrade of devvm is what changes them. To change what a VM reaches, add your own rules, and to keep a VM from a host that devvm&rsquo;s rules allow, add a deny, which beats any allow. devvm leaves storage and paste sites out of its defaults on purpose, because they&rsquo;re easy ways to send data out. Rules never come from the project folder, because the VM can write it. The proxy reads each of your files again when it changes, so an edit applies at once, from the next connection. <a href="https://next.devvm.dev/docs/internals/network/#policy-files">How it works</a> lists where each policy comes from.</p>
|
||
<h3 data-hextra-search-id="rules">Rules<span class="hx:absolute hx:-mt-20" id="rules"></span>
|
||
<a href="#rules" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>A policy file holds one rule per line. <code>#</code> starts a comment, and matching a host ignores case.</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>Rule</th>
|
||
<th>Matches</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td><code>example.com</code></td>
|
||
<td>that host only</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>*.example.com</code></td>
|
||
<td>any subdomain, at any depth, not <code>example.com</code> itself</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>**</code></td>
|
||
<td>any host, and any address, though an internal address still needs its own rule</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>10.0.0.5</code>, <code>10.0.0.0/8</code>, <code>fd00::/8</code></td>
|
||
<td>addresses, IPv4 or IPv6 (also what lets a connection past the internal-address refusal)</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>RULE:22</code>, <code>[fd00::1]:22</code>, <code>10.0.0.0/8:8080</code></td>
|
||
<td>only that port; without a port, 443 and 80</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>RULE:*</code>, <code>**:*</code></td>
|
||
<td>any port</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>!RULE</code></td>
|
||
<td>deny: a deny beats any allow</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>RULE METHODS PATH</code>, such as <code>api.github.com GET,HEAD /repos/</code></td>
|
||
<td>only those requests to a host name, by their methods, their path or both (<a href="#rules-by-method-and-path">rules by method and path</a>)</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<p>A rule is written this way:</p>
|
||
<ul>
|
||
<li>A rule is plain ASCII, and a host&rsquo;s part has no spaces in it, while a rule by method and path has its methods and its path after the host, each after a space.</li>
|
||
<li>A port is a number from 1 to 65535, or <code>*</code> for any port.</li>
|
||
<li>A host&rsquo;s one trailing dot is dropped, so <code>example.com.</code> matches <code>example.com</code>.</li>
|
||
<li>Brackets hold only an IPv6 address, and an address can&rsquo;t follow <code>*.</code>.</li>
|
||
<li>A line that holds anything else, such as <code>example.com:x</code>, <code>a*.example.com</code> or <code>! example.com</code> with a space after the <code>!</code>, isn&rsquo;t a rule. A line that isn&rsquo;t a rule and doesn&rsquo;t start with <code>!</code> is skipped, and the file&rsquo;s other lines still apply. The proxy names each such line in its own log.</li>
|
||
</ul>
|
||
<div class="devvm-callout devvm-callout-warning">
|
||
<p class="devvm-callout-title"><svg class="devvm-icon" aria-hidden="true" focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12" fill="currentColor" shape-rendering="crispEdges"><path d="M5 1h1v1H5ZM4 2h1v1H4ZM6 2h1v1H6ZM4 3h1v1H4ZM6 3h1v1H6ZM3 4h1v1H3ZM7 4h1v1H7ZM3 5h1v1H3ZM5 5h1v1H5ZM7 5h1v1H7ZM2 6h1v1H2ZM5 6h1v1H5ZM8 6h1v1H8ZM2 7h1v1H2ZM5 7h1v1H5ZM8 7h1v1H8ZM1 8h1v1H1ZM9 8h1v1H9ZM1 9h1v1H1ZM5 9h1v1H5ZM9 9h1v1H9ZM0 10h1v1H0ZM10 10h1v1H10ZM0 11h11v1H0Z"/></svg> Warning</p><p>When a line that isn&rsquo;t a rule starts with <code>!</code>, it reads as a deny, but the proxy can&rsquo;t tell what it would deny. So while the line is there, the proxy of every VM that reads the file denies every new connection apart from the VM&rsquo;s <a href="#links-between-vms">links</a>, whatever the other rules allow. Connections that are already open stay open. Each refusal names the file and the line, and it suggests no <code>devvm network allow</code> command, because no rule would help.</p></div><p>devvm warns about each line that isn&rsquo;t a rule, with the file and the line&rsquo;s number, and the warning for a broken deny says that the proxies deny everything until it&rsquo;s fixed. It warns when you open a confined VM whose proxy reads the file, when <code>devvm network allow</code>, <code>deny</code> or <code>rm</code> changes the file, and in <code>devvm doctor</code>. <code>devvm network</code> also marks the line. Fix the line or remove it, and the change applies from the next connection.</p>
|
||
<p>The proxy never dials a denied address, even for an allowed name that resolves to it or to its NAT64 or 6to4 form. A missing file has no rules. A file that changed but can&rsquo;t be read keeps its last rules, so a deny never lapses.</p>
|
||
<h3 data-hextra-search-id="quiet-hosts">Quiet hosts<span class="hx:absolute hx:-mt-20" id="quiet-hosts"></span>
|
||
<a href="#quiet-hosts" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>Some tools send telemetry to a host of their own, and devvm&rsquo;s built-in policies leave such hosts out. Cursor&rsquo;s CLI has no setting that turns its metrics off, so it keeps sending them to <code>api3.cursor.sh</code> and getting blocked, many times a session. devvm&rsquo;s built-in policies mark a few such hosts quiet, with a <code>quiet HOST</code> line, for one exact host name. A quiet host is blocked as any host that no rule allows, and <code>devvm network log</code> still shows each block, ending <code>, quiet</code>. The VM gets no note before its prompt for it, though, and <code>devvm-why</code> doesn&rsquo;t list it, the <code>403</code> that the tool gets suggests no command, <code>devvm network log --blocked</code> shows <code>- (quiet)</code> instead of one, and <code>devvm network lock</code> never offers it.</p>
|
||
<p>A block is quiet only when no rule of yours covers the host and nothing else refused it, such as its address. To allow a quiet host anyway, add it as any other host, such as <code>devvm network allow api3.cursor.sh</code>, and your rule wins. Only devvm&rsquo;s own policies can mark a host quiet. In one of your files, a <code>quiet</code> line isn&rsquo;t a rule, so the proxy skips it, and devvm warns about it as it warns about any other line that isn&rsquo;t a rule, saying that only devvm&rsquo;s policies can mark a host quiet. These are the quiet hosts:</p>
|
||
<ul>
|
||
<li><code>api3.cursor.sh</code>, the host Cursor documents for its editor&rsquo;s Tab requests, which Cursor&rsquo;s CLI uses for its metrics (in a <code>devvm cursor</code> window, Tab&rsquo;s requests come from the Cursor app on this machine, not the VM);</li>
|
||
<li><code>telemetry.go.dev</code>, Go&rsquo;s telemetry uploads, which every VM turns off.</li>
|
||
</ul>
|
||
<h3 data-hextra-search-id="changing-rules">Changing rules<span class="hx:absolute hx:-mt-20" id="changing-rules"></span>
|
||
<a href="#changing-rules" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p><code>devvm network</code> shows this folder&rsquo;s VM&rsquo;s allowlist after its tier. It prints each of the VM&rsquo;s policies that holds more than comments, and then its rules without their comments. A built-in policy has its name after <code># devvm:</code>, because it has no file you could edit, and one of your files has its path after <code>#</code>, followed by <code>(denies only)</code> on the internet and none tiers, where it shows only the file&rsquo;s denies. An open VM has no policies, so <code>devvm network</code> prints its tier alone. A built-in policy&rsquo;s quiet line is marked <code># blocked, without a notice in the VM</code>, and a line that isn&rsquo;t a rule is marked <code># not a rule, skipped</code>, with its line number:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">allowlist
|
||
</span></span><span class="line"><span class="cl"># devvm: layers/base.policy
|
||
</span></span><span class="line"><span class="cl"> ports.ubuntu.com
|
||
</span></span><span class="line"><span class="cl"> github.com
|
||
</span></span><span class="line"><span class="cl"># /Users/you/.local/share/devvm/vms/71a99b1076d92c/policy
|
||
</span></span><span class="line"><span class="cl"> example.com
|
||
</span></span><span class="line"><span class="cl"> example.com:x # not a rule, skipped (line 2)</span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th></th>
|
||
<th></th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td><code>devvm network allow RULE...</code></td>
|
||
<td>add the rules to the VM&rsquo;s own file</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>devvm network deny RULE...</code></td>
|
||
<td>add them as denies, adding <code>!</code> when it&rsquo;s missing</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>devvm network rm RULE...</code></td>
|
||
<td>remove the lines with these rules, a deny with its <code>!</code>, and warn about one that isn&rsquo;t there</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>-g</code>, <code>--global</code></td>
|
||
<td>with <code>allow</code>, <code>deny</code> or <code>rm</code>, change <code>~/.config/devvm/policy</code>, for every VM, instead, which needs no VM</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>--method METHODS</code>, <code>--path PATH</code></td>
|
||
<td>with <code>allow</code>, <code>deny</code> or <code>rm</code>, narrow each rule to those requests (<a href="#rules-by-method-and-path">rules by method and path</a>)</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<p>A rule is what <a href="#rules">Rules</a> lists, without spaces or a comment, and <code>--method</code> and <code>--path</code> add its methods and its path. devvm refuses anything else before it adds any rule, and it also refuses <code>allow !RULE</code>. A rule that&rsquo;s already in the file, in any case, isn&rsquo;t added again, and a rule by method and path is the same rule however its methods are written, while its path&rsquo;s case is its own. Each change applies at once, from the next connection. For an open VM, devvm notes that no rule applies to it, and for an allow on the internet or none tier, that only denies apply there. When <code>devvm network log --blocked</code> or a blocked request in the VM suggests a <code>devvm network allow</code> command, its rule is one that <code>devvm network allow</code> takes.</p>
|
||
<p>If a VM was deleted outside devvm, devvm deletes what it kept for that VM when it makes a new VM for the same project folder, so the new VM never gets the old one&rsquo;s rules.</p>
|
||
<h3 data-hextra-search-id="rules-by-method-and-path">Rules by method and path<span class="hx:absolute hx:-mt-20" id="rules-by-method-and-path"></span>
|
||
<a href="#rules-by-method-and-path" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>A rule for a host name can also name the requests it covers, by their methods, their path or both. So a VM can read from an API without changing anything there, or reach a host without pushing to it. <code>devvm network allow</code>, <code>deny</code> and <code>rm</code> take <code>--method</code> and <code>--path</code> for this, and the file gets the rule as one line, such as <code>api.github.com GET,HEAD /repos/</code>:</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th></th>
|
||
<th></th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td><code>devvm network allow api.example.com --method GET,HEAD</code></td>
|
||
<td>let the VM only read from <code>api.example.com</code>, a host that no other rule allows</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>devvm network allow api.example.com --path /v1/</code></td>
|
||
<td>let it reach only the paths below <code>/v1/</code> there</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>devvm network deny api.github.com --method POST,PUT,PATCH,DELETE</code></td>
|
||
<td>keep it from changing anything through GitHub&rsquo;s API, which devvm&rsquo;s rules allow</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>devvm network deny github.com --path '/*/*/git-receive-pack'</code></td>
|
||
<td>keep it from pushing to GitHub over HTTPS</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>devvm network deny -g pastebin.com --method POST</code></td>
|
||
<td>keep every VM from posting there</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<p>Allows add up and a deny beats any allow, as for every rule:</p>
|
||
<ul>
|
||
<li>An allow by method and path lets through only the requests it names, and the host&rsquo;s other requests stay blocked unless another rule allows the whole host.</li>
|
||
<li>So to narrow a host that a rule already allows whole, such as <code>api.github.com</code>, which devvm&rsquo;s own rules allow, add a deny of what the VM mustn&rsquo;t do. An allow by method and path for such a host narrows nothing, and devvm warns you so when you add one, naming the VMs where another rule allows the host whole, with <code>-g</code> each VM&rsquo;s own rules counted, and the deny to add instead. Where a whole allow names port 443 alone, such as <code>api.example.com:443</code>, an allow by method and path still narrows the host&rsquo;s plain HTTP on port 80, and the warning says that.</li>
|
||
<li>A deny by method and path refuses only the requests it names, and the host&rsquo;s other requests go on.</li>
|
||
<li>You can narrow any host this way, devvm&rsquo;s built-in ones, a secret&rsquo;s and an agent&rsquo;s included, for one VM or with <code>-g</code> for every VM.</li>
|
||
<li>On the internet and none tiers your denies apply, by method and path too, while your allows apply only on the allowlist tier, as for every rule.</li>
|
||
</ul>
|
||
<p>The methods are some of <code>GET</code>, <code>HEAD</code>, <code>POST</code>, <code>PUT</code>, <code>PATCH</code>, <code>DELETE</code>, <code>OPTIONS</code>, <code>TRACE</code> and <code>QUERY</code>, in any case, joined by commas, and devvm writes them in capitals in that order:</p>
|
||
<ul>
|
||
<li><code>GET</code> doesn&rsquo;t include <code>HEAD</code>, so name both for reading.</li>
|
||
<li>A deny refuses only the methods it names, so to keep a host read-only, name <code>POST</code>, <code>PUT</code>, <code>PATCH</code> and <code>DELETE</code>.</li>
|
||
<li>A GraphQL API, such as GitHub&rsquo;s at <code>api.github.com/graphql</code>, takes its reads as <code>POST</code> too, so such a deny refuses them as well, and the GitHub CLI, which reads through it, fails there.</li>
|
||
<li>Some servers take a request&rsquo;s method from a header or a parameter instead of the request itself, so the proxy judges a request by every method it names, and while a rule by method covers a host, it refuses a request whose method it can&rsquo;t read alike for every server (<a href="https://next.devvm.dev/docs/internals/network/#requests-by-method-and-path">requests by method and path</a>).</li>
|
||
</ul>
|
||
<p>A path is a pattern:</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>Pattern</th>
|
||
<th>Example</th>
|
||
<th>Matches</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td><code>*</code></td>
|
||
<td><code>/repos/*/*/issues</code>, <code>/*/*.git/info/refs</code></td>
|
||
<td>any part of one segment</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>**</code>, as a whole segment</td>
|
||
<td><code>/repos/**</code></td>
|
||
<td>one segment or more</td>
|
||
</tr>
|
||
<tr>
|
||
<td>a path that ends with <code>/</code></td>
|
||
<td><code>/repos/</code></td>
|
||
<td>everything below it, as <code>/**</code> there would, so <code>/repos/a</code> and <code>/repos/a/b</code> but not <code>/repos</code> itself</td>
|
||
</tr>
|
||
<tr>
|
||
<td>a path without a <code>/</code> at its end</td>
|
||
<td><code>/user</code></td>
|
||
<td>also the request&rsquo;s path with one, so <code>/user/</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td>any path</td>
|
||
<td><code>/search</code></td>
|
||
<td>whatever the query, so <code>/search?q=x</code>, because the query never counts</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<p>A path starts with <code>/</code>, and it has no <code>.</code> or <code>..</code> part, no doubled slash, and no space, <code>%</code>, <code>\</code>, <code>;</code>, <code>?</code> or <code>#</code>. Servers don&rsquo;t all read a request&rsquo;s path alike, so an allow matches only a path in a plain form that every server reads the same way, and a deny matches broadly. So a deny of <code>/gists/</code> refuses <code>/gists</code>, <code>/GISTS/1</code>, <code>/gists/</code>, <code>/gists.json</code>, <code>/%67ists/1</code>, <code>/x/../gists/1</code> and <code>/gists;x/1</code> alike, and a deny of <code>/admin</code> refuses <code>/admin.json</code> and <code>/admin.</code> but not <code>/administrator</code>. While a rule with a path covers a host, a request there whose path has an encoded character, such as a file name with a space, is refused unless a rule without a path allows it (<a href="https://next.devvm.dev/docs/internals/network/#requests-by-method-and-path">requests by method and path</a>).</p>
|
||
<p>To see each request, the proxy decrypts the host&rsquo;s HTTPS on port 443 with <a href="#secrets">the VM&rsquo;s own CA</a>, as it does for a secret&rsquo;s hosts. That has these effects:</p>
|
||
<ul>
|
||
<li>The proxy checks every request on the connection, each one on a kept-alive connection and on HTTP/2 alike, with the rules as they are then, so a change to them applies to a decrypted tunnel from its next request. A tunnel that was open to the host before a rule narrowed it isn&rsquo;t decrypted, so it carries on unchecked until it closes.</li>
|
||
<li>A tunnel to such a host on any other port is refused, because the proxy can&rsquo;t see the requests in it, while plain HTTP on any port gets the same check for each request.</li>
|
||
<li>A tool in the VM that doesn&rsquo;t trust the VM&rsquo;s CA fails there, and <code>devvm network log</code> gives the reason <code>TLS with the VM failed</code>, which is why devvm reminds you when you add such a rule that the host is now decrypted. A host that a whole allow covers, with no deny by method and path, stays a tunnel.</li>
|
||
<li>A rule by method and path needs a host name or <code>*.name</code>, so devvm refuses <code>--method</code> and <code>--path</code> with an address or a CIDR, which have no name to decrypt by, and with <code>**</code>, which would decrypt every host.</li>
|
||
<li>A WebSocket is checked by the request that opens it, and what it carries after that isn&rsquo;t. A switch to any other protocol, such as <code>Upgrade: h2c</code>, and a <code>CONNECT</code> inside a decrypted tunnel are refused, because the proxy couldn&rsquo;t check the requests that would follow.</li>
|
||
</ul>
|
||
<p>A request that the rules block gets <code>403</code> from the proxy, with the reason, and never reaches the host. <code>devvm network log</code> shows it with its method and its path, and <code>devvm-why</code> lists it. For a request that no allow covers, the proxy suggests the <code>devvm network allow</code> command for the whole host, and for one that a deny refuses it suggests nothing, because no allow lifts a deny. A request that a rule by method and path let through shows that rule in <code>devvm network log</code>:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">$ devvm network allow api.example.com --method GET --path /v1/
|
||
</span></span><span class="line"><span class="cl">==&gt; devvm added api.example.com GET /v1/ to devvm-some-project-71a99b1076d92c&#39;s rules.
|
||
</span></span><span class="line"><span class="cl">The proxy now decrypts api.example.com&#39;s HTTPS on port 443 to check each request, so a tool that doesn&#39;t trust the VM&#39;s CA fails there, and a new tunnel to it on another port is refused. Tunnels to it that are open already carry on unchecked until they close.
|
||
</span></span><span class="line"><span class="cl">https://devvm.dev/docs/safety/network/#rules-by-method-and-path</span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>In the VM, a <code>GET</code> below <code>/v1/</code> reaches the host, while a <code>POST</code> there gets the proxy&rsquo;s answer:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">$ curl -X POST https://api.example.com/v1/charges
|
||
</span></span><span class="line"><span class="cl">devvm: api.example.com:443 is blocked (no rule allows this method and path). Allow it on the host with: devvm network allow api.example.com</span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>And on this machine, <code>devvm network log</code> shows both:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">2026-11-08T10:00:01Z allowed api.example.com:443 rule api.example.com GET /v1/, decrypted
|
||
</span></span><span class="line"><span class="cl">2026-11-08T10:00:01Z allowed api.example.com:443 GET /v1/charges, rule api.example.com GET /v1/
|
||
</span></span><span class="line"><span class="cl">2026-11-08T10:00:02Z BLOCKED api.example.com:443 POST /v1/charges: no rule allows this method and path</span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>Learning stays by host: <code>devvm network lock</code> adds whole hosts, and you can narrow them afterwards with these flags (<a href="#learning-the-hosts-a-vm-needs">learning the hosts a VM needs</a>). A line with a method that devvm doesn&rsquo;t know, such as <code>!api.github.com PSOT</code>, isn&rsquo;t a rule, so as a deny it makes the proxy deny everything until you fix it (<a href="#rules">rules</a>). The shared Nix cache&rsquo;s own downloads from <code>cache.nixos.org</code> meet these rules too, as <code>GET</code>s of the paths the VM asked the cache for (<a href="#nix">Nix</a>).</p>
|
||
<p>A VM&rsquo;s proxy is the devvm binary that started it, which is the one from before an upgrade until the VM&rsquo;s next launch. A proxy from before rules by method and path reads such a rule as a line that isn&rsquo;t a rule: it skips an allow by method and path, and a deny by method and path makes it deny the VM everything, until it starts again. Likewise, once one of a VM&rsquo;s secrets goes in by method or by a path pattern, such a proxy puts none of the VM&rsquo;s secrets in. So when you add or remove such a rule, or change such a secret, while a VM&rsquo;s proxy runs from another devvm binary, or from one devvm can&rsquo;t tell, devvm warns you and names the VM, and running <code>devvm</code> in the VM&rsquo;s folder starts its proxy again.</p>
|
||
<h3 data-hextra-search-id="devvm-network-json">devvm network &ndash;json<span class="hx:absolute hx:-mt-20" id="devvm-network-json"></span>
|
||
<a href="#devvm-network-json" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p><code>devvm network --json</code> prints the VM&rsquo;s tier and its allowlist as one JSON object, as <a href="https://next.devvm.dev/docs/using/command-line/#output-for-scripts">output for scripts</a> describes. With <code>--json</code> the command only shows, so devvm refuses a tier with it.</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>Field</th>
|
||
<th>What it holds</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td><code>policy</code></td>
|
||
<td><code>open</code>, <code>internet</code>, <code>allowlist</code>, <code>none</code> or <code>unenforced</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>learning_since</code></td>
|
||
<td>for a learning VM, the time it started <a href="#learning-the-hosts-a-vm-needs">learning</a></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>allowlist</code></td>
|
||
<td>each policy that holds more than comments, in the order the proxy reads them, with the fields below</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>builtin</code>, <code>file</code></td>
|
||
<td>a built-in policy&rsquo;s name, or the path of one of your files</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>rules</code></td>
|
||
<td>the policy&rsquo;s rules: all of a file&rsquo;s rules, or on the internet and none tiers, for a file whose denies alone apply, its denies, as <code>devvm network</code> lists them under <code>(denies only)</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>denies_only</code></td>
|
||
<td><code>true</code> for a file whose denies alone apply</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>not_rules</code></td>
|
||
<td>each line that isn&rsquo;t a rule, with its <code>line</code> number and its <code>text</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>quiet</code></td>
|
||
<td>a built-in policy&rsquo;s <a href="#quiet-hosts">quiet hosts</a>, there only when it has some</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>transparent</code></td>
|
||
<td>the VM&rsquo;s <a href="#tools-that-ignore-the-proxy">transparent mode</a>, with <code>on</code> and <code>from</code>, as <code>devvm network transparent --json</code> has it</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<p>With <code>-g</code>, the object has only <code>policy</code>, which is the tier new VMs get, and <code>source</code>, which says where it came from: <code>config.toml</code>, <code>settings.json</code> for what <code>devvm network -g</code> or <code>devvm setup</code> saved, or <code>built-in</code> (<a href="https://next.devvm.dev/docs/using/settings/#where-a-default-comes-from">where a default comes from</a>).</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;version&#34;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;policy&#34;</span><span class="p">:</span> <span class="s2">&#34;allowlist&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;source&#34;</span><span class="p">:</span> <span class="s2">&#34;config.toml&#34;</span>
|
||
</span></span><span class="line"><span class="cl"><span class="p">}</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;version&#34;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;policy&#34;</span><span class="p">:</span> <span class="s2">&#34;allowlist&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;allowlist&#34;</span><span class="p">:</span> <span class="p">[</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;builtin&#34;</span><span class="p">:</span> <span class="s2">&#34;layers/base.policy&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;rules&#34;</span><span class="p">:</span> <span class="p">[</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;ports.ubuntu.com&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;github.com&#34;</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">],</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;not_rules&#34;</span><span class="p">:</span> <span class="p">[]</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;file&#34;</span><span class="p">:</span> <span class="s2">&#34;/Users/you/.local/share/devvm/vms/71a99b1076d92c/policy&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;rules&#34;</span><span class="p">:</span> <span class="p">[</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;example.com&#34;</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">],</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;not_rules&#34;</span><span class="p">:</span> <span class="p">[</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;line&#34;</span><span class="p">:</span> <span class="mi">2</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;text&#34;</span><span class="p">:</span> <span class="s2">&#34;example.com:x&#34;</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">]</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">],</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;transparent&#34;</span><span class="p">:</span> <span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;on&#34;</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;from&#34;</span><span class="p">:</span> <span class="s2">&#34;default&#34;</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
|
||
</span></span><span class="line"><span class="cl"><span class="p">}</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>On the none tier, a VM with Claude Code gets Claude Code&rsquo;s built-in policy whole, and its own file shows only its denies:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;version&#34;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;policy&#34;</span><span class="p">:</span> <span class="s2">&#34;none&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;allowlist&#34;</span><span class="p">:</span> <span class="p">[</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;builtin&#34;</span><span class="p">:</span> <span class="s2">&#34;shared-tools/claude.policy&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;rules&#34;</span><span class="p">:</span> <span class="p">[</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;api.anthropic.com&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;claude.ai&#34;</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">],</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;not_rules&#34;</span><span class="p">:</span> <span class="p">[]</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;file&#34;</span><span class="p">:</span> <span class="s2">&#34;/Users/you/.local/share/devvm/vms/71a99b1076d92c/policy&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;denies_only&#34;</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;rules&#34;</span><span class="p">:</span> <span class="p">[</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;!tracker.example.com&#34;</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">],</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;not_rules&#34;</span><span class="p">:</span> <span class="p">[]</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">]</span>
|
||
</span></span><span class="line"><span class="cl"><span class="p">}</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<h2 data-hextra-search-id="inside-the-vm">Inside the VM<span class="hx:absolute hx:-mt-20" id="inside-the-vm"></span>
|
||
<a href="#inside-the-vm" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>Every login in the VM has the proxy settings in its environment (<code>HTTP_PROXY</code>, <code>HTTPS_PROXY</code> and their lowercase forms, <code>NO_PROXY</code> for the VM itself, and <code>NODE_USE_ENV_PROXY</code>), and the <a href="https://next.devvm.dev/docs/using/settings/#a-companys-ca">CA variables</a> that every VM has point the tools that don&rsquo;t read the system&rsquo;s store at the VM&rsquo;s own CAs. devvm also points apt, sudo, ssh and Docker at the proxy (<a href="https://next.devvm.dev/docs/internals/network/#the-vms-setup">how</a>), on every tier.</p>
|
||
<p>On a confined tier, a direct connection to an address fails at once, even as root, and no DNS query leaves the VM. Names resolve in the proxy as the tool wrote them, without this machine&rsquo;s DNS search domain added, so to reach a host on your network, use its full name, such as <code>jenkins.corp.example.com</code> and not <code>jenkins</code>. Inside the VM, every name resolves to one stand-in address, which leads to the proxy too, so a tool that skips the proxy settings still reaches the hosts the rules allow over HTTPS and HTTP (<a href="#tools-that-ignore-the-proxy">tools that ignore the proxy</a>). Such a tool&rsquo;s connection to another port of a name is refused at once, and nothing reaches the log for it (<a href="https://next.devvm.dev/docs/using/troubleshooting/#a-tool-that-skips-the-proxy-fails">what to do</a>).</p>
|
||
<p>A blocked request gets <code>403</code>, and the response names the host, the reason and the rule that would allow it, but for a <a href="#quiet-hosts">quiet host</a>. The proxy also answers at <code>http://devvm.proxy/</code>:</p>
|
||
<ul>
|
||
<li><code>/blocked</code> lists the last 50 blocks.</li>
|
||
<li><code>/blocked/new?after=N</code> gives the number of blocks so far, then those after the Nth, with each rule once, so a shell prompt can show what a command hit.</li>
|
||
<li><code>/ca.pem</code> is the VM&rsquo;s own CA certificate and the next one&rsquo;s, never their keys.</li>
|
||
<li><code>/nix/</code> is the shared Nix cache, in a VM with the <code>nix</code> layer (<a href="#nix">below</a>).</li>
|
||
<li><code>/transparent/ports</code> lists the ports that <a href="#tools-that-ignore-the-proxy">transparent mode</a> sends to the proxy, one a line.</li>
|
||
</ul>
|
||
<p>A request for <code>http://devvm.proxy/</code> that comes through transparent mode, without the proxy settings, reaches <code>/blocked</code> alone and gets <code>403</code> for the rest, because that way asks the tool for no password, so a container without the proxy settings can&rsquo;t fetch the VM&rsquo;s CA or the Nix cache.</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm-why <span class="c1"># in the VM: what the proxy blocked lately</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>In the VM, <code>devvm-why</code> prints what the proxy blocked lately, and a note before each prompt tells you when something new was blocked. These help too:</p>
|
||
<ul>
|
||
<li>When the proxy blocked nothing lately, <code>devvm-why</code> says so, and it adds that a connection refused, or a DNS error, for a host the tier allows means the tool skipped the proxy on a port or in a way devvm can&rsquo;t send to it, so you turn on the tool&rsquo;s own proxy setting or give it the address in <code>$HTTPS_PROXY</code> (<a href="https://next.devvm.dev/docs/using/troubleshooting/#a-tool-that-skips-the-proxy-fails">a tool that skips the proxy fails</a>).</li>
|
||
<li>With transparent mode on, <code>devvm-why</code> then says which ports it sends to the proxy, lists the connections to other ports that the VM refused lately, by port and time, and lists the names that tools looked up lately.</li>
|
||
<li>devvm also tells Claude Code and Codex, in <code>~/.claude/CLAUDE.md</code> and <code>~/.codex/AGENTS.md</code>, why a request may fail and to run <code>devvm-why</code>, that a tool that ignores the proxy settings still reaches the proxy over HTTPS, HTTP and the ports the rules name, and that a connection refused on another port while <code>devvm-why</code> shows nothing blocked means the tool skipped the proxy.</li>
|
||
</ul>
|
||
<h3 data-hextra-search-id="nix">Nix<span class="hx:absolute hx:-mt-20" id="nix"></span>
|
||
<a href="#nix" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>In a VM with the <a href="https://next.devvm.dev/docs/using/images/#nix"><code>nix</code> layer</a>, Nix&rsquo;s daemon makes most of Nix&rsquo;s downloads, and devvm also points it at the proxy, so its downloads go through the same allowlists. The layer&rsquo;s allowlist has <code>cache.nixos.org</code> for Nix&rsquo;s binary cache, and <code>channels.nixos.org</code> and <code>releases.nixos.org</code> for its channels and flake registry, and GitHub, where most flakes&rsquo; inputs come from, is in devvm&rsquo;s rules for every VM.</p>
|
||
<p>Nix asks the proxy&rsquo;s shared cache, <code>http://devvm.proxy/nix</code>, before cache.nixos.org, so every VM with the layer shares the packages that any of them downloaded (<a href="https://next.devvm.dev/docs/using/toolchains/#nix-projects">shared downloads</a>, <a href="https://next.devvm.dev/docs/internals/network/#the-shared-nix-cache">the shared Nix cache</a>):</p>
|
||
<ul>
|
||
<li>The proxy fetches what the cache doesn&rsquo;t have from cache.nixos.org alone, and only while the VM&rsquo;s tier and rules let it reach <code>cache.nixos.org</code>. It keeps a package only when cache.nixos.org&rsquo;s signature on it checks, and the VM&rsquo;s Nix checks that signature again.</li>
|
||
<li>A VM can only make the proxy fetch from cache.nixos.org: the proxy refuses anything a VM sends to store, and every request that isn&rsquo;t for one of Nix&rsquo;s cache files.</li>
|
||
<li>Each request shows in <code>devvm network log</code> as <code>cache</code>, with whether it was a <code>hit</code>, <code>fetched</code>, or why it wasn&rsquo;t found. What one VM can learn of another through the cache is under <a href="https://next.devvm.dev/docs/safety/attack-vectors/#network">Attack vectors</a>.</li>
|
||
<li>An open VM has its proxy too, so it shares the cache as well, and its proxy fetches from cache.nixos.org for it.</li>
|
||
</ul>
|
||
<p>When a package isn&rsquo;t in the binary cache, Nix builds it from source, and the build downloads its sources from their own hosts, such as <code>ftpmirror.gnu.org</code>. The proxy blocks those hosts until you allow them, so the build fails, and the error, <code>devvm-why</code> and <code>devvm network log --blocked</code> name the host and the <code>devvm network allow</code> command that allows it.</p>
|
||
<h2 data-hextra-search-id="behind-a-company-proxy">Behind a company proxy<span class="hx:absolute hx:-mt-20" id="behind-a-company-proxy"></span>
|
||
<a href="#behind-a-company-proxy" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>When this machine reaches the internet only through a company proxy, the VM&rsquo;s proxy sends the requests it allows through that proxy. devvm reads <code>HTTPS_PROXY</code>, <code>HTTP_PROXY</code> and <code>NO_PROXY</code>, or their lowercase forms, from the shell you run it in. When that shell sets neither <code>HTTPS_PROXY</code> nor <code>HTTP_PROXY</code>, devvm reads the <code>[proxy]</code> table of <a href="https://next.devvm.dev/docs/using/settings/#configtoml"><code>config.toml</code></a> instead, so the proxy works from every shell, including an editor&rsquo;s terminal that didn&rsquo;t load your profile. The shell&rsquo;s settings win whole: devvm never mixes them with <code>config.toml</code>&rsquo;s, so a <code>NO_PROXY</code> alone in the shell still leaves <code>config.toml</code>&rsquo;s proxy in effect, with its own <code>no-proxy</code>.</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-toml" data-lang="toml"><span class="line"><span class="cl"><span class="p">[</span><span class="nx">proxy</span><span class="p">]</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">https</span> <span class="p">=</span> <span class="s2">&#34;http://[email protected]:8080&#34;</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">http</span> <span class="p">=</span> <span class="s2">&#34;http://[email protected]:8080&#34;</span>
|
||
</span></span><span class="line"><span class="cl"><span class="nx">no-proxy</span> <span class="p">=</span> <span class="s2">&#34;localhost,.example.com&#34;</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>devvm passes the settings to the VM&rsquo;s proxy when the proxy starts, and when you run devvm again with different settings, devvm starts the VM&rsquo;s proxy again with the new ones. So after you change them, run devvm again in the folder or <code>devvm restart</code>. When a VM&rsquo;s proxy went through a company proxy the last time it started and devvm finds none this time, devvm warns you and names <code>config.toml</code>, because a VM&rsquo;s proxy that a shell without the settings starts sends the VM&rsquo;s requests directly.</p>
|
||
<p>The VM&rsquo;s proxy uses the company proxy this way (<a href="https://next.devvm.dev/docs/internals/network/#through-a-company-proxy">through a company proxy</a>):</p>
|
||
<ul>
|
||
<li>It still decides each request by the host name the VM asked for, against the same allowlists, and only then passes it on. It sends tunnels, which carry HTTPS and the requests it puts your secrets into, through <code>HTTPS_PROXY</code>&rsquo;s proxy, and plain HTTP requests through <code>HTTP_PROXY</code>&rsquo;s.</li>
|
||
<li>It reaches the hosts that <code>NO_PROXY</code> names directly, and also <code>localhost</code> and loopback addresses. In <code>NO_PROXY</code>, <code>example.com</code> matches that host and its subdomains, <code>.example.com</code> matches only its subdomains, an address or a CIDR matches addresses, any entry can end in a port, and <code>*</code> matches every host. An IPv6 address with a zone, such as <code>fe80::1%eth0</code>, matches nothing, as it does in Go&rsquo;s HTTP clients.</li>
|
||
<li><code>devvm network log</code> adds <code>through host:port</code> to each request that went through the company proxy.</li>
|
||
</ul>
|
||
<p>The company proxy&rsquo;s address and password follow these rules:</p>
|
||
<ul>
|
||
<li>The company proxy needs an <code>http://</code> address, such as <code>http://user:[email protected]:8080</code> in <code>HTTPS_PROXY</code>, and a proxy without a port is on port 80. devvm doesn&rsquo;t start a VM&rsquo;s proxy while <code>HTTPS_PROXY</code>, <code>HTTP_PROXY</code> or a <code>[proxy]</code> key names an <code>https://</code> or <code>socks5://</code> proxy, and it tells you which setting to change.</li>
|
||
<li>The company proxy&rsquo;s password stays on this machine. The VM never gets it, and devvm writes it into no log, no image and no process&rsquo;s arguments.</li>
|
||
<li><code>config.toml</code> never holds the password, because it&rsquo;s a file you might copy to other machines or keep with your dotfiles, and devvm refuses a <code>[proxy]</code> URL that has one. Put only the user in the URL, as <code>http://[email protected]:8080</code>, and save the password with <code>devvm secret set proxy</code>, which keeps it as it keeps the other <a href="#saving-and-binding-secrets">secrets</a>. devvm&rsquo;s proxies look it up themselves when they start, so no file of devvm&rsquo;s holds it in the clear.</li>
|
||
<li>devvm doesn&rsquo;t make a new VM, start a VM&rsquo;s proxy, or build an image or the shared tools while <code>config.toml</code>&rsquo;s proxy names a user and no password is saved, and it checks before anything starts or stops. So <code>devvm</code> or <code>devvm restart</code> in the folder of a running VM leaves the VM and its proxy running as they were, as long as that proxy still enforces the VM&rsquo;s network tier, and otherwise devvm stops the VM (<a href="https://next.devvm.dev/docs/internals/network/#the-proxy">the proxy</a>).</li>
|
||
<li>A VM&rsquo;s proxy reads the password only when it starts, so after you change it, run <code>devvm restart</code> in each VM&rsquo;s folder. No VM ever gets the <code>proxy</code> secret, and <code>devvm secret use proxy</code> refuses.</li>
|
||
</ul>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm secret <span class="nb">set</span> proxy <span class="c1"># save the company proxy&#39;s password, which devvm asks for</span>
|
||
</span></span><span class="line"><span class="cl">devvm restart <span class="c1"># in each VM&#39;s folder, once the password changed</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<div class="devvm-callout devvm-callout-note">
|
||
<p class="devvm-callout-title"><svg class="devvm-icon" aria-hidden="true" focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12" fill="currentColor" shape-rendering="crispEdges"><path d="M4 9h3V8H6V5H4v1h1v2H4Zm-3 1h1V9H1Zm1 1h1v-1H2ZM0 9h1V4H0Zm3 3h5v-1H3Zm5-1h1v-1H8ZM1 4h1V3H1Zm8 6h1V9H9ZM2 3h1V2H2Zm3 1h1V3H5Zm5 5h1V4h-1ZM3 2h5V1H3Zm6 2h1V3H9ZM8 3h1V2H8Zm0 0"/></svg> Note</p><p>The company proxy sees the name and port of every host the VM reaches, and if it inspects TLS, the <a href="https://next.devvm.dev/docs/using/settings/#a-companys-ca">CA you add for it</a> also lets it read the traffic. The company proxy also looks up each name itself, so the VM&rsquo;s proxy can&rsquo;t check every address a name leads to. It still refuses an address that&rsquo;s this machine&rsquo;s own or internal, unless a rule names it, and it refuses a name when this machine&rsquo;s lookup gives an internal or denied address for it. A name that this machine can&rsquo;t look up goes to the company proxy unchecked only when an allowlist names it, as <code>example.com</code> or <code>*.example.com</code>. When only <code>**</code> allows a name that this machine can&rsquo;t look up, the VM&rsquo;s proxy refuses it, so <code>**</code> never lets a VM send the company proxy a name of its own making. What a VM can still reach through the company proxy, such as hosts on your company&rsquo;s network, is under <a href="https://next.devvm.dev/docs/safety/attack-vectors/#network">Attack vectors</a>.</p></div><h3 data-hextra-search-id="open-vms-and-builds">Open VMs and builds<span class="hx:absolute hx:-mt-20" id="open-vms-and-builds"></span>
|
||
<a href="#open-vms-and-builds" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>These go through the company proxy too:</p>
|
||
<ul>
|
||
<li><strong>Open VMs.</strong> An open VM goes through its proxy as every VM does, and its proxy sends its requests through the company proxy, from the shell&rsquo;s settings or <code>config.toml</code>&rsquo;s, so the company proxy&rsquo;s password stays on this machine for it too. The VM never gets the shell&rsquo;s proxy settings, and Lima gets none to pass on to it. What an open VM reaches directly, past its proxy, such as the hosts its <code>NO_PROXY</code> names, doesn&rsquo;t go through the company proxy. Lima prints each proxy setting it gives a VM, password and all, as it starts the VM. devvm keeps the password out of its <a href="https://next.devvm.dev/docs/using/troubleshooting/#a-command-fails">run log</a>, and once the VM has started, it replaces the password with as many <code>*</code> in the log Lima keeps for the VM.</li>
|
||
<li><strong>Builds.</strong> Builds never get your company proxy&rsquo;s settings, and images never keep them. A build goes through the shell&rsquo;s company proxy, or else <code>config.toml</code>&rsquo;s, as a VM&rsquo;s proxy does. When devvm builds an image, builds the shared tools or converts a <code>--from</code> container image on Lima behind a company proxy, the build goes through a proxy of devvm&rsquo;s on this machine, made for that build alone, which goes through your company proxy. The build&rsquo;s commands get only that proxy&rsquo;s address, with a password devvm makes for the build, while they run, and devvm stops the proxy when the build ends.</li>
|
||
<li><strong>What a build runs.</strong> So the code a build runs, which includes a container image&rsquo;s own, never sees your company proxy&rsquo;s address or password. That proxy also runs on this machine, so a company proxy on <code>localhost</code>, such as one a VPN client runs, works for builds too. A build&rsquo;s proxy allows any host, as <code>**</code> does. It sends a name that this machine can&rsquo;t look up on to the company proxy, so builds work where only the company proxy looks up outside names.</li>
|
||
<li><strong>devvm&rsquo;s own downloads on this machine.</strong> They are devvm&rsquo;s copy of mise and the versions it looks up for the shared tools, the list of Ubuntu&rsquo;s cloud images, and a container registry&rsquo;s answers for <code>--from</code>. With the shell&rsquo;s settings, each of them uses the shell&rsquo;s. With <code>config.toml</code>&rsquo;s, devvm&rsquo;s own requests send the password only to the company proxy. When a VM&rsquo;s proxy refreshes a Codex or opencode login on this machine, the refresh goes through the same company proxy as the VM&rsquo;s requests, with the password kept on this machine.</li>
|
||
<li><strong>The mise devvm runs on this machine.</strong> It gets the proxy&rsquo;s URL with the password in it, in its environment, because mise takes a proxy&rsquo;s password nowhere else. devvm percent-encodes the password in that URL and mise decodes it before it sends it, so a password with characters such as <code>@</code>, <code>:</code>, <code>/</code>, <code>#</code>, <code>%</code> or a space works too. devvm never puts that URL in mise&rsquo;s arguments or in a file.</li>
|
||
</ul>
|
||
<h2 data-hextra-search-id="tools-that-ignore-the-proxy">Tools that ignore the proxy<span class="hx:absolute hx:-mt-20" id="tools-that-ignore-the-proxy"></span>
|
||
<a href="#tools-that-ignore-the-proxy" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>On every tier but open, devvm sends a tool that ignores the proxy settings to the VM&rsquo;s proxy anyway, by the names it looks up. This is transparent mode, and it&rsquo;s on unless you turn it off. In the VM, every name resolves to one stand-in address, <code>198.18.0.1</code>, and a connection to that address on port 443, port 80 or a port that one of your allow rules names goes to the VM&rsquo;s proxy.</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm network transparent <span class="c1"># show whether this folder&#39;s VM has transparent mode</span>
|
||
</span></span><span class="line"><span class="cl">devvm network transparent off <span class="c1"># turn it off for the VM, from its next launch</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>The proxy reads the host from the connection itself, from the TLS server name (SNI) on HTTPS and from each request&rsquo;s <code>Host</code> on plain HTTP, and it judges that host as it judges a request through the proxy settings, against the same allowlist, with the same secrets and the same log. A blocked HTTPS host gets the proxy&rsquo;s <code>403</code>, over a certificate for that host from the VM&rsquo;s own CA, so the tool shows the same message, with the <code>devvm network allow</code> command, that a request through the proxy settings would show. <code>devvm network log</code> and <code>devvm-why</code> mark each of these connections <code>without proxy settings</code>, and so does the note before the prompt. A tool such as workerd, which <code>wrangler dev</code> runs for Cloudflare&rsquo;s adapters, makes its own lookups and connections, and transparent mode is what lets it reach your allowed hosts from a confined VM.</p>
|
||
<p>Transparent mode covers HTTPS and HTTP to a host by name on ports 443 and 80, and on up to 32 more ports that your allow rules name for hosts by name, such as <code>api.example.com:8443</code>, the lowest first. It never covers port 22 or 53, even when a rule names one, because SSH names no host in its first bytes and port 53 is the VM&rsquo;s own names&rsquo;. It leaves these to the tool&rsquo;s own proxy settings:</p>
|
||
<ul>
|
||
<li><strong>Other ports.</strong> A connection to another port of a name is refused at once, and so is UDP to any port, QUIC included, so a client that tries HTTP/3 falls back to TCP. A client that uses HTTP/3 alone doesn&rsquo;t connect.</li>
|
||
<li><strong>Protocols that name no host in their first bytes,</strong> such as Postgres, MySQL, Redis, SSH and raw TCP, and those whose server speaks first, such as SMTP. The proxy refuses such a connection and logs why, even on a port a rule names.</li>
|
||
<li><strong>Addresses.</strong> A URL with an address in it, such as <code>https://1.2.3.4/</code>, is a direct connection, which fails, and so does a tool that looks a name up itself and then gives the proxy the stand-in address, which the proxy refuses with a reason that says so.</li>
|
||
<li><strong>IPv6.</strong> Names have no IPv6 address in the VM, so a client that uses IPv6 alone finds no address.</li>
|
||
<li><strong>Names without a dot, and your network&rsquo;s names.</strong> A name without a dot, such as <code>db</code>, resolves only when <code>/etc/hosts</code> has it, as the name of a <a href="https://next.devvm.dev/docs/using/links/">link between VMs</a> does. The VM&rsquo;s resolver adds the search domain of this machine&rsquo;s network to such a name, and transparent mode can&rsquo;t tell <code>db.corp.example.com</code> made that way from one a tool names whole, so every name under that search domain gets no answer either, such as <code>printer.lan</code> or <code>git.corp.example.com</code> when your network&rsquo;s search domain is <code>corp.example.com</code>. A tool that reaches such a host needs its proxy settings.</li>
|
||
<li><strong>A DNS server of yours on the VM&rsquo;s <code>127.0.0.1:53</code>.</strong> Transparent mode sends the VM&rsquo;s lookups there to its own names, so such a server, and a <a href="https://next.devvm.dev/docs/using/ports-size/#ports">forward</a> of port 53 to it, gets none. Put the server on another address or port, or turn transparent mode off for the VM.</li>
|
||
<li><strong>Clients that don&rsquo;t trust the VM&rsquo;s CA,</strong> such as most Docker containers, and those that pin a certificate. For a blocked HTTPS host they show a certificate error instead of the <code>403</code>, and the block is logged all the same.</li>
|
||
</ul>
|
||
<p>With the <a href="https://next.devvm.dev/docs/using/images/#docker">docker layer</a>, Docker&rsquo;s containers get the same treatment as the VM&rsquo;s own programs, on Docker&rsquo;s default bridge and on the networks that <code>docker network create</code> and Compose make. A container without the proxy settings, whether its environment emptied them or a program made it through Docker&rsquo;s API without them, reaches what the VM&rsquo;s rules allow, as every program in the VM does. To give a container no network, run it with <code>--network none</code>, and a container on an <code>--internal</code> network reaches nothing either.</p>
|
||
<p><code>devvm network transparent</code> shows a VM&rsquo;s transparent mode, <code>on</code> or <code>off</code>, and where that comes from: the VM&rsquo;s own setting, <code>config.toml</code>&rsquo;s <code>transparent-proxy</code>, or devvm&rsquo;s default, which is on. <code>devvm network transparent off</code> and <code>devvm network transparent on</code> give the folder&rsquo;s VM its own setting, and <code>transparent-proxy = false</code> in <a href="https://next.devvm.dev/docs/using/settings/#transparent-mode"><code>config.toml</code></a> turns it off for every VM that has none of its own. A change applies at the VM&rsquo;s next launch, without a restart.</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-console" data-lang="console"><span class="line"><span class="cl"><span class="gp">$</span> devvm network transparent
|
||
</span></span><span class="line"><span class="cl"><span class="go">on # devvm: default
|
||
</span></span></span><span class="line"><span class="cl"><span class="gp">$</span> devvm network transparent off
|
||
</span></span><span class="line"><span class="cl"><span class="go">==&gt; devvm turns transparent mode off for devvm-web-0c3c7077e29f06 at its next launch, and it applies while the VM is on a confined tier.
|
||
</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>With transparent mode off, names don&rsquo;t resolve in a confined VM at all, so a tool that skips the proxy fails with a DNS error. Tools such as curl and workerd under <code>wrangler dev</code> get that error at once, on macOS and on a Linux host alike. On the open tier there&rsquo;s no transparent mode, and the VM resolves names with Lima&rsquo;s DNS. A VM made from an image built before devvm had transparent mode lacks the programs it runs, so each launch says so, and <code>devvm update</code> makes the VM again from a newer image.</p>
|
||
<p><code>devvm network transparent --json</code> prints the same as JSON, with <code>on</code> and <code>from</code>, which is <code>vm</code>, <code>config</code> or <code>default</code>, and <code>devvm network --json</code> has it too, as <code>transparent</code>:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;version&#34;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;on&#34;</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;from&#34;</span><span class="p">:</span> <span class="s2">&#34;default&#34;</span>
|
||
</span></span><span class="line"><span class="cl"><span class="p">}</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>On the open tier, a tool that ignores the proxy settings in the VM&rsquo;s environment connects directly, past its proxy. Its connections still work, because an open VM reaches everything this machine can, but they don&rsquo;t show in <code>devvm network log</code>, they don&rsquo;t go through your company proxy, and a request of theirs that needs one of your secrets carries only its placeholder, so the secret&rsquo;s host refuses it. On every other tier, a tool that transparent mode doesn&rsquo;t cover needs the proxy&rsquo;s address in its own settings. These common tools don&rsquo;t read <code>HTTP_PROXY</code> and <code>HTTPS_PROXY</code>, or read them only when told to:</p>
|
||
<ul>
|
||
<li><strong>Node&rsquo;s <code>fetch</code></strong> reads them only with <code>NODE_USE_ENV_PROXY=1</code>, from Node 24.0.0 and 22.21.0, or with <code>--use-env-proxy</code>, from Node 24.5.0 and 22.21.0. devvm sets <code>NODE_USE_ENV_PROXY</code> in every VM, so an older Node&rsquo;s <code>fetch</code> is the one that connects directly.</li>
|
||
<li><strong>Python&rsquo;s aiohttp</strong> reads them only when a program makes its session with <code>trust_env=True</code>.</li>
|
||
<li><strong>Go programs</strong> read them through Go&rsquo;s default HTTP transport, but a program that makes its own transport without a proxy function connects directly.</li>
|
||
<li><strong>Java</strong> reads none of them. It takes its proxy from the <code>https.proxyHost</code> and <code>https.proxyPort</code> system properties, such as <code>-Dhttps.proxyHost=…</code>, and <code>http.proxyHost</code> and <code>http.proxyPort</code> for plain HTTP.</li>
|
||
<li><strong>The Docker daemon</strong> reads them only from its own environment as it starts, or from its <code>daemon.json</code>, never from your shell. devvm points the daemon at the proxy itself, as <a href="#inside-the-vm">Inside the VM</a> says.</li>
|
||
</ul>
|
||
<h2 data-hextra-search-id="secrets">Secrets<span class="hx:absolute hx:-mt-20" id="secrets"></span>
|
||
<a href="#secrets" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>Secrets stay on this machine, whatever the VM&rsquo;s tier. A VM gets a placeholder of its own for each one, and its proxy puts the real value into requests for that secret&rsquo;s hosts. An open VM can send a request around its proxy, but then the request carries only the placeholder, which the secret&rsquo;s host refuses (<a href="#tools-that-ignore-the-proxy">tools that ignore the proxy</a>). The proxy puts each secret into one header:</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>Secret</th>
|
||
<th>Hosts</th>
|
||
<th>Header</th>
|
||
<th>Used by</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td><code>claude</code></td>
|
||
<td><code>api.anthropic.com</code></td>
|
||
<td><code>Authorization</code></td>
|
||
<td>every VM whose image has <code>claude</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>github</code></td>
|
||
<td><code>api.github.com</code>, <code>github.com</code>, <code>codeload.github.com</code>, <code>raw.githubusercontent.com</code></td>
|
||
<td><code>Authorization</code></td>
|
||
<td>VMs it&rsquo;s bound to</td>
|
||
</tr>
|
||
<tr>
|
||
<td><a href="#your-own-secrets">your own</a></td>
|
||
<td>the hosts you give it, for the paths and methods you give it</td>
|
||
<td><code>Authorization</code>, or the header you give it</td>
|
||
<td>VMs it&rsquo;s bound to</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<p>Agents&rsquo; logins work the same way. When a VM&rsquo;s image has a coding agent and devvm&rsquo;s agent store has a login or an API key for it, the VM gets placeholders for the login, and so do Claude Code&rsquo;s MCP servers&rsquo; secrets (<a href="https://next.devvm.dev/docs/internals/network/#agents-logins-and-settings">agents&rsquo; logins and settings</a>). A Claude Code, Codex or opencode login that you make inside a VM goes to the store, and the VM gets placeholders for it too (<a href="https://next.devvm.dev/docs/using/coding-agents/#claude-code-login">Claude Code login</a>). A login to an MCP server that you make with <code>/mcp</code> in a VM stays in that VM instead, with real tokens that code in the VM can read (<a href="https://next.devvm.dev/docs/using/coding-agents/#mcp-servers-logins">MCP servers&rsquo; logins</a>).</p>
|
||
<p>The logins a VM saves have two limits (<a href="https://next.devvm.dev/docs/internals/network/#logins-made-in-a-vm">logins made in a VM</a>):</p>
|
||
<ul>
|
||
<li><strong>Only its own agents.</strong> A VM saves a login only for an agent that its image has, and its proxy refuses a login for any other agent, so a VM without Codex can never replace the store&rsquo;s Codex login.</li>
|
||
<li><strong>One login for each agent.</strong> Because the store keeps one login for each agent, any VM with the agent can replace it, so a VM you don&rsquo;t trust can log your other VMs in to an account of its choosing.</li>
|
||
</ul>
|
||
<h3 data-hextra-search-id="saving-and-binding-secrets">Saving and binding secrets<span class="hx:absolute hx:-mt-20" id="saving-and-binding-secrets"></span>
|
||
<a href="#saving-and-binding-secrets" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><table>
|
||
<thead>
|
||
<tr>
|
||
<th>Command</th>
|
||
<th>What it does</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td><code>devvm secret set claude</code> or <code>github</code></td>
|
||
<td>asks for the Claude Code token or the GitHub token without showing it, and saves it (<code>--stdin</code> reads a line instead)</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>devvm secret set proxy</code></td>
|
||
<td>asks for the <a href="#behind-a-company-proxy">company proxy</a>&rsquo;s password, for the user that <code>config.toml</code>&rsquo;s <code>[proxy]</code> names, and saves it (<code>--stdin</code> reads a line instead)</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>devvm secret set NAME --host HOST --env VARIABLE</code></td>
|
||
<td>asks for a <a href="#your-own-secrets">secret of your own</a>, such as an API key, and saves it with the hosts it goes to and the variable that VMs find its placeholder in (<code>--stdin</code> reads a line instead)</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>devvm secret rm NAME</code></td>
|
||
<td>deletes a saved secret, after asking</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>devvm secret</code></td>
|
||
<td>lists the secrets, each with its variable, header and hosts, a secret of your own&rsquo;s path and methods, whether it&rsquo;s saved, and the VMs using it</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>devvm secret use NAME</code></td>
|
||
<td>lets this folder&rsquo;s VM use the secret, and reach its hosts on port 443</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>devvm secret unuse NAME</code></td>
|
||
<td>stops this folder&rsquo;s VM using it, though a VM whose image has <code>claude</code> always uses <code>claude</code></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<p>devvm saves a secret in the macOS Keychain, or elsewhere in <code>~/.local/share/devvm/secrets/&lt;name&gt;</code>, a file only you can read (<a href="https://next.devvm.dev/docs/internals/network/#where-secrets-are-saved">details</a>). No devvm command prints a saved secret, because each VM&rsquo;s proxy reads the values it needs itself. devvm checks each value as you save it:</p>
|
||
<ul>
|
||
<li>It drops whitespace in a secret&rsquo;s value, except inside the <code>proxy</code> password, which loses only the whitespace around it.</li>
|
||
<li>It refuses a value with a quote, a backslash or a control character, a value that holds a VM&rsquo;s placeholder, such as one copied from a VM&rsquo;s <code>GH_TOKEN</code>, and a <code>claude</code> value that isn&rsquo;t a setup token (<code>sk-ant-oat01-…</code>, from <code>claude setup-token</code>).</li>
|
||
<li>A <code>CLAUDE_CODE_OAUTH_TOKEN</code> in devvm&rsquo;s environment wins over a saved one.</li>
|
||
</ul>
|
||
<p>Each change applies in its own time:</p>
|
||
<ul>
|
||
<li>Saving, deleting, binding and unbinding apply at once to the proxies that are running.</li>
|
||
<li>From its next launch, the VM gets the placeholder in <code>CLAUDE_CODE_OAUTH_TOKEN</code>, <code>GH_TOKEN</code> or your own secret&rsquo;s variable, and with <code>github</code> a git credential helper for <code>https://github.com</code>.</li>
|
||
<li>A secret&rsquo;s hosts join the allowlist of each VM that uses it, on port 443 alone, whatever the VM&rsquo;s tier, so a VM on the none tier reaches them too.</li>
|
||
</ul>
|
||
<p>To put a secret in, the proxy shows the VM a certificate from the VM&rsquo;s own CA, which no other VM trusts. Each CA lasts 30 days, and a VM that you don&rsquo;t open again keeps working for at least 30 days after its last launch with <code>devvm</code> in its folder. When its CA has ended, its proxy refuses its HTTPS connections to secrets&rsquo; hosts, and <code>devvm network log --blocked</code> gives the reason <code>devvm's CA has ended</code>, so run <code>devvm</code> in the VM&rsquo;s folder to install new CAs (<a href="https://next.devvm.dev/docs/internals/network/#the-vms-ca">the VM&rsquo;s CA</a>).</p>
|
||
<p><code>devvm secret unuse</code> and <code>devvm secret rm</code> take a secret away from a VM at once, because the VM only ever had its placeholder. Neither command revokes what a VM made with the secret (<a href="https://next.devvm.dev/docs/safety/attack-vectors/#secrets-and-keys-the-vm-may-use">minting credentials with a secret</a>), so rotate it if that matters. Use a fine-grained GitHub token, scoped to the repos your VMs need.</p>
|
||
<h4 data-hextra-search-id="devvm-secret-json">devvm secret &ndash;json<span class="hx:absolute hx:-mt-20" id="devvm-secret-json"></span>
|
||
<a href="#devvm-secret-json" class="subheading-anchor" aria-label="Permalink for this section"></a></h4><p><code>devvm secret --json</code> prints the list as one JSON object, as <a href="https://next.devvm.dev/docs/using/command-line/#output-for-scripts">output for scripts</a> describes. Each of the <code>secrets</code> has its name, <code>saved</code>, which is <code>true</code> when it&rsquo;s saved or, for <code>claude</code>, in devvm&rsquo;s environment, and <code>used_by</code>, the names of the VMs using it. Then <code>custom</code> is <code>true</code> for a <a href="#your-own-secrets">secret of your own</a>, and <code>hosts</code> lists the hosts the proxy puts it in for, none for <code>proxy</code>. A secret that VMs get has its <code>header</code> and <code>env</code>, the variable that holds its placeholder, and <code>prefix</code> when its placeholder starts with one. A secret of yours also has its <code>scheme</code>, its <code>path</code>, its <code>methods</code> and <code>basic_user</code> when it has them. The JSON never holds a secret&rsquo;s value.</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;version&#34;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;secrets&#34;</span><span class="p">:</span> <span class="p">[</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;name&#34;</span><span class="p">:</span> <span class="s2">&#34;claude&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;saved&#34;</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;used_by&#34;</span><span class="p">:</span> <span class="p">[</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;devvm-some-project-71a99b1076d92c&#34;</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">],</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;custom&#34;</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;hosts&#34;</span><span class="p">:</span> <span class="p">[</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;api.anthropic.com&#34;</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">],</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;header&#34;</span><span class="p">:</span> <span class="s2">&#34;Authorization&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;env&#34;</span><span class="p">:</span> <span class="s2">&#34;CLAUDE_CODE_OAUTH_TOKEN&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;prefix&#34;</span><span class="p">:</span> <span class="s2">&#34;sk-ant-oat01-&#34;</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;name&#34;</span><span class="p">:</span> <span class="s2">&#34;github&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;saved&#34;</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;used_by&#34;</span><span class="p">:</span> <span class="p">[],</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;custom&#34;</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;hosts&#34;</span><span class="p">:</span> <span class="p">[</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;api.github.com&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;github.com&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;codeload.github.com&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;raw.githubusercontent.com&#34;</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">],</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;header&#34;</span><span class="p">:</span> <span class="s2">&#34;Authorization&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;env&#34;</span><span class="p">:</span> <span class="s2">&#34;GH_TOKEN&#34;</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;name&#34;</span><span class="p">:</span> <span class="s2">&#34;proxy&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;saved&#34;</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;used_by&#34;</span><span class="p">:</span> <span class="p">[],</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;custom&#34;</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;hosts&#34;</span><span class="p">:</span> <span class="p">[]</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;name&#34;</span><span class="p">:</span> <span class="s2">&#34;stripe&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;saved&#34;</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;used_by&#34;</span><span class="p">:</span> <span class="p">[</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;devvm-some-project-71a99b1076d92c&#34;</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">],</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;custom&#34;</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;hosts&#34;</span><span class="p">:</span> <span class="p">[</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;api.stripe.com&#34;</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">],</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;header&#34;</span><span class="p">:</span> <span class="s2">&#34;Authorization&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;env&#34;</span><span class="p">:</span> <span class="s2">&#34;STRIPE_API_KEY&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;prefix&#34;</span><span class="p">:</span> <span class="s2">&#34;sk_&#34;</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">]</span>
|
||
</span></span><span class="line"><span class="cl"><span class="p">}</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<h3 data-hextra-search-id="your-own-secrets">Your own secrets<span class="hx:absolute hx:-mt-20" id="your-own-secrets"></span>
|
||
<a href="#your-own-secrets" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>Any other credential that a tool in a VM sends in a header, such as an API key for Stripe, OpenRouter or your company&rsquo;s own service, can be a secret of your own. You give it a name, the hosts it goes to and the variable that VMs find its placeholder in, and devvm asks for the value without showing it:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">$ devvm secret set stripe --host api.stripe.com --env STRIPE_API_KEY --prefix sk_
|
||
</span></span><span class="line"><span class="cl">Paste the value of stripe, which VMs that use it send to api.stripe.com.
|
||
</span></span><span class="line"><span class="cl">The VMs that use it can reach those hosts on port 443.
|
||
</span></span><span class="line"><span class="cl">Token:
|
||
</span></span><span class="line"><span class="cl">==&gt; devvm saved the stripe secret in the Keychain.
|
||
</span></span><span class="line"><span class="cl">$ devvm secret use stripe
|
||
</span></span><span class="line"><span class="cl">==&gt; devvm-web-71a99b1076d92c uses the stripe secret from its next launch, and its allowlist has api.stripe.com on port 443.</span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>From its next launch, the VM has <code>STRIPE_API_KEY</code> set to its own placeholder, such as <code>sk_devvm-proxy-managed-secret-stripe-…</code>, and a tool there sends it as <code>Authorization: Bearer $STRIPE_API_KEY</code>. The proxy puts the real value in place of the placeholder only in requests to <code>api.stripe.com</code> on port 443, over TLS, and a request to any other host goes out with the placeholder alone. A program that loads a <code>.env</code> file gets the placeholder too, as long as the file doesn&rsquo;t set <code>STRIPE_API_KEY</code> itself, because most dotenv libraries leave a variable that&rsquo;s already set as it is. Keep the real key out of the project&rsquo;s <code>.env</code>, which the VM can read.</p>
|
||
<p>A secret of yours goes only to the VMs you use it in with <code>devvm secret use</code>, and each one&rsquo;s hosts then join that VM&rsquo;s allowlist on port 443. <code>devvm secret set</code> takes these flags:</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>Flag</th>
|
||
<th>What it gives the secret</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td><code>--host HOST</code></td>
|
||
<td>a host it goes to, such as <code>api.stripe.com</code>: repeat the flag, or join hosts with commas, for up to 16</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>--env VARIABLE</code></td>
|
||
<td>the variable that VMs find its placeholder in, such as <code>STRIPE_API_KEY</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>--header HEADER</code></td>
|
||
<td>the header it goes in, such as <code>X-Api-Key</code>, when it isn&rsquo;t <code>Authorization</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>--prefix PREFIX</code></td>
|
||
<td>what its placeholder starts with, such as <code>sk_</code>, for a client that checks how its key starts</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>--path PATH</code></td>
|
||
<td>the path of the requests it goes in for, written as a <a href="#rules-by-method-and-path">rule&rsquo;s path</a> is, such as <code>/api/</code> for everything below <code>/api/</code>, so a request to the host&rsquo;s other paths carries the placeholder alone, or <code>none</code> for every path</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>--method METHODS</code></td>
|
||
<td>the methods of the requests it goes in for, such as <code>GET,HEAD</code>, so a request with another method carries the placeholder alone, or <code>none</code> for every method</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>--scheme SCHEME</code></td>
|
||
<td>a scheme of its own before it in <code>Authorization</code>, besides <code>Bearer</code> and <code>Token</code>, such as <code>ApiKey</code>, or <code>none</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>--basic-user</code></td>
|
||
<td>lets it go in as the username of <code>Basic</code> credentials, as Stripe and some other services take a key (<code>--basic-user=false</code> takes that away)</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<p>The proxy puts the value in only when exactly one of the header&rsquo;s values holds the placeholder, in one of these shapes, so that the value lands where the server reads a credential:</p>
|
||
<ul>
|
||
<li>the placeholder alone, such as <code>X-Api-Key: PLACEHOLDER</code>;</li>
|
||
<li>for <code>Authorization</code>, <code>Bearer</code>, <code>Token</code> or the secret&rsquo;s own <code>--scheme</code>, in any case, then one space and the placeholder;</li>
|
||
<li>for <code>Authorization</code>, <code>Basic</code> credentials whose password is the placeholder, after a username of printable ASCII up to 64 characters, such as git&rsquo;s <code>x-access-token:PLACEHOLDER</code>;</li>
|
||
<li>with <code>--basic-user</code>, <code>Basic</code> credentials whose username is the placeholder, before a password of printable ASCII up to 64 characters, such as <code>PLACEHOLDER:</code>.</li>
|
||
</ul>
|
||
<p>The placeholder in any other shape stays as it is, and the proxy&rsquo;s own log says why without the value. That includes bytes of the VM&rsquo;s own around it, the placeholder twice, a <code>Digest</code> field, and the username of <code>Basic</code> credentials without <code>--basic-user</code>, because a server can show the VM those parts of a request it refuses, such as a username it doesn&rsquo;t know. The same shapes apply to the <code>github</code> and <code>claude</code> secrets, which the GitHub CLI, git and Claude Code send as <code>Bearer</code>, <code>token</code> and git&rsquo;s <code>Basic</code> password.</p>
|
||
<p>Without <code>--path</code> and <code>--method</code>, the value goes in for every path and every method. With them, the proxy judges each request as it judges an allow by method and path: by its method as written and each method it names in a method-override header or a <code>_method</code> parameter, and by its path only in a plain form (<a href="#rules-by-method-and-path">rules by method and path</a>). So a key that may only read goes in for <code>GET</code> and <code>HEAD</code> alone:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">$ devvm secret set reports --host api.example.com --env REPORTS_API_KEY --method GET,HEAD
|
||
</span></span><span class="line"><span class="cl">Paste the value of reports, which VMs that use it send to api.example.com.
|
||
</span></span><span class="line"><span class="cl">The VMs that use it can reach those hosts on port 443.
|
||
</span></span><span class="line"><span class="cl">Token:
|
||
</span></span><span class="line"><span class="cl">==&gt; devvm saved the reports secret in the Keychain.</span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>A <code>POST</code> from the VM to <code>api.example.com</code> then carries the placeholder, which the host refuses, while a <code>GET</code> gets the key. The proxy judges every request on a connection, so a kept-alive connection or an HTTP/2 one gets the key only in the requests that have those methods. The <code>github</code> and <code>claude</code> secrets go in for every method. To keep a VM from writing with your GitHub token, give it a deny instead, such as <code>devvm network deny api.github.com --method POST,PUT,PATCH,DELETE</code>, which refuses those requests before they leave the proxy.</p>
|
||
<p>devvm refuses a secret that breaks these rules:</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>Part</th>
|
||
<th>Rules</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td>name</td>
|
||
<td>lowercase letters, digits and dashes, and not <code>claude</code>, <code>github</code> or <code>proxy</code>, nor starting with a coding agent&rsquo;s name, such as <code>codex-key</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td>host</td>
|
||
<td>a host name, such as <code>api.example.com</code>. devvm refuses a wildcard, such as <code>*.example.com</code>, because some domains let anyone own a name under them. It also refuses an address, any port but 443, a name with a character that isn&rsquo;t plain ASCII, as the proxy refuses such a host, and a name that&rsquo;s only ever internal, such as <code>localhost</code>, <code>printer.local</code> or a Tailscale or <code>nip.io</code> name. The proxy refuses an internal address whatever name resolves to it anyway</td>
|
||
</tr>
|
||
<tr>
|
||
<td>header</td>
|
||
<td>not <code>Host</code>, <code>Cookie</code>, <code>Content-Length</code>, <code>Content-Type</code>, <code>Transfer-Encoding</code>, <code>Expect</code>, <code>Forwarded</code>, <code>Via</code>, an <code>X-Forwarded-</code> or <code>Proxy-</code> header, or one that ends at the next hop, such as <code>Connection</code>, because the proxy drops or sets those itself. Nor one that servers commonly log or send back, such as <code>Origin</code>, <code>Referer</code>, <code>User-Agent</code>, <code>X-Request-Id</code> or <code>Traceparent</code></td>
|
||
</tr>
|
||
<tr>
|
||
<td>variable</td>
|
||
<td>not one that devvm or the VM&rsquo;s shell sets, such as <code>PATH</code>, <code>GH_TOKEN</code>, <code>HTTPS_PROXY</code>, <code>NPM_CONFIG_PREFIX</code> or any <code>DEVVM_</code> variable, nor one that changes what a program runs or trusts, such as a <code>GIT_</code> or <code>PYTHON</code> variable, <code>NODE_OPTIONS</code>, <code>EDITOR</code> or <code>SSL_CERT_DIR</code>, nor another secret&rsquo;s</td>
|
||
</tr>
|
||
<tr>
|
||
<td>prefix</td>
|
||
<td>not holding <code>devvm-proxy-managed</code>, which every placeholder holds after its prefix</td>
|
||
</tr>
|
||
<tr>
|
||
<td>value</td>
|
||
<td>printable ASCII alone and at most 3,800 characters, and devvm refuses a longer one before it touches the one saved</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<p>To save a new value or change a secret, give <code>devvm secret set</code> only what changes:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm secret <span class="nb">set</span> stripe <span class="c1"># save a new value, such as after you rotate the key</span>
|
||
</span></span><span class="line"><span class="cl">devvm secret <span class="nb">set</span> stripe --host api.stripe.com,files.stripe.com <span class="c1"># give it a second host</span>
|
||
</span></span><span class="line"><span class="cl">devvm secret rm stripe <span class="c1"># delete it, after asking</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<ul>
|
||
<li>Run without the other flags, <code>devvm secret set NAME</code> keeps the secret&rsquo;s hosts, header, variable, prefix, path, methods and scheme. To change one of those, give only its flag with the new value, and the rest stay as they are.</li>
|
||
<li><code>--host</code> gives the whole list of hosts each time. A host the secret loses goes from every VM at once. A host it gains reaches only the VMs you then run <code>devvm secret use NAME</code> in again, so a host you add never gets the value from a VM you didn&rsquo;t give it to, and devvm names the VMs that keep the hosts they had.</li>
|
||
<li>To take a prefix away, delete the secret and save it again.</li>
|
||
<li>Running VMs keep the variable they launched with, so after you change <code>--env</code> or <code>--prefix</code>, a VM that uses the secret gets the new placeholder at its next launch.</li>
|
||
</ul>
|
||
<p><code>devvm secret rm NAME</code> deletes the secret with its definition after asking, and the question names the VMs that use it, which stop using it before it goes. It also deletes a value that a failed save left without its definition. Each VM records the secret it was bound to by an ID that the secret gets as it&rsquo;s first saved, so a secret saved again later by the same name goes to none of those VMs until you use it there again. A VM still bound to an earlier secret of the name gets nothing of the new one, its launch says so, and <code>devvm secret unuse NAME</code> takes the name away whether a secret has it or not.</p>
|
||
<p>devvm keeps your secrets&rsquo; hosts, headers, variables, prefixes, paths, methods and schemes in <code>~/.local/share/devvm/custom-secrets.json</code>, without their values, and checks each entry again whenever it reads the file. When it can&rsquo;t read the file, or an entry breaks the rules above, such as after an edit by hand, devvm secret and the launch of each VM that uses one of your secrets fail and name the file. Fix the entry, or delete the file and save your secrets again with devvm secret set (<a href="https://next.devvm.dev/docs/internals/network/#where-secrets-are-saved">details</a>).</p>
|
||
<div class="devvm-callout devvm-callout-warning">
|
||
<p class="devvm-callout-title"><svg class="devvm-icon" aria-hidden="true" focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12" fill="currentColor" shape-rendering="crispEdges"><path d="M5 1h1v1H5ZM4 2h1v1H4ZM6 2h1v1H6ZM4 3h1v1H4ZM6 3h1v1H6ZM3 4h1v1H3ZM7 4h1v1H7ZM3 5h1v1H3ZM5 5h1v1H5ZM7 5h1v1H7ZM2 6h1v1H2ZM5 6h1v1H5ZM8 6h1v1H8ZM2 7h1v1H2ZM5 7h1v1H5ZM8 7h1v1H8ZM1 8h1v1H1ZM9 8h1v1H9ZM1 9h1v1H1ZM5 9h1v1H5ZM9 9h1v1H9ZM0 10h1v1H0ZM10 10h1v1H10ZM0 11h11v1H0Z"/></svg> Warning</p><p>The proxy passes the replies from a secret&rsquo;s hosts to the VM as they are, so a host that sends the request&rsquo;s headers back, such as an echo or debug endpoint, shows the VM the real value. Give a secret only hosts that you trust with it, and a key scoped to what the VMs need. A secret&rsquo;s hosts are also open to the VMs that use it for requests without the placeholder, on every tier, the none tier included. So on a host where anyone can make an account, such as a storage or payments service, code in the VM can send data to an account of its own there.</p></div><h2 data-hextra-search-id="logs">Logs<span class="hx:absolute hx:-mt-20" id="logs"></span>
|
||
<a href="#logs" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p><code>devvm network log</code> shows the proxy&rsquo;s decisions for this folder&rsquo;s VM, oldest first, one line each. A line has the time, <code>allowed</code>, <code>BLOCKED</code> or <code>cache</code>, and the host and port. An allowed line then has the rule that allowed it (<code>, decrypted</code> for an intercepted tunnel), or the request (<code>GET /user</code>), with the <a href="#rules-by-method-and-path">rule by method and path</a> that let it through when one did, and the secrets put in (<code>, token: github</code>). A blocked line has why it was blocked, after the request when the proxy saw one, and a <code>cache</code> line, a request to the <a href="#nix">shared Nix cache</a>, has the request and what came of it. A line ends <code>, without proxy settings</code> when <a href="#tools-that-ignore-the-proxy">transparent mode</a> sent the connection to the proxy:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">2026-10-09T10:00:00Z BLOCKED example.com:443 not on the allowlist
|
||
</span></span><span class="line"><span class="cl">2026-10-09T10:00:05Z allowed github.com:443 rule github.com
|
||
</span></span><span class="line"><span class="cl">2026-10-09T10:00:06Z allowed api.github.com:443 GET /user, token: github
|
||
</span></span><span class="line"><span class="cl">2026-10-09T10:00:07Z BLOCKED api.github.com:443 POST /gists: denied by !api.github.com POST,PUT,PATCH,DELETE
|
||
</span></span><span class="line"><span class="cl">2026-10-09T10:00:08Z cache cache.nixos.org:443 GET /nix/yv1zf3y6all4j99aad30cb8i55dw9zmp.narinfo: hit
|
||
</span></span><span class="line"><span class="cl">2026-10-09T10:00:09Z allowed api.open-meteo.com:443 rule **, without proxy settings</span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th></th>
|
||
<th></th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td><code>-n N</code>, <code>--lines N</code></td>
|
||
<td>the last N (default 50)</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>--follow</code></td>
|
||
<td>then each new one as it happens, until Ctrl+C</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>--blocked</code></td>
|
||
<td>the blocks instead, one row per host and port, by when last blocked: <code>LAST</code>, <code>COUNT</code>, <code>HOST</code> and <code>ALLOW WITH</code>, the <code>devvm network allow</code> command that allows it</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<p><code>ALLOW WITH</code> is <code>-</code> for a request that the proxy refuses whatever the allowlist says, such as a GitHub call that makes a credential, and for a host that isn&rsquo;t a host name or an address, and <code>- (quiet)</code> for a <a href="#quiet-hosts">quiet host</a>. An open VM&rsquo;s log holds what went through its proxy and its links&rsquo; connections, but not what the VM reached directly, and <code>devvm network log</code> says so. The proxy keeps each VM&rsquo;s log to its last 10 to 20 MiB by starting a new file once the current one reaches 10 MiB and keeping one older file, which <code>devvm network log</code> reads too. <code>devvm rm</code> deletes the VM&rsquo;s logs, and <a href="https://next.devvm.dev/docs/internals/network/#log-files">How it works</a> describes the files.</p>
|
||
<h3 data-hextra-search-id="devvm-network-log-json">devvm network log &ndash;json<span class="hx:absolute hx:-mt-20" id="devvm-network-log-json"></span>
|
||
<a href="#devvm-network-log-json" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p><code>devvm network log --json</code> prints the last N events as one JSON object, as <a href="https://next.devvm.dev/docs/using/command-line/#output-for-scripts">output for scripts</a> describes, and devvm refuses it with <code>--follow</code>. Each of the <code>events</code> has what the proxy logged, without the VM&rsquo;s name, and a log with nothing in it gives <code>&quot;events&quot;: []</code>:</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>Field</th>
|
||
<th>What it holds</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td><code>time</code>, <code>host</code>, <code>port</code></td>
|
||
<td>when, and the host and port, which for a link&rsquo;s connection is the link&rsquo;s name</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>event</code></td>
|
||
<td><code>tunnel</code> for an allowed connection, <code>intercept</code> for an allowed tunnel that the proxy decrypted, <code>forward</code> for an allowed request, <code>blocked</code>, or <code>nix-cache</code> for a request to the shared Nix cache. A link&rsquo;s connection is <code>link</code> when devvm carried it, and <code>link_refused</code>, <code>link_target_stopped</code> or <code>link_limit</code> when devvm refused it</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>method</code>, <code>path</code></td>
|
||
<td>the request&rsquo;s, when the event has them</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>rule</code></td>
|
||
<td>the rule that allowed it</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>reason</code></td>
|
||
<td>the reason it was blocked, or what came of a cache request</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>agent</code></td>
|
||
<td>the request&rsquo;s <code>User-Agent</code> header</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>secrets</code></td>
|
||
<td>the secrets put in</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>refused</code></td>
|
||
<td>for a request refused whatever the allowlist says, such as an allowed name that doesn&rsquo;t resolve</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>quiet</code></td>
|
||
<td>for a block of a <a href="#quiet-hosts">quiet host</a></td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>upstream</code></td>
|
||
<td>the company proxy it went through</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>target</code></td>
|
||
<td>the VM that a link&rsquo;s connection went to</td>
|
||
</tr>
|
||
<tr>
|
||
<td><code>via</code></td>
|
||
<td><code>dns</code> for a connection that <a href="#tools-that-ignore-the-proxy">transparent mode</a> sent to the proxy</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<p>Each field but <code>time</code>, <code>event</code>, <code>host</code> and <code>port</code> is there only when the event has it.</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;version&#34;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;events&#34;</span><span class="p">:</span> <span class="p">[</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;time&#34;</span><span class="p">:</span> <span class="s2">&#34;2026-10-09T10:00:00Z&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;event&#34;</span><span class="p">:</span> <span class="s2">&#34;blocked&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;host&#34;</span><span class="p">:</span> <span class="s2">&#34;example.com&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;port&#34;</span><span class="p">:</span> <span class="mi">443</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;method&#34;</span><span class="p">:</span> <span class="s2">&#34;CONNECT&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;reason&#34;</span><span class="p">:</span> <span class="s2">&#34;not on the allowlist&#34;</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;time&#34;</span><span class="p">:</span> <span class="s2">&#34;2026-10-09T10:00:06Z&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;event&#34;</span><span class="p">:</span> <span class="s2">&#34;forward&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;host&#34;</span><span class="p">:</span> <span class="s2">&#34;api.github.com&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;port&#34;</span><span class="p">:</span> <span class="mi">443</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;method&#34;</span><span class="p">:</span> <span class="s2">&#34;GET&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;path&#34;</span><span class="p">:</span> <span class="s2">&#34;/user&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;secrets&#34;</span><span class="p">:</span> <span class="p">[</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="s2">&#34;github&#34;</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">]</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">]</span>
|
||
</span></span><span class="line"><span class="cl"><span class="p">}</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>With <code>--blocked</code>, each of the <code>blocked</code> has the <code>last</code> time it was blocked, the <code>count</code>, the <code>host</code> and the <code>port</code>, and <code>allow</code>, the rule that <code>devvm network allow</code> takes to allow it. A block that <code>ALLOW WITH</code> shows as <code>-</code> has no <code>allow</code>, and a quiet host&rsquo;s has <code>&quot;quiet&quot;: true</code> instead.</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;version&#34;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;blocked&#34;</span><span class="p">:</span> <span class="p">[</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;last&#34;</span><span class="p">:</span> <span class="s2">&#34;2026-10-09T10:01:00Z&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;count&#34;</span><span class="p">:</span> <span class="mi">2</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;host&#34;</span><span class="p">:</span> <span class="s2">&#34;example.com&#34;</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;port&#34;</span><span class="p">:</span> <span class="mi">443</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;allow&#34;</span><span class="p">:</span> <span class="s2">&#34;example.com&#34;</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="p">]</span>
|
||
</span></span><span class="line"><span class="cl"><span class="p">}</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<h2 data-hextra-search-id="links-between-vms">Links between VMs<span class="hx:absolute hx:-mt-20" id="links-between-vms"></span>
|
||
<a href="#links-between-vms" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>A <a href="https://next.devvm.dev/docs/using/links/">link between VMs</a> lets a program in one VM, the client, reach a port that another VM, the target, publishes. devvm carries a link&rsquo;s connections over ssh through this machine, so they use neither VM&rsquo;s network, and a confined VM reaches only what its tier allows and the links you added to it. A client&rsquo;s proxy is a second way into its links: it carries a request for one of the client&rsquo;s own links, by the link&rsquo;s name and port, to the same link on this machine, and passes it on as it is, without looking into it or putting a secret into it. It reaches no other socket on this machine and no other VM&rsquo;s links. The allowlist&rsquo;s rules don&rsquo;t apply to links, so <code>devvm network deny</code> doesn&rsquo;t stop one, and <code>devvm link rm</code> does.</p>
|
||
<p>A link joins the two VMs&rsquo; trust. Code in the client can often run code in the target through the target&rsquo;s service, such as Postgres&rsquo;s <code>COPY … TO PROGRAM</code>, and it then has whatever the target has: its network, the secrets it may use and its project folder. So devvm keeps two rules:</p>
|
||
<ul>
|
||
<li><strong>A client links only to a target on its own tier or a stricter one.</strong> An allowlist client links to allowlist and none targets, but not to internet or open ones, because a link to a target on a lower tier would let the client reach more through the target, around its own proxy. An open client may link to any target, and it then has the target&rsquo;s secrets and project folder within reach as well as its own network.
|
||
<ul>
|
||
<li>devvm checks this when you add a link, at each launch of the client and on every connection, and for a client on a confined tier, on every connection the target&rsquo;s tier must be in force as it runs, so devvm refuses the connection while the target shows as <code>unenforced</code>, and it warns you of such a target when you add the link, when you publish a port in its folder that the client links to, and when the client starts.</li>
|
||
<li>While such a link exists, devvm refuses to give the target a tier lower than the client&rsquo;s, such as <code>devvm network open</code>, and it refuses to give the client a tier higher than a target&rsquo;s, such as <code>devvm network allowlist</code> for a client that links to an open target.</li>
|
||
</ul>
|
||
</li>
|
||
<li><strong>The target publishes.</strong> A link reaches only a port that the target&rsquo;s folder publishes with <code>devvm link publish</code>, and only on the target&rsquo;s own loopback. Publishing offers the port to any of your VMs, and each link is still added in the client&rsquo;s folder, so a VM reaches another&rsquo;s service only when you&rsquo;ve run a command in both folders.</li>
|
||
</ul>
|
||
<p>The first rule keeps a client&rsquo;s tier whole, but it doesn&rsquo;t keep the target&rsquo;s data in the target. A client on a confined tier can read whatever the target&rsquo;s service gives it and send that out through the hosts its own tier reaches. Link two VMs only when you&rsquo;d trust each with what the other has.</p>
|
||
<p>A <a href="https://next.devvm.dev/docs/using/links/#groups">group</a> links each of its VMs to the ports that the others publish, once you&rsquo;ve run <code>devvm group join</code> in each VM&rsquo;s folder. Its VMs are all on one tier, so every link it makes keeps the first rule, and devvm refuses to change a VM&rsquo;s tier with <code>devvm network</code> while it&rsquo;s in a group. A group joins the trust of all its VMs, so put VMs in one only when you&rsquo;d trust each with what the others have.</p>
|
||
<h2 data-hextra-search-id="not-covered">Not covered<span class="hx:absolute hx:-mt-20" id="not-covered"></span>
|
||
<a href="#not-covered" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>The tiers leave some things open, such as what an allowed host accepts beyond what <a href="#rules-by-method-and-path">rules by method and path</a> narrow, whatever your secrets allow, such as pushes and API calls, and what a company CA that you add can read. <a href="https://next.devvm.dev/docs/safety/attack-vectors/">Attack vectors</a> lists them under <a href="https://next.devvm.dev/docs/safety/attack-vectors/#network">Narrowed, not closed</a> and <a href="https://next.devvm.dev/docs/safety/attack-vectors/#the-network">Left to you</a>. What transparent mode leaves to a tool&rsquo;s own proxy settings, such as other ports, databases&rsquo; protocols, addresses and HTTP/3 alone, is under <a href="#tools-that-ignore-the-proxy">tools that ignore the proxy</a>.</p></description></item><item><title>.git protection</title><link>https://next.devvm.dev/docs/safety/git-protection/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://next.devvm.dev/docs/safety/git-protection/</guid><description>
|
||
<p>The project folder is read-write in the VM, so without protection anything in the VM could add a git hook, or set <code>core.fsmonitor</code>, <code>core.hooksPath</code> or <code>core.sshCommand</code> in <code>.git/config</code>, and your next git command on this machine would run it. devvm protects them:</p>
|
||
<ul>
|
||
<li><strong>On macOS,</strong> devvm locks the git hooks and config with a flag that even root in the VM can&rsquo;t clear, so nothing the VM does runs through them on this machine.</li>
|
||
<li><strong>On Linux,</strong> devvm makes them read-only in the VM&rsquo;s own view of the folder, which root in the VM can&rsquo;t change either (<a href="#linux-hosts">Linux hosts</a>).</li>
|
||
<li><strong>Nested repos:</strong> it does the same for each git repo nested in the folder that it has found, such as the repos of a folder that holds several, but a repo or a submodule that the VM adds while it runs is git&rsquo;s to use before devvm finds it (<a href="#nested-repos">nested repos</a>, <a href="#not-covered">not covered</a>).</li>
|
||
</ul>
|
||
<p>Only <a href="https://next.devvm.dev/docs/using/clone/"><code>--clone</code></a> keeps the VM&rsquo;s code away from git on this machine.</p>
|
||
<p>Every new VM gets <code>.git</code> protection. <code>--no-git-protect</code> creates a VM without it, and <a href="#turning-it-on-or-off"><code>devvm git-protect</code></a> changes it later. <a href="https://next.devvm.dev/docs/internals/git-protection/">How it works › .git protection</a> lists what devvm locks and when it checks the locks again.</p>
|
||
<h2 data-hextra-search-id="what-still-works">What still works<span class="hx:absolute hx:-mt-20" id="what-still-works"></span>
|
||
<a href="#what-still-works" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>git in the VM can commit, branch, check out, stash, fetch and pull, and <code>git worktree add</code> works on this machine. Commands that write <code>.git/config</code> fail in the VM, and on macOS they fail on this machine too, with <code>Operation not permitted</code>. Those are <code>git config</code>, <code>git remote add</code>, <code>push -u</code> to a new branch, and hook installers such as husky or pre-commit. On macOS, <code>git worktree remove</code> and <code>prune</code> also fail for the worktrees that were there when devvm locked <code>.git</code>. On Linux, these commands work on this machine as usual, and the VM sees what they change (<a href="#linux-hosts">Linux hosts</a>).</p>
|
||
<p>To run them on macOS, stop the VM, unlock <code>.git</code>, run the commands on this machine, and lock it again:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm stop
|
||
</span></span><span class="line"><span class="cl">devvm git-protect off
|
||
</span></span><span class="line"><span class="cl">git config …
|
||
</span></span><span class="line"><span class="cl">devvm git-protect on</span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<h2 data-hextra-search-id="turning-it-on-or-off">Turning it on or off<span class="hx:absolute hx:-mt-20" id="turning-it-on-or-off"></span>
|
||
<a href="#turning-it-on-or-off" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm git-protect <span class="c1"># show this folder&#39;s VM&#39;s protection: on, off or clone</span>
|
||
</span></span><span class="line"><span class="cl">devvm git-protect off <span class="c1"># take the locks off</span>
|
||
</span></span><span class="line"><span class="cl">devvm git-protect on <span class="c1"># lock .git as it is now</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p><code>devvm git-protect</code> shows the VM&rsquo;s protection, which is <code>on</code>, <code>off</code>, or <code>clone</code> for a <a href="https://next.devvm.dev/docs/using/clone/"><code>--clone</code></a> VM, which mounts no <code>.git</code>. <code>devvm git-protect on</code> or <code>off</code> changes it at once when the VM is stopped. A running VM could race the locks, so for a running VM devvm saves your choice and asks in a terminal whether to restart the VM now, which stops anything running in it. If you answer no, or there&rsquo;s no terminal, or you pass <code>--no-input</code>, devvm says it saved the choice. It applies the choice the next time it finds the VM stopped: at the restart you agreed to, at <code>devvm stop</code>, at <code>devvm restart</code>, or, when the VM was stopped some other way, at the next launch, before the VM starts. Until then, <code>devvm git-protect</code> shows the protection the VM has, and a later choice replaces the saved one. Launches lock only a stopped VM for the same reason.</p>
|
||
<ul>
|
||
<li><code>on</code> locks <code>.git</code> as it is now and takes it as yours, so a <code>.git</code> that was replaced since the last lock isn&rsquo;t reported, and the next launches compare with this one. It reports what <a href="https://next.devvm.dev/docs/internals/git-protection/#what-a-lock-cant-stop">a lock can&rsquo;t stop</a> and what&rsquo;s <a href="#not-covered">not covered</a>, as devvm did when it made the VM. If the folder has no <code>.git</code> yet, devvm locks it on the first launch after one appears. The locks don&rsquo;t reach a submodule or a nested repo that the VM adds while it runs, so git on this machine runs what that repo&rsquo;s config and hooks say, such as its <code>core.fsmonitor</code>, until <code>devvm stop</code> or the next launch that finds the VM stopped names it and locks it (<a href="#not-covered">not covered</a>).</li>
|
||
<li><code>off</code> takes the locks off. The VM can then change <code>.git</code> hooks and config, which run on your machine.</li>
|
||
</ul>
|
||
<p>On an existing VM, devvm ignores <code>--no-git-protect</code> and warns you. A <code>--clone</code> VM&rsquo;s protection can&rsquo;t be changed. <code>devvm clone on</code> takes the locks off once it has made the VM again with its own clone, and <code>devvm clone off</code> makes it mount the folder again with protection as a new VM gets it (<a href="https://next.devvm.dev/docs/using/clone/#switching-a-vm-that-exists">switching a VM that exists</a>).</p>
|
||
<h3 data-hextra-search-id="devvm-git-protect-json">devvm git-protect &ndash;json<span class="hx:absolute hx:-mt-20" id="devvm-git-protect-json"></span>
|
||
<a href="#devvm-git-protect-json" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p><code>devvm git-protect --json</code> prints the VM&rsquo;s protection as one JSON object with <code>mode</code>, which is <code>on</code>, <code>off</code> or <code>clone</code>, as <a href="https://next.devvm.dev/docs/using/command-line/#output-for-scripts">output for scripts</a> describes. With <code>--json</code> the command only shows, so devvm refuses <code>on</code> or <code>off</code> with it.</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;version&#34;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
|
||
</span></span><span class="line"><span class="cl"> <span class="nt">&#34;mode&#34;</span><span class="p">:</span> <span class="s2">&#34;on&#34;</span>
|
||
</span></span><span class="line"><span class="cl"><span class="p">}</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<h3 data-hextra-search-id="vms-that-were-strict">VMs that were strict<span class="hx:absolute hx:-mt-20" id="vms-that-were-strict"></span>
|
||
<a href="#vms-that-were-strict" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p><code>devvm git-protect</code> takes only <code>on</code> and <code>off</code>. <code>devvm git-protect strict</code> is a usage error that points to <code>devvm clone on</code>, which keeps the VM&rsquo;s code away from git on this machine.</p>
|
||
<p>An earlier devvm&rsquo;s <code>strict</code> set <code>diff.ignoreSubmodules = all</code> in the locked <code>.git/config</code>, so that <code>git status</code> and <code>git diff</code> on this machine skipped the submodules the VM adds. That couldn&rsquo;t keep git on this machine out of them. A <code>.gitmodules</code> line that the VM writes, such as <code>ignore = none</code>, makes <code>git status</code> enter a submodule again, and <code>git add -A</code>, <code>git add -u</code>, <code>git describe --dirty</code>, <code>git diff-index</code>, <code>git diff-files</code>, <code>git fetch</code> and <code>git pull</code> enter one whatever the setting says, as does <code>--ignore-submodules</code> on the command line.</p>
|
||
<p>A VM that was made strict shows as <code>on</code> at once, in <code>devvm ls</code>, <code>devvm git-protect</code> and its <code>--json</code>, and its locks stay as they are while it runs. The first time devvm finds it stopped, at a launch, at <code>devvm stop</code>, or at <code>devvm clone on</code>, or when devvm undoes a <code>devvm clone off</code> that didn&rsquo;t finish, devvm takes <code>diff.ignoreSubmodules = all</code> out of the <code>.git/config</code> of the folder&rsquo;s own repo and of each nested repo the VM protected, unlocking each file for the moment and locking it again. Then it records the VM as <code>on</code> and says so once, unless you chose <code>devvm git-protect off</code> while it ran, which it applies next. <code>devvm git-protect on</code> and <code>off</code> and <code>devvm rm</code> take the setting out the same way, without saying so.</p>
|
||
<p>devvm leaves the setting where it can&rsquo;t tell that it set it, and names what it leaves:</p>
|
||
<ul>
|
||
<li>strict doesn&rsquo;t record a value that the setting had before it sets its own, so devvm can&rsquo;t put one back. It takes out only the value <code>all</code>, so a value that you set since, such as <code>none</code> or <code>dirty</code>, stays.</li>
|
||
<li>devvm leaves the setting alone in a repo whose <code>.git</code> isn&rsquo;t the one it recorded, because strict never set it there: a <code>.git</code> that the VM replaced, which devvm names, a nested repo that it finds for the first time at that check, and every repo of a VM it has no record of, such as one that <code>devvm adopt</code> moved. When such a config sets <code>all</code>, devvm names it once.</li>
|
||
<li>On a Linux host that watches <code>.git</code>, it also leaves a config that changed since the check read it, which the next check names.</li>
|
||
<li>If git can&rsquo;t change a config, devvm names it, and <code>git status</code> and <code>git diff</code> on this machine go on skipping that repo&rsquo;s submodules until you take the setting out yourself.</li>
|
||
<li>A <code>.git/config</code> that another VM&rsquo;s protection also keeps locked keeps the setting, because unlocking it would let that VM change the file if it runs, and devvm names the file and that VM at each launch that finds this VM stopped. devvm takes the setting out at such a check once the other VM no longer keeps the file locked.</li>
|
||
</ul>
|
||
<p>To take the setting out of a repo yourself, if you didn&rsquo;t set it:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">devvm stop <span class="c1"># in this VM&#39;s folder, and in the other VM&#39;s when another VM locks the file too</span>
|
||
</span></span><span class="line"><span class="cl">devvm git-protect off
|
||
</span></span><span class="line"><span class="cl">git config --file .git/config --unset-all diff.ignoreSubmodules <span class="s1">&#39;^all$&#39;</span> <span class="c1"># in that repo</span>
|
||
</span></span><span class="line"><span class="cl">devvm git-protect on <span class="c1"># lock .git again as it is then</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>Stop both VMs when another VM keeps the file locked too, because a running VM could change the file while it&rsquo;s unlocked, and a launch into a running VM locks nothing. In that case, run <code>chflags nouchg .git/config</code> on macOS in place of <code>devvm git-protect off</code>, and the next launch of either VM finds it stopped and locks the file again, and on Linux the other VM&rsquo;s watch names the change.</p>
|
||
<h2 data-hextra-search-id="when-devvm-reports-git">When devvm reports .git<span class="hx:absolute hx:-mt-20" id="when-devvm-reports-git"></span>
|
||
<a href="#when-devvm-reports-git" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>Every launch of an existing VM, and <code>devvm stop</code>, check <code>.git</code> again, and devvm reports what it finds there that it didn&rsquo;t lock. When it names one of these, check it before you run git in the folder, because git on this machine would run what the VM put there:</p>
|
||
<ul>
|
||
<li><strong>A repo that appeared</strong> in the folder after its VM was made, the folder&rsquo;s own or a <a href="#nested-repos">nested one</a>. devvm locks it from then on, but if you didn&rsquo;t make it, check its hooks and config.</li>
|
||
<li><strong>A submodule that appeared</strong> with its git folder in the project folder. devvm locks it from then on, but git on this machine may already have run what its config and hooks say (<a href="#not-covered">not covered</a>), so if you didn&rsquo;t add it, check them.</li>
|
||
<li><strong>A nested repo that&rsquo;s gone or moved,</strong> which the VM could have moved aside to put another in its place.</li>
|
||
<li><strong>Hooks in a folder devvm hadn&rsquo;t locked,</strong> because the folder wasn&rsquo;t there to lock or belongs to a new submodule.</li>
|
||
<li><strong>A submodule whose git folder isn&rsquo;t one.</strong> The VM can name any folder in the project as a submodule&rsquo;s git folder, such as your <code>src</code>, so devvm locks nothing in a folder that doesn&rsquo;t look like a git folder, and names the submodule instead.</li>
|
||
<li><strong>A path that&rsquo;s a symlink or under one.</strong> devvm never locks anything through a symlink, because the VM could point one at a file elsewhere on this machine, so it leaves that path unlocked.</li>
|
||
<li><strong>A path that moved while devvm locked it.</strong> devvm leaves it unlocked and takes the lock off wherever it landed, so check <code>.git</code>.</li>
|
||
</ul>
|
||
<p><a href="https://next.devvm.dev/docs/internals/git-protection/#on-each-launch">How it works › .git protection</a> lists every check.</p>
|
||
<h2 data-hextra-search-id="nested-repos">Nested repos<span class="hx:absolute hx:-mt-20" id="nested-repos"></span>
|
||
<a href="#nested-repos" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>A folder can hold git repos of its own besides its submodules, such as <code>ws/repo-a</code> and <code>ws/repo-b</code> in a folder <code>ws</code>, whether <code>ws</code> is a repo itself or only a folder of repos. The VM can write all of them, and git on this machine runs what their <code>.git</code> holds when you run git there, so devvm protects each one it finds as it protects the folder&rsquo;s own <code>.git</code>: it locks them on macOS, makes them read-only in the VM on Linux, and watches them on a Linux host that can&rsquo;t lock. It finds them this way:</p>
|
||
<ul>
|
||
<li><strong>When:</strong> when it creates the VM, at each launch that finds the VM stopped and at <code>devvm stop</code>. A launch into a running VM doesn&rsquo;t look again, and it doesn&rsquo;t check the nested repos either, so they&rsquo;re checked at the next launch that finds the VM stopped, or at <code>devvm stop</code>.</li>
|
||
<li><strong>Where:</strong> up to four folders below the project folder, for anything named <code>.git</code> (on macOS, <code>.GIT</code> as well). It doesn&rsquo;t look in the folders that package managers and build tools fill, <code>node_modules</code>, <code>vendor</code>, <code>.venv</code>, <code>__pycache__</code> and <code>.terraform</code>, nor in a folder on another disk.</li>
|
||
<li><strong>How many:</strong> it protects the first 100 it finds and names the rest, at every check.</li>
|
||
</ul>
|
||
<p>What <a href="#what-still-works">still works</a> and what doesn&rsquo;t is the same in a nested repo as in the folder&rsquo;s own: <code>git config</code>, <code>git remote add</code> and hook installers fail there on macOS, so run them with protection off. devvm keeps protecting a nested repo for as long as anything is at its <code>.git</code>, even when that <code>.git</code> no longer looks like a repo&rsquo;s, because the VM can change it back at any time.</p>
|
||
<p>When you don&rsquo;t need the VM to write your working trees, <code>devvm --clone</code> in a folder of repos keeps the VM out of all of them instead:</p>
|
||
<div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code">
|
||
<div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl"><span class="nb">cd</span> ws <span class="o">&amp;&amp;</span> devvm --clone <span class="c1"># a VM with its own clone of each repo you choose, mounting none of them</span>
|
||
</span></span><span class="line"><span class="cl">devvm clone fetch <span class="c1"># bring the VM&#39;s work back</span></span></span></code></pre></div></div><div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0">
|
||
<button
|
||
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
|
||
title="Copy code"
|
||
aria-label="Copy code"
|
||
data-copied-label="Copied!"
|
||
>
|
||
<div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
<div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"></div>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<p>The VM gets a clone of each repo you choose, at the same path, and mounts nothing of this machine, so it can&rsquo;t reach any repo&rsquo;s working tree or <code>.git</code> here, and none of what this page describes applies to it (<a href="https://next.devvm.dev/docs/using/clone/#folders-of-repos">folders of repos</a>). You get its work back with <code>devvm clone fetch</code>.</p>
|
||
<p>devvm can&rsquo;t protect a repo before it has found it, so when you run git in a folder of a VM&rsquo;s project while the VM runs, the protection holds only for the repos devvm has already found:</p>
|
||
<ul>
|
||
<li>A repo the VM makes in the folder while it runs, by cloning one or by making a <code>.git</code> in a folder of yours, is git&rsquo;s repo for that folder from the moment it&rsquo;s there: your <code>git status</code> in the folder, and the shell prompts and editors that run git as you open it, run what its config says.</li>
|
||
<li>devvm names such a repo only at the next launch that finds the VM stopped, or at <code>devvm stop</code>, with the settings in its config and the hooks that run programs, and then locks it as it is, so check what it names before you run git there.</li>
|
||
<li>A repo the VM makes more than four folders down, or in a folder devvm doesn&rsquo;t look in, is never named, only counted where devvm walks the folder for set-id files on Linux.</li>
|
||
<li>On Linux the VM can also move a nested repo&rsquo;s folder aside and put another repo in its place while it runs, which devvm names only if it&rsquo;s still in place when the VM stops (<a href="#linux-hosts">Linux hosts</a>).</li>
|
||
</ul>
|
||
<h3 data-hextra-search-id="bare-repos">Bare repos<span class="hx:absolute hx:-mt-20" id="bare-repos"></span>
|
||
<a href="#bare-repos" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>git also takes a folder shaped like a git folder, with a <code>HEAD</code>, <code>objects</code> and <code>refs</code>, for a bare repo, and its config can name a work tree, so git run in a folder below one uses it, <code>core.fsmonitor</code> and all. The VM can make one anywhere in the folder. devvm names the ones it finds up to four folders down that aren&rsquo;t a repo&rsquo;s own git folder, and <code>devvm doctor</code> gives a tip when git on this machine takes a bare repo it isn&rsquo;t told to use. git 2.38 and newer can refuse that: <code>git config --global safe.bareRepository explicit</code> makes git use a bare repo only when you name it, with <code>--git-dir</code> or <code>GIT_DIR</code>. devvm only checks the setting, and never changes your git config.</p>
|
||
<h3 data-hextra-search-id="vms-an-earlier-devvm-made">VMs an earlier devvm made<span class="hx:absolute hx:-mt-20" id="vms-an-earlier-devvm-made"></span>
|
||
<a href="#vms-an-earlier-devvm-made" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>A VM that an earlier devvm made protects only the folder&rsquo;s own repo. The first time devvm finds nested repos in its folder, it names them once and tells you to run <code>devvm git-protect on</code>, which protects them all from then on. Until you do, devvm names each nested repo it finds that it hadn&rsquo;t named before.</p>
|
||
<h3 data-hextra-search-id="two-vms-one-repo">Two VMs, one repo<span class="hx:absolute hx:-mt-20" id="two-vms-one-repo"></span>
|
||
<a href="#two-vms-one-repo" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>A nested repo can have a VM of its own, and then two VMs protect it. On macOS, the flag that locks it is the same for both, so <code>devvm rm</code> or <code>devvm git-protect off</code> for one VM leaves locked what the other VM still protects, and names that VM. Run <code>devvm git-protect off</code> for the other VM too when you want the locks off. When devvm can&rsquo;t read another VM&rsquo;s state, it leaves locked what that VM may protect, and names the state to fix. On Linux, each VM has its own read-only view, so each protects the repo from its own VM.</p>
|
||
<p>A nested repo devvm stopped protecting, because it&rsquo;s gone or moved, keeps its locks until devvm takes them off with the rest, at <code>devvm rm</code> or <code>devvm git-protect off</code>. When it&rsquo;s no longer in the folder, devvm can&rsquo;t find it to unlock it, so it names it, and <code>chflags -R nouchg</code> on its <code>.git/hooks</code> and <code>.git/config</code> takes the locks off.</p>
|
||
<h2 data-hextra-search-id="not-covered">Not covered<span class="hx:absolute hx:-mt-20" id="not-covered"></span>
|
||
<a href="#not-covered" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>The lock covers <code>.git</code>, and the VM can still put things elsewhere that git on this machine runs. devvm tells you about each of these, so read what it reports before you run git in the folder, and use <a href="https://next.devvm.dev/docs/using/clone/"><code>--clone</code></a> for a repo you don&rsquo;t trust.</p>
|
||
<ul>
|
||
<li><strong>Hooks in the working tree</strong>, such as husky&rsquo;s <code>.husky/</code> with <code>core.hooksPath=.husky</code>, or an absolute path into the project folder. The VM can edit them, and they run on this machine. devvm warns about them when it creates the VM.</li>
|
||
<li><strong>What the locked files hand over to the project folder</strong>, which is an <code>include.path</code> or <code>includeIf.*.path</code> that leads into it, or a hook that&rsquo;s a symlink into it. The VM can edit those files, and git on this machine reads or runs them. devvm warns about them when it creates the VM, and on a launch after they change.</li>
|
||
<li><strong>Submodules whose git folder is outside the project.</strong> devvm can&rsquo;t lock that folder, because another project&rsquo;s VM may write it, and <code>git status</code> on this machine reads its config. devvm names these submodules when it creates the VM.</li>
|
||
<li><strong>A submodule the VM adds.</strong> The VM writes <code>.git/index</code>, because it has to in order to commit, so it can add a submodule with a git folder of its own anywhere in the project folder. Whenever git on this machine enters that submodule, it reads the submodule&rsquo;s config and runs its hooks, so its <code>core.fsmonitor</code> runs on this machine. <code>git status</code>, <code>git diff</code>, <code>git add -A</code> and <code>git describe --dirty</code> all enter it, and so do the shell prompts and editors that run them. devvm names the submodule and locks its git folder only at <code>devvm stop</code> or at the next launch that finds the VM stopped (<a href="#when-devvm-reports-git">when devvm reports .git</a>).</li>
|
||
<li><strong>A replaced <code>.git</code>.</strong> The VM can rename <code>.git</code> and put a new one in its place, or point git at another config. devvm reports this on each launch but doesn&rsquo;t undo it (<a href="https://next.devvm.dev/docs/internals/git-protection/#what-a-lock-cant-stop">what a lock can&rsquo;t stop</a>).</li>
|
||
<li><strong>Some of the git repos nested in the folder.</strong> devvm protects each repo it finds below the project folder (<a href="#nested-repos">nested repos</a>), but not one more than four folders down, one in a folder that a package manager fills, such as <code>node_modules</code>, one on another disk, or one past the first 100. It doesn&rsquo;t lock the git folder that a nested repo&rsquo;s <code>.git</code> file names unless that&rsquo;s another repo&rsquo;s that devvm locks, and a git folder outside the project folder it can&rsquo;t lock at all. The VM can set <code>core.fsmonitor</code> in such a repo&rsquo;s config, and your next <code>git status</code> there runs it. devvm names the ones it finds and doesn&rsquo;t protect, and counts those on other disks, so check them before you run git there, or move them out of the folder.</li>
|
||
<li><strong>A repo the VM makes while it runs</strong>, and a <a href="#bare-repos">bare repo</a> it makes. git on this machine uses either as soon as it&rsquo;s there, and devvm finds it only once the VM stops (<a href="#nested-repos">nested repos</a>).</li>
|
||
</ul>
|
||
<h2 data-hextra-search-id="linux-hosts">Linux hosts<span class="hx:absolute hx:-mt-20" id="linux-hosts"></span>
|
||
<a href="#linux-hosts" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>On Linux, devvm runs each VM&rsquo;s QEMU in a user namespace of its own, without root, and there it makes the paths that macOS&rsquo;s flag would lock read-only: the hooks and config of <code>.git</code> and of its submodules, and the rest of <a href="https://next.devvm.dev/docs/internals/git-protection/#whats-locked">what&rsquo;s locked</a>. The VM reaches the project folder only through QEMU, so root in the VM gets <code>Read-only file system</code> when it writes one of them, and <code>Device or resource busy</code> when it renames or removes one, or renames <code>.git</code> itself.</p>
|
||
<ul>
|
||
<li>A <a href="#nested-repos">nested repo</a>&rsquo;s own folder isn&rsquo;t pinned, so the VM can still rename the folder, <code>.git</code> and all, and put another repo in its place, which devvm reports at the next check as a replaced <code>.git</code>.</li>
|
||
<li>Nothing changes on this machine: your own git commands write <code>.git/config</code> as usual, and the read-only view ends when the VM stops.</li>
|
||
<li><code>devvm git-protect</code> works as it does on macOS, and a change to a running VM&rsquo;s protection applies at its next start.</li>
|
||
</ul>
|
||
<div class="devvm-callout devvm-callout-warning">
|
||
<p class="devvm-callout-title"><svg class="devvm-icon" aria-hidden="true" focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12" fill="currentColor" shape-rendering="crispEdges"><path d="M5 1h1v1H5ZM4 2h1v1H4ZM6 2h1v1H6ZM4 3h1v1H4ZM6 3h1v1H6ZM3 4h1v1H3ZM7 4h1v1H7ZM3 5h1v1H3ZM5 5h1v1H5ZM7 5h1v1H7ZM2 6h1v1H2ZM5 6h1v1H5ZM8 6h1v1H8ZM2 7h1v1H2ZM5 7h1v1H5ZM8 7h1v1H8ZM1 8h1v1H1ZM9 8h1v1H9ZM1 9h1v1H1ZM5 9h1v1H5ZM9 9h1v1H9ZM0 10h1v1H0ZM10 10h1v1H10ZM0 11h11v1H0Z"/></svg> Warning</p><p>Start VMs with devvm. A VM that <code>limactl start</code> starts runs without the read-only view, and so does one whose view went for another reason, so each launch of a running VM, and <code>devvm stop</code>, check that the VM still can&rsquo;t rename <code>.git</code> and still sees its hooks and config read-only, and name what it doesn&rsquo;t: run <code>devvm restart</code> then. If devvm&rsquo;s own process that runs the VM ends, the VM ends with it at once, as if you pulled its power, so it never runs without the view.</p></div><p>Because a lock in the VM&rsquo;s view covers one name of a file, devvm also <a href="#when-devvm-names-a-change">watches</a> <code>.git</code> as a Linux host without locks does, and names what changed at each launch that finds the VM stopped and at <code>devvm stop</code>. That includes your own changes, such as a <code>git remote add</code> or <code>git push -u</code>.</p>
|
||
<h3 data-hextra-search-id="when-git-on-this-machine-replaces-a-locked-file">When git on this machine replaces a locked file<span class="hx:absolute hx:-mt-20" id="when-git-on-this-machine-replaces-a-locked-file"></span>
|
||
<a href="#when-git-on-this-machine-replaces-a-locked-file" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>The VM sees your changes, because its view is the same folder. A git command on this machine that writes <code>.git/config</code>, such as <code>git config</code>, <code>git remote add</code> or <code>git push -u</code>, writes a new file and renames it over the old one, and the new file isn&rsquo;t read-only in the VM until devvm locks it again. devvm watches the folders of what it locks, so it locks the new file within milliseconds, but until then the VM can change it, replace it with a file of its own, which devvm then locks as yours, or open it to write it later, which the lock doesn&rsquo;t stop. A VM running code that watches for that moment can use it, so this is a real gap whenever you change a locked file on this machine while the VM runs.</p>
|
||
<p>devvm doesn&rsquo;t stop it, but it names it:</p>
|
||
<ul>
|
||
<li>At <code>devvm stop</code>, or at the next launch when the VM stopped another way, devvm names each file it locked again, once however often it happened, and the watch names each one whose contents changed.</li>
|
||
<li>If devvm couldn&rsquo;t record whether its locks held while the VM ran, it says so then, and you should check <code>.git</code>&rsquo;s hooks and config yourself.</li>
|
||
</ul>
|
||
<p>Check what it names before you run git in the folder, or stop the VM before you change its <code>.git</code> on this machine.</p>
|
||
<h3 data-hextra-search-id="hard-links">Hard links<span class="hx:absolute hx:-mt-20" id="hard-links"></span>
|
||
<a href="#hard-links" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>A lock in the VM&rsquo;s view covers one name of a file, and macOS&rsquo;s flag covers the file itself, whatever its names. So devvm doesn&rsquo;t start a VM whose <code>.git/config</code>, or a hook in a locked hooks folder, has another name (a hard link), because the VM could change the file through that other name. Make it a file of its own, by copying it and moving the copy over it, and start the VM again. A file that gets another name while the VM runs isn&rsquo;t locked again, and devvm names it when the VM stops.</p>
|
||
<h3 data-hextra-search-id="what-else-differs-in-the-vm">What else differs in the VM<span class="hx:absolute hx:-mt-20" id="what-else-differs-in-the-vm"></span>
|
||
<a href="#what-else-differs-in-the-vm" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>Two more things work differently in the VM. The VM sees <code>.git</code> as a file system of its own, so renaming a file between the working tree and <code>.git</code> fails with <code>Invalid cross-device link</code>, which <code>mv</code> handles by copying the file, and git never does. And the VM can&rsquo;t remove or rename a submodule&rsquo;s git folder, so <code>git submodule absorbgitdirs</code>, or <code>rm -rf</code> on a submodule, fails while the VM runs.</p>
|
||
<p>A VM that a devvm without these locks made on this machine stays off, and each launch says that devvm can lock it now: run <code>devvm git-protect on</code> to lock it, or <code>devvm git-protect off</code> to keep it off and stop the warning.</p>
|
||
<h3 data-hextra-search-id="when-linux-cant-lock">When Linux can&rsquo;t lock<span class="hx:absolute hx:-mt-20" id="when-linux-cant-lock"></span>
|
||
<a href="#when-linux-cant-lock" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>The locks need a kernel that lets a program make a user namespace and mount in it, which Debian, Fedora, RHEL, openSUSE and Arch do by default. Where the kernel doesn&rsquo;t, devvm doesn&rsquo;t lock <code>.git</code>, and it <a href="#when-devvm-names-a-change">watches</a> it instead. <code>devvm doctor</code> says why, and what lets devvm lock:</p>
|
||
<ul>
|
||
<li><strong>AppArmor</strong>, on Ubuntu 23.10 and newer, lets only programs that a profile names use a user namespace (<a href="#ubuntu">Ubuntu</a>).</li>
|
||
<li><strong><code>kernel.unprivileged_userns_clone</code> is 0</strong>, as on Arch&rsquo;s <code>linux-hardened</code> kernel. <code>sudo sysctl kernel.unprivileged_userns_clone=1</code> lets devvm lock, until the next boot unless you set it in <code>/etc/sysctl.d/</code>.</li>
|
||
<li><strong><code>user.max_user_namespaces</code> is 0</strong>, which <code>sudo sysctl user.max_user_namespaces=15000</code> changes.</li>
|
||
</ul>
|
||
<p>Without the locks, VMs get <code>off</code> as their mode, devvm refuses <code>devvm git-protect on</code>, and <a href="https://next.devvm.dev/docs/using/clone/"><code>--clone</code></a> keeps the VM out of <code>.git</code> instead, so use it for any repo where you don&rsquo;t trust what runs in the VM. A VM that&rsquo;s on, made when the kernel let devvm lock, doesn&rsquo;t start until it can again, or until you run <code>devvm git-protect off</code>.</p>
|
||
<h3 data-hextra-search-id="ubuntu">Ubuntu<span class="hx:absolute hx:-mt-20" id="ubuntu"></span>
|
||
<a href="#ubuntu" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>Ubuntu 23.10 and newer set <code>kernel.apparmor_restrict_unprivileged_userns</code> to 1, so a program gets a user namespace with the rights to mount in it only when an AppArmor profile names the program with the <code>userns</code> rule. Ubuntu does that to keep programs that don&rsquo;t need one out of the kernel code behind it. devvm&rsquo;s binary lives in a folder you can write, such as <code>~/.local/lib/devvm/</code>, and a profile for that path would let any program running as you put itself there and get the same rights, which undoes what Ubuntu set the restriction for. So devvm doesn&rsquo;t ask for a profile, and on Ubuntu with the restriction on it doesn&rsquo;t lock <code>.git</code>: it <a href="#when-devvm-names-a-change">watches</a> it, and <code>devvm doctor</code> and each launch say so. Use <a href="https://next.devvm.dev/docs/using/clone/"><code>--clone</code></a> there for any repo where you don&rsquo;t trust what runs in the VM.</p>
|
||
<h3 data-hextra-search-id="the-warning-at-each-launch">The warning at each launch<span class="hx:absolute hx:-mt-20" id="the-warning-at-each-launch"></span>
|
||
<a href="#the-warning-at-each-launch" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>On a Linux host that can&rsquo;t lock, each launch of a VM that mounts a folder with a <code>.git</code>, or with <a href="#nested-repos">nested repos</a>, warns that the VM can change their hooks and config, which run on this machine, and names the nested repos devvm doesn&rsquo;t watch. That includes the launch that creates the VM, and launches of a VM that&rsquo;s already running. Once you&rsquo;ve read the warning and decided to go on without protection, run <code>devvm git-protect off</code> in the folder. devvm records that you chose it and stops warning for that VM, but it still names the changes that the next section describes. A VM that you create with <code>--no-git-protect</code> doesn&rsquo;t warn either, and a <code>--clone</code> VM never warns, because it mounts no <code>.git</code>.</p>
|
||
<h3 data-hextra-search-id="when-devvm-names-a-change">When devvm names a change<span class="hx:absolute hx:-mt-20" id="when-devvm-names-a-change"></span>
|
||
<a href="#when-devvm-names-a-change" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>On a Linux host that can&rsquo;t lock, devvm can&rsquo;t stop the VM from changing <code>.git</code>, and on one that locks, the VM can change a file that git on this machine <a href="#when-git-on-this-machine-replaces-a-locked-file">replaced</a>, but devvm notices the change afterwards on both. When devvm creates a VM, it records a hash of each of these:</p>
|
||
<ul>
|
||
<li>each path that a lock would cover on macOS, which are the hooks in <code>.git/hooks</code>, <code>.git/config</code> and the rest of <a href="https://next.devvm.dev/docs/internals/git-protection/#whats-locked">what&rsquo;s locked</a>, submodules&rsquo; and <a href="#nested-repos">nested repos&rsquo;</a> included</li>
|
||
<li><code>.git/commondir</code>, whether it&rsquo;s there or not</li>
|
||
<li>what the config hands over to the project folder: the files that an <code>include.path</code> leads to, and the hooks folder that <code>core.hooksPath</code> names, such as husky&rsquo;s <code>.husky</code></li>
|
||
</ul>
|
||
<p>Each launch that finds the VM stopped, and <code>devvm stop</code>, hash them again and name every path that changed since the last check, such as <code>.git/config</code> and <code>.git/hooks/pre-commit</code>. A warning names ten paths at most, and then how many more changed. The same checks report what a lock can&rsquo;t stop either, as they do on macOS: a <code>.git</code> that was replaced, a <code>commondir</code>, a repo or submodule that appeared, and includes, hook links and a <code>core.hooksPath</code> into the project folder (<a href="#not-covered">not covered</a>). A launch of a VM that&rsquo;s already running checks nothing, so run <code>devvm stop</code> when you want the check. A VM that devvm has no hashes for yet, such as one that an older devvm made, records them at its first check and names nothing.</p>
|
||
<p>devvm names a change only after it happened, so git on this machine may already have run a changed hook or read a changed config. devvm can&rsquo;t tell who made a change, so it also names your own, such as a <code>git remote add</code> or <code>git push -u</code> that you ran on this machine. When it names a path that you didn&rsquo;t change, check it before you run git in the folder:</p>
|
||
<ul>
|
||
<li><code>git config --list --show-origin</code> shows each setting of the repo and the file it comes from. Look for settings that run a program, such as <code>core.fsmonitor</code>, <code>core.hooksPath</code>, <code>core.sshCommand</code>, <code>core.pager</code>, <code>filter.*</code> and <code>include.path</code>.</li>
|
||
<li><code>ls -la .git/hooks</code> lists the hooks, and git runs a hook there by its name, such as <code>pre-commit</code>, so read every file whose name doesn&rsquo;t end in <code>.sample</code>.</li>
|
||
</ul>
|
||
<p>If you find something that you didn&rsquo;t put there, remove it, and use <a href="https://next.devvm.dev/docs/using/clone/"><code>--clone</code></a> for that repo.</p>
|
||
<h3 data-hextra-search-id="what-the-watch-cant-see">What the watch can&rsquo;t see<span class="hx:absolute hx:-mt-20" id="what-the-watch-cant-see"></span>
|
||
<a href="#what-the-watch-cant-see" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>The watch isn&rsquo;t a security boundary, and it doesn&rsquo;t stop anything. It compares what&rsquo;s in <code>.git</code> when the VM is stopped with what was there at the last check, so it misses a change that the VM made and then undid before it stopped, even though git on this machine may have run the change in between. It also can&rsquo;t fully watch some paths, and it names them at every check until they&rsquo;re gone:</p>
|
||
<ul>
|
||
<li><strong>A symlink, or a path under one,</strong> such as a hook that&rsquo;s a symlink, or a <code>.git</code> that&rsquo;s a symlink. devvm never follows a symlink out of the project folder, so it can&rsquo;t see changes to what such a link points to. For a link that stays inside the project folder, it hashes what the link leads to as well.</li>
|
||
<li><strong>A file larger than 16 MiB,</strong> which devvm records by its size, inode and change time, so it notices a change that keeps the size but can&rsquo;t hash the file.</li>
|
||
<li><strong>A hooks folder with more than 1,000 entries,</strong> which devvm records by its count and change time. It always hashes the hooks that git runs, at the folder&rsquo;s top, before the rest. The VM can fill a hooks folder to blind the watch, the folder&rsquo;s own or a nested repo&rsquo;s, so devvm names such a folder at every check.</li>
|
||
<li><strong>What&rsquo;s past 2,000 paths in all,</strong> across every git folder and hooks folder of the folder&rsquo;s own repo, or past 200 paths of each <a href="#nested-repos">nested repo</a>.</li>
|
||
</ul>
|
||
<p>A repo rarely has any of these, so when devvm names one that you didn&rsquo;t make, check what it holds, and use <a href="https://next.devvm.dev/docs/using/clone/"><code>--clone</code></a> for that repo.</p></description></item><item><title>Attack vectors</title><link>https://next.devvm.dev/docs/safety/attack-vectors/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://next.devvm.dev/docs/safety/attack-vectors/</guid><description>
|
||
<p>This page lists the common ways that code you didn&rsquo;t write gets to run on a developer&rsquo;s machine or gets data off it, and what devvm does about each one. devvm stops most of them on its own, and the <a href="https://next.devvm.dev/docs/safety/#the-habits">habits</a> close most of what&rsquo;s left. <a href="#narrowed-not-closed">Narrowed, not closed</a> and <a href="#left-to-you">Left to you</a> are the one list of what devvm leaves open, and each entry links to the page that explains its mechanism.</p>
|
||
<h2 data-hextra-search-id="how-devvm-handles-each-attack">How devvm handles each attack<span class="hx:absolute hx:-mt-20" id="how-devvm-handles-each-attack"></span>
|
||
<a href="#how-devvm-handles-each-attack" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>The rest of this page sorts the attacks by how much of each one devvm stops:</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th></th>
|
||
<th></th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td><a href="#blocked">Blocked</a></td>
|
||
<td>The attack can&rsquo;t work, because what it&rsquo;s after isn&rsquo;t in the VM or the VM can&rsquo;t reach it.</td>
|
||
</tr>
|
||
<tr>
|
||
<td><a href="#kept-inside-the-vm">Kept inside the VM</a></td>
|
||
<td>The attacker&rsquo;s code runs, but it runs in the VM, where it reaches only the project folder and what you gave the VM.</td>
|
||
</tr>
|
||
<tr>
|
||
<td><a href="#narrowed-not-closed">Narrowed, not closed</a></td>
|
||
<td>devvm closes part of the attack, and the entry says what&rsquo;s still open.</td>
|
||
</tr>
|
||
<tr>
|
||
<td><a href="#left-to-you">Left to you</a></td>
|
||
<td>devvm doesn&rsquo;t stop the attack, and the entry says what to do instead.</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<p>Some protections hold only on some <a href="https://next.devvm.dev/docs/safety/network/#network-tiers">network tiers</a> or only on macOS, and each entry names its conditions. Everything here rests on the VM&rsquo;s boundary. How devvm does each of these is in the <a href="https://next.devvm.dev/docs/internals/security/">security model</a>.</p>
|
||
<h2 data-hextra-search-id="blocked">Blocked<span class="hx:absolute hx:-mt-20" id="blocked"></span>
|
||
<a href="#blocked" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><h3 data-hextra-search-id="credentials-on-this-machine">Credentials on this machine<span class="hx:absolute hx:-mt-20" id="credentials-on-this-machine"></span>
|
||
<a href="#credentials-on-this-machine" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><ul>
|
||
<li><strong>SSH keys.</strong> Malware on a developer&rsquo;s machine looks in <code>~/.ssh</code> first, because a private key opens every server and repo that trusts it. A VM never mounts <code>~/.ssh</code>, and besides the project folder it mounts only the shared tools and the folders of devvm&rsquo;s agent store, read-only, so there&rsquo;s no key in it to copy. <a href="#secrets-and-keys-the-vm-may-use">Agent forwarding</a>, which you turn on yourself, lets the VM use your keys but never copy them.</li>
|
||
<li><strong>Cloud, cluster and registry logins.</strong> Worms that steal credentials collect <code>~/.aws</code>, <code>~/.config/gcloud</code>, <code>~/.azure</code>, <code>~/.kube/config</code>, <code>~/.docker/config.json</code> and the npm publish token in <code>~/.npmrc</code>. A VM mounts none of them, so a package that goes looking finds nothing. Secrets you keep in the project folder are a different case, which <a href="#files-the-vm-writes">Left to you</a> covers.</li>
|
||
<li><strong>The Keychain, browsers and password managers.</strong> Stealers read saved passwords, cookies and login sessions from browser profiles and the Keychain. The VM has no browser profile of yours, and it can&rsquo;t reach this machine&rsquo;s Keychain.</li>
|
||
<li><strong>Your coding agents&rsquo; history.</strong> Agent transcripts hold what you pasted into them, such as secrets and code from other projects. Your history never goes into a VM, and each VM&rsquo;s own history stays in that VM (<a href="https://next.devvm.dev/docs/using/coding-agents/">coding agents</a>).</li>
|
||
<li><strong>Secrets, on every tier.</strong> Every VM, an open one included, gets a placeholder instead of each secret, such as your GitHub token or Claude Code&rsquo;s token, and the proxy on this machine puts the real value only into requests for that secret&rsquo;s own hosts (<a href="https://next.devvm.dev/docs/safety/network/#secrets">secrets</a>). A placeholder copied out of the VM is worthless elsewhere, because it ends in a random value of that VM&rsquo;s own, and an open VM that sends a request around its proxy sends only the placeholder.
|
||
<ul>
|
||
<li>Another VM, or another user&rsquo;s program on this machine, can&rsquo;t spend the secret through the proxy either, because the proxy needs the VM&rsquo;s own password, which only you can read. A program that runs as you can read it, though, as it can read the rest of your files.</li>
|
||
<li>Codex and opencode logins and the MCP secrets that Claude Code gets from this machine work the same way, and devvm refreshes those OAuth logins on this machine, so a VM never holds their refresh tokens.</li>
|
||
<li>A login to an MCP server that you make with <code>/mcp</code> in a VM is that VM&rsquo;s own. Claude Code keeps its real tokens in the VM, where code in the VM can read them, and they never leave it (<a href="https://next.devvm.dev/docs/using/coding-agents/#mcp-servers-logins">MCP servers&rsquo; logins</a>).</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
<h3 data-hextra-search-id="git-running-code-on-this-machine">Git running code on this machine<span class="hx:absolute hx:-mt-20" id="git-running-code-on-this-machine"></span>
|
||
<a href="#git-running-code-on-this-machine" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><ul>
|
||
<li><strong>Git hooks and config.</strong> A VM can write the project folder, so without protection it could add a hook such as <code>.git/hooks/post-checkout</code>, or set a command in <code>.git/config</code>: <code>core.fsmonitor</code>, <code>core.hooksPath</code>, <code>core.sshCommand</code>, <code>core.pager</code>, <code>core.editor</code>, a <code>filter.*</code> or <code>diff.*.textconv</code> driver, a <code>credential.helper</code> or a <code>!</code> alias. Your next git command on this machine would run it. On macOS, devvm locks hooks and config with a flag that even root in the VM can&rsquo;t clear, and on Linux it makes them read-only in the VM&rsquo;s view of the folder (<a href="https://next.devvm.dev/docs/safety/git-protection/">.git protection</a>). A Linux host whose kernel doesn&rsquo;t let devvm do that, which <a href="#the-platform">Left to you</a> covers, has neither.</li>
|
||
<li><strong>devvm&rsquo;s own git commands.</strong> devvm runs git on this machine itself, for example to read your name and email for the VM, to check a <code>--clone</code> VM&rsquo;s repo for uncommitted changes, and to fetch from the VM. A VM can write a repo that git on this machine reads, such as the project folder&rsquo;s on Linux or a repo inside a folder it mounts, so devvm&rsquo;s git runs none of the programs a repo&rsquo;s config can name:
|
||
<ul>
|
||
<li>It turns off the repo&rsquo;s fsmonitor, its hooks, including those its config defines, and its filters, it never enters a submodule for <code>git status</code>, and it uses no transport but ssh, so <code>git status</code> or a fetch of devvm&rsquo;s runs nothing that the VM wrote into the repo.</li>
|
||
<li>It runs no program a repo&rsquo;s config names to check signatures, and it sees a repo&rsquo;s real history, whatever replace refs or a grafts file say.</li>
|
||
<li>It ignores the git variables of the shell you run devvm in, such as <code>GIT_DIR</code> and <code>GIT_CONFIG_GLOBAL</code>, so it never works on another repo or config by mistake, and it never asks you anything (<code>GIT_TERMINAL_PROMPT=0</code>).</li>
|
||
<li>Its fetches reach the VM with ssh in batch mode (<code>-o BatchMode=yes</code>), so the VM&rsquo;s ssh server can&rsquo;t ask you for a password. They always connect to that VM itself, whatever host the repo&rsquo;s config sends them to, accept only the host key devvm pinned for it, and forward neither your agent nor any port.</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
<h3 data-hextra-search-id="getting-out-over-the-network-on-the-allowlist-and-none-tiers">Getting out over the network, on the allowlist and none tiers<span class="hx:absolute hx:-mt-20" id="getting-out-over-the-network-on-the-allowlist-and-none-tiers"></span>
|
||
<a href="#getting-out-over-the-network-on-the-allowlist-and-none-tiers" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><ul>
|
||
<li><strong>Sending data to the attacker&rsquo;s server.</strong> Most attacks end by sending what they stole to a server the attacker runs. A confined VM reaches only its proxy, and on the allowlist tier the proxy allows only the hosts on the VM&rsquo;s allowlist, and on the none tier only its agents&rsquo; and secrets&rsquo; hosts. On the internet tier, which a VM is on while it <a href="https://next.devvm.dev/docs/safety/network/#learning-the-hosts-a-vm-needs">learns the hosts it needs</a>, the proxy allows every public host, the attacker&rsquo;s included, so this holds only for this machine and your networks. devvm leaves storage and paste sites out of the default allowlist on purpose, because they&rsquo;re easy ways to send data out (<a href="https://next.devvm.dev/docs/safety/network/#allowlists">allowlists</a>).</li>
|
||
<li><strong>DNS tunnelling.</strong> An attacker can encode data into names and look them up at a DNS server of their own. A VM sends no DNS queries out of it, because names resolve in the proxy on this machine. The names that tools look up in the VM are answered in the VM, by <a href="https://next.devvm.dev/docs/safety/network/#tools-that-ignore-the-proxy">transparent mode</a>&rsquo;s dnsmasq, which has no server to ask, and the proxy resolves a name only once the VM&rsquo;s rules allow it.</li>
|
||
<li><strong>Services on this machine and your network.</strong> Code in a VM could attack what developers leave open on <code>localhost</code>, such as databases, dev servers, Docker&rsquo;s API and other VMs&rsquo; ports. It could also attack your router, a NAS, or a cloud provider&rsquo;s metadata service at <code>169.254.169.254</code>. The proxy refuses this machine&rsquo;s own addresses and internal ones, such as loopback, private, link-local and CGNAT ranges, unless a rule names the address (<a href="https://next.devvm.dev/docs/internals/network/#the-proxy">the proxy</a>).</li>
|
||
<li><strong>DNS rebinding and address tricks.</strong> A name can resolve to a public address when it&rsquo;s checked and to an internal one when it&rsquo;s dialed, and an internal address can hide in an IPv6, NAT64 or 6to4 form. The proxy dials only the address it checked, and it sees through NAT64 and 6to4 forms (<a href="https://next.devvm.dev/docs/internals/network/#the-proxy">the proxy</a>).</li>
|
||
<li><strong>Going around the proxy.</strong> Root in a VM can change its routes and firewall, but devvm confines the VM from outside it, so nothing in the VM reaches anything but the proxy (<a href="https://next.devvm.dev/docs/internals/lima/#confinement">confinement</a>). devvm catches a VM started outside devvm, or one given a second network, with <a href="https://next.devvm.dev/docs/internals/network/#the-self-check">the self-check</a>. It stops a VM that gets out through a second network, and it offers to restart one started outside devvm confined, or stops it when there&rsquo;s no terminal to ask in.</li>
|
||
</ul>
|
||
<h3 data-hextra-search-id="spreading-beyond-the-vm">Spreading beyond the VM<span class="hx:absolute hx:-mt-20" id="spreading-beyond-the-vm"></span>
|
||
<a href="#spreading-beyond-the-vm" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><ul>
|
||
<li><strong>Your agents&rsquo; config.</strong> A rogue agent could add a hook to <code>~/.claude/settings.json</code> or a skill to <code>~/.claude/skills</code>, so that it runs the next time you use the agent on this machine. devvm mounts the agents&rsquo; config folders read-only, which this machine enforces, and copies their files in on every launch, so nothing the VM changes goes back (<a href="https://next.devvm.dev/docs/using/coding-agents/#mounts">mounts</a>). Only <code>devvm agent save</code> copies a VM&rsquo;s settings into devvm&rsquo;s agent store, for every VM, and it shows what changed and asks first, so read its diff for hooks, MCP servers and plugins you didn&rsquo;t add (<a href="https://next.devvm.dev/docs/using/coding-agents/#saving-a-vms-settings">saving a VM&rsquo;s settings</a>).</li>
|
||
<li><strong>Other projects and other VMs.</strong> Each project folder gets its own VM with its own disk, and a VM mounts only its own project folder. Each VM&rsquo;s proxy has its own password, so one VM can&rsquo;t use another&rsquo;s secrets. A VM reaches a service in another VM only through a <a href="https://next.devvm.dev/docs/using/links/">link between VMs</a> that you add in its folder, to a port that the other VM&rsquo;s folder publishes. A link joins the two VMs&rsquo; trust, because code in one can often run code in the other through its service, so a VM links only to a VM on its own tier or a stricter one, and nothing in a VM can add a link (<a href="https://next.devvm.dev/docs/safety/network/#links-between-vms">links between VMs</a>).</li>
|
||
<li><strong>Images, layers and devvm itself.</strong> Malware could try to make itself permanent by editing an image, a layer script or devvm&rsquo;s own files. devvm builds images with nothing from this machine mounted, and the shared tools are read-only in every VM. devvm also refuses a project folder that holds its own folders or sits inside them, so a VM can&rsquo;t reach the layer scripts that every build runs or the files devvm runs on this machine (<a href="https://next.devvm.dev/docs/internals/security/#only-the-project-folder">only the project folder</a>).</li>
|
||
<li><strong>A folder made again.</strong> If you delete a repo and clone another at the same path, the new folder never gets the old VM&rsquo;s disk or anything left in it. devvm knows a folder by its inode and birth time as well as its path, which nothing in a VM can give a new folder, so it refuses and offers <code>devvm rm</code> or <code>devvm adopt</code> (<a href="https://next.devvm.dev/docs/using/vms/#a-folder-made-again">a folder made again</a>).</li>
|
||
<li><strong>A devcontainer.json that reaches this machine.</strong> Other tools run a devcontainer&rsquo;s <code>initializeCommand</code> on the host. devvm never runs it, refuses <code>${localEnv:…}</code>, adds no mounts from the file and doesn&rsquo;t follow a link out of the folder (<a href="https://next.devvm.dev/docs/using/devcontainer/#security">devcontainer.json</a>). devvm uses the file&rsquo;s <code>image</code> only when the image&rsquo;s registry gives it to anyone who asks, and it refuses a registry on this machine or its network. Behind a company proxy, devvm looks the image up through the company proxy and checks only the registry&rsquo;s name, so a company proxy that reaches this machine or its network for a name that looks public takes the lookup there (<a href="https://next.devvm.dev/docs/contributing/design/#devcontainerjson">the design note</a>).</li>
|
||
<li><strong>Impersonating a VM.</strong> ssh checks a VM against host keys that devvm reads through the VM&rsquo;s backend instead of over the network, so a program that answers on the VM&rsquo;s port in its place is refused (<a href="https://next.devvm.dev/docs/using/ssh/#ssh-access-by-name">ssh access by name</a>).</li>
|
||
</ul>
|
||
<h2 data-hextra-search-id="kept-inside-the-vm">Kept inside the VM<span class="hx:absolute hx:-mt-20" id="kept-inside-the-vm"></span>
|
||
<a href="#kept-inside-the-vm" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><p>The attacks in this section run the attacker&rsquo;s code, and devvm doesn&rsquo;t stop that code from running. It runs in the VM, as the VM&rsquo;s user, who has passwordless sudo. From there it reaches the project folder, or with <a href="https://next.devvm.dev/docs/using/clone/"><code>--clone</code></a> the VM&rsquo;s own clone of it, and the secrets the VM uses, which are placeholders on every tier. It reaches what the VM&rsquo;s tier allows: the hosts on the allowlist on the allowlist tier, every public host on the internet tier, and the whole network on the open tier. Everything in <a href="#blocked">Blocked</a> still holds. What the code writes into the project folder can still reach you when a program on this machine runs it, which <a href="#files-the-vm-writes">Left to you</a> covers.</p>
|
||
<h3 data-hextra-search-id="install-and-build-scripts">Install and build scripts<span class="hx:absolute hx:-mt-20" id="install-and-build-scripts"></span>
|
||
<a href="#install-and-build-scripts" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><ul>
|
||
<li><strong>npm, yarn, pnpm and bun lifecycle scripts.</strong> A package&rsquo;s <code>preinstall</code>, <code>install</code>, <code>postinstall</code> and <code>prepare</code> scripts run any command when the package is installed, and most npm attacks use them. pnpm&rsquo;s build approvals (<code>pnpm approve-builds</code>) and <code>--ignore-scripts</code> narrow which packages run scripts, and they&rsquo;re still worth using, but a package you approved runs its scripts all the same, even one compromised after you approved it. In a VM, those scripts reach only what this section&rsquo;s introduction lists.</li>
|
||
<li><strong>Python packages.</strong> Installing a source distribution runs its <code>setup.py</code> or its build backend, and a <code>.pth</code> file in <code>site-packages</code> runs code every time Python starts.</li>
|
||
<li><strong>Ruby gems.</strong> A gem with a native extension runs its <code>extconf.rb</code> when it&rsquo;s installed, and Bundler can install gems straight from a git repo.</li>
|
||
<li><strong>Rust build scripts and procedural macros.</strong> <code>build.rs</code> and procedural macros run on <code>cargo build</code> and <code>cargo check</code>, and also when rust-analyzer opens the project, so opening the folder in an editor is enough to run them. With <code>devvm code</code> or <code>devvm cursor</code>, the editor&rsquo;s extensions, rust-analyzer among them, run in the VM (<a href="https://next.devvm.dev/docs/using/ssh/#devvm-host-devvm-code-and-devvm-cursor">devvm host, devvm code and devvm cursor</a>).</li>
|
||
<li><strong>Go modules.</strong> Go has no install scripts, but cgo passes flags to the C compiler, <code>go generate</code> runs commands, a <code>toolchain</code> line in <code>go.mod</code> makes Go download another toolchain, and a module&rsquo;s <code>init</code> functions run in every test and program that imports it.</li>
|
||
<li><strong>Makefiles, task runners and <code>curl | sh</code>.</strong> A <code>Makefile</code>, a <code>justfile</code> or a project&rsquo;s install line from its README runs whatever its author wrote.</li>
|
||
</ul>
|
||
<h3 data-hextra-search-id="bad-packages-and-images">Bad packages and images<span class="hx:absolute hx:-mt-20" id="bad-packages-and-images"></span>
|
||
<a href="#bad-packages-and-images" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><ul>
|
||
<li><strong>Typosquatting, dependency confusion and made-up names.</strong> Attackers publish packages under names one typo away from popular ones, under a company&rsquo;s internal package names with a higher version, and under names that AI coding agents invent and that attackers then register. Their code runs as the scripts above do.</li>
|
||
<li><strong>Compromised maintainers.</strong> A trusted package can turn malicious when its maintainer&rsquo;s account is taken over or a new maintainer joins with bad intent, as event-stream (2018) and xz (2024) did. Updating such a package runs its new code in the VM.</li>
|
||
<li><strong>Malicious images.</strong> An image from <a href="https://next.devvm.dev/docs/using/from/"><code>--from</code></a> or from a devcontainer&rsquo;s <code>image</code> runs its own code as root in the build VM (<a href="https://next.devvm.dev/docs/internals/images/#the-image-is-untrusted">the image is untrusted</a>). devvm uses only images that the registry gives to anyone who asks anonymously, never one that only your Docker or your registry login reaches, and it confines builds (<a href="https://next.devvm.dev/docs/internals/security/#read-only-and-confined-builds">read-only and confined builds</a>). On macOS a build can&rsquo;t reach this machine&rsquo;s loopback, but <a href="#the-platform">Left to you</a> covers what it still reaches.</li>
|
||
<li><strong>A devcontainer.json&rsquo;s commands and features.</strong> A project&rsquo;s <code>postCreateCommand</code> and its other commands run in the VM as the VM&rsquo;s user, as soon as devvm makes the VM. Its image and features decide what&rsquo;s in the VM, and devvm adds its ports to the ones it forwards to this machine&rsquo;s <code>localhost</code>, even beyond a list you narrowed, so the VM is the project&rsquo;s from the start. Its features can only be devvm&rsquo;s own layers, so devvm never fetches or runs a feature&rsquo;s script. <code>devvm --no-devcontainer</code> skips the file for a project you don&rsquo;t trust that far (<a href="https://next.devvm.dev/docs/using/devcontainer/">devcontainer.json</a>).</li>
|
||
</ul>
|
||
<h3 data-hextra-search-id="rogue-agents">Rogue agents<span class="hx:absolute hx:-mt-20" id="rogue-agents"></span>
|
||
<a href="#rogue-agents" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><ul>
|
||
<li><strong>Prompt injection.</strong> Instructions hidden in a README, an issue, a code comment, a web page, a dependency&rsquo;s docs or an MCP tool&rsquo;s output can turn a coding agent against you. devvm can&rsquo;t tell an agent&rsquo;s own work from injected work, so it limits what the agent reaches instead. An attack like this needs private data, untrusted input and a way to send the data out. On the allowlist tier, the only way out is the hosts on the allowlist, which <a href="#the-network">Left to you</a> covers.</li>
|
||
<li><strong>Agents with their checks off.</strong> An agent run with <code>claude --dangerously-skip-permissions</code> or <code>codex --dangerously-bypass-approvals-and-sandbox</code> acts without asking, and a mistaken <code>rm -rf ~</code> or <code>sudo</code> command reaches only the VM. The project folder is still the agent&rsquo;s to change, so commit often, or use <a href="https://next.devvm.dev/docs/using/clone/"><code>--clone</code></a> to keep the agent&rsquo;s work apart until you fetch it.</li>
|
||
<li><strong>Malware that stays.</strong> Anything the attacker leaves in the VM, such as a cron job, a changed shell startup file or a backdoored program, stays in that VM&rsquo;s disk and goes into no other VM&rsquo;s, unless you save an agent&rsquo;s settings that it changed with <code>devvm agent save</code>. What it wrote into the project folder stays there, though, and the folder&rsquo;s next VM gets it, such as a <code>devcontainer.json</code> command that runs as soon as devvm makes the VM, or a hook in the project&rsquo;s agent settings. devvm never deletes a VM on its own, because it may hold unsaved work, so save what you need and run <code>devvm rm</code>, then check the folder for what <a href="#files-the-vm-writes">the VM writes</a>, or use <a href="https://next.devvm.dev/docs/using/clone/"><code>--clone</code></a>, before you make the VM again.</li>
|
||
<li><strong>Mining and resource abuse.</strong> A VM&rsquo;s CPUs, memory and disk are capped by its size, which <code>devvm size</code> shows and changes (<a href="https://next.devvm.dev/docs/using/ports-size/#size">size</a>). The VM&rsquo;s proxy on this machine carries at most 1024 tunnels and 2048 connections of every kind for it at once, and on a Linux host devvm carries at most 256 of its connections to the proxy at once, each a process on this machine, so a VM that opens connections without end can&rsquo;t fill this machine with them (<a href="https://next.devvm.dev/docs/internals/network/#the-proxy">the proxy</a>).</li>
|
||
</ul>
|
||
<h2 data-hextra-search-id="narrowed-not-closed">Narrowed, not closed<span class="hx:absolute hx:-mt-20" id="narrowed-not-closed"></span>
|
||
<a href="#narrowed-not-closed" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><h3 data-hextra-search-id="secrets-and-keys-the-vm-may-use">Secrets and keys the VM may use<span class="hx:absolute hx:-mt-20" id="secrets-and-keys-the-vm-may-use"></span>
|
||
<a href="#secrets-and-keys-the-vm-may-use" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><ul>
|
||
<li><strong>Worms that use your GitHub token.</strong> Shai-Hulud (2025) spread through npm install scripts. It collected npm, GitHub and cloud credentials, then used them to publish repos and new versions of packages. A VM holds no npm or cloud credentials, and its GitHub token is a placeholder. The proxy still puts the real GitHub token into every request to GitHub&rsquo;s hosts, so a worm in the VM can push, make repos and do whatever else the GitHub token&rsquo;s scope allows. Use a fine-grained GitHub token scoped to the repos the VM needs, or bind none (<a href="https://next.devvm.dev/docs/safety/network/#saving-and-binding-secrets">saving and binding secrets</a>).</li>
|
||
<li><strong>A host that sends your secret back.</strong> The proxy puts a secret only into requests for its own hosts, but it passes their replies to the VM as they are. A host that echoes a request&rsquo;s headers, such as a debug endpoint, or an error page that quotes them, shows the VM the real value. This matters most for <a href="https://next.devvm.dev/docs/safety/network/#your-own-secrets">your own secrets</a>, whose hosts you choose, so give each one only hosts that you trust with it. A secret&rsquo;s hosts are on the allowlist of every VM that uses it, on every tier, so on a host where anyone can make an account, code in the VM can also send data to an account of its own there.</li>
|
||
<li><strong>Minting credentials with a secret.</strong> A VM that can use a secret can use it to make another credential that outlasts it. The proxy refuses GitHub REST calls that add an SSH key, a deploy key, a self-hosted runner or a webhook with <code>403</code>, but it can&rsquo;t refuse everything, such as GitHub&rsquo;s GraphQL API, an OAuth app grant or other services.
|
||
<ul>
|
||
<li>A bound API key can make credentials too. With Google Gemini&rsquo;s key, code in the VM can ask <code>generativelanguage.googleapis.com</code> for an ephemeral token for Gemini&rsquo;s Live API, which lasts up to about 20 hours and allows as many uses as the VM asks for. With xAI&rsquo;s key it can ask <code>api.x.ai</code> for a realtime client secret that lasts as long as the VM chooses, and with OpenAI&rsquo;s key it can ask <code>api.openai.com</code> for one that lasts up to 2 hours.</li>
|
||
<li>These credentials work without the proxy, and the proxy allows the requests that make them, because opencode&rsquo;s experimental voice mode makes them itself (<a href="https://next.devvm.dev/docs/using/coding-agents/#api-keys-the-proxy-puts-in">API keys the proxy puts in</a>). If a VM may have done this, rotate the secret and check the service&rsquo;s keys, access tokens and runners.</li>
|
||
</ul>
|
||
</li>
|
||
<li><strong>Keys devvm can&rsquo;t tell apart.</strong> devvm takes the keys out of the VM&rsquo;s copies of your agents&rsquo; settings and logins only where it can tell a key from the rest. A key in other text, such as a hook&rsquo;s command, stays when it neither starts like a known key nor follows <code>Bearer</code> or <code>Basic</code>. opencode&rsquo;s and pi&rsquo;s keys that devvm can&rsquo;t bind, such as a local model server&rsquo;s, stay on this machine unless you list their provider in <code>config.toml</code>&rsquo;s <code>[pass-keys]</code>, and then they go in as they are. The agents&rsquo; folders that the VM mounts whole, such as <code>~/.claude/skills</code> or <code>~/.config/opencode/plugin</code>, reach the VM with every file in them, so a <code>.env</code> in one is in the VM, and so is a private plugin marketplace&rsquo;s git config with a password or an access token in its URL. Keep secrets out of those folders (<a href="https://next.devvm.dev/docs/internals/network/#what-stays-in-the-vms-copies">what stays in the VM&rsquo;s copies</a>).</li>
|
||
<li><strong>Your SSH agent.</strong> While <a href="https://next.devvm.dev/docs/using/ssh/#agent-forwarding">agent forwarding</a> is on, anything in the VM can use the agent&rsquo;s keys to push, log in to servers or sign any data, though it can&rsquo;t copy them. It also can&rsquo;t remove the agent&rsquo;s keys, lock the agent or add keys to it, so it can&rsquo;t take the agent away from you or from other VMs (<a href="https://next.devvm.dev/docs/internals/processes/#the-ssh-agents">the SSH agents</a>). A VM that has run since before you upgraded devvm to this release can still do those until its next start, so restart such VMs with <code>devvm restart</code>. The VM has the agent while you&rsquo;re connected. <code>devvm ssh-agent devvm</code> limits it to the keys you add to <a href="https://next.devvm.dev/docs/using/ssh/#devvms-own-agent">devvm&rsquo;s own agent</a>, and an agent that asks you to approve each use, such as 1Password&rsquo;s or Secretive, narrows it further.</li>
|
||
</ul>
|
||
<h3 data-hextra-search-id="git">Git<span class="hx:absolute hx:-mt-20" id="git"></span>
|
||
<a href="#git" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><ul>
|
||
<li><strong>The shell prompt.</strong> Many shell prompts and editors run <code>git status</code> as soon as you <code>cd</code> into a folder or open it, and <code>git status</code> runs <code>core.fsmonitor</code>. Where devvm locks <code>.git</code>, the lock covers the <code>.git</code> of the folder and of the nested repos devvm has found, so opening the folder runs nothing that the VM wrote into them. It doesn&rsquo;t cover a submodule the VM adds, a <code>.git</code> the VM replaces or a repo the VM makes while it runs, which git on this machine reads before devvm&rsquo;s next check, as the entries below describe.</li>
|
||
<li><strong>Submodules with their own config.</strong> The VM writes <code>.git/index</code> to commit, so it can add a submodule whose config sets <code>core.fsmonitor</code>. <code>git status</code>, <code>git diff</code>, <code>git add -A</code> and <code>git describe --dirty</code> on this machine read that config, and run what it names, before devvm stops the VM or the next launch finds the submodule and locks it. No git setting keeps git on this machine out of a submodule that the VM adds, because the VM writes the <code>.gitmodules</code> file that git reads, and several commands enter a submodule whatever the settings say. So use <a href="https://next.devvm.dev/docs/using/clone/"><code>--clone</code></a> for a repo where you run git on this machine while the VM runs (<a href="https://next.devvm.dev/docs/safety/git-protection/#not-covered">not covered</a>).</li>
|
||
<li><strong>Replacing <code>.git</code>.</strong> The VM can rename <code>.git</code> and put a new one in its place, or add a <code>commondir</code> that points git at another config. devvm reports these on each launch but doesn&rsquo;t prevent them, so check what it names before you run git in the folder (<a href="https://next.devvm.dev/docs/internals/git-protection/#what-a-lock-cant-stop">what a lock can&rsquo;t stop</a>).</li>
|
||
<li><strong>Nested repos.</strong> devvm protects the git repos nested in the folder, but the VM can clone a new one while it runs, or move a protected one aside and put another in its place, and git on this machine runs its config before devvm&rsquo;s next check names it. devvm also doesn&rsquo;t protect a nested repo deeper than four folders, in a folder such as <code>node_modules</code>, or past the first 100, which it counts and names (<a href="https://next.devvm.dev/docs/safety/git-protection/#nested-repos">nested repos</a>).</li>
|
||
</ul>
|
||
<h3 data-hextra-search-id="network">Network<span class="hx:absolute hx:-mt-20" id="network"></span>
|
||
<a href="#network" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><ul>
|
||
<li><strong>Domain fronting.</strong> The proxy checks the host name that a TLS connection asks for, its SNI, but not the <code>Host</code> inside the encrypted traffic, so a CDN that serves many sites on one address can route an allowed connection to a site that isn&rsquo;t allowed. The proxy reads the connections to hosts with a bound secret, and it refuses a request in them that names another host. A connection that <a href="https://next.devvm.dev/docs/safety/network/#tools-that-ignore-the-proxy">transparent mode</a> sends to the proxy is judged by its SNI in the same way, and so is a client with an Encrypted Client Hello configuration from somewhere other than DNS, whose outer SNI, the CDN&rsquo;s public name, is what the proxy sees. The VM&rsquo;s own names give no client such a configuration.</li>
|
||
<li><strong>The first seconds of an open start.</strong> A VM that was confined and is made open runs transparent mode from its next boot until that launch&rsquo;s setup takes it out, a few seconds later. In that window, its names resolve to the stand-in address and its connections reach its proxy, which is an open one by then, so they reach what the open tier allows, and nothing keeps those answers after.</li>
|
||
<li><strong>Model providers that fetch for the VM.</strong> The proxy allows a bound API key&rsquo;s provider hosts on port 443, and some providers&rsquo; own tools fetch URLs that the request names, such as Google Gemini&rsquo;s URL context and Search grounding, xAI&rsquo;s live search, Groq&rsquo;s compound models and Mistral&rsquo;s agents with web search, as Anthropic&rsquo;s and OpenAI&rsquo;s web fetch and search tools do. Code in the VM can send data out through such a tool to a host that the allowlist doesn&rsquo;t have (<a href="https://next.devvm.dev/docs/using/coding-agents/#api-keys-the-proxy-puts-in">API keys the proxy puts in</a>).</li>
|
||
<li><strong>Ports the VM listens on.</strong> devvm forwards the VM&rsquo;s TCP ports from 1024 up to this machine&rsquo;s <code>localhost</code>, unless you list the ports with <a href="https://next.devvm.dev/docs/using/ports-size/#size-and-ports"><code>--ports</code></a>, so a VM could take a port that a program on this machine trusts while that port is free, and what the VM serves there reaches whatever connects to it. devvm&rsquo;s forwarder never takes a port that a program on this machine already has, or one that devvm records for a VM, but a program that binds a port on all addresses after devvm forwarded it gets its <code>localhost</code> connections sent to the VM. <code>devvm ports</code> limits what a VM forwards, and <code>devvm ports none</code> forwards nothing, though a project&rsquo;s <code>devcontainer.json</code> adds its <code>forwardPorts</code> to that list when devvm makes the VM or <code>devvm update</code> reads the file (<a href="https://next.devvm.dev/docs/using/devcontainer/#security">devcontainer.json</a>, <a href="https://next.devvm.dev/docs/using/ports-size/#ports">ports</a>, <a href="https://next.devvm.dev/docs/internals/ports/">port forwarding</a>).</li>
|
||
<li><strong>A browser login&rsquo;s port.</strong> While <code>devvm agent login</code> waits for Codex&rsquo;s or opencode&rsquo;s browser login to ChatGPT, devvm forwards this machine&rsquo;s <code>localhost:1455</code>, and <code>localhost:1457</code> when it&rsquo;s free, to the agent&rsquo;s login server in the VM, so any program on this machine that connects in that window reaches the VM&rsquo;s server and gets what it answers. The forward ends with the login, and <code>--device-code</code> logs in without one (<a href="https://next.devvm.dev/docs/internals/agents/#logging-in">logging in</a>).</li>
|
||
<li><strong>VS Code&rsquo;s and Cursor&rsquo;s relays.</strong> Over Remote-SSH, which <code>devvm code</code> and <code>devvm cursor</code> open, the editor forwards the ports that programs in the VM listen on, and it answers git&rsquo;s prompts with your GitHub sign-in. devvm turns both off in the VM&rsquo;s settings for each editor each time it sets the VM up, but the VM can turn them back on, and its settings take precedence over your own on this machine. The editor&rsquo;s extensions also run in the VM, its AI features among them, and they may get the editor&rsquo;s sign-ins there, such as Copilot&rsquo;s GitHub token or your Cursor login. Recent Cursor runs its Agent in the VM with your sign-in in memory (<a href="https://next.devvm.dev/docs/using/ssh/#cursors-agent">Cursor&rsquo;s Agent</a>). So don&rsquo;t open a VM you don&rsquo;t trust with <code>devvm code</code> or <code>devvm cursor</code>, or sign out of the editor&rsquo;s AI features and its GitHub sign-in first (<a href="https://next.devvm.dev/docs/using/ssh/#vs-code-and-cursor">VS Code and Cursor</a>).</li>
|
||
<li><strong>What a VM does through a link.</strong> A <a href="https://next.devvm.dev/docs/using/links/">link between VMs</a> joins the two VMs&rsquo; trust. Code in the client can often run code in the target through the service it reaches, such as Postgres&rsquo;s <code>COPY … TO PROGRAM</code>, and it then has the target&rsquo;s network, the secrets it may use and its project folder. devvm limits a link to the ports the target publishes, on the target&rsquo;s loopback, and a client to targets on its own tier or a stricter one, but it doesn&rsquo;t limit what the service does. In a <a href="https://next.devvm.dev/docs/using/links/#groups">group</a>, every VM trusts every other in the same way, and a VM that joins later gets the same reach (<a href="https://next.devvm.dev/docs/safety/network/#links-between-vms">links between VMs</a>).</li>
|
||
<li><strong>History imported from a less strict tier.</strong> An export of agents&rsquo; history carries what the old VM&rsquo;s agents read, so importing one from an open VM into a VM on the allowlist tier can bring in credentials and data that the new VM couldn&rsquo;t reach itself, along with any instructions planted in them. devvm warns before such an import, and before importing an export whose tier it has no record of, but it imports all the same. Import history only from a VM you trusted as much as the new one (<a href="https://next.devvm.dev/docs/using/coding-agents/#importing-history">importing history</a>).</li>
|
||
<li><strong>What one VM learns of another through the shared Nix cache.</strong> VMs with the nix layer share one cache of Nix&rsquo;s packages on this machine. A VM can tell by how fast the cache answers whether some VM fetched a public package. The packages are public, and a project&rsquo;s <code>flake.lock</code> names the ones it needs, so this tells a VM only that another project on this machine uses a package. A VM that fetches many packages can also fill the cache up to its cap and push other VMs&rsquo; packages out, so they download them again, but it can&rsquo;t fill the disk past the cap or keep anything that cache.nixos.org didn&rsquo;t sign (<a href="https://next.devvm.dev/docs/internals/network/#the-shared-nix-cache">the shared Nix cache</a>).</li>
|
||
<li><strong>Through a company proxy.</strong> The company proxy looks up the names it&rsquo;s sent itself, and it may get another answer than this machine did, or a later one, so the VM&rsquo;s proxy can&rsquo;t check every address a name leads to there. Under a name that an allowlist names, a VM reaches whatever the company proxy reaches, such as your company&rsquo;s internal hosts and the company proxy&rsquo;s own host, which is this machine&rsquo;s loopback when the company proxy runs on this machine, as a VPN client&rsquo;s does. A name that the VM&rsquo;s allowlist doesn&rsquo;t allow never reaches the company proxy (<a href="https://next.devvm.dev/docs/contributing/design/#a-company-proxy">the design note</a>).</li>
|
||
<li><strong>Which names resolve to internal addresses.</strong> When the proxy refuses a name because this machine&rsquo;s lookup gives it an internal address, its refusal says so, so a VM can learn which names this machine&rsquo;s DNS resolves to internal addresses. The refusal never names the address, this machine&rsquo;s DNS server or the company proxy, which stay in the proxy&rsquo;s own log (<a href="https://next.devvm.dev/docs/internals/network/#log-files">log files</a>).</li>
|
||
</ul>
|
||
<h3 data-hextra-search-id="this-machine">This machine<span class="hx:absolute hx:-mt-20" id="this-machine"></span>
|
||
<a href="#this-machine" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><ul>
|
||
<li><strong>A nested project replaced through its parent folder&rsquo;s VM.</strong> A project with a VM of its own inside a folder with another VM is in both VMs, so code in the parent folder&rsquo;s VM can replace the nested project folder with a link, such as one to your home folder, which the nested VM would mount at its next start.
|
||
<ul>
|
||
<li>devvm warns each time it makes or opens such a nested VM, naming the parent folder&rsquo;s VM. It checks the nested folder, by its path and by the folder itself, just before it starts the nested VM and again once the VM runs, and it refuses the start or stops the VM again when the folder was replaced.</li>
|
||
<li>On macOS the VM mounts the folder itself rather than its path, so it never mounts what a link points to, even when the folder is put back before devvm checks again.</li>
|
||
<li>On Linux the VM mounts the folder by its path, so code that replaces the folder for the moment the VM&rsquo;s backend mounts it and puts it back before devvm checks again stays unseen, and the VM keeps what the link pointed to until its next start. Keep a nested project that you don&rsquo;t want the parent folder&rsquo;s VM to reach out of the parent folder (<a href="https://next.devvm.dev/docs/using/vms/#a-nested-project-replaced">a nested project replaced</a>).</li>
|
||
</ul>
|
||
</li>
|
||
<li><strong>Set-id files on Linux hosts.</strong> Root in a VM can set the set-user-id bit on a file in the project folder, and on Linux hosts that bit reaches the host, so the file runs as its owner for whoever runs it. devvm names such files when it makes a VM and once a VM is stopped, but not at a launch into a running VM, and <a href="https://next.devvm.dev/docs/using/troubleshooting/#devvm-names-set-id-files">Troubleshooting</a> says how to clear them. Don&rsquo;t run programs from the project folder outside the VM (<a href="https://next.devvm.dev/docs/internals/security/#set-id-files-on-linux-hosts">set-id files</a>).</li>
|
||
<li><strong>The proxy&rsquo;s CA keys.</strong> Inside a VM, its CA vouches for any site, so someone with a copy of its key and a place on your network could impersonate sites to that VM. Each VM has CAs of its own, so a copy reaches one VM and no other. Only you can read the keys, they never leave this machine, and devvm keeps them out of Time Machine. Each CA lasts 30 days, so a copy goes stale, but the next CA&rsquo;s key is on disk for up to 23 days before that CA starts, so a copy of it taken then works until that CA ends, up to 53 days later. Keep <code>~/.local/share/devvm/vms</code> out of other backup and sync tools as well, and on Linux, which has no Time Machine, out of your backups (<a href="https://next.devvm.dev/docs/internals/network/#the-vms-ca">the VM&rsquo;s CA</a>).</li>
|
||
<li><strong>Your company proxy&rsquo;s password.</strong> No VM gets the company proxy&rsquo;s settings: an open VM goes through its own proxy, which goes through the company proxy for it.
|
||
<ul>
|
||
<li>devvm keeps the password out of its run logs only where it can tell it&rsquo;s a password, so one in an address with neither a scheme nor a port, one with a raw <code>/</code>, <code>?</code>, <code>#</code> or <code>@</code> in it, or one in a run of more than 4 KiB without a space that a command writes in pieces can stay.</li>
|
||
<li>Lima&rsquo;s own log for the VM holds the password until the VM has started, when devvm replaces it with as many <code>*</code>, so the log still shows its length. If devvm is killed before then, or you run <code>limactl start</code> outside devvm, the log keeps it. Lima&rsquo;s logs of the VM&rsquo;s serial consoles hold the VM&rsquo;s own proxy password in the same way, until the VM has started. A reboot inside the VM writes it to the console&rsquo;s log again, and while the VM runs, its proxy replaces it within about a second of its line ending. So the log holds it for that second, or for as long as the proxy isn&rsquo;t running (<a href="https://next.devvm.dev/docs/internals/processes/#limas-hostagent">Lima&rsquo;s hostagent</a>). With <code>config.toml</code>&rsquo;s proxy, the mise that devvm runs on this machine gets the password in its environment, where programs that run as you can read it (<a href="https://next.devvm.dev/docs/safety/network/#open-vms-and-builds">open VMs and builds</a>, <a href="https://next.devvm.dev/docs/using/troubleshooting/#a-command-fails">the run log</a>).</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
<h2 data-hextra-search-id="left-to-you">Left to you<span class="hx:absolute hx:-mt-20" id="left-to-you"></span>
|
||
<a href="#left-to-you" class="subheading-anchor" aria-label="Permalink for this section"></a></h2><h3 data-hextra-search-id="files-the-vm-writes">Files the VM writes<span class="hx:absolute hx:-mt-20" id="files-the-vm-writes"></span>
|
||
<a href="#files-the-vm-writes" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><p>The VM can write anything in the project folder, and devvm locks only <code>.git</code>. Any other file there that a program on this machine runs, or reads as its config, is the VM&rsquo;s to change. <a href="https://next.devvm.dev/docs/using/clone/"><code>--clone</code></a> keeps all of these away from this machine until you fetch the VM&rsquo;s work and review it.</p>
|
||
<ul>
|
||
<li><strong>Hooks in the working tree.</strong> Hooks kept in the project, such as husky&rsquo;s <code>.husky/</code> with <code>core.hooksPath</code> pointing there, run on this machine, and so do an <code>include.path</code> or a hook symlink that leads into the folder. devvm warns about them when it makes the VM (<a href="https://next.devvm.dev/docs/safety/git-protection/#not-covered">not covered</a>).</li>
|
||
<li><strong>Agent config in the project.</strong> Claude Code reads a project&rsquo;s <code>.claude/settings.json</code>, whose hooks run commands, and <code>.mcp.json</code>, which starts MCP servers, and agents follow a project&rsquo;s <code>CLAUDE.md</code> and <code>AGENTS.md</code>. pi reads a project&rsquo;s <code>.pi</code> folder, whose <code>extensions</code> run as code when pi starts, whose <code>settings.json</code> installs packages and sets <code>shellCommandPrefix</code>, which comes before every command pi runs, and whose <code>mcp.json</code> starts MCP servers. pi asks before it loads them, unless your <code>~/.pi/agent/trust.json</code> on this machine already trusts the folder or your settings trust every folder. Running an agent on this machine in the folder after the VM has worked in it runs what the VM wrote, so run your agents in the VM.</li>
|
||
<li><strong>Editor and tool config.</strong> VS Code runs <code>.vscode/tasks.json</code> tasks set to <code>runOn: folderOpen</code> and starts the interpreters and formatters that <code>.vscode/settings.json</code> names. direnv loads <code>.envrc</code>, and mise reads <code>mise.toml</code>&rsquo;s environment, hooks and tasks. Keep VS Code&rsquo;s workspace trust on, and use direnv&rsquo;s and mise&rsquo;s own approval prompts.</li>
|
||
<li><strong>Project code and binaries.</strong> <code>npm install</code>, <code>make</code>, a test run or <code>./bin/tool</code> on this machine runs whatever the VM wrote. Run them in the VM instead.</li>
|
||
<li><strong>Symlinks out of the folder.</strong> The VM can create a link in the project folder that points at a file of yours, such as <code>~/.ssh/id_ed25519</code>. A program on this machine that follows it, such as an upload, an archive or an agent reading files, reads your file instead. devvm itself never follows a link out of the folder.</li>
|
||
<li><strong>Backdoors in code you merge.</strong> Treat the VM&rsquo;s commits as an untrusted contributor&rsquo;s, and review them before you merge, deploy or publish them.</li>
|
||
<li><strong>Secrets in the project folder.</strong> A <code>.env</code> file, a project <code>.npmrc</code> or a cloud key in the folder is in the VM. On the allowlist tier it can reach only the hosts on the allowlist, on the internet tier any public host, and on the open tier anywhere. Keep secrets out of the project folder, or use <code>--clone</code>, which copies no untracked files into the VM but those of a <code>git stash -u</code> entry, though it copies your repo&rsquo;s hooks as they are and a folder of repos&rsquo; own files (<a href="https://next.devvm.dev/docs/using/clone/#whats-copied">what&rsquo;s copied</a>). The same goes for your agents&rsquo; config folders, which <a href="#secrets-and-keys-the-vm-may-use">keys devvm can&rsquo;t tell apart</a> covers (<a href="https://next.devvm.dev/docs/using/coding-agents/#mounts">mounts</a>).</li>
|
||
<li><strong>What you paste in.</strong> An image, a PDF or a file you send with <code>devvm paste</code> is a file in the VM, which anything in the VM can read, as it reads the project folder. devvm reads only an image, a PDF or a copied file&rsquo;s reference from your clipboard, never text, asks before sending a copied file, showing its path, refuses a link anywhere in a copied file&rsquo;s path but the system&rsquo;s own, and lets nothing the VM says onto your clipboard, so paste nothing you wouldn&rsquo;t put in the folder (<a href="https://next.devvm.dev/docs/using/coding-agents/#pasting-images">pasting images</a>).</li>
|
||
</ul>
|
||
<h3 data-hextra-search-id="the-network">The network<span class="hx:absolute hx:-mt-20" id="the-network"></span>
|
||
<a href="#the-network" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><ul>
|
||
<li><strong>Allowed hosts.</strong> Anything an allowed host accepts can carry data out. github.com accepts a push from anyone with an account, including an attacker with an account of their own, and the npm registry accepts packages the same way. Keep allowlists short, narrow a host to the methods and paths a VM needs (<a href="https://next.devvm.dev/docs/safety/network/#rules-by-method-and-path">rules by method and path</a>), and check what a VM reached with <code>devvm network log</code>. A rule by method and path judges each request&rsquo;s method and path, not its body or its other headers, so what an allowed request sends still reaches the host. A deny of <code>git-receive-pack</code> on github.com, for example, blocks pushes over HTTPS alone: a push over ssh to <code>github.com:22</code>, if a rule allows it, and the commits that GitHub&rsquo;s Git Data API makes at <code>api.github.com</code> with a GitHub token go on.</li>
|
||
<li><strong>What your secrets allow.</strong> A VM can push with a GitHub token it may use and spend Claude quota. Use a fine-grained GitHub token, bind only the secrets a VM needs, and deny the methods a VM mustn&rsquo;t use, such as <code>devvm network deny api.github.com --method POST,PUT,PATCH,DELETE</code>.</li>
|
||
<li><strong>Your claude.ai connectors.</strong> With your Claude subscription&rsquo;s login, a VM with Claude Code can use every connector you added in claude.ai, as Claude Code on this machine can, so code in the VM can read what they reach, such as your mail or documents, and act through them. Disconnect the connectors you don&rsquo;t want VMs to use, or keep them from a VM with <code>devvm network deny mcp-proxy.anthropic.com</code>, or from every VM with <code>-g</code>, which works on every tier but open (<a href="https://next.devvm.dev/docs/using/coding-agents/#claude-code-login">Claude Code login</a>).</li>
|
||
<li><strong>Open VMs.</strong> An open VM, because you chose open or passed <code>--network open</code>, reaches everything this machine can, including its services on <code>localhost</code>, such as other VMs&rsquo; ports, dev servers and databases, and your local network, directly and through its proxy, which applies no rules for it. Its proxy still puts its secrets in, so it can spend them on their hosts as any VM can, but it holds only their placeholders, as every VM does. A VM started outside devvm, such as with <code>limactl start</code>, or one running since before <code>devvm network</code> gave it a confined tier, runs unconfined in the same way until devvm restarts it confined (<a href="https://next.devvm.dev/docs/internals/network/#the-self-check">the self-check</a>).</li>
|
||
<li><strong>Your browser.</strong> Programs in a VM can open URLs in this machine&rsquo;s browser, and a page that a VM serves on a forwarded port runs in your browser like any other. From there it can reach the internet past the VM&rsquo;s tier, and your services on <code>localhost</code>. Browsers send a host&rsquo;s cookies to every port on it, so a server in the VM on a forwarded <code>localhost</code> port gets the cookies of the apps you use on <code>localhost</code>, such as a local dashboard you&rsquo;re signed in to.</li>
|
||
<li><strong>A VM&rsquo;s ssh port in your browser.</strong> Root in a VM can make its ssh port on this machine answer as a web server, so devvm puts every VM&rsquo;s ssh on one of the ports that every browser refuses, and a VM that forwards no ports gets no page from your browser that way. A browser you&rsquo;ve told to allow those ports, such as with Chrome&rsquo;s <code>--explicitly-allowed-ports</code> or Firefox&rsquo;s <code>network.security.ports.banned.override</code>, reaches it again. Another user on this machine can also take all 17 of those ports, so none of your VMs starts until they let one go (<a href="https://next.devvm.dev/docs/using/troubleshooting/#too-many-vms-at-once">too many VMs at once</a>).</li>
|
||
<li><strong>Remote forwards you add.</strong> A <code>RemoteForward</code> in your ssh config, or an <code>ssh -R</code> you type, makes this machine connect to whatever it names for the VM. devvm&rsquo;s ssh entries can&rsquo;t turn off a <code>RemoteForward</code> of yours without also refusing an <code>ssh -R</code> you type. The VM&rsquo;s ssh server refuses a remote forward on any address outside <code>127.77.0.0/16</code>, the range devvm keeps for links between VMs, so one on the VM&rsquo;s <code>localhost</code>, which <code>ssh -R</code> asks for by default, is refused. Root in the VM can change that setting, though, and the server allows a forward on an address in <code>127.77.0.0/16</code> for anyone it lets in. A forward you ask for by a host name that begins with <code>127.77.</code> binds whatever address that name resolves to in the VM. So keep remote forwards out of <code>Host *</code>, and don&rsquo;t forward into a VM you don&rsquo;t trust (<a href="https://next.devvm.dev/docs/internals/security/#ssh-into-vms">ssh into VMs</a>).</li>
|
||
<li><strong>A company CA you add.</strong> A <a href="https://next.devvm.dev/docs/using/settings/#a-companys-ca">company CA</a> that you put in <code>~/.config/devvm/ca</code> can read the TLS traffic of every VM, whatever its tier, as it can this machine&rsquo;s, and the proxy trusts it for its own connections. Only that folder adds CAs to the proxy, and nothing a VM sends can.</li>
|
||
</ul>
|
||
<h3 data-hextra-search-id="the-platform">The platform<span class="hx:absolute hx:-mt-20" id="the-platform"></span>
|
||
<a href="#the-platform" class="subheading-anchor" aria-label="Permalink for this section"></a></h3><ul>
|
||
<li><strong><code>.git</code> on Linux hosts.</strong> devvm makes hooks and config read-only in the VM&rsquo;s view, but a git command on this machine that replaces <code>.git/config</code> while the VM runs leaves the new file the VM&rsquo;s to change, replace or open for writing until devvm locks it again, which devvm names only when the VM stops (<a href="https://next.devvm.dev/docs/safety/git-protection/#when-git-on-this-machine-replaces-a-locked-file">when git replaces a locked file</a>). Where the kernel doesn&rsquo;t let devvm use a user namespace, such as on Ubuntu 23.10 and newer, VMs have no <code>.git</code> protection, and the VM can change hooks and config that run on the host, so use <code>--clone</code> there (<a href="https://next.devvm.dev/docs/safety/git-protection/#linux-hosts">Linux hosts</a>).</li>
|
||
<li><strong>What a build reaches.</strong> A build, such as a <a href="https://next.devvm.dev/docs/using/from/"><code>--from</code></a> image&rsquo;s or a layer&rsquo;s, reaches the internet and your local network as well, this machine&rsquo;s own address on it included, so a service of yours that listens on every address is in its reach. On macOS that&rsquo;s all it reaches of this machine, because its loopback is out of reach, but on Linux the build reaches the services on this machine&rsquo;s <code>localhost</code> too, such as other VMs&rsquo; proxies and dev servers. Build images only from container images and layers you trust (<a href="https://next.devvm.dev/docs/internals/lima/#confinement">confinement</a>).</li>
|
||
<li><strong>Escaping the VM.</strong> A bug in Lima, Apple&rsquo;s Virtualization framework or QEMU could let code out of the VM. So could a bug in devvm&rsquo;s own programs on this machine that read what a VM sends, which are the VM&rsquo;s proxy, the port forwarder, the sessions of links between VMs, <code>devvm agent save</code> and the export of agents&rsquo; history that <code>devvm history export</code> and <code>devvm rm</code> save.
|
||
<ul>
|
||
<li>The part of the VM&rsquo;s proxy that reads the VM&rsquo;s network runs in a sandbox, which is macOS&rsquo;s on macOS and Landlock with a seccomp filter on Linux. A bug there reaches the secrets bound to that VM, the company proxy&rsquo;s password, the VM&rsquo;s logs, the shared Nix cache and the public internet. It doesn&rsquo;t reach your files, the Keychain, other VMs&rsquo; secrets, or this machine&rsquo;s unix sockets, such as ssh&rsquo;s and Docker&rsquo;s. Nor does it reach this machine&rsquo;s services on <code>localhost</code>, its own addresses or your LAN&rsquo;s private addresses, unless a rule names the address or a company proxy reaches them. On Linux it can also learn whether a file of yours exists, and an older kernel confines it less (<a href="https://next.devvm.dev/docs/internals/network/#the-childs-sandbox">what it still reaches</a>). devvm doctor warns when a VM&rsquo;s proxy runs without its sandbox, or with only part of it (<a href="https://next.devvm.dev/docs/using/troubleshooting/#the-proxy-runs-without-a-sandbox">the proxy runs without a sandbox</a>).</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
<p>Found a way out of a VM? See <a href="https://github.com/devvmhq/devvm/blob/main/SECURITY.md" target="_blank" rel="noopener">SECURITY.md</a>.</p></description></item></channel></rss> |