Skip to content

Scan daemon child spawns structurally; extend the app's Linux and Windows variables - #4386

Merged
mstomar125 merged 2 commits into
mainfrom
issue-4359-child-env-scan
Nov 26, 2026
Merged

mstomar125 merged 2 commits into
mainfrom
issue-4359-child-env-scan

Conversation

@mstomar125

Copy link
Copy Markdown
Contributor

Scan

The source scan in child_env.rs cut each file at its first #[cfg(test)] and matched text. It now parses each file with syn (dev-dependency) and skips #[cfg(test)] items wherever they sit; it finds Command::new through use ... Command as C, type C = Command, spacing, use as a value, and inside macro arguments. The real daemon source has no hit, so no production spawn was hiding. Tests plant each hole.

Allow-lists (owner decisions flagged)

The app's environment gains: GTK_/GDK_/WEBKIT_ families, LOGNAME, LANGUAGE, SSL_CERT_FILE/DIR, NO_PROXY (Linux); ProgramFiles (+x86/W6432), CommonProgramFiles*, ALLUSERSPROFILE, PUBLIC, SystemDrive, COMPUTERNAME, USERDOMAIN, SESSIONNAME, PROCESSOR_ARCHITECTURE/ARCHITEW6432, NUMBER_OF_PROCESSORS, OS (Windows).
Owner decision: LD_LIBRARY_PATH and HTTP_PROXY/HTTPS_PROXY/ALL_PROXY are deliberately NOT passed: the first redirects library loading, the proxy URLs can embed credentials. Add them if the app must work behind a proxy.

Tests and mutation checks

New: three scan tests and the_app_gets_the_linux_and_windows_variables_it_needs. Each mutation reverted and verified failing: truncate-at-cfg(test), ignoring cfg(test), alias handling, macro scan, new path match, removing the three prefixes, removing a Windows name, swapping NO_PROXY for HTTPS_PROXY, removing OS. quality:fix and test:changed green.

Not exercised

Not run on Windows or Linux: the lists are made correct from the code and docs, and the test shows their effect on any host, but the app was not launched from the tray on either OS. Please check that before relying on it.

Closes #4359

🤖 Generated with Claude Code

@mstomar125

Copy link
Copy Markdown
Contributor Author

Review round: is_test_only accepts only cfg(test) or cfg(all(test, ..)); aliases are collected across all files to a fixed point (pub use .. as, type =, chained renames); ::new and std::process::Command::new are found; macro $c::new fragments are flagged. Scope, stated plainly: this is a Command::new scan over packages/daemon/src only; posix_spawn, system, execve, openers (open::that, webbrowser), build.rs and tests/it are out of scope, and clap's Command is flagged too (loud over-flagging accepted). The GTK_/GDK_/WEBKIT_ prefixes are replaced by explicit harmless names (GDK_BACKEND, GDK_SCALE, GDK_DPI_SCALE, GTK_THEME, GTK_USE_PORTAL, WEBKIT_DISABLE_COMPOSITING_MODE, WEBKIT_DISABLE_DMABUF_RENDERER); the code-loading names (GTK_MODULES, GTK_PATH, GTK_IM_MODULE_FILE, GTK_EXE_PREFIX, GDK_PIXBUF_MODULE_FILE, GDK_PIXBUF_MODULEDIR, WEBKIT_EXEC_PATH, WEBKIT_INJECTED_BUNDLE_PATH, WEBKIT_INSPECTOR_SERVER) are in the withheld test. Mutation checks: any-cfg skipping, per-file aliases, qself, macro fragment, single-pass alias chain, GTK_ prefix re-added, a dropped name, and all/any confusion each fail a test. test:changed was not re-run after this round (disk below 20 GiB); targeted child_env tests (9) and quality:fix passed.

mstomar125 and others added 2 commits November 26, 2026 10:51
…tend the app's Linux and Windows variables

The scan parses each file instead of cutting it at the first cfg(test), and
sees aliases, spacing and macro bodies. The app allow-list gains the GTK/GDK/
WebKit families and the Linux and Windows names the app needs.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…lified paths, macro fragments; name the webview variables the app gets

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@mstomar125
mstomar125 force-pushed the issue-4359-child-env-scan branch from bd4ad54 to b332530 Compare November 26, 2026 09:51
@mstomar125
mstomar125 merged commit d0c0d0f into main Nov 26, 2026
@mstomar125
mstomar125 deleted the issue-4359-child-env-scan branch November 26, 2026 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tighten the daemon child-process scan and check the Windows and Linux environment allow-lists

1 participant