Repository navigation
Start the tray's child programs with an allow-listed environment - #4350
Conversation
|
APPROVE (static review plus the checks listed; two non-blocking follow-ups) Ran: Spawn sites: every macOS app launch: HOME, PATH, TMPDIR, USER, LANG, SHELL, TERM, CF_USER_TEXT_ENCODING are kept, plus NODESPACE*/NODESPACED/XDG_/LC_*. The app itself reads almost no environment (NODESPACE_HOME, HOME). The database variable set after the clear (tray.rs:808) is kept. I see no way the clear breaks the macOS launch. Findings, non-blocking:
|
…vironment A child_env module clears the inherited environment and rebuilds it from an allow-list for the tray's ps, taskkill and desktop-app spawns. A scan test fails on any other production Command::new in the daemon crate. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
ce12e3d to
6f4c0b8
Compare
The tray started
ps,taskkilland the desktop app with the daemon's full environment. They now go throughpackages/daemon/src/child_env.rs, which clears the environment and rebuilds it from an allow-list: PATH/HOME/USER/LANG/TMPDIR and the Windows loader variables for helpers; for the app also the display session, Windows profile folders, and the product's own names (NODESPACE_*,NODESPACED_*,XDG_*,LC_*). Credentials in the daemon's environment no longer reach these children.The agent's PTY child and tool programs already clear their environment inside
nodespace-agent(untouched). A scan test fails if any other production code in the daemon crate uses a bare process-start call, so a new spawn cannot skip this.Security-sensitive: changes what environment child processes receive. The allow-list for the app is a judgement call (a variable the app needs and is missing from the list would be absent on a given platform; the Windows and Linux lists are not run here).
Tests added (all mutation-checked): helper gets only base vars (removing env_clear fails it), app gets its names and not a planted credential (skipping the UI names fails it), source scan (reverting tray's
psto a bare spawn fails it). Existing tray tests pass;bun run test:changedpassed.Not covered: the design document states every child process runs scrubbed; that document lives in the NodeSpace workspace and was not edited. Spawns in the CLI and in
desktop-app(daemon_setup, which starts the daemon and system tools like launchctl from the app process, not the daemon) are not changed here.Closes #4306
🤖 Generated with Claude Code