mirror of
https://github.com/devvmhq/devvm.git
synced 2026-12-01 16:27:33 -10:00
main
37
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
97cc14b79d |
fix(assets): base keeps its own packages when it drops the cloud image's server extras
Ubuntu 26.04's cloud image has jq only as an automatic dependency of ubuntu-server. base.sh's apt-get install marked it manual while the image's jq was the newest, but once Ubuntu published jq 1.8.1-4ubuntu2.1 the install upgraded it and left it automatic, and the purge of the server extras (--autoremove) took jq and libjq1 with ubuntu-server. The base was recorded as good without jq, so the VMs' editor settings and the agents' settings that the guest scripts edit with jq weren't set up (e2e project: 4 checks, jq: command not found). base.sh's packages are now one list, base_pkgs, which the install uses and which is marked manual with the kept tools before the purge; any of them, or ICU, gone after the purge fails the build, naming it. TestBaseKeepsItsPackages runs base.sh's own lines against stubbed apt and dpkg-query: an upgraded automatic package stays, and one removed anyway fails the build. base's key changes (base.sh), so devvm update builds base again. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
9f2dda910d |
feat(assets): base's build fetches only the package lists apt installs from
apt.sh begin's update fetched 35.8 MB of lists on arm64, of which the translations (Translation-en, 7.9 MB), AppStream's components (4.8 MB) and command-not-found's metadata are nothing apt installs from, and the image keeps no lists. The build's apt settings now leave them out (Acquire::Languages "none", and DefaultEnabled "false" for the DEP-11 and CNF index targets): 22.8 MB, and apt.sh begin 3.7 s against 6.4 s on the mini (measured). The record still gives back every InRelease and Packages list it used. A layer's apt.sh lists runs after apt.sh end has removed these settings, so its apt is Ubuntu's as it is. Base's and every layer's key change (apt.sh). Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
32a3469ed2 |
fix(assets): image builds' downloads retry, resume and time out on a stall
What a build VM downloads failed on a network's first hiccup: curl's --retry 3 skips a connection cut mid-transfer (exit 18) and waits for ever on a stall, apt's retries were off, and oh-my-bash's clone had none. - devvm-fetch: each try has --connect-timeout 20 and a stall limit (--speed-limit 1024 --speed-time 30), and any failure is tried again, five tries in all, from where it stopped (-C -): curl's own --retry, --retry-all-errors included, starts again from nothing (measured on curl 8.7). A server that can't resume (33, 36) starts it again; a file that came whole and checks out ends the loop; a file that doesn't check out is fetched again from nothing once, as a resume may have joined two versions. A redirect goes only to https (--proto-redir =https), so no try or resume moves to plain http. TestDevvmFetchTries runs it against a server that cuts, ignores ranges, changes the file, fails and redirects to http. - apt.sh: package lists still fail fast (exit 75 when no source answers), and once they're in, the build's installs get Acquire::Retries "3", with apt's own backoff. - crane (oci/build.sh, the --from conversion, which has no devvm-fetch): --retry 5 --retry-all-errors --retry-delay 2 and the same timeouts. - oh-my-bash: the clone is tried five times in all, with git's low-speed limit. Docs: images.md's Building and Base's packages, customizing.md's devvm-fetch; the CHANGELOG's second highlight, which says which downloads resume, and What to do 1, which names the layers and --from bases that rebuild and pull again; the release page's A first run on a bad network. Image keys change: base's (base.sh, apt.sh, omb.sh), every layer's (apt.sh is in each), and a --from conversion's (oci/build.sh). Tool images' keys don't (shared-tools/build.sh is unchanged). Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
3c7fbad7a3 |
feat(tools): mise downloaded as its .tar.gz, on the host and in base
mise's raw binary is 147 to 192 MB, its .tar.gz 51 to 63 MB. Both of a first run's mise downloads now take the archive: - the host's mise (internal/tools): the .tar.gz checked against its pinned SHA-256 by fetch.Download as before, into a folder of its own, then hashed again through the descriptor that mise/bin/mise is taken out of with archive/tar and compress/gzip, capped at miseCap. One devvm downloads it at a time (Dirs.MiseDownloadLock, cache/mise/download.lock, mise_waiting), and another takes what it kept. Under the lock, a .download-* folder a killed run left is taken away first (TestHostMise). A failure says its cause (mise_download_failed's Because) in the run log too. - base's mise (layers/base.sh): devvm-fetch's .tar.gz, unpacked with tar in a folder of mktemp's, which every base has (gzip is Essential on Debian and Ubuntu, BusyBox has it): .tar.xz would need xz, which --from images may lack. The pins are the archives' SHA-256s from the release's SHASUMS256.txt, and scripts/bump.sh reads the .tar.gz lines. TestMisePins still checks that base.sh's Linux pins are the host's. Docs: images.md's Versions and overview.md's locks; the release page's A faster first run; the CHANGELOG's Highlights, a first run that downloads less with the cloud image's two lines, now highlights too. Base's key changes (base.sh). Tool images' keys don't: they hash base's mise version, not its checksum. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
82f075c5bd |
build(deps): bump pins
scripts/bump.sh's safe bumps, patches and minors: - images: mise 2026.11.10 -> 2026.11.14 (base and the host's, with internal/tools/mise.go's checksums), nix 2.35.6 -> 2.36.0, Docker's buildx 0.39.0 -> 0.39.1 and model 1.2.9 -> 1.2.10 - e2e: the lock's pnpm 12.21.0 -> 12.23.0, bun 1.4.4 -> 1.4.5, codex 0.169.1 -> 0.171.0, opencode 2.3.2 -> 2.4.1, pi 1.5.2 -> 1.6.0; --from's node:24 by its new digest - dev-tools: nilaway to its newest commit's pseudo-version (0.0.0-20261124161746-91ad9bf5d8e6), goreleaser 2.20.3, vale 3.28.1, markdownlint-cli2 0.24.2, whose lock folder moves to .mise/locks/markdownlint-cli2/0.24.2/, zizmor 1.33.1, with mise.lock - ci: the workflows' mise 2026.11.14, jdx/mise-action v5.3.0, amannn/action-semantic-pull-request v6.1.4 The e2e lock keeps Claude Code at 2.1.327: 2.1.328 made its sign-in link much shorter, without the state parameter that the network section's login check reads to answer it, so with 2.1.330 that check and the refresh after it fail. devvm itself never reads the link. mise's and Nix's new checksums match upstream's SHASUMS256.txt and .sha256 files; buildx and model are apt packages from Docker's signed repository. Cursor's CLI stays on 2026.11.17-f532c45: 2026.11.22-e9042b2 is out, and it moves only when named. pflag stays held below 1.1.0 and Node on 24. The new nilaway no longer reports three of agentsave.go's bounds findings, so their lines leave testdata/nilaway-baseline.txt, which nilaway and nilaway:linux fail on while they're stale. The CHANGELOG's Unreleased has the pins line, and the 0.2.0 page a section for them. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
c9005ae4be |
build(deps): bump pins: mise 2026.11.10, Docker 29.10.0, Hugo 0.170.1 and e2e's pins
scripts/bump.sh's safe bumps (patches and minors; no majors or held pins): images (assets/): - mise 2026.11.8 -> 2026.11.10 (base's, and the host's resolving mise) - docker 29.9.3 -> 29.10.0, compose 5.7.1 -> 5.8.0 e2e: - claude 2.1.322 -> 2.1.326, codex 0.167.2 -> 0.169.1, opencode 2.2.7 -> 2.3.0 - pnpm 12.18.0 -> 12.21.0, uv 0.13.7 -> 0.13.9, rust 1.99.1 -> 1.100.0 - ubuntu:26.04 digest 065aa8626841 -> d66b366dac61 - Ubuntu's cloud image release-20261016 -> release-20261108 go: deadcode v0.52.0 -> v0.53.0 dev-tools: govulncheck 1.9.0 -> 1.10.0, vale 3.26.0 -> 3.27.0, hugo-extended 0.169.0 -> hugo 0.170.1 ci: jdx/mise-action v5.2.8 -> v5.2.10, the workflows' mise 2026.11.8 -> 2026.11.10 Hugo 0.170 has no extended edition (one binary, without LibSass, which the site doesn't use): mise.toml's hugo-extended becomes hugo, the docs workflow installs hugo, its release job installs the tag's own tools (an older tag names hugo-extended), and docs/hugo.yaml drops the deprecated hugoVersion.extended. The e2e runner deletes its sandbox's Ubuntu pin when it names a release other than e2eUbuntuRelease (not in a --newest-base run), as devvm keeps a pin it has: without it, moving e2eUbuntuRelease left a cached sandbox on the old release. pinned and ubuntuPin are e2e's one reader of the pin, and TestHarnessRepin covers repin. Image keys change: base and every image above it, the docker layer's included, and the shared tools' images build again. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
aee6340ea9 |
chore(deps): bump assets' pinned downloads and devvm's host mise
scripts/bump.sh, every checksum from upstream's published sums: - mise (base, and devvm's host mise): 2026.11.3 -> 2026.11.8, from the release's SHASUMS256.txt - Docker's buildx: 0.38.1 -> 0.39.0 - Docker's compose: 5.7.0 -> 5.7.1 - nix: 2.35.5 -> 2.35.6, from releases.nixos.org's .sha256 files Up to date: docker 29.9.3, containerd 2.4.2, model 1.2.9, Docker's signing key, direnv 2.38.2, nix-direnv 3.2.0, git-lfs 3.8.1, rustup 1.29.3, crane 0.22.1, omb 94c2977eda06, eza 0.23.5, tealdeer 1.9.1. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
52bb0f467b |
feat(clone): a --clone VM gets the repo as it is here
A --clone VM's clone is now seeded with a snapshot, not git push, and gets everything a working copy has. devvm clone fetch brings it all back, and devvm rm and clone off check it before deleting. - Refs: every branch, tag and notes ref, and a detached HEAD. - Uncommitted changes: staged, unstaged and untracked files; files skip-worktree by hand get the index's version, named. - Operations in progress (merge, rebase, cherry-pick, revert, bisect) and the stash; a stash's untracked part goes as its own branch. - The repo's settings and hooks, sent as settings only where they live in the repo (husky); ORIG_HEAD never goes. - Partial clones, with their promisor remote, and messages per network tier when it can't be reached. - Initialised submodules, nested ones too, each with a clone of its own; a submodule's own folder is refused as a top-level --clone. vm.json gains an optional `submodules` field. - Git LFS both ways: objects hash-checked, written under os.Root with no link followed, a question past 2 GiB; the filter is set only in the clone's repos; git-lfs 3.8.1 in base, pinned by SHA-256. - rm and clone off keep the VM when anything the VM has didn't come back, and name it. - Every shell script embedded in Go is shellchecked. - clone.md is a guide that leads with commands; TestUserPageProse covers it and coding-agents.md. After you upgrade: base and every image on it build again once, for git-lfs. Fixes #40, reported by @Josuesp1620. Thanks to @dhruv1220 for #42, which found the cause (receive-pack refusing a shallow push); its receive.shallowUpdate setting stays in the VM's repos. Co-authored-by: Dhruv Arora <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
7b876d7285 |
build: bump nix to 2.35.5 and the e2e pins (#39)
scripts/bump.sh nix e2e-tools e2e-from; mise stays deferred. - assets/layers/nix.sh: nix 2.35.4 -> 2.35.5 (sha256 arm64 34b8d0c0658321e63143f892086bd2d9623a81bf96e4ffefc1551092d80caedb, amd64 c349f0559b7849a2cb3b20b8584e532b3fcf5025092cb6180eb0b99240d7b96c), which changes the nix layer's image key. - tests/e2e-mise.lock: codex 0.166.0 -> 0.167.0 (its entries now carry mise's checksum_source = "mise-versions", as others already did) and opencode 2.2.5 -> 2.2.6; node, pnpm, bun, python, uv, go, rust, dotnet, claude and pi were already the newest. - tests/e2e/from_test.go: fromAlpineDigest -> sha256:f59abe656b69…, alpine:3's digest now (3.24); node:24 and ubuntu:26.04 didn't move. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HTFcPrY8FzzQMopN5wgpLQ |
||
|
|
647ad4bf2a |
feat(network): transparent mode for tools that ignore the proxy settings
On every confined tier, a tool that ignores the proxy settings (workerd
under wrangler dev, a static Go binary, a container made through Docker's
API) reaches the VM's proxy by the names it looks up. In the VM, dnsmasq
answers every name with the stand-in address 198.18.0.1 and has no
upstream; nftables sends that address's ports 80, 443 and those the allow
rules name to socat listeners on it, which make each an authenticated
CONNECT transparent.devvm.proxy:PORT to the VM's proxy. The proxy reads the
host from the connection's first bytes (TLS SNI, or each HTTP request's
Host) and judges it as CONNECT host:PORT, with the same order of checks,
log, secrets and floor. A blocked HTTPS host gets the 403 over a
certificate from the VM's CA. Nothing new runs on the host, and the
backends don't change.
Proxy (internal/proxy):
- transparent.go: TransparentHost, ProxyDomain, SentinelAddr,
IsSentinelAddr, ViaDNS, transparent (serve, take, tls, handler,
refusePage, ports), sniHost, replay, reservedRefusal, withVia, viaOf.
- routeFor and route: the one order of checks for CONNECT and the
transparent path; carry, the one tunnel with its SNI check; block split
into the record and blockPage; links.refuse split (isLinkDomain);
caEndedRefusal's test moved to routeFor; handshake and serveOne shared
by intercept and the 403 page.
- devvm.proxy reserved whole, CONNECT devvm.proxy:P included; the stand-in
address refused with its own reason.
- Hosts and SNI in ASCII alone, never folded (the Kelvin sign), in
splitHostPort, sniMatches and sniHost.
- A ClientHello record past 16 KiB + 256 is never read; once it starts,
a ClientHello must arrive whole within 10 s, on every tunnel; a stream
whose first byte is 0x16 is TLS from then on, so a record header that
doesn't come whole, or isn't TLS's version, is refused, never passed on
unchecked; and only a ClientHello that parsed (sniOf) counts, so one
split across records is refused, an address's tunnel's included, which
may have no name (a gap older than this change).
- routeFor carries the method and path rules: a host they narrow is
refused where it can't be decrypted and intercepted where it can, on
the transparent path too.
- On the transparent HTTP path, devvm.proxy answers /blocked alone.
- policy.transparentPorts and /transparent/ports: 80, 443, then the ports
allow rules name for hosts by name, at most 32, never 22 or 53.
- Event.Via ("dns"), shown in devvm network log, /blocked and the prompt's
note as "without proxy settings".
Guest (assets/): base.sh installs dnsmasq(-base), socat and nftables;
guest/transparent.sh is devvm-transparent: setup and teardown from
sync.sh (the proxy URL on stdin), the supervisor service (systemd or
OpenRC), the ruleset (render: two filter chains at -150 keep every
interface but lo and Docker's bridges, and every protocol but TCP, UDP
and ICMP, off the stand-in address; both NAT chains at -110 map every port of
the stand-in address, so Docker's published ports never take one; DNS to
public servers and 127.0.0.1:53 go to dnsmasq, which listens on the
stand-in address alone; private, link-local, CGNAT and loopback servers
are left alone, but the VM's own name servers, which Lima's DHCP adds
beside 127.0.0.1 and Docker gives containers, go to dnsmasq too), slots,
the port list's check, and status for devvm-why. Names without a dot and
names under the search domains (this machine's network's, through Lima)
don't resolve.
Setting: config.toml's transparent-proxy, and devvm network transparent
[on|off], the VM's own value in net.transparent (Settings.Transparent,
SetTransparent; netpolicy.TransparentOf, TransparentAddr); the setup gets
DEVVM_TRANSPARENT_ADDR while the VM runs confined and its mode is on.
devvm network --json has transparent; devvm network lock lists apart the
hosts only tools without proxy settings reached (Learned.NoProxy, via in
--json). vmssh.dialAddr refuses the stand-in address.
Tests: the transparent path's unit tests and FuzzTransparent; the
setting, TransparentOf, FormatEvent's via and learned hosts; the ruleset,
slots and port list under bash 3.2; network_transparent.txtar and
sync.txtar; e2e: transparentRuns, the network section's checks, a docker
step, the from section's Debian 12 and Alpine on the allowlist tier, and
the guarantee checks run with transparent mode stopped and running.
Docs: safety/network.md (tools that ignore the proxy, what isn't
covered, the setting, logs, lock), internals/network.md (tools that skip
the proxy), internals/design.md (the design note and threat check),
using/settings.md, using/troubleshooting.md, using/limits.md,
using/images.md, safety/attack-vectors.md, internals/lima.md,
contributing/tests.md and testing.md, the proxy's README, the CLI
reference and the Commands page.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
||
|
|
33ec9eb0dc |
refactor(tools): one definition per toolchain
Each toolchain is one image.ToolDef in image.SharedTools, which also holds its guest environment, its PATH folders and its version files. They leave base's devvm-tools.sh for /etc/devvm/toolchains.sh, which every launch writes, so base.sh changes and every image rebuilds once. The structure test's names rule fails on a toolchain's name as a literal outside internal/image, TestToolchainsComplete checks the toolchains page, and Contributing gains Adding a toolchain. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
9f51e79421 |
refactor(agents): one definition per coding agent (#29)
Each coding agent gets one definition, an agents.Def in a new stdlib-only leaf package, internal/agents, and everything else iterates over agents.Defs: agentlogin's format per login kind, secrets' login kinds, settings' [pass-keys], image.SharedTools, the vm package's store tables and scripts, and cli's help lists. The VM copies of every login file, their bindings, the store's layout, the scripts and the CLI reference stay the same byte for byte, as golden tests made before the refactor show. The agents' guest variables leave base.sh for /etc/devvm/agents.sh, written at every launch, so every image rebuilds once. Messages are merged per agent (login_kept, login_passed, login_withheld, login_oauth_withheld, agent_login_key_only). The structure test's new names rule fails on an agent's name or login kind as a literal outside internal/agents, and literals on one holding an agent's folder. Docs link the supported coding agents rather than listing them, and Contributing gains Adding a coding agent. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
84f1190b04 |
feat(agents): pi, as a fourth coding agent (#23)
Adds pi (earendil-works/pi) as a shared coding agent beside Claude Code, Codex and opencode: --agents pi, devvm tools add pi, the new-VM picker and devvm setup offer it. Its network policy allows pi.dev; base sets PI_SKIP_VERSION_CHECK=1 and PI_TELEMETRY=0 and installs fd-find, so base and every image on it build again once. The agent store mounts and copies pi's settings, with keys redacted as JSON. pi's auth.json is a new login kind: its API keys for Anthropic, OpenAI and OpenRouter become per-VM placeholders the proxy fills in (devvm agent login pi --api-key --provider PROVIDER), and everything else is withheld by default, unless config.toml's [pass-keys] lists the provider. pi's own account logins aren't supported, and pi has no musl build, so a musl VM refuses it (image.ToolDef.GlibcOnly). Its sessions go into devvm history export and import. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
8d8da01037 |
feat(tools): dotnet, the .NET SDK, as a shared toolchain (#7)
Adds `dotnet`, the .NET SDK, as a fifth shared toolchain next to node, python, rust and go. `--tools dotnet`, `devvm tools add dotnet` and the picker offer it, and a folder with `*.sln`, `*.slnx`, `*.csproj`, `*.fsproj` or `global.json` at its top level suggests it in the new VM's summary, the way `package.json` suggests node. Refs #2. Thanks to @jsskeen-utah for the detailed request. Co-authored-by: Claude Opus 5.5 <[email protected]> |
||
|
|
588ba6f9a1 |
build: bump docker 29.9.3, mise 2026.11.3, rustup 1.29.3, oh-my-bash, tealdeer 1.9.1 and the --from digests
docker 29.9.3, containerd 2.4.2, buildx 0.38.1, compose 5.7.0, model 1.2.9; mise 2026.11.3 (VMs and the host mise); rustup 1.29.3; oh-my-bash 94c2977; tealdeer 1.9.1; e2e's node:24 and alpine:3 digests. Every checksum is from upstream's published sums. bump.sh's value check now knows a Go constant's camelCase *Digest name, which it refused before. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
b6b60d5cf3 |
fix(agents): opencode 2 VMs get the store's changed logins and keys at each launch
opencode 2 keeps its logins in its database, so a VM whose database existed kept the logins it had: a key saved from another VM, or a ChatGPT login for another account, never reached it. Every launch's setup now sends the store's opencode logins as opencode auth import reads them (agentlogin.OpencodeImport: each API key the proxy puts in and OpenAI's Codex login, placeholders alone, IDs cred_devvm_<provider>; methodID chatgpt-browser and a whole-number expires, as opencode 2.2.5's credential schema needs). The new guest script assets/guest/opencode.sh reads them on its input, never argv, and, once opencode has a database, imports them when they differ from its record (~/.local/state/devvm/opencode-import.json) or when the database no longer holds one of devvm's IDs (deleted, or replaced by a history import; checked with opencode auth export, only the IDs kept). It logs out of devvm's earlier entries (opencode auth import skips an ID it has), imports each entry on its own and switches its provider to devvm's entry; the user's own credentials stay in the database. devvm agent login opencode --api-key runs the same script at once, in place of the old one-key import. The record lives in the VM because only the VM knows its database and what it holds. No partial success: a provider whose import opencode refuses is printed as devvm-opencode-failed PROVIDER, the script exits 1 and records nothing, so the next launch tries again, and devvm agent login names the providers in the new message opencode_import_failed. Three faults found on real opencode 2.2.5 VMs and fixed: bash -lc runs ~/.bash_logout (Debian's clear_console, failing without a terminal), which under set -e became the script's status after a good import, so the work runs in a subshell; opencode 2.2.5 made its database without importing auth.json while the script had recorded the entries anyway, so nothing is recorded until the database exists; and a missing expires becomes 0. Every VM also sets OPENCODE_DISABLE_AUTOUPDATE=1, beside Claude Code's DISABLE_AUTOUPDATER in base's /etc/profile.d/devvm-tools.sh: the agents are read-only shared tools whose versions mise pins. Tests: TestOpencodeImport; TestOpencodeScript (the script against a fake opencode: no database, an import, the same input again, a database made again, a refused entry); TestOpencodeRefused; TestToolsEnvironment; agent_login.txtar (the script at a key's save, opencode-import.json in the setup, a refused provider named through the guest stub's new opencode-refuses switch). e2e's network section: OPENCODE_DISABLE_AUTOUPDATE in an opencode VM's login shell; a second opencode VM with a database and a credential of its own gets a key saved from the first at its next launch, its own credential kept; and gets it again once its database is deleted and made again. Failures print opencode.sh's stderr, the run logs' opencode lines and the VM's credential IDs. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
3f2d3658ed | fix(network): allow the trust roots mise checks attestations against | ||
|
|
6391a8ba48 |
fix(agents): opencode 2's history exports leave its credentials out
opencode 2 keeps its sessions and its logins in one SQLite database, ~/.local/share/opencode/opencode.db (opencode-<channel>.db for other channels), in WAL mode, so the history export, which tarred ~/.local/share/opencode, carried its credential table (logins, API keys, MCP OAuth tokens), account and control_account (its console's access and refresh tokens) and session_share's secrets to this machine, and an import gave them to another VM. The -wal file carries them too: it holds full page images of what opencode wrote last, a just-saved credential row among them, until a checkpoint, and opencode makes it at once. The export now copies each database in the VM with sqlite3 (base installs it: sqlite3 on Debian and Ubuntu, sqlite on Alpine), keeping the sessions: VACUUM INTO (one snapshot, the WAL's rows included); every trigger dropped; the login tables emptied (credential, account, control_account, account_state, session_share, and any table whose name or a column's says it holds a secret, for tables a later opencode adds); the record of opencode's auth.json import migration taken out, so the next VM's opencode imports the logins devvm's setup wrote there; WAL off and secure_delete with VACUUM, so no free page keeps a deleted row; then the rows counted, and the database left out on any failure or without sqlite3. tar leaves the database and its -wal, -shm and -journal files out and adds the copy at its path (--transform, links' targets kept). The import does the same in the VM to an export it unpacks (one devvm didn't write may hold the logins): it deletes the -wal, -shm and -journal files and any database that isn't a regular file, and puts in the copy, or nothing. Every sqlite3 runs with trusted_schema off. opencode 1's mcp-auth.json joins the logins left out. Rejected: excluding the database (loses opencode's sessions); opencode session export (runs opencode and its server per session, and per project, which rm's export can't count on). Security review (security-audit skill, guidance mode, data isolation and lifecycle): export scope, the WAL, import of an export holding the logins, a trigger restoring rows and a hostile schema each have a holder and a test (design.md's threat check). Not covered, documented: a secret pasted into a session stays in it; a VM without sqlite3 exports no opencode database; a remake's home copy keeps the database's logins, as it's the same VM's data going to the same folder's VM. Tests: TestOpencodeClean (a running opencode's database, its credential only in the WAL of an open connection, an account's tokens, a share's secret, a later table's key and a trigger: none in any byte of the copy, the session kept; a file that isn't a database gives none), TestHistoryExportRuns and TestHistoryImportCleansOpencode (GNU tar, with and without sqlite3); the CLI tests' export calls; e2e's network section plants a key with the VM's sqlite3 and finds neither it nor the login's placeholders in devvm history export's file. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
36f910839e |
fix(desktop): browsers reach the web through a local proxy that adds the VM's password
Chrome, Chromium and Firefox ignore the password in HTTP(S)_PROXY, so in devvm desktop they asked for the proxy's username and password on every site. The guest setup now writes devvm-local-proxy, which socat (now in the desktop layer) serves on 127.0.77.1:3128, the VM's loopback alone. For each connection it reads the request's head, drops the client's Proxy-Authorization and Proxy-Connection, adds the VM's password and sends it to devvm's proxy, then socat carries the rest both ways. It takes only CONNECT HOST:PORT and absolute http(s):// requests, the latter with Connection: close, so each connection's one request carries the password. devvm-desktop starts it and points the Xfce session's http_proxy, https_proxy, HTTP_PROXY and HTTPS_PROXY at it; on Xfce, Chrome and Chromium read those, and Firefox reads them first with its default system proxy setting. A blocked host still gets the proxy's 403. - proxy.LocalProxyAddr, LocalProxyPort, IsLocalProxyAddr: the one owner of the address, sent to the guest as DEVVM_LOCAL_PROXY (vm.localProxy). - vmssh: the port forwarder never forwards a server on 127.0.77.1. - Tests: netpolicy's TestLocalProxy runs sync.sh's script (bash 3.2 on macOS) against a fake proxy: the password replaced, Connection: close, a tunnel, the 403 passed on, origin-form and junk refused with 400 before any connection; TestListeners, TestIsLocalProxyAddr, TestLocalProxy (vm), sync.txtar. e2e desktop (tests/e2e.sh, still the bash section): the session's variables, the listener on 127.0.77.1 alone, curl without a password to github.com, example.com's 403 over CONNECT and plain HTTP, 400 for origin form, nothing on this machine's 3128. - Docs: using/desktop.md (Browsers), internals/desktop.md (The local proxy), design.md's desktop note, ports.md, network.md's setup. Security review (security-audit skill, guidance mode, local IPC and proxy request handling): - Fixed by design: devvm forwards every VM port by default, so a local proxy on 127.0.0.1 would have put a password-less route to the VM's proxy, and its secrets, on the host's localhost for every local user. The forwarder now skips the local proxy's address on every port. - The password goes only to the VM's proxy, whose address is fixed in the script, never to an address a request names, in the one header the local proxy adds; devvm's proxy strips Proxy-Authorization before forwarding. It's never in a process's arguments (bash builtins only). - Web pages: requests from a page to the loopback are origin form, refused with 400 before any connection; a page can't send CONNECT or an absolute-form line, and DNS rebinding changes only Host. - No new power in the VM: the same password is in /etc/environment; the script is mode 700, the VM user's. - Residual: a program in the VM can hold up to 256 connections slowly (30 s a line, 100 headers), only against the VM's own browsing; an ssh -L the user types to 127.0.77.1:3128 would expose it, as any forward they choose. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
3a2c290d3d |
refactor(msg): messages and comments say network tier and the VM's proxy, not network policy
Every VM runs a proxy and is on one of four tiers, so the proxy's messages name the VM's proxy, the unenforced ones its network tier, and the redaction ones say devvm keeps secrets on this machine on every tier. Message IDs are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
9cde4abf2e |
fix(build): refuse a recorded base package older than a newer pocket lists
The host checked that each package a first build of base recorded is the archive's, but root in the recording build VM chose which signed lists to hand back: it could return only the release pocket's and record an older version than -updates or -security have. Now: - a recording must hand back resolute-updates' and resolute-security's signed InRelease files with lists for the architectures whose lists have the recorded packages (another archive's InRelease, such as archive.ubuntu.com's on arm64, doesn't count), and every non-empty list each InRelease it hands back gives for those architectures, in every component (packages_lists_missing); - a recorded package that the release pocket, -updates or -security lists a newer version of, for its architecture, is refused, naming the package, both versions and the suite (packages_not_newest); -backports doesn't count, as apt installs from it only when asked; - a list's SHA-256 is checked against the verified InRelease files before it's read, so only signed lists are parsed; - apt.sh's recording takes phased updates (APT::Get::Always-Include-Phased-Updates), so apt installs the newest version the lists have. - internal/ubuntu: CompareVersions, dpkg --compare-versions in Go (epoch, upstream, revision, ~ and letters' order; ErrVersion for one that isn't a version); Release.Lists gives the matching lists with their paths, ListsFor, List.Arch, Backports, RequiredSuites. - internal/build: signedEntries returns a signed (entries, each package's architectures, the newest version by architecture and name and its suite); verified, complete, checkNewest, newer; readArchiveList returns an archiveList. - Messages: packages_lists_missing, packages_not_newest. - Tests: CompareVersions' table (Debian policy's ordering and dpkg's cases, invalid versions); ListsFor and Backports on Ubuntu's real InRelease; a recording refused for an older version than -updates has, for a missing -updates or -security InRelease, a missing list, another archive's -security, a missing backports list; kept for the newer version, a newer one in backports, an older one in -security; checkNewest's table. The gpg-made fixtures are signed again by a new test key, with Packages-newer, Packages-security and InRelease-newer, -security, -security-amd64 and -backports added. - Docs: images.md's Base's packages, design.md's trust note (the pocket choice closed; what root in the recording VM still chooses). Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
9348a1e518 |
refactor(assets): one prelude for the build scripts' architecture, libc and pins
assets/prelude.sh gives each of devvm's scripts that a build runs with
bash $devvm_arch (arm64 or amd64), $devvm_libc (musl where apk is, else
gnu) and devvm_sha TOOL (the script's TOOL_sha256_<arch>_musl on musl
where it pins one, else TOOL_sha256_<arch>). It replaces the arch and sha
helpers in layers/base.sh, layers/nix.sh, features/cli-tools.sh,
shared-tools/build.sh and oci/build.sh, and the Alpine checks in
docker.sh, desktop.sh and fzf.sh. Each script that reads it checks it
came first (: "${devvm_arch:?}").
image.OwnScript reads devvm's own scripts with the prelude before them:
base.sh, apt.sh, built-in layers (LayerData) and features (featureStep),
shared-tools/build.sh (the tools build and ToolFile's key) and the
conversion's oci/build.sh (Lima's convertSteps, written into the
conversion's own temp folder). Users' layers and features get none.
keyHash.own goes, its one caller now hashing OwnScript's bytes.
Image keys change: every image and every shared tool image rebuilds.
Tests: testdata/script/prelude.txtar pins which pin devvm_sha picks from
each script on arm64 (aarch64 and arm64) and amd64, gnu and musl, and
refuses another architecture and a missing pin; oci.txtar sources the
prelude first and checks build.sh stops without it; TestOwnScript,
TestPreludeUsers (only scripts that get the prelude use it, each checks
its variables), key rows for the prelude in build and tool keys, and
recipe expectations with the prelude before devvm's scripts only.
e2e's nix copy as a user layer starts with the prelude.
Docs: internals/images.md (the scripts' prelude, keys), contributing
(owner, agreement test), maintaining, assets/oci/README.md, AGENTS.md.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
||
|
|
de28721978 |
fix(build): check base's recorded packages on the host against Ubuntu's signed archive lists
A first build of base gave back each package it downloaded with apt's
entry for it, and the host took the build VM's word that each entry was
apt's: anything with root in that VM before apt.sh end could record a
package with a made-up entry, which every later build of the key
replayed. Now the build also hands back the InRelease files and package
lists apt used, and the host checks them itself before it keeps
anything:
- each InRelease is clearsigned by Ubuntu's archive key, pinned in
assets/layers/ubuntu-archive.gpg ("Ubuntu Archive Automatic Signing
Key (2018)", F6ECB3762474EDA9D21B7022871920D1991BC93C, from
keyserver.ubuntu.com by fingerprint, checked against the Ubuntu
security team's list), and one of 26.04's suites;
- each package list has the SHA-256 and size a verified InRelease gives
one of its Packages lists;
- each recorded .deb's SHA-256 is in one of those lists, as the package,
version, architecture and size apt's entry says, and the set keeps
the archive's own entry.
- internal/ubuntu/pgp.go verifies clearsigned messages (RFC 4880's
cleartext signatures: text signatures, dash-escaping, trailing
whitespace, nothing before or after); archive.go's VerifyRelease and
Release.Lists read a verified InRelease (ArchiveKeyring).
- assets/layers/apt.sh: record copies apt's *_InRelease and *_Packages
lists to out/<n>.InRelease and out/<n>.Packages; base's build keeps
lists uncompressed (Acquire::GzipIndexes "false").
- internal/build: take accepts the lists (an InRelease at most 4 MiB and
all of them 32 MiB, a list 512 MiB with lines of 1 MiB and entries of
4 MiB, all lists 2 GiB, no name twice), signedEntries and
archiveEntry check them; cache carries devvm's own files for the key.
- Tests: Ubuntu's real resolute-updates InRelease verified, and refused
when changed, framed differently or signed by another key; clearsigned
parsing (dashes, CR LF, trailing whitespace, a binary signature
refused); InRelease fields; a recording refused for a forged
InRelease, a list no InRelease gives, a .deb no signed list has,
another package's entry, missing lists, a list or an InRelease twice,
a line over 1 MiB; a good set kept
with the archive's entry (gpg-made fixtures in
internal/build/testdata/archive); apt.sh's record giving back the
lists.
- Docs: images.md's Base's packages, design.md's trust note (the
recording VM's made-up packages closed), settings.md's mirror
section, maintaining.md's archive key.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
||
|
|
0941219a76 |
feat(build): base's packages recorded per key, replayed from a host cache
base's apt packages are no longer pinned by a snapshot. A key's first build of base records them: assets/layers/apt.sh (a recipe step, as root, before base.sh and after the last feature) points the image's sources at an apt mirror+file: list of config.toml's ubuntu-mirror and then Ubuntu's own archive, so apt checks everything against the archive key whichever server answers, and keeps what it downloads. At the end it gives back each package with apt's entry for it. devvm checks what comes back (regular files only, each named by its own SHA-256, each entry matching a file's size and SHA-256, nothing left over, at most 20,000 entries and 16 GiB), keeps the files in ~/.local/share/devvm/packages/<sha256>.deb and the key's set in packages/sets/<key>.json, before the image's record. Every later build of that key replays the set from the cache, checked on the host first, with apt given only those files: no network for base's packages, and a key's packages never change. A --from base keeps its image's own sources, unpinned. base keeps no package lists, so each layer's recipe starts with apt.sh lists, which fetches them when there are none. - backend.ImageSpec.Packages (Send before the steps, Take after) and backend.PackagesDir; Lima runs both over limactl shell as root. - Fail fast: apt.sh turns apt's retries off and exits 75 when no source answers, which Lima reports as build_sources_unreachable. - packages_missing refuses a replay whose cached file is gone or changed; packages_refused what a build gives back that isn't packages. - config.toml's ubuntu-mirror (settings.UbuntuMirror), checked as an http(s) address without a user, query or spaces (ubuntu_mirror_invalid). - devvm gc deletes the sets of keys neither current nor built, then, under the cache's lock, the files no set names at that moment, and builds' leftover folders over a day old (gc_packages, deleted_packages); devvm space lists the cache. - The snapshot is gone from base.sh, guest/sync.sh and desktop.sh, and scripts/bump.sh's apt step with it. - Tests: recording then replaying, a missing or changed cached file, every refusal of what comes back, gc's view of the cache and its race with a new set, the set record, the mirror setting, Lima's exchange and exit 75, apt.sh's mirrored and record functions, apt.sh in the keys; the limactl stub keeps what's sent and gives back $STUB_DIR/packages-out.tar. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
d2dc8c74b6 |
feat(layers): desktop is a built-in layer, not one of base's features
devvm --layers desktop (or desktop under the picker's Layers heading) gives a VM the Xfce desktop devvm desktop opens; base no longer has it. - assets/features/desktop.sh moves to assets/layers/desktop.sh, with a built-in layer's header, and assets/layers/desktop.policy (no rules: its packages come from the distribution's archive, which base's policy has). - image.DesktopLayer joins image.Builtins (desktop, docker, nix, sorted): reserved, listed under Layers, taken by --layers and completion, its policy read by netpolicy.Policies. - build: desktopFeature and chosenFeatures' special case are gone; until a choice is made, base gets every feature. devvm setup --features desktop is no_feature. - devvm desktop: desktop_no_feature becomes desktop_no_layer (devvm rm, then devvm --layers desktop), linked to the desktop page. The picker's row: pick_layer_desktop. - apt snapshot: base.sh's /etc/apt/apt.conf.d/50devvm-snapshot stays in base's image, and only guest/sync.sh (project VMs) removes it, so a layer built on base installs from the same snapshot and package lists; said in base.sh, desktop.sh and internals/images.md. - No backend feature: desktop builds and runs like any layer on Lima. base's image key changes (desktop leaves the features, base.sh's comment changes), so base rebuilds, now about 400 MB smaller without the desktop on the --from tier's every-feature base, and for anyone who chose it. Tests: TestBuiltins; TestOwnFeatures (devvm's features without desktop, every one until chosen, desktop refused); TestLayersAndCheckLayers, TestCompleteParts, TestPartFlags and TestUpPicker list desktop under Layers; TestBuiltinPolicies allows desktop.policy alone without rules; testscript: desktop.txtar (a base VM refused with desktop_no_layer, its build without the layer's script; --layers desktop builds the desktop image), setup.txtar (--features desktop is no_feature), the layer lists in build, layer, up and up_checks. e2e: the desktop section checks a base VM has none of the desktop's programs and is refused, then makes its VM with --layers desktop; from's Alpine VM gets the desktop layer too. Docs: using/desktop.md, using/images.md (built-in layers, desktop), using/customizing.md, using/from.md, using/_index.md, getting-started/commands.md, internals/desktop.md, internals/images.md (the desktop layer, the snapshot in layers), internals/design.md, contributing; the CLI reference for devvm desktop. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
f4fd373439 |
refactor(backend): remove the smolvm backend
Lima is devvm's only backend. The backend architecture stays (Backend, Caps, Features, Review/Require, the registry, backendtest.Fake), so another backend is an addition. State from a smolvm VM reads as an unknown backend (backend_unknown_vm, gc_orphans_unknown); nothing migrates it. The image keys of layers/docker.sh, layers/nix.sh and features/desktop.sh change, so images rebuild once. Lima's port forwarder moves off smolvm's files first: newForwarderCmd and forwarderMain from internal/cli/smolvmports.go to limaports.go, and assets/container/ports.sh to assets/guest/ports.sh (sent by the forwarder at run time, so no image key changes). Removed: - internal/backend/smolvm (4,070 lines with tests), _smolvm-ports, its registry entry, registry.Experimental and backend_experimental. - The decider: backend.Decider/UsesDecider, Confinement.Decider and DeciderToken, internal/proxy/decider.go and its test, the proxy's -decider, -decider-to and -decider-token-file, netpolicy's KeyDeciderPort, KeyDeciderToken and deciderToken, the decider port in vm's forwarding and UsedPorts. - backend.AgentStarter/AgentUnchosen, vm's checkAgentStart and agent_unchosen_stop. - vmssh/key.go (EnsureKey, Public, HostKey, ServicesArgs, Capped). - paths.Smolvm/SmolvmImage and space's smolvm folders; paths.VM's Record, Key, KnownHosts and ProxyURL; project.Detect, which nothing called (a test helper now). - ubuntu.ContainerRepo/ContainerDigest/ContainerRef/ContainerOrigin and bump.sh's ubuntu_image, with its part of bump.txtar. - assets/smolvm/ and assets/container/; the no-init-system branches of layers/docker.sh, layers/nix.sh and guest/sync.sh, and the notes in features/desktop.sh and guest/ca.sh. - Messages: smolvm_* (14), vm_no_ssh, vm_no_sshd, ports_no_ssh, creating_from_image, packing_image, pack_failed, backend_experimental, agent_unchosen_stop; descriptions naming smolvm reworded. - Tests: smolvm.txtar, the smolvm stub, registry, decider, netpolicy and sshagent cases; gc_backend, gc_skipped, gc_orphans and space test a failing or hanging Lima listing instead (the limactl stub's list-fails and list-hangs); the --backend smolvm examples; e2e's --backend smolvm and its section (about 1,130 lines), the smol_* helpers and the link section's backend switch. - Coverage: internal/backend/smolvm's lines in both baselines. - Docs: backends/smolvm.md, internals/smolvm.md, design.md's smolvm notes (Ports on Lima now holds the forwarder's description), the backends table's smolvm column, every page naming smolvm, the README, the home page's backends art, and AGENTS.md's smolvm rows and gotchas (and the Docker bind-mount gotcha, which nothing refers to). Kept: the docker layer, on Lima; --from's local Docker; --backend, the BACKEND column and setup's backend choice, which the next commit removes. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
a134e0d8a6 |
feat(cli): choose a new VM's toolchains, agents and layers in a picker or with --tools, --agents and --layers
devvm takes no IMAGE word any more than any other: in a terminal a new VM's toolchains, coding agents and layers are checked in one picker, under three headings, before the network-policy question; --tools, --agents and --layers (each an exact list, or none) skip it, and a part left out takes its default: the detected toolchains, devvm setup's agents, no layers (a devcontainer.json's features still count). Without a terminal, or with --no-input, the VM gets the defaults and new_vm_gets says so in one line. devvm setup --agents (and its first-run question) chooses new VMs' agents. devvm tools in a terminal opens the same picker for the VM, its layers fixed, and turns the changes into tools add and rm. An image is base and layers only: tools are the VM's tool_names state key. build, rebuild and images rm refuse a shared tool (tool_not_layer), and devvm build builds no tool images. devvm ls gains a TOOLS column and --json tools. gc's --tools is --tool-images, so --tools has one meaning. Gone: image.Reserved, checkWord's image half (devvm WORD is no_command or no_command_like, did-you-mean over commands, msg.Closest), the lacks path in internal/vm/existing.go, and the messages vm_lacks_tools, vm_lacks_layer, layer_is_command, layer_name_command, no_image_for, no_command_or_image*, tools_not_images, tools_not_images_rm, detected, vm_is_now (vm_tools_now), secret_with_image (secret_with_claude). New: ui.Pick takes headed sections with fixed rows, ui.CanPick, vm.PickPart/PickRow/AgentsChoice/CheckPart (internal/vm/parts.go), state.KeyToolNames, state.ReadAgents/WriteAgents, paths.Dirs.Agents, project.DetectFiles. Image keys are unchanged in form: images never held tools; docker.sh's and nix.sh's comments changed, so those layers rebuild. Docs: the home page's quick start steps, diagram (sandbox.svg), cards and FAQ; README; getting started; using (images' What a new VM gets, coding agents' Running an agent, settings' agents); internals; contributing; the cli skill; AGENTS.md. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
8bcdbfbbf4 |
fix(layers): the docker and nix layers' comments say why their daemons start during the build
A layer can't be added to an existing VM, so the comments no longer describe one added in place. Both files are in image keys: every image rebuilds. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
133a4d3cdb |
feat(guest): what a client VM needs for links: sshd's rule, low ports, /etc/hosts and NO_PROXY
Every VM's sshd (base.sh's 00-devvm.conf, services.sh) allows remote
forwards of TCP ports only on 127.77.0.0/16: AllowTcpForwarding all,
GatewayPorts clientspecified, PermitListen 127.77.*:*. Remote socket
forwards, tunnels and X11 stay refused. The setup sets
ip_unprivileged_port_start to 0 where it's 1024, writes the VM's links in
a marked /etc/hosts block in place (Docker's is a bind mount), and puts
DEVVM_NO_PROXY in every NO_PROXY it writes.
The links come from Env.Links (nil: none), a list of GuestLink {Addr,
Names}, checked on the host by checkLinks (link_setup_invalid) before the
start's NO_PROXY (netpolicy.LinkEnv) and the setup's hosts file. design.md,
security.md, smolvm.md and docker.md describe the sshd rule; e2e checks
it with rfwd_links on every backend, and low ports on Alpine and smolvm.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
||
|
|
3b1959efd2 |
feat(network): network policy rules and log under devvm network, and network -g for new VMs
devvm network allow|deny|rm RULE... [-g] and devvm network log [-f] [-n N] [--blocked] replace devvm policy and devvm log. Bare devvm network shows the VM's network policy, then its allowlist file by file. devvm network -g shows or saves whether new VMs get network policy (ask, on or off), through the network file devvm setup also writes; --network-policy and --no-network-policy beat it and skip reading it, a saved off makes a VM without the docker-layer and backend warnings, and with ask and no terminal a new VM gets it. The proxy's block messages, devvm-why's, network log --blocked's ALLOW WITH and the VM's setup note name devvm network allow. New messages: net_default_failed, net_ask_global; -g reports with network_default. Docs, the CLI reference, txtars (network_rules, network_log, network), e2e (bare devvm network's first line) and AGENTS.md follow. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
b70742eaf9 |
feat(images): the nix layer on --from Debian and Alpine
Debian (systemd) needed nothing new: the node:24 (Debian 12) VM's nix layer installs, runs nix run nixpkgs#hello and builds in Nix's sandbox. Alpine (OpenRC, musl) is supported: Nix's tarball binaries are static or linked against its store's glibc, so they run on musl, and its daemon becomes an OpenRC service of devvm's. - nix.sh: on Alpine, apk add xz (GNU tar needs it for the tarball; shadow's groupadd and useradd are base's), unpinned and said so, as the docker layer's Alpine packages are; on OpenRC, /etc/init.d/nix-daemon (openrc-run, command_background, its pid in /run/nix-daemon.pid, its log in /var/log/nix-daemon.log), added to the default runlevel and started. OpenRC reads /etc/conf.d/nix-daemon for it, the file guest/sync.sh writes with the VM's proxy under network policy. - sync.sh: on OpenRC, a changed /etc/conf.d/nix-daemon restarts the service with rc-service. - e2e from: the node:24 VM is node+python+docker+nix+claude (nix-daemon's socket active, hello, a sandboxed build); the alpine:3 VM is node+docker+nix (the service running, hello, a sandboxed build, no crashed services, then devvm network on and restart: /etc/conf.d/nix-daemon has the proxy and a fixed-output fetch from a host that isn't allowed gets the proxy's 403). - Docs: using/images (the bases the layer works on), using/from (Alpine's unpinned packages, what's tested), internals/images (OpenRC's service, xz, musl), contributing. Review (security-audit skill, guidance mode): the OpenRC service runs the root-owned default profile's nix-daemon and reads only the root-written /etc/conf.d/nix-daemon; xz is Alpine's own package from its signed repositories, unpinned as every Alpine package devvm installs is, and says so; nothing else changed in what the image or the daemon gets. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
f0d8aea497 |
feat(smolvm): the nix layer on smolvm; refused on Docker, whose containers can't sandbox Nix's builds
smolvm runs no init system, so the nix layer's daemon starts the way the docker layer's does: nix.sh starts it when there's no systemd (for a VM it's added to in place), and assets/container/services.sh starts it after each start (its pid in /run/nix-daemon.pid, counted only when that process is nix-daemon). Its settings are /etc/conf.d/nix-daemon, devvm's alone, which guest/sync.sh writes with the VM's proxy under network policy and removes when it's off, restarting the daemon when the file changed. nix-layer is native on smolvm. Docker stays none, so devvm refuses the layer in one line (backend_lacks) for a VM or a build. Tested on Docker Desktop with nix-layer let through: the layer builds and substitutes (nix run nixpkgs#hello works), but every build fails with "this system does not support the kernel namespaces that are required for sandboxing", as its containers lack CAP_SYS_ADMIN, and the layer's sandbox-fallback = false keeps Nix from building unsandboxed without a word. Supporting it there needs sandbox = false or Sysbox, a choice left open. - nix.sh: OpenRC refused in one line for now; with no init system, the daemon started with /etc/conf.d/nix-daemon read. - sync.sh: one block for nix-daemon's proxy, a systemd drop-in or /etc/conf.d/nix-daemon. - Caps: smolvm's nix-layer native; Docker's comment says why it's none. - e2e: smolvm's nix section (a nix VM with network policy: nix-daemon running with the VM's proxy, nix run nixpkgs#hello through it, a build in Nix's sandbox, network off and restart giving a daemon without it); Docker's base project refuses the nix layer in one line (both engines); Lima's nix section gains the sandboxed build. smol_others is exported for the last smolvm check, whose bash -c couldn't find it. - Docs: internals/backends (nix-layer's row), backends (the table, smolvm's Nix works, Docker's can't-do list), using/images, internals/images, internals/smolvm (no init system), internals/network, contributing. Review (security-audit skill, guidance mode): /etc/conf.d/nix-daemon is written by root through sudo in a root-owned folder and holds only the VM's own proxy URL, so services.sh, running as root, sources only what root wrote; the pid file is root's and a stale one never makes devvm kill another process (its comm is checked); the daemon gets no host value. The Docker refusal keeps every Nix build sandboxed. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
91a429108f |
feat(images): a built-in nix layer with Nix, direnv and nix-direnv, pinned
nix is a layer devvm ships, as docker is: devvm nix, devvm node+nix, devvm build nix, or added to an existing VM in place. A folder with flake.nix, shell.nix or devenv.nix at its top level, or a default.nix that makes a shell (mkShell), gets it after its toolchains, so package.json and flake.nix give node+nix. - assets/layers/nix.sh: Nix 2.35.4's release tarball (releases.nixos.org), its version and SHA-256 per arch at the top, checked against the tarball's .sha256 files and nixos.org/nix/install, fetched with devvm-fetch; 2.35.3 fixes GHSA-hf6w-2rg9-v84g (store ownership in the scripted installer) and CVE-2026-110450 (store corruption through the daemon's repair flag). The tarball's own install --daemon --yes --no-channel-add, with experimental-features = nix-command flakes, trusted-users = root, sandbox = true and sandbox-fallback = false. The installer runs without proxy variables (it writes any it finds into a systemd override for nix-daemon, which would put a build's proxy into the image) and with NIX_SSL_CERT_FILE at the system's bundle. The layer checks the store is root's, adds Nix's default profile to the end of sudo's secure_path (/etc/sudoers.d/devvm-nix, checked with visudo), and appends Nix's profiles to BASH_ENV's PATH. direnv 2.38.2 (per arch) and nix-direnv 3.2.0's direnvrc, pinned the same way; direnv's hook in ~/.bashrc.d/direnv.sh, which loads before mise.sh so direnv's prompt hook runs after mise's and a dev shell's PATH comes first; a direnv lib file puts each project's layout under ~/.cache/direnv/layouts, so nix-direnv writes no .direnv into the project folder. Without systemd the script refuses in one line. - assets/layers/nix.policy: cache.nixos.org, channels.nixos.org, releases.nixos.org (GitHub is in base.policy). - assets/guest/sync.sh: nix-daemon gets a systemd drop-in with the VM's proxy (http_proxy, https_proxy, no_proxy) under network policy, removed when it's off, the daemon restarted when it changed. - image.NixLayer in Builtins; project.Detect's nix marker (a default.nix is read only as a regular file, at most 64 KiB); backend.FeatureNixLayer (nix-layer), needed by a VM of an image with the layer and by building one: Lima native, smolvm and Docker none, so both refuse in one line (backend_lacks); dockerLayers.choice returns every layer feature of the image, so docker+nix on Docker needs nix-layer too. - scripts/bump.sh: nix (the version nixos.org's installer names, the sums Nix publishes; it fails when the installer names no tarball, as Nix's Rust installer will), direnv, nix-direnv. - Docs: using/images (built-in layers, detection), using/toolchains (Nix projects), safety/network (the layer's hosts; source builds' hosts blocked), internals/images (the nix layer), internals/network (the daemons' drop-ins), internals/backends (nix-layer), internals/design (the nix layer beside Instead of Nix), backends, customizing, coding-agents, contributing (the e2e section); the CLI reference; AGENTS.md's assets/ and e2e lines. - Tests: Detect (markers, default.nix with and without a shell, a linked one), layer and environment lists, layer new nix reserved, nix-layer in ImageSpec and ImageFeatures, caps tests, up_checks.txtar (node+nix detected under an agent), docker.txtar (nix refused for a VM and a build). e2e nix section: the layer built behind a company proxy leaves no proxy settings and no password on its image's disk; a node+nix flake VM with network policy: pins, a root-owned store, sandbox without fallback, trusted-users root and an untrusted substituter ignored, the daemon's drop-in, nix run nixpkgs#hello, sudo nix and nix over ssh, the flake's node ahead of the shared node prompt after prompt through direnv, no .direnv in the folder, a blocked fixed-output fetch named by devvm-why, and the drop-in gone after network off. Review (security-audit skill, guidance mode, against the review task's list): the tarball and direnv's files are pinned in devvm's source and checked before tar or install runs; nothing from the host goes into the image (no proxy override, e2e greps the disk); the drop-in holds only the VM's own proxy URL, devvm's value, and goes when policy is off; trusted-users stays root and an untrusted user's substituters are ignored (the VM's user has sudo, so that guards an honest VM and the allowlist is what holds); secure_path gains only the root-owned default profile, last; /nix is on the VM's own disk and nothing mounts a host's or another VM's store. Found and fixed in review: Nix's default sandbox-fallback would build unsandboxed without a word where the kernel can't sandbox, so it's off. No confirmed findings. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
2b413028e6 |
fix(images): pin Ubuntu's container image with base's package snapshot
smolvm's and Docker's base start from Ubuntu's container image by a digest pinned in internal/ubuntu (ContainerDigest), not the tag's digest looked up at build time. base's key hashes it (each backend's KeyFiles), and base's record names it. The image is never newer than assets/layers/base.sh's snapshot: an image with newer packages leaves apt unable to install what depends on their exact versions (the docker layer's docker-ce, through systemd's libsystemd0). - internal/ubuntu: ContainerRepo, ContainerDigest, ContainerRef, ContainerOrigin; the backends' Digest fields and UbuntuImage go. - base.sh: apt_snapshot 20261026T000000Z, with the image's digest sha256:19fcd1bf268f (built 2026-10-25). - scripts/bump.sh: apt moves the snapshot and the image's digest together (the index's digest hashed from what the registry sent), and refuses an image built after the snapshot; bump.txtar covers both. - tests/e2e.sh: timings per selection and Docker engines, so an --engine linux run isn't compared with one that included Desktop; the Linux engine's run pulls the pinned Ubuntu image before recording what Docker has without the sandbox's label; base's records are checked against the pin; smolvm's TSI check takes any of this machine's resolvers; the from section allows devvm's labelled VM listing. - docs: smolvm, Docker, images, maintaining, contributing; design.md's smolvm notes describe the reviewed emulations as they are. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
9ec1601801 |
feat(docker): an experimental Docker backend, its containers and native features
Each VM is a container from an image devvm builds by running its scripts in a container and committing it. A container is not a VM: on Linux it shares the host's kernel, on macOS Docker Desktop's one VM; docker.md says so first. - internal/backend/docker: build-image (docker commit; base from Ubuntu's image by digest, prepared by the container scripts smolvm shares, now in assets/container), from (any image Docker has or pulls), clone, project-mount and agent-folders (bind mounts), tools-share (tool images unpacked into a volume by a network-less container, linked by guest/tools.sh; ToolFormat dir-<unpack.sh>), cpus and memory (docker update). Build confinement native only on a rootful engine of this Linux machine; Docker Desktop and other engines build nothing yet. - Containers run --init and a sleep; services.sh after each start, without Docker's daemon. Mounts and network are hashed into a label; a start that finds them changed commits the container and makes it again under the same name (flattened past 100 layers), its home a per-VM volume. - The VM's user has the host's uid, and on Linux its gid. A --clone VM's clone gets a volume (VMSpec.CloneAt). - Disk none: DiskUser reports what a VM holds (devvm size's disk_used), warned past base's disk by launches and ls; a default disk size is left out of a new VM on such a backend, said. - Everything labelled devvm.data=<data folder>; only labelled resources are touched; names Docker shares between users carry its hash. - Problems: docker on PATH, a reachable engine (or the docker group fix), 29.1+, Linux containers, this machine's arch; Report names the engine and Docker Desktop's file sharing, which CreateVM checks. - ssh, ports, ports-all, agent forwarding and toggling, egress-proxy, disk and the new docker-layer feature are none: refused in one line. Builds ask for build features only when they build, so a built image works where it couldn't be built. - testdata/stubs/docker: a stateful engine; docker.txtar; unit tests; tests/e2e.sh --backend docker on a Linux engine in a Lima VM e2e keeps (~/.lt-e2e-go-docker) and on Docker Desktop, with images copied from the Linux run. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
e6681035b2 |
feat(images): a built-in docker layer
Docker is a layer devvm ships, docker, chosen per VM like any layer (devvm node+docker, devvm build docker) and added to an existing VM in place. base installs no Docker. - Built-in layers: image.Builtins (docker) and IsBuiltin; a name is looked up in devvm's assets/layers first, so a user's docker.sh is never read; devvm layer new docker is refused (layer_name_reserved); an image's key hashes the shipped script (own file, must exist); Layers, Environments, completion and unknown_layer/no_image_for list it; Env.LayerData reads either kind's script. - assets/layers/docker.sh: Docker's apt repository (pinned key, pinned package versions; Alpine's own packages, rc-update, the docker group), the daemon started now too (OpenRC, or with no init system as services.sh does) for a VM it's added to in place. scripts/bump.sh's docker pins read it. - assets/layers/docker.policy: Docker's packages and the registries, applied to VMs with the layer (netpolicy.PolicyFiles); base.policy keeps OS packages (Alpine's too), mise and GitHub. - Adding layers in place sets the new image in the VM's state before their scripts run, so a network-policy VM's proxy allows their hosts; a failing script sets it back. - smolvm's sshd.sh keeps the snapshot's package lists, for layers' apt-get install. - Docs: images (base, built-in layers, keys), customizing, commands, network, smolvm, from, install, maintaining, design, coding-agents, contributing; the CLI reference; AGENTS.md's assets/ line. - Tests: key, layers, build, policy files, in-place add (devvm's script, image during the run, set back on failure), layer new docker; e2e: a base VM has no Docker (Lima, smolvm), the docker layer on Debian 12 and Alpine (from), and smolvm's network-policy VM is a docker VM whose Docker pulls through the proxy. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
9f24d2639e |
refactor: group devvm's files under assets/
assets/ holds the files devvm ships: base.yaml, layers/, features/, shared-tools/ (mise.toml, build.sh, the tools' policies), guest/ and oci/. devvm reads them from assets/ beside its binary (paths.Root, paths.RootOf); releases, the Homebrew formula, the CLI tests and e2e put them there. Image keys hash them by their names in assets/. Co-Authored-By: Claude Opus 5.5 <[email protected]> |