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]>
Lock waits:
- Tests record the label of each lock's wait that had none, the lock held
as by another devvm and the wait ended by a cancel, a deadline failing
one that shows nothing rather than hanging: git_lock_waiting
(TestGitLockWaits; .git protection's Serial is gitSerial, so a test can
reach it), packages_waiting and rebuilds_waiting (TestImageLocksWait),
ubuntu_pin_waiting (TestPinOriginWaits), custom_secrets_waiting
(TestYoursLockWaits) and forwarder_waiting (TestForwardsLockWaits).
- A test build's locks panic on a nil platform.Waiting
(platform.CheckWaiting, which the root's run calls in every test build
beside state.CheckLockOrder), so the CLI tests and e2e catch a nil wait
the structure test can't see, such as a zero agentlogin.File's; a
msg.Waiting given a nil status shows nothing and stays review only.
msg.Waiting with no status gives a wait that shows nothing, never nil;
platform.NoWait is the Waiting of a lock that never waits (the build
port's record, which passed nil), and the status-lines rule holds it to
statusSites as it does nil (TestCheckWaiting, TestWaiting, the rule's
NoWait case).
- forbidigo refuses syscall.Flock and unix.Flock outside internal/platform,
internal/proxy/rotate.go, the stubs and tests (testdata/lint, both).
- TestLockFileWaiting runs in a synctest bubble and checks the wait shows
while held, not before (its counters under a mutex, which the race
detector needs, as only the file's lock orders them).
Status lines:
- TestCommandStatusLines runs the setters too: devvm ports LIST and ports
add, size --cpus, network open, allowlist, transparent off and on, learn
and allow, git-protect off and on, ssh-agent off. It found devvm ports on
a running VM starting its forwarder again (ssh and a command in the VM)
with no status line; that step now shows ports_restarting.
The folder named twice:
- vm_folder_unreadable's why was the open's error, the folder's path in
it; folderUnreadable gives the system's reason alone when the error is
about the folder itself (TestUnreadableFolder checks the whole message).
- platform.OpenNoLinks and StatFolder return a link on the path as an
fs.PathError about the folder too (ErrLinkOnPath still matches), so that
case names it once as well (TestStatFolderUnique).
Docs: Contributing's CLI page (status lines) and structure page, the
codebase-standards guards; CHANGELOG (devvm ports' status line).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
forbidigo refuses os.Chmod, os.Chtimes, os.Chown, os.Lchown and
os.Truncate in internal/proxy, internal/vmlog and internal/vmssh, outside
tests: a change by path follows a link a VM swapped in after the open.
The two sites today, the proxy's SSH agent relay socket and the link
session's sockets, chmod a unix socket devvm has just made in its own
folder, which only its path can set; each says so in a nolint.
The safefile rule widens to internal/vmlog, which has no open of its
own, and to the proxy's rotate.go and nixcache.go, whose three opens to
write or lock say why in their nolints.
testdata/lint breaks the rule once for each function and keeps the
descriptor's own methods. Named as the guard in codebase-standards'
Treat what a VM can write as hostile and rules.md, and in the checks on
owners.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
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]>
internal/from had its own copy of the internet-address judge
(publicAddr, nonPublic) with a shorter table than the proxy's: no NAT64
or 6to4 decoding and none of IPv6's special ranges, so a registry at
64:ff9b::10.0.0.1 or fec0::1 passed it.
- publicOnly and publicHost ask proxy.Public; publicAddr and nonPublic
go. internal/proxy is the standard library only, so from may import it.
- forbidigo refuses netip.Addr.IsPrivate outside internal/proxy, as a
second judge would drift; testdata/lint breaks it once, and the owners'
table in Contributing's structure page names proxy.Public.
- TestPublicAddr checks publicHost and publicOnly, with NAT64, 6to4,
site-local and documentation rows.
- A CHANGELOG Fixed entry.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
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]>
msg.Safe is the one owner: a graphic character in any script is safe;
controls, bidi controls, format characters, variation selectors, private
use and the invisible fillers are not. Printable and OneLine drop what
Safe refuses, agent save's diff escapes it, and forbidigo bans
unicode.IsGraphic, IsPrint, IsControl and Bidi_Control outside
internal/msg.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
devvm set SSH_AUTH_SOCK process-wide from the finder's inspect, each
start and a new VM's plan, so later limactl calls and every background
process devvm spawned got whichever VM's agent was set last: a run that
reached several VMs (a group's sync, a link's change) could hand one VM
another's agent, and ssh-add -l checked the wrong agent.
- vm: Env.useAgent is gone; Env.agentSocket maps a choice to its socket
(devvm's, the user's from Environ, or none). The finder's found carries
agent, set by inspect and by bringUp from the confinement it returns;
found.exec passes it. start sets Confinement.AgentSocket for every mode,
runningConfinement takes the running mode and sets it too, and the sync,
devcontainer commands, --clone's seed, home copy, export, desktop and
the shell carry it.
- backend: ExecOpts.Agent, ShellOpts (Shell takes it), AgentSocket ""
means none; the backend never reads devvm's SSH_AUTH_SOCK.
- lima: limactl removes SSH_AUTH_SOCK from every command; Exec, Shell
and start (confine) set the VM's own; a degraded start's check carries
it.
- daemon: Spawn drops SSH_AUTH_SOCK from the child environment.
- Guard: forbidigo bans os/syscall Setenv, Unsetenv and Clearenv outside
tests and daemon/status.go; testdata/lint breaks it.
- Tests: TestAgentPerVM (two VMs, devvm's and the user's, in one run),
TestDetach (no agent), TestExecAndShell and TestProfileAgent (Lima's
per-command env), TestUpSSHAgent and TestOpenAgent check the shell's
and Exec's agents and that devvm's environment stays as it started.
- Docs: internals/security.md (how the agent travels), contributing's
forbidigo list and owners table.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
fetch.Client was an alias of http.Client, so &fetch.Client{} got past
NewClient's timeout and HTTPSOnly. It is now a struct only NewClient fills:
Do sends with the client's policy, Transport returns its own transport for
callers to change (ubuntu's file://, the public registry's dialer), and any
other Client fails every request with ErrNoClient, which isn't transient.
forbidigo's HTTP rule also bans http.Transport, and http.Client's Transport
field, outside fetch, the proxy and tests.
The os.WriteFile rule also bans os.Create and os.O_TRUNC, so a
truncate-in-place write outside state needs a nolint saying why. The four
left are not files written whole from memory, or are the standard library
only: tools' check log and a link session's log (a process writes them as
it runs), fetch.Download's file (streamed, removed on failure) and
daemon's pid and status files (one write, which readLine and readStatus
take as missing until its line ends). state's doc says so.
Tests: TestClientMadeByNewClient (nil and zero Clients send nothing and
aren't retried; NewClient's transport is its own); from's and build's
tests use the registry's own client trusting the TLS test server.
Fixture lines: http.Transport, os.Create, os.O_TRUNC.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The consolidation pass over the shared foundations:
- Lima's host address on its user-mode network, 192.168.5.2, is one
constant, limaHost, which the VM's proxy URL and the build proxy's
both use (proxyHostDarwin and buildProxyHost went).
- platform.LockFileShared had no caller: LockFileSharedWaiting with no
waiting does its job, and its tests use that. image.ToolName had none
either, and goes until the tools picker needs it. mise run deadcode
lists only what AGENTS.md names.
- tools' writeNew, a third whole-file writer, goes: the share's .sha256,
.target and idle files are written through state.WriteFile.
From the security audit of the phase:
- daemon.Proc.Stop sends SIGKILL only to a process whose arguments still
say it's this one. A process still ending, whose arguments can't be
read, is waited for; so is another process given the pid since whose
arguments can't be read either (a setuid one, on macOS), which would
have been killed. TestProcStopKillsOnlyItsOwn fails without it.
- forbidigo's signalling rule also bans os.Process's Kill and Signal
outside daemon and platform; tests signal their own children, and
devvm desktop's ssh child, not yet waited for, says why with a nolint.
testdata/lint has a line for each. Contributing's checks table says so,
and internals/network.md says which process SIGKILL goes to.
testdata/coverage/linux.txt is measured again with mise run coverage on
the x86_64 Linux host: it had no lines for fetch, shell and vmname, so
mise run test failed on Linux, and daemon was set by hand. arm64 (the
Linux host VM) agrees within a point. darwin.txt: daemon 97.8, tools
89.2.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
paths.FromEnv reads HOME, which must be absolute, and keeps it, cleaned,
as Dirs.Home; everything else takes the home folder from there. Six other
reads go: vm.NewEnv's and cli's devvm secret's os.Getenv("HOME"),
gitprotect.New's, Docker's and smolvm's os.UserHomeDir (Desktop's
settings file, the machines' location), and smolvm's Getenv("HOME")
(DiskDirs).
- vm.Env.Home and secrets.Store.Home are gone: both read Dirs.Home.
secrets.NewStore takes the Dirs alone; gitprotect.New takes the home
folder for ~ in git's paths.
- forbidigo bans os.UserHomeDir, with its line in
testdata/lint/forbidigo.go; the structure test's owners check gains
envOwners, HOME read only in internal/paths/dirs.go, with cases for a
read outside it, through a field, in paths and in a test.
Tests: TestFromEnv checks Home (and a HOME cleaned), TestNewHome (~ is
the home New is given, not the environment's), TestDiskDirs checks
Location too. Coverage unchanged.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
internal/state is the one writer of whole files outside the proxy:
state.WriteFileMode joins state.WriteFile for another mode (0700 for
the QEMU wrapper and Docker's copies of devvm's Linux build), and
state.PrivateDir makes a folder the user's alone (700), refusing a file
or a symbolic link there, as vmssh's runDir did.
- Deleted: both writeOwn (backend's build proxy, Docker's egress), lima's
writeFile (the Seatbelt profile, the QEMU wrapper, the start record),
vmssh's writeWhole and runDir, Docker's copyFile, the Linux build
fetch's temporary file (fetch.Open's body is read whole, its SHA-256
checked, then written with state.WriteFileMode), and Resolve's
.tmp-and-rename loop. The host's mise stays fetch.Download's.
- os.WriteFile to state.WriteFile: tools (Resolve's and lockVersions'
mise.toml, the checked file, the tools build's files), sshagent (two),
ubuntu's checksum files, docgen's pages and backendtest's fake tool
images.
- state.PrivateDir for nine MkdirAll and Chmod pairs (eleven folders):
the run log's two, tools' logs, secrets, netpolicy's CA, run, logs and
socket folder, lima's run folder and the exports folder. MakePrivate
and ~/.ssh keep following a link: where they live is the user's choice.
- The proxy's writers are one, writeAtomic: the login files' writeJSON
and the Nix cache's size file use it, its temporary files named
.<name>.tmp-* as state's are.
- forbidigo bans os.WriteFile outside internal/state, internal/proxy,
internal/msg/gen, internal/stubtest and tests, with its line in
testdata/lint/forbidigo.go.
Tests: TestWriteFileMode, TestPrivateDir (a symbolic link to a folder
refused, its folder's mode unchanged), TestWriteAtomic; mode checks on
the Seatbelt profile and Docker's Linux build copy. Coverage baselines
raised: lima, netpolicy, proxy, secrets, ui.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
internal/fetch (standard library only) owns how devvm reaches the web:
NewClient(timeout, HTTPSOnly|SameScheme) on a clone of net/http's
default transport, the Client alias other packages name, Retry and
Transient/TransientStatus (no answer, 408, 429, 5xx; never a refused
redirect, a bad request, a body over its cap or a SHA-256 mismatch),
ReadCapped, Open, Get, and Download, which keeps a file only when its
SHA-256 matches and leaves nothing on any failure.
- from: NewRegistry uses fetch.NewClient(HTTPSOnly); its own NewClient,
httpsOnly, errRedirect and transient go; the token GET is fetch.Get;
retry wraps fetch.Retry, keeping ErrNotFound and ErrUnreachable.
- ubuntu: NewClient is fetch.NewClient(SameScheme) with file://
registered; sameScheme and errRedirect go; fetch is fetch.Retry over
fetch.Get.
- tools: mise's client is fetch.NewClient(HTTPSOnly); its download is
fetch.Download, which checks the pin before the file is kept.
- docker: devvm's Linux build is fetched with a client of its own
(HTTPS-only redirects, a Client seam on linuxFinder) instead of
http.DefaultClient, and retried twice on a failure that may pass or
an archive cut short; an archive without a devvm (errArchive) isn't.
forbidigo bans http.Client, DefaultClient, DefaultTransport, Get, Head,
Post and PostForm outside internal/fetch, internal/proxy and tests; its
line in testdata/lint/forbidigo.go fires. internal/fetch is a leaf in
the structure test's layers.
Tests: fetch's TestRetry, TestRetryUnanswered, TestRetryCanceled,
TestTransient, TestRedirects, TestReadCapped, TestDownload; first,
characterising the callers, from's TestDigestRetries and tools'
TestHostMiseRedirect; docker's TestFetchLinuxRetries. Coverage
baselines: fetch 95.2 (new), from 87.1 to 91.3, ubuntu 88.7 to 92.5,
tools 87.9 to 88.6, docker 80.8 to 81.1.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
internal/daemon (standard library only, so devvm _proxy uses it too) owns
devvm's background processes: Detach and Spawn (own session, no input,
reaped once they end, DEVVM_DAEMON_STATUS naming the process's own status
file), Handle (signals through the process started), Proc (a pid file
checked against the process's arguments, Stop: SIGTERM, a wait, SIGKILL,
the pid file removed once stopped), readiness by status file (Ready,
WriteStatus, WaitReady: the pid and data, written in one line-ended
write, never another start's), Alive and Signal (no pid below 1), and one
lifeline meaning (FollowLifeline, Lifeline.Holds and Wait: content
equality, a bounded wait past what the file held first).
It replaces netpolicy's proxy pid, stop and start wait, vmssh.Forwards'
pid, stop and start wait, the build proxy's process and log-read port,
links' link-session pid, stop and start, the proxy's watchLifeline and
vmssh's lifeline reading, platform.StartDetached/StartDetachedProcess,
and the alive copies (netpolicy alive/signal, lima alive,
vmssh.ProcessRuns, smolvm runsOn's). The three log-scraping waits go:
the proxy and the forwarder say they're ready in a status file, and the
build proxy's port comes from its own.
forbidigo bans os.FindProcess, syscall.Kill and unix.Kill outside
internal/daemon and internal/platform, with its line in
testdata/lint/forbidigo.go; the structure test lists DEVVM_DAEMON_STATUS
and puts internal/daemon among the leaves; depguard holds it to the
standard library.
Tests: daemon's own (detach, handle stop, a reused pid, a stale pid file,
groups refused, readiness, lifeline), characterisation tests first for
the proxy's, the forwarders', the link sessions' and the build proxy's
pid handling; coverage: internal/daemon 97.7%, lima 87.6 to 87.7.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
AGENTS.md gets the rule, linking Contributing's new "One owner for each
concern" section: the checks on owners, agreement tests and the
consolidation pass the reviews run.
- forbidigo: testbuild.On only in internal/cli (readOverrides).
- testdata/lint/forbidigo.go breaks every forbidigo rule once on a line
marked "// want forbidigo"; lint:code fails unless forbidigo reports
exactly those lines.
- The structure test's owners rule, as forbidigo can't see arguments:
exec.Command/CommandContext of "git" (literal or constant, any import
name) only in internal/hostgit, tests aside; a Getenv/LookupEnv call
(any function or field of that name) of a DEVVM_ variable only in
internal/cli/overrides.go, or where envSettings lists it
(DEVVM_NO_TOOL_CHECK, DEVVM_LIMA_HOME, DEVVM_SECRET_SERVICE,
DEVVM_FROM, DEVVM_MESSAGES, DEVVM_LOGIN_SALT, DEVVM_GUESTFWD), a listed
file that stops reading its variable failing. TestRulesFail's
ownerCases break and keep both.
Co-Authored-By: Claude Opus 5.5 <[email protected]>