The nightly fuzz run found an input that failed FuzzParse's own check, not
devvm: {"remoteEnv":{"A":"${${localEnv:}"}}. devvm reads each ${ to the
first } after it, so ${${localEnv:} is one variable whose name starts with
${, which it leaves as single-quoted text for the VM's shell, as the design
note intends. The check's pattern matched ${localEnv:} inside it.
The check now takes the variables as devvm reads them, non-overlapping
${...} to the first }, and flags only one whose name starts with localEnv:
or env:, in the environment and in what's kept. TestParse has a nested
${${localEnv:HOME}} in a variable and in a command, kept as text, and the
input is in the corpus. FuzzParse's row in Contributing's testing page
says how it reads them.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
devvm update now makes the folder's VM again from its devcontainer.json
as it is now when the file changed, is gone or appeared since the VM was
made, as well as when its image is outdated. devcontainer_changed and
devcontainer_new name devvm update instead of devvm rm, then devvm. A
file's forwardPorts now join the VM's ports as devvm ports add adds them,
for a new VM and when devvm update reads the file again.
- vm.json's devcontainer section records what of the VM is the file's:
image (the file's image, when the base starts from it), from_flag
(--from won), parts (what its features mapped to), gave (those the VM
got from the file alone, not from --tools/--layers, setup's layers,
the folder's other files, nor unchecked), ports (its forwardPorts) and
ports_gave (those it added to the VM's ports).
- devcontainer.Reread (pure) drops what the file gave that it no longer
lists and adds what it lists anew that the VM lacks; the user's stay,
and what the user took out stays out. It applies to parts
(rereadParts) and to ports (filePorts, through AddPorts and
RemovePorts, as devvm ports add and rm). devcontainers.reread
re-pins a new image (or falls back to $DEVVM_FROM's), keeps --from's,
and replaces variables and commands.
- The remake section carries reread (the new from, shared tools, ports
and devcontainer section; tools built for the new base after the
image) and was (what the VM had, kept when the new machine is made),
which the undo gives back, for every remake.
- Messages: devcontainer_changed/new reworded, devcontainer_reread and
devcontainer_gone added, devcontainer_ports_not_forwarded removed; the
docs link points at the new "Updating a VM from the file" section.
- Tests: TestReread, TestRereadParts, TestFilePorts, TestFileParts,
TestUpdateDevcontainer (undo and finish), TestUpDevcontainer and
TestPlanDevcontainerFrom (the file's ports added), devcontainer.txtar
(a new VM's ports, update after a change with the user's port added
and the file's removed, --from winning, the file removed, a file that
appeared), e2e's devcontainer section (the file's port reaches this
machine; devvm update, the home kept, the new port in place of the
old one).
- Docs: using/devcontainer (its ports, the security note), images,
toolchains, commands, the internals overview's remake section and
state table, the design note, the security model, attack vectors.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
image.SharedTools, a table of image.ToolDef (name, kind, members, the
files that call for it, its installer), is the one list of shared
tools. image.Toolchains, image.Agents, GroupTools, IsTool, IsAgent and
SortTools derive from it, and so do project.DetectFiles' toolchain
markers (the nix layer's own files stay in project), the lock's rust
case (image.NoDownload, for a tool rustup installs) and the
devcontainer features devvm maps to a toolchain.
Tests: TestSharedTools (the views, NoDownload, each member once),
TestSharedToolsPolicies (shared-tools' policies are one per shared
tool), and TestConfigTools now checks mise.toml's tools against the
table's members. The contributing page names the table and what adding
a shared tool takes.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
devvm _proxy takes one flag, -config, and running the proxy is Main's only
mode. What only the host does runs in devvm itself, through typed functions:
- internal/agentlogin (new; imports only fetch, jsonc, proxy and state):
File{Kind, Path, Salt, TokenURL} with VMCopy (the VM's copy and what it
keeps as it is), Bindings, Get (refreshing OAuth tokens), plus Hosts,
MCPSecrets and Redact. The salt is a parameter, not a global or
DEVVM_LOGIN_SALT. Login files are read with proxy.ReadRegular (no FIFO
hang, 64 MiB cap) and written with state.WriteFile; the refresh goes
through fetch.NewClient (HTTPS-only redirects, 30 s, reply capped at
1 MiB) with context.WithoutCancel.
- trust.InitCA makes devvm's CA (state.WriteFileMode), replacing -init-ca;
netpolicy's InitCA field is it, and proxy_ca_failed carries the error.
- internal/jsonc: devcontainer's JSONC stripper, now redaction's too; the
redactor's own copy changed commas inside strings.
- proxy.HostOK is exported for agentlogin's MCP host check.
- secrets.Store loses its Login seam and LoginKept; IO loses Stdin and Kept.
Tests: proxy.txtar's login, redact and init-ca cases become unit tests in
agentlogin and trust; proxy.txtar and TestMainRefuses check the old flags
are refused. New: TestRefreshOutlivesItsCaller, TestRefreshFails,
TestGetRefuses, TestLoginFileNotRegular, TestHosts, TestRedactRefuses,
TestRedactJSONKeepsStrings, TestInitCA, TestInitCAFails, TestBundle.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
internal/shell, a stdlib leaf: Quote, QuoteJoin and EnvName. They
replace the 4 shell quoters (lima's shq and shqJoin, docker's shq, vm's
and devcontainer's shellQuote) and the 4 variable-name regexes (docker's
envKey, vmssh's envName, vm's envVarName, devcontainer's envName).
lima's quoting tests move there as TestQuote and FuzzQuote.
internal/vmname, a stdlib leaf below project: Prefix, HashLen, IsVM and
SlugOf. project's vmName regex, IsVM and Prefix go (callers use vmname),
lima's projectVM, docker's hostname parsing and cli's export-name regex
use it. TestImageKey (lima) pinned imageKey before the change;
TestParseExportName covers the export names.
Value patterns exported once: from.IsDigest (lima's idPattern),
image.IsKey (build's keyLike and the keyPattern copies in lima, docker
and smolvm), image.ToolVersion (tools' versionLike) and image.ToolName,
with TestIsDigest and TestValuePatterns. state's featureName stays:
internal/state may not import internal/image.
netpolicy.PolicyFiles names a user layer's policy file only for a part
image.LayerName takes, so an image-name part such as ../x never names a
file outside the user's layers; TestPolicyFiles's ../x cases failed
without the check.
The structure test's owners check gets literals: a non-test string
literal holding '\'' outside internal/shell, or [0-9a-f]{14} outside
internal/vmname, fails, naming the owner. TestRulesFail has cases that
break and keep both. shell and vmname join the leaves' layer, and
devcontainer may import shell. Coverage baselines: shell and vmname
added at 100.0.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
internal/stubtest puts testdata/stubs first on PATH with a folder of its
own (New, New with only some stubs), reads and writes the stubs' files
(Calls, Reset, Touch, Write, Read, Path, Log) and has one ExecRunner. It
replaces the stub setups of the Lima, Docker and smolvm backends' tests,
vm's --clone tests and platform's Keychain tests, and the backends' own
execRunner, reset and touch copies. The structure test holds it to tests
and to importing only internal/msg.
msg.IDOf and msg.NamesOf replace the names(), isMsg, id and shown helpers
and the errors.AsType checks that only read a message's ID or names;
msg.Recorder replaces the inline recorders tests set as Info, Warn or Say.
backendtest.Stored replaces the four stored fakes with disks.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A value a VM made reached the terminal unfiltered wherever a caller
forgot msg.Shown, such as the errors passed as err.Error() and a link's
name. Four cleaners did the job in different ways: msg.Shown (quoting),
ui's printable and oneLine, netpolicy's oneLine and the port
forwarder's log (which let C1 through, in UTF-8).
msg.Printable and msg.OneLine are now the one cleaner: they drop C0 but
newline and tab (OneLine drops those too), DEL and C1, in UTF-8 or as a
lone byte. Every message value goes through OneLine as the message
renders, in Text, Segments and names mode, so no caller can forget it,
and msg.Shown is gone with its 68 calls. The status line, the run log's
end and verbose output, Pick, devvm network log, the forwarder's log and
a clone's status lines use them too.
Tests: TestPrintable and TestValuesArePrintable (internal/msg), the
hostile-value segments test, TestLogLimit (internal/backend/vmssh) with
C1 in UTF-8 and as a lone byte; TestCheckLinks and
TestNewVMOtherRepoAndCommondir expect the cleaned values.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A new VM gets what the folder's .devcontainer/devcontainer.json (or .devcontainer.json) says, on every backend: image as --from (only an image its registry gives anyone, asked anonymously, pinned to that digest, never a registry on this machine or its network), features devvm has layers for (docker-in-docker as the docker layer, node, python, rust, go), forwardPorts as far as the user's ports allow, containerEnv and remoteEnv in the VM's environment, onCreate/updateContent/postCreate commands once and postStartCommand at each start, in the VM as its user. --no-devcontainer skips it; the command line wins. Later launches only warn when the file changed.
Nothing from it runs on or reaches the host: initializeCommand never runs, ${localEnv} and the host-folder variables are refused, builds, Compose and docker-outside-of-docker are refused, mounts, runArgs and privileged ignored. The file is read through os.Root, without blocking, at most 1 MiB. A docker layer only the file asks for still asks about network policy on Docker.
Reviewed with the security-audit skill (FuzzParse, design note); e2e: project 69/0, docker linux 135/0, smolvm 131/0.
Co-Authored-By: Claude Opus 5.5 <[email protected]>