16 Commits
Author SHA1 Message Date
w3cjandClaude Opus 5.5 e85e85d075 build(cosign): the units, install.sh and the co-signer's docs
- [email protected], a template: devvm-cosign@run for the timer, and
  @check and @init for setting up. The keys are root's, mode 0600, and
  reach the service only as systemd's credentials (LoadCredential=), in
  a folder of its own while it runs; the base's key comes from a drop-in,
  devvm-cosign-base.conf, which install.sh installs once there is one, as
  a credential that isn't there fails the service. Its processes are in
  a PID namespace of their own (PrivatePIDs=), and any failure starts
  devvm-cosign-failed.service (OnFailure=).
- devvm-cosign-podman.service, where a process that escapes a build's
  container lands: a PID namespace of its own, so no other process's
  /proc/<pid>/root; the config, the keys, every service's credentials and
  the whole state folder inaccessible; its HOME, with podman's config and
  storage, and its only writable folder, the build folder,
  /var/lib/devvm-cosign-build; StopWhenUnneeded=, so it runs only while
  a run needs it; each start deletes the whole build folder, podman's
  config first, then its images and containers (podman system reset),
  then the rest, so nothing a build left, a link or a config pointing
  podman at another runtime, reaches the next; and OnFailure=, as a run
  whose podman fails to start doesn't fail itself.
- devvm-cosign-failed.service runs devvm-cosign failed, which tells the
  maintainer through the config's notify command, reading no key.
- devvm-cosign.timer starts devvm-cosign@run hourly.
- install.sh: 65536 subordinate IDs from the first multiple of 65536
  above every range another user has in /etc/subuid or /etc/subgid, so
  no two users' containers share an ID; the state folder and the build
  folder, with the folders the units need; the config readable by the
  co-signer's group, for retry and ack; the old devvm-cosign.service
  removed.
- Docs: contributing/cosigner.md for the new flow: what CI hands over,
  what a run does (the old step 8 split into the draft, the publish and
  the check after), refusals and alerts, retry, ack and notify through
  OnFailure (HTTPS, not a local sendmail, under NoNewPrivileges), the
  base's snapshot bound and why, its files, the config's new keys and
  the credentials' names and modes, the setup with the Go the tag's
  mise.lock pins (mise exec), the units, what a build's container can
  reach and what's still shared (the user and the machine: an escape can
  slow or change the build it's in, which then doesn't match, and use
  the network while that run lasts; a kernel escape gets past it all),
  the GitHub App's Actions: read and the tap ruleset's bypass, that the
  units name the folders, and moving machines by copying
  /var/lib/devvm-cosign but stage/, src/ and cache/. maintaining.md's
  Release keys say who publishes, as it is; structure.md's package row;
  the 0.2.0 page and the changelog line.

Validated on Fedora 43 (SELinux enforcing, podman 5.6, systemd 258), in
a throwaway Lima VM: install.sh, then check, init and a run under these
units with rootless podman, against the fake GitHub over TLS with a
throwaway v9.9.9 and throwaway keys. CI's build was release.sh --tag
under rootless podman, handed over as an artifact; the co-signer cloned
its root-owned checkout, rebuilt, matched, signed, made the release,
published it and wrote both formulas, the same bytes as CI's build's.
Both signatures verified with minisign, every file with SHA256SUMS, the
podman unit stopped after the run, and a second run did nothing. During
the build, from the podman service's namespaces as the co-signer's
user: only the build's own processes were there, so release.sh's and
the run's /proc/<pid>/root weren't; the state folder, the clone
release.sh ran from and CI's staged files were refused; and only the
build folder was writable; only SHA256SUMS and CI's signature were
staged; and the build's finished files and the download cache were in
the state folder. A second start of the podman service reset the last
build's images and containers and left an empty build folder. A run
failed with GitHub gone started devvm-cosign-failed, whose notify got
the recorded failure, and a podman start that failed started it too. The first
runs found three things the fake can't, fixed in the earlier commits:
podman needs ~/.config, which install.sh now makes; system credentials
are mode 0440 with an ACL; and the clone needs the checkout's .git named
safe.

The podman service's first ExecStartPre deletes the co-signer's user's
/dev/shm/libpod* files, podman's locks, which outlive the service and no
folder it empties holds (TestPodmanUnitStartsClean). cosigner.md also
covers a build that keeps failing and GitHub's latest release.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-30 21:36:37 -07:00
w3cjandClaude Opus 5.5 f3052e5a8e feat(upgrade): releases checked by two of three release keys, bridged from the old key
devvm upgrade and install.sh accept a release's SHA256SUMS when any two
of three release keys signed it (CI's, the co-signer's and an offline
recovery key's), each in SHA256SUMS.<role>.minisig, checked only against
its own role's key, with the trusted comment devvm-release <version>
compared exactly; one signer counts once. While releases bridge from it,
the old release key's single SHA256SUMS.minisig (devvm <version>) still
passes alone, so 0.1 and 0.2 keep upgrading and --to/--version can
install them; install.sh now checks that key's trusted comment too.

The keys themselves aren't made yet, so packaging/keys holds none and
install.sh's three key lines are empty: a devvm built so checks each
release with the old release key alone, and a release that only the
release keys signed is refused. Releases go out as before, signed with
the old key, until the keys are made and added, all three at once.

- internal/minisign: the one owner of signature checks (moved from
  internal/upgrade): ParsePublicKey, PublicKey.Check (comment always
  compared), Role (CI, Cosign, Recovery), Kind (Release, Base),
  Kind.Comment, SigName, KeyFile, Keys/NewKeys/Keys.Check (two of three,
  distinct keys and key IDs). minisigntest/ signs for tests. Stdlib and
  blake2b only (depguard), a leaf; FuzzCheck, FuzzKeysCheck,
  FuzzParsePublicKey.
- The structure test's signatures rule: outside internal/minisign no
  code calls ed25519/rsa/ecdsa's Verify functions or imports blake2b,
  but signatureFree's files (ubuntu/pgp.go, proxy/nixcache.go).
- internal/upgrade: Source.Keys, checkSums (signatures.go); the bridge
  in legacy.go (checkLegacy, legacyKey, Source.Key); FuzzSumOf.
- packaging/keys/release-{ci,cosign,recovery}.pub, none yet;
  packaging.Key ("" without one). TestReleaseKeys (checkReleaseKeys:
  none, or three distinct minisign keys, none the old key),
  TestCheckReleaseKeys (fixture keys from minisigntest),
  TestInstallScriptKeys (checkInstallScriptKeys: one line per role,
  empty without keys), TestReleaseRefusesPlaceholders (no key in keys/
  marked PLACEHOLDER).
- scripts/release.sh (a tag, --check, --tag; never a snapshot) needs
  none or all three of packaging/keys' release keys. With none,
  install.sh's release_<role>_key lines are empty or missing; with all
  three, each is a minisign key, distinct, not the old release key, not
  marked PLACEHOLDER (placeholder), and equal to its install.sh line.
- install.sh checks with minisign -VHQm: prehashed signatures only.
- The structure guard also flags dot imports of the verifier packages
  and calls of x509's CheckSignature* method names.
- install.sh: release_<role>_key lines, download_signatures (a role's
  signature only when the script has its key), check_signature,
  signed_by_two, check_legacy; plainer warning without minisign, with
  the commands to check by hand.
- Tests: signatures_test.go (TestFetchWithoutReleaseKeys among them),
  upgrade.txtar (-legacy, -keys, and the keys built in, none),
  install.txtar (stub minisign with -Q; NO_KEYS), install_minisign.txtar
  (real minisign), release.txtar (none, nolines, nokeyline, old, marked
  and the rest); DEVVM_RELEASE_KEYS override.
- Docs: internals/install.md, using/upgrading.md, maintaining.md's
  Release keys, structure, tests, testing, SECURITY.md, CHANGELOG,
  releases/0.2.0.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-30 21:36:37 -07:00
w3cjandClaude Opus 5.5 7c4659ce87 chore(release): trust the second release machine's tag-signing key
packaging/release-signer names a fingerprint for each machine that tags
releases, so a tag signed on either one builds.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-20 19:24:00 -07:00
CJandClaude Opus 5.5 72b648df31 feat(release): prereleases on the Homebrew tap, as devvm-rc (#19)
Prereleases now reach the Homebrew tap through a second formula, `devvm-rc`. The stable `devvm` formula stays on the last final release.

Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-11-07 11:36:20 -07:00
w3cjandClaude Opus 5.5 f3e4753445 build(release): the Homebrew formula installs the release's signed binary
The formula has an archive per platform (macOS and Linux, arm64 and
Intel), each URL and checksum filled in by release.sh from the
SHA256SUMS it wrote, and installs only the binary; no Go dependency.
release.sh --formula-from DIR writes the formula for a published
release from its downloaded SHA256SUMS, checked against minisign.pub.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 09:34:18 -07:00
w3cjandClaude Opus 5.5 c3b9e89211 docs: the release key, and checking the install script with it
README.md, SECURITY.md and How it works' install page show the minisign
public key, and the install page links to Checking the install script:
download install.sh, SHA256SUMS and its signature, check the signature
with the key (minisign -Vm SHA256SUMS -P KEY), the script against the
sums (shasum -a 256 -c --ignore-missing), then run it. A key from the
docs, not the release, catches a release replaced whole.
TestDocsShowTheKey checks that every key in README.md, SECURITY.md and
docs/content is minisign.pub's, and that the three pages show it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 07:25:16 -07:00
w3cjandClaude Opus 5.5 7540715b06 build(release): the release key's public half and the tag signer's fingerprint
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 07:11:05 -07:00
w3cjandClaude Opus 5.5 8d44175601 refactor: the Go module is github.com/devvmhq/devvm
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 06:16:29 -07:00
w3cjandClaude Opus 5.5 15e063c616 chore: the Homebrew tap is devvmhq/tap
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 00:14:40 -07:00
w3cjandClaude Opus 5.5 f4f2ec6a8f chore: the repo is devvmhq/devvm
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 00:09:04 -07:00
w3cjandClaude Opus 5.5 5f7289e6f7 feat(cli): devvm upgrade, the newest release the way devvm was installed
devvm upgrade [--check] [--to VERSION] [-f/--force] [--json] installs
devvm's newest release the way this devvm was installed, asking first
(upgrade_confirm, answered by --force). upgrade is a top-level exception
in the cli skill: it acts on devvm itself, not this folder's VM, and it's
the name other tools give the verb. It skips the layout check, as a
layout a newer devvm wrote is a reason to run it.

- install.sh's (<prefix>/lib/devvm/<version>/devvm, which
  <prefix>/bin/devvm links to): SHA256SUMS and its .minisig over HTTPS,
  the signature checked against the key built in from
  packaging/minisign.pub (packaging/key.go embeds the folder; no file,
  no key, and upgrade_no_key), the archive's SHA-256, unpacked into
  lib/.<v>.new.<pid>, run (--version), renamed to lib/<v>, the link
  switched atomically (symlink beside, rename over), run again through
  the link, rolled back on any failure; then older versions pruned as
  install.sh does (kept: the one that ran, any a running process names,
  another upgrade's staging folder).
- Homebrew's (a Cellar/devvm/ keg): brew upgrade devvm, asked first,
  through the run log; --to refused.
- Anything else: says how it was installed (a checkout build, go
  install, a copy elsewhere) and fails.
- Already latest says so; a newest release older than this devvm is
  refused even with --force (rollback); --to installs a named one, older
  asked about (upgrade_confirm_older). --check and --json install
  nothing.

minisign verification is Go's: ed25519 over blake2b.Sum512 for the
default prehashed ED signature (legacy Ed refused), the key ID, the
global signature over signature||trusted comment, and the trusted
comment "devvm <version>" as scripts/release.sh writes it. Verified
against a signature minisign 0.12 made. golang.org/x/crypto v0.58.0
added for blake2b only (approved; depguard allows only
golang.org/x/crypto/blake2b); MVS raised x/text to v0.43.0 and x/tools
to v0.51.0. mise run vuln: no vulnerability reached; the module-level
GO-2026-5932 is x/crypto/openpgp, which devvm doesn't import.

New: internal/upgrade (Detect, Source: Latest, Check for the release
notice to call, Fetch; ParsePublicKey/Verify; Valid/Compare; Upgrader),
internal/upgrade/upgradetest (TLS release server, minisign signer;
tests only, a structure layer), fetch.Resolve (where a HEAD's redirects
end), fetch.Download's size cap (mise's 256 MiB too). Test-build
overrides: DEVVM_REPO_URL, DEVVM_RELEASE_KEY, DEVVM_RELEASE_CA,
DEVVM_TEST_VERSION; script command release_server [-badsig].

Security review (security-audit skill, guidance mode, a fresh reviewer):
- Prerelease order compared suffixes as text (rc.10 < rc.9), which let
  an older signed prerelease past the rollback refusal: fixed, semver
  precedence, with table cases.
- No cap on the archive download (a host could fill TMPDIR before the
  checksum failed): fixed, fetch.Download takes a limit.
- Two upgrades at once: prune removed another's staging folder: fixed,
  .<v>.new/old.<pid> folders are kept while that pid runs.
- A failed rollback of the link was silent: fixed,
  upgrade_rollback_failed names the link and the old devvm, and the new
  folder stays so the link isn't left dangling.
- QEMU's guestfwd names devvm with commas doubled, which the in-use check
  missed: fixed.
- Freeze (a host serving the current version as newest forever): no
  boundary crossed, inherent without signed expiring metadata;
  documented in internals/install.md.
Checked sound: nothing untrusted runs or unpacks before the signature
and SHA-256; versions from the redirect and --to pass Valid before any
URL or path; tar takes only regular files in its one folder (no links,
subfolders, ..), 512 MiB cap, fixed modes; test overrides are read only
by test builds.

Tests: minisign (real minisign fixture, tampering, legacy, other key),
each install kind against the fake TLS server, bad signature, wrong
trusted comment, replaced archive (wrong SHA), bad archives, a new
devvm that fails before and after the switch, a failed switch (old
kept), a failed rollback, downgrade refused and --to, pruning, Homebrew
via a brew script, Check, Latest's failures, Compare; CLI test
upgrade.txtar.

Docs: getting-started/install.md (Upgrading: how, what it checks, an
older release, --json), getting-started/commands.md (This machine row,
Upgrading devvm, questions, output for scripts), internals/install.md
(devvm upgrade), contributing (release_server), the CLI reference.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-05 22:47:23 -07:00
w3cjandClaude Opus 5.5 1917072228 refactor(backend): remove the Docker backend
devvm is about VMs, and Docker's containers aren't VMs: Lima is the
default backend and smolvm stays experimental. The backend architecture
(Backend, Caps, Require, the registry, backendtest.Fake) stays, so
another backend is an addition.

Removed:
- internal/backend/docker, its registry entry and Names/Experimental's
  docker half; devvm _docker-connect and _docker-ports
  (internal/cli/dockerssh.go); assets/docker/unpack.sh.
- Test-build overrides DEVVM_DOCKER_KIND, DEVVM_DOCKER_PROC_SYS,
  DEVVM_LINUX_BUILD_URL/_SHA256, the registry.linuxURL/linuxSHA256
  ldflags vars and the CLI tests' Linux-build archive (linux_release).
- Interfaces only Docker implemented, with their callers:
  backend.ProxySocket/ProxySocketOf (the proxy's -listen-unix),
  DiskUser (ls's and size's disk-over warning, size's disk_used and
  --json disk_used_gib), Reporter (doctor), LeftoverLister and Leftover
  (gc --orphans' volumes, networks, containers and images),
  DockerLayerVM and VMSpec.DockerLayer, SSHTarget.ProxyCommand and
  vmssh.SSH.Proxy, vmssh.SSH.SessionArgs, CacheEntry.Name.
- The docker layer's runtime on a backend that makes VMs for it:
  vm/dockerlayer.go, KeyDockerLayer, chooseNet's refusal (chooseNet
  returns a bool now), the refusals at start and devvm network on, ls's
  "(sysbox)" and --json docker_layer, size_disk_default_unused.
- The proxy's relay mode (relay.go, -relay, -relay-to, -listen-unix).
- paths.Dirs.Docker and paths.VM.Lifeline.
- assets/guest/tools.sh's linked-folder branch; services.sh's
  DEVVM_LOOP, DEVVM_DOCKERD and DEVVM_SSHD=inetd.
- Messages: every docker_* the backend used, docker_layer_runtime,
  net_docker_layer, net_off_docker_layer, committing_image,
  pulling_image, unpacking_tools, disk_over, size_disk_default_unused,
  gc_orphan_volume/_network/_container/_image, docker_connect_failed;
  gc_orphan_elsewhere reworded.
- Tests: docker.txtar, the docker stub's engine (its --from half
  stays), the ssh stub's login-shell branch; e2e's --backend docker,
  --engine, the docker host VM and Docker Desktop runs.
- Release: one GoReleaser pass, no Linux-build pin in the macOS builds,
  no Linux devvm in the Homebrew formula's libexec. Linux builds stay.
- Docs: backends/docker.md and internals/docker.md, design.md's Docker
  notes, the Docker column of the feature table, and every page's
  mentions of the Docker backend, Docker Desktop as one, and Sysbox.

Kept: the docker layer in Lima VMs, devcontainer docker-in-docker,
--from with images only a local Docker has, Docker Hub references.

State written by a Docker VM before this reads as an unknown backend
(backend_unknown_vm).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 10:26:07 -07:00
w3cjandClaude Opus 5.5 fcbea2c744 feat(docker): network policy, and build confinement on Docker Desktop
A Docker VM with network policy sits alone with a relay container on an
internal network of its own (inhibit_ipv4). The relay, devvm's own Linux
build in an empty imported image (read-only, every capability dropped),
copies the VM's connections to a unix socket of devvm's proxy on the
host, so tokens, the Keychain, the CA key and agents' logins never enter
Docker. On and off is docker network connect/disconnect at the next
start. Desktop builds run on a network and relay of their own, through a
host proxy allowing any host on ports 80 and 443.

- every Docker VM drops NET_RAW; it's in the config hash, so containers
  are made again from their commit
- confined: the start's ID, the VM alone on its network with the relay
  by its recorded container ID, the network still internal; a foreign
  member is docker_network_shared, at start and on removal
- proxy: -listen-unix, -relay/-relay-to; a lifeline pid file written
  after the proxy started whose process has gone ends it
- macOS fetches the release's Linux build on first use, checked against
  a SHA-256 the two-pass release.sh bakes in; builds without the pin use
  devvm-linux-<arch> beside devvm or refuse
- the build proxy is stopped through the process devvm started
- reviewed: design notes and threat check in design.md; e2e on the
  Linux engine and Desktop: dropped capabilities, network members and
  options, no IPv6 beyond the bridge's link-local, no DNS query leaving
  (captured, with an unconfined control), direct connections refused

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 05:08:03 -07:00
w3cjandClaude Opus 5.5 851e39ef86 build: embed devvm's files in its binary
devvm is one file: assets/ (base.yaml, layers/, features/,
shared-tools/, guest/, oci/, smolvm/) is embedded as assets.FS, which
cli passes to every constructor; backends, the builder, the shared
tools, the proxy and Ubuntu's key check read it as an fs.FS. Scripts
reach VMs on stdin (backend.Script carries their contents). What needs
a path (limactl create's base.yaml, oci/ mounted into the conversion
VM, the proxies' policy files) is written out to
~/.local/share/devvm/assets/<hash>, atomically, files 600 and folders
700; devvm gc deletes older copies no VM's proxy was started with
(gc_assets, deleted_assets). Release archives hold the binary with
README.md, CHANGELOG.md and LICENSE, and the formula installs the
binary alone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 18:12:37 -06:00
w3cjandClaude Opus 5.5 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]>
2026-10-25 17:08:33 -06:00
w3cjandClaude Opus 5.5 f42d436350 build(release): release.sh around GoReleaser, bump.sh
scripts/release.sh checks the signed tag (git tag -v) and its signer
against this checkout's packaging/release-signer, then runs goreleaser
release --skip=publish (--snapshot with --head) in a clone of the commit,
so only what's committed goes in. .goreleaser.yaml builds darwin/linux x
arm64/amd64 archives with the binary and its data files, a source
tarball and SHA256SUMS, with -X github.com/w3cj/devvm/internal/cli.version
(VERSION's version, for HEAD too). release.sh checks the host's binary
prints the version, signs SHA256SUMS with minisign and verifies it, fills
in install.sh (release_version, minisign_key) and the Homebrew formula,
which builds from the source tarball with Go (brew audit --strict clean).
--head takes DEVVM_MINISIGN_PUB for a test key, and skips a missing
install.sh; a tag without one is refused.

scripts/bump.sh writes the host mise's pins in internal/tools/mise.go.
VERSION and a fresh CHANGELOG.md. docs: maintaining.md (pins, releasing).
Tests: testdata/script/release.txtar (unsigned tag, no pin, another
signer, the checkout's pin, no install.sh), release_head.txtar (unsigned,
signed and verified, install.sh and formula filled in, only committed
files, wrong key, wrong version, bad install.sh, bad VERSION), bump.txtar
(crane, mise in base.sh and mise.go, hostile and missing values, --check
control characters, unknown tool). The sandbox sets DEVVM_REPO.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 23:04:37 -06:00