219 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 a8f0517579 feat(lima): devvm downloads Ubuntu's cloud image itself
Lima's download of the cloud image neither retries nor times out: one cut
in its 900 MB fails base's build, and a stall hangs it. devvm now
downloads the pinned image itself through fetch.Resumable
(ubuntu.Download), into images/ubuntu/<sha256>.img (Dirs.UbuntuImage),
resuming across cuts, stalls and runs, and gives Lima that file. Lima
2.3 checks a local file against the digest before it copies it.

- Before downloading, it takes the image from Lima's own download cache
  when that holds it with the pin's SHA-256: copied into a new file of
  devvm's own, mode 600, hashed as it's written, capped, stopped by the
  context, and kept only once it checks out. Lima's cache is never
  changed, and a base whose dated release Ubuntu may have removed still
  builds again.
- One devvm downloads at a time (images/locks/ubuntu-image), another
  waiting under ubuntu_image_waiting and looking again under the lock
  (TestUbuntuImageAfterWait, which fails without that second look).
- The download goes through the company proxy and trusts the user's CAs
  (Lima.Roots, from trust.Pool, which internal/cli passes through the
  registry), as do the Finder's lookups (TestNewTrustsRoots, and the
  registry's TestOverrides). An untrusted certificate is
  ubuntu_untrusted, naming the CAs' folder, one from a trusted CA
  that's for another host, out of date or not valid yet
  ubuntu_bad_certificate (check the clock and what answers for the
  host), and any other that fails to verify (a SHA-1 signature, a CA's
  name constraints, a key for clients alone) ubuntu_certificate_invalid,
  naming Go's reason, for the lookups (the listing, the checksums, their
  signature: TestLookupCertificates) and the download alike
  (TestLocalImageFailsFor), and a release Ubuntu removed (404, 410)
  ubuntu_release_gone, which names devvm rebuild base; none is retried.
  ubuntu_download_failed no longer starts with devvm.
- fetch.Untrusted, fetch.BadCertificate (an x509.HostnameError, or a
  CertificateInvalidError that's Expired) and fetch.Unverified (any
  failure to verify, with its reason, so every error the other two
  name), beside fetch.Gone, are the one
  place that tells a certificate's failures apart: Transient asks
  Unverified, the lookups and the download ask all three, host mise
  asks Untrusted, and a forbidigo rule keeps x509's and tls's
  verification errors in internal/fetch (TestCertificateClasses,
  TestTransient, testdata/lint, the owners doc's row).
- An https address, or a test build's file:// DEVVM_UBUNTU_URL, read
  from disk the same way; anything else is refused. The CLI tests'
  sandbox has a stand-in of this host's image in the store.
- Base's record keeps the image's address, and the key is as it was: it
  hashes the pin (release, file, digest), not the location.
- devvm gc --caches frees devvm's copies that no record names and that
  aren't pinned now, unchanged for an hour, a stopped .part and a killed
  import's .import included, and those of a kept image once its .img is
  there. A pin it can't read fails it.
- Of Lima's cache, it frees only an entry that devvm's own state shows a
  build of devvm's left: a base record names its address, devvm has its
  own copy of the image, and the installed Lima's own templates
  (share/lima/templates beside limactl, Lima.Templates) don't name it.
  An entry no record names may be the user's own Lima's, so it stays,
  and none is freed when the templates can't be read, with a line in
  the run log naming the folder and why. A test build's
  DEVVM_LIMA_TEMPLATES stands in for the templates folder.
- ubuntu.ParseImage reads a record's image as Image.String writes it,
  and ubuntu.IsSHA256 is the one check of a cloud image's SHA-256, in
  place of Lima's own regex.
- devvm space shows the copies as a cloud images row, freed by gc
  --caches, kept as state, as a release Ubuntu removed can't be
  downloaded again.

0.1.0's frozen state runs the new commands (fixture_v010_cloud_image):
devvm looks in Lima's cache under the SHA-256 of the address 0.1.0's
base record keeps and never changes the entry, base builds from devvm's
own copy, and gc --caches keeps that copy, frees Lima's entry the
record names and devvm's own stale copies, and keeps an older entry no
record names.

Docs: images.md (the download, its failures, the import, gc's rules),
space.md, backends/lima.md, settings.md (the lookups and the download
trust your CAs), troubleshooting.md, overview.md, testing.md,
tests.md, structure.md's internal/fetch row; the CHANGELOG's two Fixed
lines, which later commits make highlights, What to do 5 and 6, and the
release page's Ubuntu's cloud image in devvm's folder.

New messages: downloading_ubuntu, importing_ubuntu, ubuntu_image_waiting,
ubuntu_download_failed, ubuntu_release_gone, ubuntu_bad_certificate,
ubuntu_certificate_invalid, ubuntu_image_checksum, ubuntu_untrusted.
Lima.LocalImage is the seam, Lima.ImageClient the client.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-29 22:53:34 -07:00
w3cjandClaude Opus 5.5 2615a1322b docs: changelog entries by audience, with a test that keeps their shape
Releasing, in Contributing's maintaining.md, now gives the entry's groups
in their order (Highlights, What to do, Fixed, If you use… blocks,
Security hardening, Internal changes), what goes in each and the question
behind them, who notices; each line as one outcome sentence of at most 35
words, then its links; the release page as the full story; the sort table
and a fresh docs-voice review before the release commit; and how lines go
into Unreleased as changes land.

AGENTS.md gets a Changelog line, and the codebase-standards skill a
checklist item and its guard in rules.md. The rules that named the old
Breaking and After you upgrade sections (AGENTS.md, structure.md's
Released state, standards.md, rules.md) now name What to do.

TestChangelogShape (internal/cli/docgen/changelog_test.go) reads
CHANGELOG.md and checks each entry from 0.2.0-rc.1 on, and Unreleased
once it has a line: the groups and their order, three to five
Highlights, balanced <details> with a <summary> and the blank lines
GitHub needs, 35 words of prose a line outside What to do (links and a
credit not counted), a details link to releases/ on every line, and full
links for issues and pull requests. TestChangelogProblems breaks each
rule once on a small entry. lint:docs runs both.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-21 06:26:05 -07:00
w3cjandClaude Opus 5.5 b7178b0dc8 docs: the design notes move to Contributing
The design notes are for contributors: they hold each emulation's
design note, its threat check and its tests, with hundreds of Go
identifiers, so the page moves from How it works to Contributing
(weight 8, after Writing docs), keeping its title and anchors. An
alias keeps /docs/internals/design/ working, as a redirect to the new
page.

Every reference follows: the internals, using, safety and contributing
pages' links, the page's own links to the How it works pages, the
section index pages, AGENTS.md's Backends rule, contributing/docs.md's
What goes where, internal/proxy/README.md and two e2e comments.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-20 22:49:50 -07:00
w3cjandClaude Opus 5.5 654ade131f docs: release notes as actionable changelog entries, with the full story on the docs site's release page
The changelog's 0.2.0-rc.1 entry keeps Breaking and After you upgrade
complete, gives each Changed and Fixed item a sentence or two, and adds a
Hardening section of one-liners. Every bullet links its section on the new
Releases page, its issue as a bare #N, as earlier entries write it, and the
commit that made the change.

docs/content/docs/releases/ is a new section, after Using, with 0.2.0.md:
a section for each change, with what was wrong, how it showed, how devvm
works now and what to do, holding every fact the entry had.

Writing docs, the docs-voice skill and AGENTS.md say releases/ is the one
place docs describe history, and Releasing describes the entry's sections,
its links and the release page.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-20 21:02:25 -07:00
w3cjandClaude Opus 5.5 cb7177b32c feat(ui): waits for another devvm's lock show a status line; a project folder devvm can't read says so
Lock waits:
- platform.LockFile and LockFileShared take a platform.Waiting, called
  once they find the lock held, never when it's free, whose end they call
  once the wait ends; LockFileWaiting, LockFileSharedWaiting and their
  delays (ShareNote, OCINote, WaitNote, groupsNote, makingNote) go.
- msg.Waiting makes one from a Reporter's Status and a label;
  msg.WithStatus and msg.StatusOf carry the run's Status in its context
  for the two packages that take no Reporter, internal/state and
  internal/trust, which cli's execute sets; forbidigo keeps StatusOf to
  them, and AGENTS.md says so.
- Every lock that waits shows its own label: vm_state_waiting (a VM's
  state, its deletion), claims_waiting, layout_waiting, git_lock_waiting,
  ca_waiting, packages_waiting, rebuilds_waiting, ubuntu_pin_waiting,
  custom_secrets_waiting, forwarder_waiting, agent_store_waiting, and the
  waits that printed a line after a delay, which now show theirs as a
  status line: share_waiting, oci_waiting, image_build_waiting,
  group_waiting, making_waiting.
- An agent's login file's lock (agentlogin's lockLogin, a folder's flock
  that a VM's proxy holds while it refreshes the login) tries first
  without waiting and shows agentlogin.File's Waiting
  (agent_login_waiting) while it waits; secrets fills it from its
  Reporter, for SaveLogins, Claude Code's logins folder and every File.
- The structure test's status-lines rule counts a LockFile or
  LockFileShared whose waiting is nil as slow work; the build port's
  record, a file just made that never waits, is listed in statusSites.
- Without a terminal, or with -v, a status line draws nothing, so the
  waits that printed an info line after a delay no longer print it there;
  the CHANGELOG and the troubleshooting page say so. from.txtar's check
  that a free conversion lock printed no wait goes, as TestLockOCI checks
  it.

The layout's migration runs under a status line (layout_migrating),
only when there are migrations to run.

Backend calls outside a launch: TestCommandStatusLines runs devvm ls,
ports, size, network, tools, git-protect, history export, stop and rm on
a running and a stopped VM and fails on a backend call with no status
line showing, with a control that each makes one.

A project folder devvm can't open and read (vm_folder_unreadable) was
taken for another folder's VM (vm_other_folder, which offers rm and
adopt, and adopt went on); the finder now keeps why (target.unread), and
every command on the folder's VM, from the folder or a subfolder of it,
names the folder and why; devvm rm VM run elsewhere goes by the VM's
name as before.

platform.UniqueFolderID had no caller but its test: FolderStat.Unique,
from the open folder, replaced it; it goes, and its test checks
StatFolder's Unique instead.

Tests: TestLockFileWaiting (rewritten: called only when held, its end
once got or given up, shared too), TestVMLockWaits, TestCheckLayoutWaits,
TestCheckLayout (migrations under layout_migrating, nothing shown
otherwise), TestLockGroups, TestLockShare, TestMaking, TestLockOCI and
the build lock's test (status lines, not info lines), TestLockLogin,
TestInitCACancelled (ca_waiting), the status-lines rule's lock cases,
TestCommandStatusLines, TestUnreadableFolder (a subfolder of it too),
TestStatFolderUnique.

Docs: Contributing's CLI page (Status lines) and structure page, the cli
and codebase-standards skills (the guards), AGENTS.md's Go conventions,
internals/images.md and design.md (the waits), using/troubleshooting.md,
using/vms.md (a folder devvm can't read); CHANGELOG.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-19 15:10:22 -07:00
w3cjandClaude Opus 5.5 70ed1db7ef build(nilaway): nilaway:linux checks Linux's build and must pass before a push to main
CI's nilaway job only warns, so a new finding hides in a green run, and
a finding's key is its code path, so code that only moved can read as
new. mise run nilaway:linux runs scripts/nilaway.sh with GOOS=linux, so
nilaway checks the code as built for Linux, as CI's job does, from a Mac
too (a nil planted in a Linux-only file fails it there, where the plain
task passes); it exits 3 on a new finding and 1 on a stale line.

Contributing's Tools and tasks and Nil checks, AGENTS.md's tasks and
codebase-standards' rules.md say it must pass before a push to main.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-16 08:34:26 -07:00
w3cjandClaude Opus 5.5 ddb06b1ea7 docs(skills): the codebase-standards skill, a short checklist from what reviews kept finding, and how new code matches the codebase
A new project skill, .agents/skills/codebase-standards/, curated from
what reviews of devvm's whole history kept finding. A standard stays
only when it recurred or was costly, and a contributor can apply it
while writing or reviewing; what the linters and the structure test
enforce is only in rules.md's guard tables.

- SKILL.md: the checklist of 13 standards in four groups (safety,
  failures and processes, changes, tests), a Match the codebase
  section (names and files, comments, errors, dependencies as fields,
  table tests, scripts in the VM, prose), how to review a change, and
  the bar for adding a standard.
- standards.md: one section per standard, with its rule, what the
  reviews found and its guard:
  - Fail closed, on every path (a weaker mode only when visible,
    documented and chosen, as the proxy's warn-and-run without a
    sandbox)
  - Bound what you don't control (listeners, locks, overflow, a capping
    writer that doesn't embed its buffer)
  - Treat what a VM can write as hostile (descriptors, signed sources
    and re-hashing, escaping, host tools by absolute path)
  - Keep secrets and host data on the host (no argv or shared
    environment, allowlists into the VM, logs redacted)
  - Parse once, with a real parser (IPv6 and its IPv4-carrying forms)
  - Never fail silently, and name the real cause
  - Give every process an owner that ends it (accept loops included)
  - Survive a kill and a second devvm (one good copy, OS file locks)
  - Extend the owner, and wait for a third copy (an existing owner is
    always extended; a copy of a judge gets one owner at once)
  - Mind what's already running and released
  - Claim only what the code does, where precision belongs (headline
    pages keep their short claims)
  - Prove each fix with a test that fails without it (outside oracles,
    controls for absence checks, sandboxes proven by attack)
  - Write tests that pass on any host, at any load
- rules.md: the rules whose home is AGENTS.md or Contributing, by area,
  each with its guard or review only.
- AGENTS.md: a rule line for the skill and its row in the layout, and
  the owner rule's wait-for-a-third clause, which Contributing's
  structure page explains.
- Contributing's first paragraph links the skill.
- The docs-voice skill's scope, .vale.ini, mise run lint:docs
  (markdownlint and Vale) and TestCommandLines cover the new skill.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-16 07:50:54 -07:00
w3cjandClaude Opus 5.5 1793353dd9 feat(proxy): Linux confines the proxy's child with Landlock and seccomp
Before it reads a byte of the VM's, devvm _proxy-child confines every
thread of itself through proxy.confineSelf on Linux: no_new_privs
(syscall.AllThreadsSyscall), Landlock from ABI 2 (TSYNC from ABI 8) to
its logs folder, the Nix cache and the resolver's files (never /, the
home folder or one that holds it), binding no TCP port (ABI 4), scoping
signals and abstract sockets (ABI 6, or ABI 6/7 with erratum 2),
refusing named unix sockets (ABI 9) and UDP but to port 53 (ABI 10);
then a hand-written classic BPF seccomp filter, installed with TSYNC,
that refuses with EPERM AF_UNIX socket/socketpair, listen, io_uring,
ptrace, process_vm_readv/writev, pidfd_getfd, a file's mode, owner,
xattrs and times by its path (chmod, fchmodat, fchmodat2, chown, lchown,
fchownat, the six xattr calls, utime, utimes, futimesat, utimensat with
a path), truncate, the keyrings (add_key, request_key, keyctl),
prlimit64 on any pid but 0, setpriority, ioprio_set,
sched_setaffinity, sched_setscheduler, sched_setparam, sched_setattr,
inotify_init, inotify_init1, inotify_add_watch, fanotify_init,
fanotify_mark, execve, execveat, fork, vfork, unshare, setns, bpf,
userfaultfd,
perf_event_open, clone for anything but a thread or with a namespace's
flag, and clone3 with ENOSYS; it kills a foreign architecture's call or
an x32 number. fchmod, fchown, ftruncate and utimensat on a descriptor
stay. It checks the confinement holds, then proxy.checkConfined, and
that it still reads the host's addresses, within 2 seconds, or fails
the start. A kernel without Landlock or seccomp leaves that part out;
the child runs and says so. The broker sets itself undumpable
(PR_SET_DUMPABLE 0). The Nix cache marks a file used through its
descriptor. The broker's start, and its life with the child, take a
reset of the socket (ECONNRESET, Linux's end of a socket closed with
frames unread) as the child's end, as EOF is (socketEnded,
TestHandshakeChildGone).

Built on the Seatbelt item's shared owner, proxy.Confinement:
- internal/landlock (new, stdlib only, Linux build tags): Self, Result,
  Floor, ABIPorts/ABISignals/ABIUnix, ErrUnsupported; landlock_linux.go
  (resolverFolders, refusedFolder, homeFolder), filter_linux.go (filter,
  asm, encode, archOf), seccomp_linux.go, self_linux.go (Self, check,
  refused).
- internal/proxy: confineSelf on Linux calls landlock.Self;
  landlockConfinement words it (By landlock, seccomp; Why
  no-landlock-or-seccomp, no-landlock, no-seccomp, landlock-below-abi4,
  landlock-signals; full from ABI 6 with seccomp and scoped signals);
  confineChild takes the child's needs and returns an error, bounded by
  confineWait (within, confineWith); checkConfined only where Landlock
  or Seatbelt confines files; confineStarted; IO.confine required, set
  by ChildMain alone; hostAddrs.check; touch_linux.go and
  touch_other.go (touchFile, undumpable); IO.dumpable for tests.
- devvm doctor: netpolicy.Unconfined's Linux warnings
  (proxy_unconfined_no_kernel, _no_landlock, _no_seccomp, _old_ports,
  _old_signals).
- Tests: TestFilter and TestFilterBytes (an interpreter of the program's
  bytes, amd64 and arm64, and the assembler's refusals), TestSelf (a
  real confined child: outside file, ssh-like unix socket, listen, bind,
  signal, chmod, chown, setxattr, utimes, truncate, a keyring, unshare,
  exec, clone3, and new threads, fchmod, ftruncate and futimens kept),
  TestKernel, TestCheck, TestRights (refusedFolder), TestArchNumbers,
  TestLandlockConfinement, TestConfineWithin, TestCheckConfined,
  TestConfineStarted, TestRunChildOn, TestUnconfined; network.txtar; e2e
  network's Landlock, NoNewPrivs and Seccomp check.
- CI: a nocgo job (CGO_ENABLED=0) for internal/landlock and
  internal/proxy.
- Structure test, depguard, goroutineSites; docs: the child's sandbox,
  processes (and its why-Go note on unsafe), design (the network row's loopback follow-up on Linux,
  other processes and /proc without Landlock), doctor's checks,
  troubleshooting, attack vectors, Contributing, the proxy's README,
  AGENTS.md, CHANGELOG.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-15 22:04:32 -07:00
w3cjandClaude Opus 5.5 941c63c696 feat(proxy): the proxy's child runs under Seatbelt on macOS
On macOS the broker starts devvm _proxy-child through
/usr/bin/sandbox-exec -p PROFILE, by devvm's real path, with a
deny-default profile, so the child is confined from its first
instruction: devvm's binary to run and read, its folder's metadata,
dyld-support.sb, /usr/lib and /System/Library, the time zone and
resolver files, its logs folder and the shared Nix cache (regular
files only, no hard links, no folder removed, no flags, ACL, owner,
set-id or xattr changes), stat alone on the watched files and every
link on the way, trustd and trustd.agent, mDNSResponder's socket, TCP
and UDP out (loopback left to the floor: a rule for a loopback port
applies at once, which a profile fixed at the start can't follow),
sysctl but kern.proc, signals to itself. No home folder, no devvm folder but its
own, no Keychain, no other unix socket, no bind, fork, exec, signal to
or look at another process (process-info, the process list).

- internal/seatbelt: the shared owner of Seatbelt (Exec, String,
  Path, Links, ChildProfile, Sandbox.ProxyChild); sbString, sbPath and
  sandboxExec move here from the Lima backend, which uses them.
  ChildProfile refuses a relative path and the root.
- internal/proxy/confine.go: the confinement report every platform
  shares (Confinement, ParseConfinement, ReadConfined: one line of
  fixed words in run/proxy.confined, refused unless it parses, and
  unless it fits what the broker started the child with), the child's
  self-check (checkConfined: its broker's config must be refused), and
  the in-process hook (confineSelf, confineself_linux.go and
  confineself_other.go) for the Landlock follow-up.
- internal/proxy/childstart.go: startChild, childSandbox, childNeeds;
  IO.Seatbelt, set by devvm _proxy on macOS.
  A missing sandbox-exec, or one that failed before devvm's code ran
  (exit 65 or 71, or SIGABRT or SIGKILL, before the child answered,
  decided before the broker's own stop), starts the child again
  unconfined within the broker's 4 seconds, with a warning in
  proxy.log; any other failure fails the start. The broker makes the
  Nix cache's folders first. start carries how the broker started the
  child (Spawned).
- watched.get: a stat refused for want of permission reads through the
  broker each time (a watched link pointed elsewhere after the start).
- daemon.Handle.ExitCode and ExitSignal.
- devvm doctor warns for each running VM whose proxy's child isn't
  fully confined (netpolicy.Unconfined; proxy_unconfined,
  proxy_unconfined_unsupported, _no_sandbox, _sandbox_failed,
  _check_failed).
- Tests: TestParseConfinement, TestCheckConfined, TestReadConfined,
  TestStartChildSandbox (an over-claiming ready, SIGTERM),
  TestSandboxFailed, TestChildNeeds,
  TestWatchedStatRefused, TestUnconfined, TestString, TestLinks,
  TestChildProfile, TestProxyChild, TestChildProfileConfines (the test
  binary run again under the profile on macOS: flags, rmdir, the
  process list), doctor's report, ExitCode and
  ExitSignal; e2e network checks run/proxy.confined is full seatbelt
  on macOS.
- Docs: How it works' The child's sandbox, Processes, the design
  note's confinement and threat check (loopback as open work, other processes'
  details and kern.procargs2, the shared folders' flags, mDNSResponder's
  records, trustd.agent's trust settings, the fallback's signals, a
  ready that claims more), Troubleshooting's The proxy runs without a
  sandbox, Staying safe's escaping the VM, doctor's
  checks, Contributing's packages, the proxy's README, AGENTS.md,
  CHANGELOG.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-15 22:04:32 -07:00
w3cjandClaude Opus 5.5 aeea3135b2 feat(proxy): the proxy's broker and its child
A VM's proxy runs as two processes, as design.md's "The proxy's broker"
says: devvm _proxy, the broker, which keeps what only the host should
do, and devvm _proxy-child, which reads the VM's network and can be
confined by the follow-ups.

- wire.go: the protocol over one socketpair (close-on-exec from the
  start: SOCK_CLOEXEC on Linux, ForkLock elsewhere), length-prefixed JSON
  frames of at most 2 MiB, unknown fields refused, bytes as base64, one
  descriptor on a frame's first bytes (SCM_RIGHTS, MSG_CTRUNC breaks the
  rules), wire types for every secret (redact.Secret at once).
- broker.go: newBroker, the start (handshake: version 1 and each side's
  executable's SHA-256, within 4 s), the answers (value through lookups,
  kept 30 s or 5 min, a failure 5 s, dropped when the bindings change;
  file by number; link connected by the broker and passed as a
  descriptor; token exchanged by the broker), each by something in its
  own config, with caps 1/8/4/256; live: the lifeline closes the socket
  and kills the child 6 s later, SIGTERM stops it within a second, a
  child that ends ends the broker, a rule broken stops the child.
- child.go: the start (startOf), the child's server (newChildServer),
  the broker as hostSide over the socket (brokerClient), runChildOn;
  ready only after it reads the host's addresses (kept: the last good
  read), roots and time zone loaded first.
- process.go: Main(ctx, ...) and ChildMain; the child spawned with
  /proc/self/exe on Linux, PR_SET_PDEATHSIG from a locked thread
  (daemon.Cmd.DieWithThread), descriptors 3 and 4, and TZ, SSL_CERT_*
  and GODEBUG with updatemaxprocs=0 alone; run/proxy-child.pid and
  run/proxy.confined ("none" until the follow-ups); KeepLogs in the
  broker. ChildMain refuses to start unless descriptors 3 and 4 are a
  unix socket and an IP one (checkInherited): run by hand, without
  them, those numbers can be the Go runtime's own, which closing
  crashed it (signal_recv: inconsistent state).
- capture.go: a captured token request goes to the broker
  (captureToken, exchanger), so a login's real tokens never enter the
  child; an error reply passes up to 1 MiB, longer gets 502.
- watched.go: the child stats each changing file and asks the broker
  for it once it changed, keeping the stamp of what the broker read.
- rotate.go: proxy.log rotated by both through its descriptor, under a
  lock of a description of its own; OpenLog opens a log never through a
  link, one link, yours, replacing what a child left in its place.
- nixcache.go: the trim and its count through a safefile.Root, nar/
  only as a folder, links deleted as themselves; reads never through a
  link; the lock tried for 5 s (ErrNixLocked, nix_cache_locked).
- daemon: Cmd.Err, Files, Env, DieWithThread; Handle.Kill, Exit;
  WritePID.
- netpolicy: Proxy.Stop also stops a child that outlived its broker
  (run/proxy-child.pid, _proxy-child -for); proxy.log opened with
  OpenLog; a refused launch keeps a running VM only while both run.
  devvm network log and lock read the event log through safefile.
- vm, vmssh, vmlog: links.log and ports.log opened with OpenLog, read
  through safefile, trimmed only as a regular file with one link.
- backend: the build proxy's logs in a logs/ folder of their own.
- cli: _proxy-child; _proxy waits for its child on a signal
  (StopsItsOwn); the child reads none of devvm's folders (no
  makePrivate); ui.Files.
- Tests: FuzzBrokerFrames, the frames' rules, the handshake and the
  pair's end in synctest bubbles, the caps, the broker naming its own
  alone, the client over a real socketpair with a passed descriptor,
  ChildMain, TestInheritedSocket and proxy.txtar's child run by hand,
  the frozen 0.1.0 configs starting a broker and child,
  two writers rotating once, planted links, FIFOs and hard links; the
  testscript runner stops _proxy-child too; e2e: broker and child, their
  arguments, descriptors and environment, stop, SIGKILL either, planted
  files in the logs folder and the Nix cache, build proxies gone.
- Review fixes: the lifeline closes the socket and starts the kill's
  timer before logging; every log lock (proxy.log's, the event log's
  rotation) is tried without blocking for 200 ms (flockWithin, which the
  Nix lock shares), then written without or the rotation skipped; a
  copied log's rotation streams at most twice its limit from a line's
  start (copyFrom, copyAtomic); a reply too long to send goes as
  too_long; kept token headers capped at 1 KiB; the child gives up on a
  request whose context ended, dropping its late reply and holding its
  slot until then; a write deadline on the start frame; errors reach the
  child as codes (not_found, refused, busy, too_long, failed), their
  text in the broker's log; FuzzFrameStreams, and FuzzBrokerFrames
  writes from a goroutine; nix_cache_locked links to How it works.
- Docs: processes, network, overview, design (with threat rows for the
  logs' locks and a log made huge), troubleshooting, the proxy's
  README, structure, testing; CHANGELOG.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-15 22:04:32 -07:00
w3cjandClaude Opus 5.5 9c74dac11e fix(logs): a VM's logs are held to their caps while it runs
internal/vmlog owns every log a VM can drive but the proxy's own:
Limit (moved from vmssh's logLimit, with Allow for the link session's
warnings), Capped and Trim for ports.log and links.log while they run,
and KeepVM, which the VM's proxy (proxy.IO.KeepLogs, Config.VMLogs from
backend.Run.Logs) and a Lima build run on the serial consoles' and the
hostagent's logs: redacted as they grow (redact.FileFrom), so a reboot
in place can't leave the proxy password there, and rotated past 10 MiB,
counting what a log holds past the hole its writer left
(platform.DataStart).

The proxy's http.Server logs through its own limited log, and its
copied log counts what reached it as stderr; the build proxy's log is
held as a VM's proxy's is. git-pins.jsonl has a cap. Run logs take at
most 256 MiB together, never the newest or a live run's.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-15 22:04:32 -07:00
w3cjandClaude Opus 5.5 19f9900b86 fix(sshagent): a VM reaches its SSH agent only through its proxy's relay
OpenSSH's ssh-agent answers every request a forwarded connection sends,
so a VM that forwarded your agent or devvm's own (shared by every VM
that uses it) could remove all its keys (ssh-add -D), lock it with a
password of its own (ssh-add -x) or add keys without bound, denying the
agent to you and to the other VMs. Checked with a throwaway sshd and
ssh-agent: all three succeed over ssh -A.

Each VM's proxy now relays the agent its start chose on a socket of the
VM's own (paths.Dirs.AgentRelay, run/agent-<hash>.sock, mode 600), and
the VM's backend, devvm's own connections and the ssh entries for
editors name that socket. The relay passes on only
SSH_AGENTC_REQUEST_IDENTITIES, SSH_AGENTC_SIGN_REQUEST and the
[email protected] extension (so destination-constrained keys keep
their constraints), answers everything else with SSH_AGENT_FAILURE,
reads messages whole up to OpenSSH's 256 KiB, carries at most 16
connections and closes one idle for 2 minutes. A filtering relay rather
than an agent per VM: it covers your own agent too, needs no copy of a
key or a passphrase per VM, and fronts hardware and app-held keys.

- proxy: Config.Agent/AgentSocket (checked together, absolute), the
  relay in agent.go, listened before the proxy says it's ready; its
  accept loop backs off after an error that leaves the listener open
  (EMFILE), 5 ms doubling to 1 s, logging the first.
- daemon: AcceptRetry, vmssh's acceptRetry moved to the stdlib-only
  package the proxy already imports, so the relay, the port forwarder,
  the link session and a login's forward share one owner.
- netpolicy: Prepare takes a start's agent; a running VM's proxy keeps
  its start's agent from proxy.json (relayedAgent); Stop deletes the
  relay's socket.
- structure: paths.Dirs may have 62 methods (AgentRelay); the relay's
  goroutines in goroutineSites.
- sshagent: Made.Relayed, which RecordStart sets on every start of this
  devvm's whose choice forwards an agent, one without SSH_AUTH_SOCK
  included, and ReachOf(st,
  start): a relayed start gets the relay (or none while it's down), a
  start devvm didn't record (one outside devvm) gets none, or its
  proxy's relay, and only an older devvm's recorded start keeps the raw
  agent until its next start (runningConfinement, finder.inspect,
  sshconfig).
- vm: LeftoverSockets also finds a killed proxy's relay socket for
  devvm gc --orphans and devvm space.
- Tests: relay filter, wiring through Main, bounds and idle close, real
  ssh-agent/ssh-add/ssh-keygen through the relay, Prepare's relay,
  RecordStart/Relayed, sshconfig entries, vm agent tests, ssh_agent.txtar,
  an outside start in ssh_agent.txtar, and e2e checks that the VM can't
  remove, lock or add to your agent, nor the VM or an editor's
  connection remove devvm's agent's keys.
- Docs: processes (the SSH agents, listeners), ssh, attack-vectors,
  security, design, lima, overview, space, structure, proxy README,
  AGENTS.md, CHANGELOG Fixed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-15 22:04:31 -07:00
w3cjandClaude Opus 5.5 1b8fd8a639 test(lifecycles): synctest bubbles for the relays, the forwarder, the links, the proxy and the daemon's stop
Timeouts, graces and closes are tested in testing/synctest bubbles on the
bubble's fake clock, to the moment, instead of sleeping and polling on the
real one, with stand-ins in memory behind seams that are fields. Each kind
keeps one real-process test. No behaviour change: each seam's production
value is what the code did before.

Seams:
- vmssh: sshRelay{grace, start} carries a relay (pipeSSH's body, as
  pipeSSHFor was); start is execSSH in production.
- vmssh: Links.Listen (listenSocket unless set), for the links' sockets.
- proxy: egress.connect, the dialer for allowed far ends (a net.Dialer
  with its 15 s timeout, set in newServer).
- daemon: Proc.Alive (Alive unless set).
- proxy: httpServer, the proxy's http.Server as run serves it, which the
  tests' memServe shares.

New test-only package internal/memnet (standard library only): Pipe, whose
connections half-close, buffer 64 KiB and have deadlines, and Network,
listeners by address with Listen, Dial, DialContext and SetDeadline. The
structure test keeps it for tests and a leaf, depguard keeps it standard
library only, and its AfterFuncs are in goroutineSites.

Bubble tests:
- relay: TestRelayGrace (silent and talking, closed and half closed),
  TestRelayGraceSlowClient, TestRelayGraceWriteError,
  TestRelayCancelEndsBlockedWrite, TestGraceTimer (exact grace).
- forwarder: TestForwarder, TestForwarderAliveOnEnd, TestForwarderOnly,
  TestForwarderGap (reports exactly Gap apart), TestForwarderGivesUpSilently,
  TestForwarderClosesConnections (now also its stuck relay's ssh and slot).
- links: TestLinks, TestLinksSessionLost, TestLinksCap,
  TestLinksEndStuckRelays (memSSH; relays end at the next sync on removal,
  master replacement and target change), TestLinksList.
- proxy: TestTunnelHelloDeadline (EOF at exactly helloTimeout),
  TestTunnelHelloStall (and a hello whole a moment before the deadline),
  TestTunnelAddressSplitHello, TestConnectLimit, TestCloseConns,
  TestCloseConnsWaitsBounded (close gives up at exactly closeWait),
  TestSpliceEnds, TestSpliceEndsWhenItsClientCloses.
- secrets: TestSecretLookupFailuresNeverCached (hung lookups cut at
  lookupTimeout, cancelled, failed and empty ones never cached; a request's
  end doesn't cancel a lookup; the TTL to the moment).
- daemon: TestProcStopWaitsForTheEnd, TestProcStopKillsOnlyItsOwn,
  TestProcStopKillsAfterWait (fakeProc), TestFollowLifeline.
- TestCursorReplyScans uses httptest.NewTestServer.

Kept on real processes and the real clock: TestPipeSSHGrace,
TestPipeSSHGraceSlowClient, TestPipeSSHGraceWriteError,
TestForwarderEndsStuckRelay, TestLinksBurst, TestSpliceKeepsAnEarlyAnswer,
TestProcStop.

Docs: Contributing's Tests has Time and lifecycles; structure.md, _index.md
and AGENTS.md name memnet.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-15 19:36:41 -07:00
w3cjandClaude Opus 5.5 4d409589bb refactor(redact): every secret's value is a redact.Secret, revealed only where it's used
redact.Secret holds a value that lets whoever has it act as the user or
a VM, behind a pointer, so fmt's raw printing of an unexported field
shows only an address. String, GoString and Format print <redacted> for
every verb; MarshalJSON, UnmarshalJSON and MarshalText return
redact.ErrEncode, so a secret is never silently written as a stand-in
(which would lose a login); there's no LogValue. NewSecret ("" is the
zero Secret), Reveal, Empty and TrimSpace are the rest. internal/redact
joins the proxy's standard-library-only depguard group.

Reveal is refused by forbidigo outside tests; each of the 23 call sites
carries a //nolint:forbidigo saying why, and testdata/lint/forbidigo.go
keeps a call the rule must report. The structure test (checkSecrets)
refuses a struct that embeds redact.Secret outside internal/redact and
an interface that declares Reveal() string.

Typed now: proxy.Config.Password (configFile is the wire type, in
Config's order, held to it by TestConfigFile), the server's password,
proxy.Lookup and the cached values, upstream.auth, upstreamPassword,
Upstream.WithPassword's password; backend.NewProxyPassword, ProxyURL,
Confinement.ProxyPassword, BuildProxy.Password; netpolicy.Key and
NetMade.ProxyKey (netMade wire type); settings.CompanyProxy.Password;
secrets.Store.Value, saved, ProxyPassword, Token, Save, save, Get,
SaveKey, Yours.Save, Claude.Env, saveToken, oauthToken; agentlogin
File.Get, SetKey, ClaudeToken, every format's get, setKey and chatGPT,
refresh's refresh token, capture's access, refresh and id tokens, and
the JWT helpers (a login's map stays the wire, through token and
setToken; piKey is piBound); vm.Net.SecretSave, AgentLoginOptions.Key;
ui.UI.Secret. Strings by design: platform.KeychainGet/Set and the
desktop's VNC password.

Tests: TestSecret (unexported and nested fields too), TestConfigFile,
TestV010ProxyConfigs (0.1.0's proxy.json round-trips byte for byte),
TestFixtureStoreGet saves the Linux secret file back byte for byte,
checkV010Logins (login files read, copied and bound without a change),
secretCases, and e2e netNoLeaks, twice in the network section: every
VM's proxy password and the section's values, also as Basic
credentials, in no run log or proxy log, and the passwords in no
ha.stderr.log or serial log. Docs: Contributing's Secrets in the code,
the owners table, the secrets How it works page, design.md's Where
secret values live.

Fixed, found by netNoLeaks: Lima's boot script 07-etc-environment.sh
runs under set -x, so the console logs (serial*.log) kept the VM's
proxy password; redactLog now stars passwords in them as it does in
ha.stderr.log (CHANGELOG, overview, processes and attack-vectors pages).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-15 19:36:31 -07:00
w3cjandClaude Opus 5.5 cc94465400 test(leaktest): goroutine leak checks, and the leaks they found
A new internal/leaktest, standard library only, so the proxy's and the
daemon's tests use it too (depguard's proxy rule allows it, and the
structure test holds it to tests and to importing nothing of devvm's):

- leaktest.Main(m), in TestMain: once the tests pass, every goroutine's
  stack (runtime.Stack), a settle of 5 s, then a failure naming those
  still running, but the standard library's own that outlive every test
  (allowed: signal.Notify's loop, an HTTP client's idle connections);
  then Go 1.27's goroutineleak profile, which fails on any goroutine
  blocked for good.
- leaktest.Check(t), first in a test: its own goroutines, followed by
  parent through those still running, and by which ran before it, never
  by ID (each thread takes a batch of IDs).

Main runs in proxy, vmssh, daemon, desktop, ui, vm, backend/lima,
platform, cli and gitprotect (main_test.go, or the TestMain they had).
Check runs in TestLinksEndStuckRelays (replacing its NumGoroutine
count), TestForwarder, the desktop relay's serve helper, TestRunChild,
TestPinWaits, and the proxy's new close tests.

The structure test's goroutines rule (internal/structure/goroutines_test.go):
goroutineSites lists every function outside tests that starts a
goroutine, with a go statement, a wait group's Go, or time's or
context's AfterFunc, function literals in package-level vars included,
as "file: Func", with its waiter, or "detached: " and why nothing waits.
A new one fails until listed, a listed one that starts none fails, and
a package that starts one fails until its tests call leaktest.Main.

Leaks it found, each fixed with a test:

- The proxy's close left its connections running: http.Server's Close
  neither closes a connection a handler took (a CONNECT's tunnel, a
  WebSocket upgrade ReverseProxy takes) nor waits for a handler. conns
  (conns.go) holds every connection the listener accepted (track) and
  counts every handler (handle); serve calls closeConns once Serve
  returns, which closes them, closes any accepted after, and waits up
  to 5 s for the handlers. splice also ends when its client's
  connection can't be read (closed, reset), rather than half-closing
  the far end and waiting on it; a failed write to the server (one that
  answered early and closed) still lets its answer through. Tests:
  TestCloseConns (a tunnel and an upgrade), TestConnectAfterClose,
  TestSpliceEndsWhenItsClientCloses, TestSpliceKeepsAnEarlyAnswer; the
  tests' listen closes as the proxy does, and the fake upstream closes
  its target once its client's end comes.
- platform's runChild left its signal-passing goroutine blocked on a
  channel signal.Stop never closes; it now closes it and waits
  (TestRunChild).
- platform's WaitExit and WatchFolders blocked in poll(2) and read(2),
  which closing their fd from the stop doesn't wake on every kernel
  (Debian's didn't), and a retried call could land on a reused fd. They
  now wait in Go's poller (pollable), which the stop wakes (TestPinWaits,
  with a wait stopped before its process ends).

Docs: Contributing's tests page (Goroutine leaks), the structure page
(the goroutines rule, goroutineSites, the layers, the packages), the Go
lint rules' depguard line, the proxy's shutdown in How it works'
processes page and the proxy's README, and AGENTS.md. Coverage
baselines: internal/leaktest's line on both systems, netpolicy's raise
on macOS.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-15 19:36:28 -07:00
w3cjandClaude Opus 5.5 4e925492ca fix(proxy): every host is read in one form, proxy.NormHost, guarded by the structure test
Every check that judges or compares a host now reads it through
proxy.NormHost (internal/proxy/host.go), which also holds HostOK,
splitHostPort, hostASCII and asciiEqualFold: a host of printable ASCII is
lowercased in ASCII alone and loses its one trailing dot; any other host
stays as it is, so HostOK refuses it and no Unicode fold makes another
name match. A host with two trailing dots or more, or a dot after a
closing bracket, keeps them, so NormHost is idempotent and reading a host
twice can't turn evil.test.. into evil.test. A proxy.Host is what the
matchers take (rule.matchHost, noProxyRule.matches, local, sniMatches).

Brackets are strict (hostAddr): HostOK, Host.Addr and splitHostPort take
an address bare or an IPv6 address in one pair of brackets, never a stray
bracket ([[::1]], 1.2.3.4]) or brackets around a name or an IPv4 address
([evil.com]:443, [1.2.3.4]:443), which get 400.

Migrated: splitHostPort, sniMatches, sniHost, parseHostRule, the
policy's rulesFor, quiet, byName and coversOn, secrets.forHost,
parseNoProxy, route and local in internal/proxy; netpolicy.RiskOf,
Tickable and sameRule (devvm network rm and the duplicate check, so a
Kelvin sign never names the rule with a k); secrets.CheckHost;
from.publicHost (a name HostOK refuses isn't public);
agentlogin.claudeHost; vm.urlHostPort and privateHost. vm.urlHost
(cloneseed.go) keeps its own reading: it's a remote's ssh host, which ssh
lowercases and keeps the trailing dot of, to find a VM's alias.

Differential fuzz targets keep a frozen copy of each reader as it was and
allow only the decided differences: FuzzHostSites (proxy), FuzzRiskSites,
FuzzCheckHostSite, FuzzPublicHostSite, FuzzClaudeHostSite and
FuzzPromisorHostSite. A rule line is the same rule or no rule exactly as
before, so a broken deny stays a broken deny. TestFixtureHosts reads the
frozen v0.1.0 state's secrets.policy, secrets.json and links.json hosts
and finds them unchanged.

The structure test's new hosts check refuses, outside host.go and tests:
Trim, TrimLeft or TrimRight with a cutset holding ".", TrimSuffix or
CutSuffix with "."; ToLower, ToUpper, EqualFold and the TrimFunc family on
an argument named for a host; and a conversion to proxy.Host of anything
but a literal. Exceptions are by file and function, each with why
(request.go:trimDots, cloneseed.go:urlHost, cloneworktree.go:safeIndexPath,
cloneconfig.go:transportHelper, lima/start.go:machines.fillPassword). It
doesn't see slicing, strings.Map or variables not named for a host. The
owners doc, the proxy README, structure.md, design.md (One form of a
host), network.md and safety/network.md say so.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-15 19:36:28 -07:00
w3cjandClaude Opus 5.5 89f26c5771 docs(site): draw the diagrams at build time with pele, no Mermaid JS
The docs site's 18 mermaid blocks are now drawn as SVGs before Hugo
builds the site, by docs/render-diagrams.mjs with pele 1.13.0, and
inlined by a render hook, so no page loads Mermaid's 5.5 MB script.

- docs/render-diagrams.mjs: finds each mermaid block in docs/content,
  draws it with pele in Departure Mono at 14px (a measurer from the
  font's metrics), and writes <key>.svg and <key>.json (its size) to
  the git-ignored docs/.build/diagrams. pele draws edge labels,
  messages and notes at round(14 * 0.875) = 12px with no option, so the
  measurer gives that text its 14px width and the script rewrites
  font-size="12" to 14 on each small-text group (pele-edge-labels,
  -notes, -boxes, -frames); a guard fails on any such group without
  font-size="12", or small text outside them, and a self-check, run
  whenever there's something to draw, renders an edge label, a message
  and a note and fails unless pele measured them at 12 and wrote their
  group with font-size="12". It also fails on a diagram without
  accTitle and accDescr, or on an indented block. A newline after each
  </text>, outside any text element, lets the search index see labels
  as separate words; screenshots of all 18 are byte-identical with and
  without it. (Newlines between a label's tspans would move centered
  lines, so a label's own lines stay joined in the index.)
- Caching: a block's key is sha256(salt + "\n" + text)[:16], the salt
  being sha256("pele <version>\n" + the script's text)[:16], written to
  diagrams/salt. The script keeps every drawing already there, draws
  only missing ones (written to .tmp and renamed), prunes files no key
  names, and touches the folder. docs:diagrams has sources (the pages,
  the script, package.json, the lock) and outputs (the folder), so mise
  skips an unchanged run, and runs npm ci only when the lock's SHA-256
  differs from docs/node_modules/.devvm-lock-sha256. An unchanged run:
  0.45-0.75 s before, 0.02 s now (0.09 s forced); one diagram changed:
  0.09 s. CI's check job caches ~/.npm keyed on the lock; the Docs
  workflow, which publishes, keeps no cache.
- docs/package.json and package-lock.json pin pele 1.13.0
  (sha512-Ie8UKY9x00MsuR3jO6AzUwzK2Z6MIV3Tf4EDdITiuk8Uaz8K7g0R082WqsqNaSU8DdgkrRvZThzhit83mi/uiw==).
- docs/layouts/_markup/render-codeblock-mermaid.html: in place of
  Hextra's hook, reads the salt, computes the key from it and .Inner,
  inlines the SVG from assets/diagrams (hugo.yaml mounts .build/diagrams
  there), sets the wrapper's contain-intrinsic-block-size to the
  diagram's height and --devvm-diagram-width to its width, and errorf's
  when a drawing or the salt is missing. layouts/_partials/scripts/
  mermaid.html and params.mermaid go.
- custom.css: .devvm-diagram with content-visibility: auto, and pele's
  --pele-* variables from the palette (subgraphs, lifelines and notes in
  the border color). A diagram wider than the text reaches into the
  article's right padding (1.5rem, 3rem from 768px) as far as it needs,
  then into the left padding for the rest, so it never covers the table
  of contents; wider than both, it scrolls. From about 1010px no diagram
  scrolls, the four wide ones included (proxy checks 751px, agent store,
  VM states, SSH agent); at 900px five scroll. With the table of
  contents shown, the proxy checks take 48px on the right and 31px on
  the left.
- mise.toml: docs:diagrams, which docs and lint:docs depend on.
  docs.yml: the next and release jobs install node and draw the
  diagrams; the release job only when the tag has the script, so older
  tags still build.
- scripts/bump.sh: bump_pele, named only, replaces bump_mermaid: npm
  install --save-exact --ignore-scripts in docs, then mise run
  docs:diagrams, whose self-check catches a pele that changed how it
  draws small text. TestBumpCoversPins finds docs/package.json's
  dependencies (npm:NAME); bump.txtar tests --check and the install.
  The header and hextra's note say the mermaid render hook replaces
  Hextra's mermaid hook, so check it still has that name.
- Every diagram gets an accTitle and accDescr, which pele makes the
  SVG's title and desc (aria-labelledby, aria-describedby). Staying
  safe's columns are written in reading order, as pele lays subgraphs
  out from left to right. The proxy checks' description names every
  branch, and a hand-placed <br> keeps "CA)" off a line of its own.
- AGENTS.md: the one Node script; no other build script is JavaScript,
  and no other npm package is installed outside mise's tools.
  Contributing's docs, tools and
  maintaining pages describe the drawing, the caching, the margin, the
  task and the bump.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-15 19:36:28 -07:00
w3cjandClaude Opus 5.5 b6954e1e11 refactor(vmname): a VM's name is a vmname.VM, parsed where it's read
vmname.VM is the name of every machine devvm runs on a backend: a
project VM, an image's machine (devvm-img-<key>), a build VM and a
remake's aside. Fields, parameters, results and map keys that held a VM's
name as a string now hold a VM, from the backend interface down to the
CLI's --json structs, whose output is byte for byte the same.

Boundary parsers, the only places a string becomes a VM:
- vmname.Parse: a project VM's name (state's vm.json name, export file
  names, devvm _links's argument, the forwarder's -vm, project.Nth)
- vmname.ParseListed: one path element, for what a backend lists
- VM.UnmarshalText: JSON (Lima's list, proxy config and events, links'
  targets in state, link lists); empty stays no VM
- vmname.Image(key), VM.Aside(), and typed constants for Lima's build VMs
- msg.M.VM: the VM a message's function took, read back

vmname's functions on names became methods (Hash, Slug, Short, Aside,
AsideHash, ImageKey, IsProject); Lima's image prefix moved to vmname;
vmname.Join joins VM lists. Messages' vm and vm_name fields are typed
by the generator. Seven messages whose field took something else became
what= (backend_lacks, backend_unreviewed, backend_unreviewed_used,
starting, deleting, configuring, running_script) and rm_vm_failed's
name=: the text is unchanged, the names-mode scripts follow.
Review.RequireFor names an image or the tools being built.

Typed sites per package (added lines with vmname.VM, non-test): msg 347
(generated), vm 124, lima 48, backendtest 32, vmssh 31, netpolicy 22,
backend 16, gitprotect 14, proxy 11, cli 11, project 10, state 8,
ports 6, paths 3, sshagent 2, sshconfig 2, tools 2.

The structure test's owners rule now fails on a field, parameter or
result named for a VM (vm, vms, otherVM, vmName) typed string, []string
or map[string]…, and on converting anything but a literal to vmname.VM
outside the files it lists; internal/stubtest is free. depguard holds
internal/vmname to the standard library, and the proxy may import it.

ParseListed and UnmarshalText refuse a name starting with -, which would read as a flag in limactl's argv, and vmname.Image refuses a key that's empty, holds a / or NUL, or makes a project VM's name, so Lima's ImageSize and DeleteImage no longer check it themselves. The check also fails on a *string VM name and an alias of vmname.VM, and says what it doesn't see.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-15 19:36:28 -07:00
w3cjandClaude Opus 5.5 1ecd1faa73 build(nilaway): mise run nilaway against a triaged baseline, an advisory CI job, and two crashes it found
nilaway is pinned in mise.toml at its newest commit's pseudo-version (it
has no releases); bump.sh's dev-tools moves it, and TestBumpCoversPins
covers it through mise.toml:tool:*. mise run nilaway runs
scripts/nilaway.sh: devvm's own packages, not the tests or their helpers
(stubtest, backendtest), compared with testdata/nilaway-baseline.txt, the
findings triaged as false positives, each with its group (checked,
bounds, mapkey, nilsafe), keyed by file and trace without line numbers,
one line for each finding, compared as multisets. It exits 3 on a new
finding, a key found more often than the baseline has it included, and
1 when nilaway can't run, when a finding in its output can't be read,
or when a baseline line is stale or malformed. TestNilawayBaseline
checks each case with a stand-in nilaway. CI's nilaway job is
continue-on-error: it warns on new findings and lists the new and stale
ones, then every finding, in the run's summary, failing when the script
exits 1.

The first run reported 83 findings, 69 without the test helpers. Two
were real:
- agentlogin.Restore sliced above[1:] for a settings file that is one
  JSON string holding a placeholder, where above is empty, and
  devvm agent save panicked.
- agentlogin's readJSON returned a nil map, with no error, for a file
  that is null, which the Codex and opencode captures then wrote to. It
  now refuses it as not a JSON object.
The other 67 are the baseline. Both fixes get a CHANGELOG Fixed entry.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-15 19:36:27 -07:00
w3cjandClaude Opus 5.5 9535110f2f docs: user-page rule covers safety, backends and compared; strict section leads with today's behaviour
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-12 11:54:42 -07:00
w3cjandClaude Opus 5.5 a03f119427 docs: user pages lead with commands, and lint:docs fails a wall of prose
The user pages (getting-started, using, safety, backends, compared) now
show a task's command first, then lists, tables, steps and callouts.
Longer mechanism moves to the matching How it works page, linked, with
every fact kept (facts.sh against each parent).

- The rule: a line in AGENTS.md's Docs, the docs-voice skill's "Commands
  first on user pages", and Writing docs' "User pages lead with doing".
- scan.sh checks runs on every page (2+ paragraphs on user pages, 3+ in
  internals and contributing), prints each run's word counts, adds a
  `long` column (paragraphs and list items over 80 words or 4
  sentences), and exempts a colon-ended lead-in only up to 40 words.
- TestUserPageProse (internal/cli/docgen), run by lint:docs, fails a
  user page with a run of 3+ paragraphs where two are over 80 words, or
  any paragraph or list item over 150 words; TestProseProblems covers
  the rules.
- Pages: images (Base first, Outdated VMs after Rebuilding), vms,
  ports-size, links, space, settings, command-line, troubleshooting ("A
  command fails" as the skill's own after example), upgrading, desktop,
  from, customizing, safety/network, safety/git-protection,
  attack-vectors, backends.
- Moved mechanism: internals/network.md (Starting a VM on its tier,
  Requests by method and path, The VM's CA) and a new "The run log" in
  internals/overview.md.

On the user pages: runs of 3+ paragraphs 32 -> 0, paragraphs or list
items over 150 words 46 -> 0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-12 11:49:47 -07:00
w3cjandClaude Opus 5.5 17d082e4d9 docs(agents): restore two rules
A review of the slim-down found two lines lost and facts the pointers'
pages stated only in part.

- AGENTS.md: task IDs from any tracker never go in commit messages,
  code comments or docs (dropped with dex, not moved), and Lima's
  failed start of a running but degraded VM, which starting tolerates,
  are inline again.
- extending.md: Lima's Start owns env:, propagateProxyEnv, dns and
  hostResolver, and a project VM's size, agent mounts and forwardAgent;
  ports are never the backend's, vmssh.Forwards forwards them over its
  SSH.
- cli.md's Messages: a message made from an error carries it with
  .Because(err).
- structure.md's The packages: which packages use the standard library
  alone (fetch, redact, agents, jsonc, shell, vmname, safefile, daemon),
  proxy with daemon and safefile; devcontainer imports no outside
  module but uses image, jsonc, msg and shell. Its rows read as
  sentences, without semicolons.
- tests.md: the Go tests' introduction reads as full sentences.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-09 08:43:13 -07:00
w3cjandClaude Opus 5.5 4d4c728f38 docs(agents): point to the docs
AGENTS.md goes from 4,463 words to 2,454. The lines whose facts a page
holds become one-line pointers to that page's section; the safety
rules, the gate, ask first, the editor tools, dependencies, cleanups,
test seams, external tools, CGO and most gotchas stay inline.

- Layout: each row is the path and a short what; The packages
  (contributing/structure.md) has each package's concerns and
  identifiers.
- Tasks: one line pointing to Tools and tasks.
- Rules: image keys, docs and docs by reader point to Building tools
  and Writing docs.
- Go conventions: printing, ctx and nolint point to Go lint rules;
  failing, signals, LoggedCmd to CLI conventions; the layers to
  Messages; arguments to Command arguments; the structure test to its
  section.
- Backends: How a backend plugs in, Missing and unreviewed features,
  the feature table and What devvm sets on a VM.
- Messages: four lines pointing to Messages, Questions, Names mode and
  the docs-voice skill.
- Testing: the unit, CLI and e2e lines point to Tests and End-to-end
  tests; Linux hosts and unreviewed emulations to testing.md.
- Gotchas: Lima's degraded start (backends/lima.md) and
  lima.REJECTED.yaml (internals/lima.md) go to their pages.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-09 07:48:49 -07:00
w3cjandClaude Opus 5.5 79fc8dab63 docs(agents): fix stale lines
Factual corrections only, each checked against the code:
- Testing: Go tests make VMs only on the fake backend (unit tests call
  Launch.Up on backendtest); the CLI tests run the built devvm against
  the stubs, and e2e makes real VMs.
- assets/: base.yaml is base's Lima template; layers/ holds base's
  scripts, policy and Ubuntu's signing keys; network/ (the tiers' own
  policies) is listed.
- scripts/: test.sh is the test and coverage tasks' script, and
  coverage.sh, which it runs, checks the baselines.
- Tasks: lint:code and lint:docs list everything they run; test and
  coverage name their scripts; cli-docs also follows Example and the
  command's docs page.
- paths: a project VM's folder is Dirs.VMDir; forbidigo's
  os.WriteFile/os.Create/O_TRUNC exemptions are internal/state,
  internal/proxy, internal/msg/gen, internal/stubtest and tests.
- The testscript runner also stops port forwarders, link sessions and
  the stub ssh masters.
- e2e: the slots run in slots_test.go; sandbox_test.go has the
  sandbox, its slot's paths and lock, and e2eUbuntuRelease.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-09 07:21:01 -07:00
w3cjandClaude Opus 5.5 1bc77c9fbd docs(agents): drop dex
AGENTS.md no longer names dex: the tasks line, dex complete, dex edit
and the rule on task IDs go. One commit per finished task (its docs and
review included) and no commit before the gate passes stay, and a task
that turns out wrong or incomplete is said so, with the change
proposed. .gitignore keeps .dex/, so an existing checkout's task file
can't be committed by mistake.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-09 07:21:00 -07:00
w3cjandClaude Opus 5.5 f1d8f86a43 docs(contributing): keep every release's state working
Released state (contributing/structure.md) is the guide to the state
fixtures: what one holds; that each is generated once from its
release's own binary and never edited or regenerated, and a release
that changes nothing on disk adds none; the tests on every fixture
(stateFixtures, fixtureBinaries, storeFixtures, the per-release
fixture_v* scripts and the checks that each fixture has them); that a
change to state runs its new commands on every fixture in the same
commit; a Breaking changelog entry and a one-time notice at launch for
a change in what devvm does with existing state; freezing a release's
state at release time; and the support window: every release since
0.1.0 until 1.0, a release's fixture and compat code leaving together
in one commit that says so.

maintaining.md's release checklist gets the step that freezes
testdata/v<version>/, and AGENTS.md the rule, in one line linking to
the guide.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-09 07:20:52 -07:00
w3cjandClaude Opus 5.5 e7a62d3677 test(state): run the state fixture tests over every release's fixture
The tests of a release's frozen state (testdata/v<release>/<os>/) run
over every release folder, so adding the next release's state is its
folder and its expectations.

- internal/vm: stateFixtures() lists each release's expectations (its
  VMs, vm.json's version, the layout version, its one-repo clones, and
  check functions for its VMs, defaults and agent store); 0.1.0's are
  v010Fixture() in fixture_v010_test.go. TestFixtureVMStates,
  TestFixtureVMsRead, TestFixtureSettings, TestFixtureAgentStore and
  TestFixtureClonesReadAsOneRepo run once per release and system, and
  TestStateFixturesListed fails when a testdata/v*/ folder has no entry
  or an entry has no folder.
- internal/proxy: TestFixtureBindings and TestFixtureProxyConfig read
  every release's files; fixtureBinaries() records each release's and
  system's binary SHA-256. TestV010Rules stays 0.1.0's own grammar table.
- internal/secrets: storeFixtures() lists each release's Linux secret;
  TestFixtureStoreGet runs each, TestStoreFixturesListed checks every
  release with a linux/ folder has one.
- internal/cli: TestFixtureScripts fails when a release folder has no
  script that runs `fixture v<release>`, or a script names a folder
  that isn't there. The scripts stay per release (fixture_v010*.txtar),
  because their checks are of that release's VMs.

testdata/v0.1.0 is unchanged; its generate.sh and generate.txtar run
against the v0.1.0 tag as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-09 07:20:28 -07:00
w3cjandClaude Opus 5.5 62d54923ec docs: compared to other tools
A Compared section: devvm beside Docker Sandboxes, OpenShell,
microsandbox, smolvm, Claude Code's sandbox, Codex CLI, nono and
Codespaces, in two tables, with what devvm doesn't do, sources and a
last-checked date; a page on Docker Sandboxes side by side. Every
competitor claim links to that tool's own docs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-08 17:45:43 -07:00
w3cjandClaude Opus 5.5 b2b12ee55d feat(gitprotect): protect every repo nested in a VM's folder
A VM over a folder of repos now protects each nested git repo, not only
the folder's own: one walk (hostsafety.Walk, at most 4 folders down and
100 repos, no symlinks, one device) finds them, and each is locked on
macOS, pinned on Linux or watched where Linux can't pin, scanned within
its own top folder and the mount. A repo counts as covered only when a
scan locks its git dir; git dirs follow git's own rule, .git is matched
without case on macOS, and a recorded repo stays protected while
anything is at its .git. Repos the walk can't protect, that appear,
that leave or that look like bare repos are named, with the config keys
and hooks a VM-made repo would run. Existing VMs get a one-time notice
and opt in with devvm git-protect on. Ownership fails closed under one
host lock, so a VM never unlocks what another protects; one scan budget
covers every repo, and launches into a running VM check only the top
repo. devvm doctor gives a tip to set safe.bareRepository=explicit,
reading the user's GIT_CONFIG_GLOBAL when set.

Refs #3.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-08 16:34:40 -07:00
w3cjandClaude Opus 5.5 8f6b30a887 feat(secret): your own secrets, bound to the hosts you choose
devvm secret set NAME --host HOST[,HOST…] --env VARIABLE [--header H]
[--prefix P] [--stdin] saves a secret of your own: the value from a hidden
prompt or stdin (never argv) into the Keychain or devvm's secrets folder,
and its definition into custom-secrets.json. A VM that uses it (devvm
secret use NAME) gets only a per-VM placeholder in VARIABLE, and its proxy
puts the real value in that header only for those exact hosts, over TLS on
443; the hosts join that VM's allowlist. Names, hosts, headers, variables
and prefixes are checked; wildcards, addresses, internal names and other
ports are refused. One placeholder builder serves every secret and login,
and the proxy caches values by kind, agent and name.


After an independent review, a secret goes in only in four exact shapes
(alone; Bearer, Token or a saved --scheme in Authorization; the Basic
password; the Basic username only with --basic-user), values are
printable ASCII under 3,800 bytes, the proxy checks each binding against
its definition, definitions carry IDs and VMs record their hosts, and
custom values are stored apart from the known secrets.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-08 14:22:42 -07:00
w3cjandClaude Opus 5.5 017cc90a4a test(state): devvm 0.1.0's state, frozen, read and upgraded by today's devvm
testdata/v0.1.0/{darwin,linux} hold what devvm 0.1.0 itself left: four
VMs, its defaults, its agent store and logins, its image and tool records
and each --json it printed. The TestV010 tests in internal/vm read and
write back every field, and fixture_v010.txtar runs today's devvm on it:
each --json keeps all of 0.1.0's, read-only commands change no file, and
launches start each VM without a Lima edit, naming Codex's unknown login
field as withheld. Contributing's Released state says the fixture is
frozen.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-08 11:28:27 -07:00
w3cjandClaude Opus 5.5 423d3da279 refactor: owner rules from one source, and Contributing in topic pages
Contributing's table of the checks on owners is generated from ownerDocs
(TestOwnersDoc, -update), and TestOwnersAgree checks every owner the
structure test names has its row; the agent home-folder literals come
from agents.Defs. Contributing's index splits into topic pages (structure,
extending, cli, tests, docs), with the batch's own Contributing changes
in the pages that now hold their sections.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-08 10:06:28 -07:00
w3cjandClaude Opus 5.5 2b68a2347c feat(gitprotect): .git protection on Linux without root, through a user namespace around QEMU
On Linux, a start of a VM whose protection is on pins .git, its git dirs
and every lock path read-only in a user and mount namespace that devvm
_qemu pinned makes around QEMU. It keeps the pins while QEMU runs, records
each re-pin, refuses hard links and fails closed on watches and records;
doctor says why a host can't lock, and such hosts watch .git instead. The
pins' events file is read through safefile, and the command-line check
takes "devvm lock" in prose as English.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-08 10:06:17 -07:00
w3cjandClaude Opus 5.5 2865158e02 feat(network): learn the hosts a new VM needs, then lock it to them (#22)
--network learn runs a VM on the internet tier while it records the hosts
it reaches beyond its allowlist, shown as internet (learning). devvm
network lock picks which of them go into the VM's own rules, ticking only
reviewed registries on 443 and listing risky hosts apart, then gives the
VM the allowlist tier at once. learn is per VM only. The lock command
names its docs page in its about.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-08 10:05:59 -07:00
w3cjandClaude Opus 5.5 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]>
2026-11-08 10:05:29 -07:00
w3cjandClaude Opus 5.5 f5e6eebc55 refactor: one safe reader for files a VM can write
internal/safefile (standard library only) owns every read of a file a VM
can write or swap: Read and Open never block on a FIFO, follow a final
link only when asked, and check the opened file is regular, within its
cap and, with OneLink, singly linked; OpenRoot opens beneath a folder.
The proxy, secrets, agentlogin, devcontainer, detect, agent save and
gitprotect read through it, fixing three hangs on a FIFO the VM leaves,
and forbidigo holds those callers to it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-08 10:05:22 -07:00
w3cjandClaude Opus 5.5 3e81767482 refactor(cli): each command carries its own docs link, group and samples
A command's metadata moves from hand-kept tables into the command itself:
an about (docs page, help group, why no --json) set as its Cobra
Annotations. msg.commandDocs, commandGroups and withoutJSON are gone;
TestDocLinks reads the links from the generated CLI reference, and help
output and the reference are byte-identical. AGENTS.md's cli and vm rows
point at new doc.go package comments.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-08 10:05:13 -07:00
w3cjandClaude Opus 5.5 eaa1706966 docs: a unix socket's path has fewer than 104 characters
macOS's sun_path holds 104 bytes, its terminating NUL included, and Lima
refuses a socket path whose length is UNIX_PATH_MAX or more, so a path
has 103 characters at most. The internals pages (design, overview,
ports), AGENTS.md and the comments on paths.SocketMax, the forwarder's
control socket and the links' sockets said "at most 104"; they now say
fewer than 104, as the Lima backend page and NameMax already did. The
figures computed from the limit (a home folder of up to 37 characters,
ControlMax) already allowed for the NUL and stay as they are.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-07 19:26:55 -07:00
w3cjandClaude Opus 5.5 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]>
2026-11-07 19:16:40 -07:00
w3cjandClaude Opus 5.5 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]>
2026-11-07 19:16:35 -07:00
CJandClaude Opus 5.5 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]>
2026-11-07 10:44:25 -07:00
w3cjandClaude Opus 5.5 f2eac89211 fix(lima): on macOS, mount the project folder by its device and inode
A parent folder's VM can move a nested project folder aside and put a
link in its place. The checks around a start refuse what they see, but a
swap timed for the moment Virtualization.framework opens the share, and
put back before devvm's last check, made the nested VM mount the link's
target. On vz, the Lima backend now mounts the project folder as
location /.vol/<dev>/<ino>, from the folder devvm recorded (the state's
folder, passed as the new Want.ProjectID), with mountPoint set to its
path. macOS's volfs opens the folder by its inode wherever it is, so the
share is the recorded folder, never what's at the path.

Checked first on a real vz VM (Lima 2.2.1, macOS 26): vz and Lima accept
the /.vol location; with the folder swapped for a link before limactl
start the VM read the real folder's files at the project path, and wrote
there; limactl list --json keeps the location and mountPoint as set.
vz serves the share by the path the folder had at the start, so once
the folder is put back the VM gets Operation not permitted (as for any
rename while it runs) until its next start, and replacing that path with
a link while it runs gives the same: never the decoy.

The Lima backend alone decides it: projectMount (vz with a recorded
folder: by inode; otherwise, and on QEMU/9p, by path), used by CreateVM
(the image's vmType, which its clone has) and Start's wantEdits, which
now compares the project mount whole (location, path in the VM,
writable) through keptMounts, so a start edits nothing when they match
and limactl list's filled-in fields never cause an edit. Instance.Project
is the mount's path in the VM, so devvm's comparisons, devvm ls, devvm
ports and .git protection keep using the host path. mount_comma checks
the path in the VM too. platform.VolPath parses a FolderID. The checks
from the nested-replaced fix stay, as defence in depth and for Linux,
where 9p has no equivalent.

Docs: internals/lima.md (the mount, the compare), internals/overview.md
(what's checked and what stays open per OS), safety/attack-vectors.md
(the residual gap is Linux's only), using/vms.md.

Tests: TestVolPath (parsing; on macOS the path opens a moved folder),
TestProjectMountByInode (wantEdits on vz: as it is, another inode, moved,
a comma, a path mount before, no folder recorded, --clone; QEMU by path;
Instance.Project), TestCreateVMByInode (the clone's mount, no mount
edit), TestUp (spec and start carry the state's folder), TestUpClone
(none); e2e's project section: the folder swapped as limactl start runs
and put back when it returns, through the parent's VM (macOS: the VM
never sees the decoy, its mount is /.vol/<dev>/<ino> at the path;
Linux: noted), and the next start runs no limactl edit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 08:13:01 -07:00
w3cjandClaude Opus 5.5 a85cba7858 build(release): scripts/publish.sh, a release from a signed tag in one run
The maintainer tags main's HEAD (git tag -s vX.Y.Z) and runs
mise exec -- scripts/publish.sh, entering the minisign password once.
It checks the preconditions (release.sh --check for the tag and its
signer, main's HEAD and origin, a clean tree, gh logged in, minisign,
no other release, the tap's checkout clean on main), builds dist/ with
release.sh, prints the version, commit, files with sizes and SHA-256s,
the CHANGELOG entry and the tap's diff, asks once on the terminal, then
pushes main and the tag, makes the GitHub release as a draft with every
file and publishes it, and commits and pushes the tap's formula. Each
step skips what's done, a draft left by a failed run gets its files
again, and a failure says what was and wasn't published. --dry-run
stops before the question; --help.

release.sh gains --check (the tag's checks only, printing its commit),
fills in the formula's @URL@ and @SHA256@ only outside its comments,
and points at publish.sh in its last line.

Tests: testdata/script/publish.txtar (a local bare origin and tap, a
fake gh, SSH-signed tags, a passwordless minisign key): refusals (no
tag, a tag release-signer doesn't pin, a dirty tree, an existing
release without its files, gh logged out, no tap), --dry-run, n, y
failing at gh release create then at publishing the draft, the reruns
and the call order, and a run with everything done.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 07:56:07 -07:00
w3cjandClaude Opus 5.5 3904d8ccf4 chore: AGENTS.md no longer waits on the release keys
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 07:31:32 -07:00
w3cjandClaude Opus 5.5 2545de19f3 test(e2e): the Go runner is the entry point, mise run e2e -- FLAGS, and tests/e2e.sh goes
TestE2E already set up the sandbox, slots, locks and flags itself, so the
898-line script only handed over. The run is now `mise run e2e -- FLAGS`
(go test -tags e2e from tests/e2e, CGO_ENABLED=0) with the same flags:
--only, --from, --clean, --every-feature, --slots, --slot, --newest-base,
--golden, plus --reuse.

- options: the flags named as the script's options; the hand-over flags
  (lock-holder, count, total, started, summary) and the ported/unported
  split are gone.
- e2eUbuntuRelease, a const in sandbox_test.go, holds the Ubuntu pin;
  scripts/bump.sh e2e-ubuntu moves it (get_const), and TestE2EUbuntuPins,
  bump.txtar and the E2E workflow read it there.
- From the script into Go: the OpenSSL-not-LibreSSL host check, and
  --newest-base's start line and its UPSTREAM DRIFT summary.
- The script's leftover bash helpers (perl vm_state, no_leak, ca_*,
  lima_listens, the retry list, its heartbeat) are gone with it.
- mise's e2e:go task merges into e2e; TestCommandLines drops its $D rule.
- Docs (contributing, testing, maintaining, internals) and AGENTS.md name
  mise run e2e; testing.md's "Porting a section" becomes "Adding a section".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 01:56:50 -07:00
w3cjandClaude Opus 5.5 db90ab1b5b fix(tools): opencode 2 in VMs, with its Codex logins and its database
devvm's pinned mise (2026.10.7) resolves aqua's "latest" to GitHub's latest
release, which opencode keeps on its 1.x line (v1.19.5) while it publishes
2.x beside it, so ls-remote lists 2.2.5 but lock picks 1.19.5. The shared
tools' mise.toml holds opencode at "2", which locks the newest 2.x on every
platform (linux-arm64/x64 and their musl entries, the same assets as 1.x).

opencode 2 keeps its logins in its SQLite database and imports auth.json
once, as it makes its credential table. devvm agent login opencode runs
its Codex logins (opencode auth login openai --method chatgpt-browser or
chatgpt-headless), which still post to auth.openai.com/oauth/token with
Codex's client ID, so the capture and the host's refresh are unchanged;
its Sign in with ChatGPT (/api/accounts/oauth/token, a client of its own
and an id_token checked against OpenAI's keys) stays refused by the
proxy's guard. An API key saved into a VM whose opencode has made its
database is imported with opencode auth import (OpencodeKeyImport).

Tests: TestOpencodeKeyImport, the login argv, agent_login.txtar's import
and its failure, the guard on opencode 2's token-sharing path; e2e's
network VM gets opencode and a device-code login against the fake
endpoint. tests/e2e-mise.lock bumped (opencode 2.2.5, claude 2.1.318,
pnpm 12.18.0).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-05 23:17:00 -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 09f7f3b568 test(e2e): the Go end-to-end runner, tests/e2e, and its gc section
tests/e2e (build tag e2e) is the end-to-end runner in Go that takes over
tests/e2e.sh's sections one at a time. TestE2E is the run, with
tests/e2e.sh's options as flags (-e2e.only, -e2e.from, -e2e.clean,
-e2e.every-feature, -e2e.slots, -e2e.slot, -e2e.newest-base, -e2e.golden)
and its own -e2e.reuse. It keeps the sandbox (each slot's paths, Lima
home, XDG folders, Keychain service, ports +100 per slot, the lock),
devvm built from the checkout, config.toml and the pinned tool lock, the
host-tool check, the output lines (PASS/FAIL/SKIP/RETRY [n/N], times,
ETA), the heartbeat, each check's time limit (process groups: TERM, then
KILL), the timings files and the check-count guard (keyed by a checksum
of tests/e2e's Go files), the retry of checks marked Flaky, the slots'
plan, seeding (clonefile, reflinks) and summing, and the cleanup of only
what the run made.

Files: main_test.go (TestMain, TestE2E), options_test.go (flags),
sandbox_test.go, runner_test.go, check_test.go (S, Check, Skip, Flaky,
Builds, Tail, Needs), cmd_test.go (Run, Devvm, DevvmNames, Msg, Limactl,
InVM, Status), state_test.go (Paths: State, VMOf, VMDir, KeysOf, Record;
NewProject, Launch, Reuse, Layer, Own, Until, Settle, Port, Defer),
shared_test.go (Golden, GoE2E), slots_test.go, clone_{darwin,linux}_test.go,
sections_test.go (the table), gc_test.go (the gc section, its five check
titles tests/e2e.sh's word for word) and harness_test.go (TestHarness*,
no VM, run by scripts/test.sh).

tests/e2e.sh no longer has the gc block: after its own sections it hands
the chosen sections that go_sections lists to TestE2E in its sandbox and
under its lock, passing its pid, check count, expected total and start,
and adds the Go run's summary.go to its results. mise run e2e:go runs the
Go runner on its own. golangci-lint builds with the e2e tag; tests/e2e may
print, exit from TestMain, signal its own process groups, and run and read
its sandbox's commands and files.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-05 21:28:44 -07:00