Files
devvm/tests
w3cjandClaude Opus 5.5 12d1a84149 fix(redact): proxy passwords stay out of Lima's hostagent log and guest commands' output
Lima's hostagent logs a proxy variable's value, password and all, as it
starts a VM (Lima's cidata setupEnv: a loopback proxy pointed at the
guest's gateway, an override of the system's value, or a value it can't
parse), into <lima home>/<vm>/ha.stderr.log. For a VM without network
policy that's the shell's HTTPS_PROXY. devvm's run log already redacted
the copy limactl start prints; Lima's own file kept it.

Start now redacts that file once limactl start ends, started or failed:
each password becomes as many "*", in place. Lima creates the file with
os.Create (no O_APPEND) and the hostagent keeps writing at its own
offset, so the file keeps its length and every other byte, and Lima goes
on where it was. Keeping the password out of the hostagent's
environment would keep it out of the guest too (Lima writes the guest's
/etc/environment from it), so apt and curl there couldn't use the
company proxy. A file devvm can't change warns (lima_log_unredacted).

Output written through UI.LogWriter() (guest commands: a VM's setup, the
home folder's copy, devcontainer.json's commands) now goes through the
run's one redacting writer, flushed at a logged command's start, at
DieLogged and at the run's end.

The patterns and both redactions have one owner, internal/redact (stdlib
leaf): String, the run log's (moved from ui's redact), and File.

- redact.String, redact.File; ui: LogWriter's redacting, flushLog;
  lima: redactLog; message lima_log_unredacted.
- Tests: TestLogWriterRedacts (fails without the fix),
  TestStartRedactsTheHostagentLog, TestString, TestFile; e2e's network
  section restarts its VM without network policy behind the run's
  loopback company proxy, its fake password read from a file: the guest
  has and uses the proxy, the run logs hold <password> only and
  ha.stderr.log stars only.
- Docs: troubleshooting's run log, network policy's Without network
  policy, Contributing's layers and e2e network section.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-04 12:52:42 -07:00
..