Repository navigation
fix(engine): start nvidia-smi, vm_stat, ps and tasklist from trusted folders only - #7788
Merged
Merged
Conversation
…folders only The renderer resolves these helpers through the shared trusted lookup and runs the absolute path, so a program with the same name in a project folder is never started in their place.
Contributor
This was referenced Nov 15, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The renderer now starts
nvidia-smi,vm_stat,psandtasklistfrom the absolute path the shared trusted lookup returns (findTrustedExecutablein@hyperframes/parsers/ff-binaries), the same rule the CLI and the ffmpeg resolver already use. When the lookup finds nothing, each site takes the fallback it already had for a missing program.Why
These four were started by bare name. A bare name is looked up through PATH, and on Windows the working directory is searched first, so when a render runs from a project folder a program with that name in the folder could run in its place.
Related work
Refs #7787, which applies the same rule to helper programs the CLI starts. This PR covers the engine.
How
browserManager.ts: the GPU memory probe resolvesnvidia-smifirst and callsexecFileSyncwith an argument list in place of a shell string. Not found: no VRAM reading, so the system-memory budget is used, as before.systemMemory.ts:vm_stat(macOS) is resolved the same way. Not found: thefreemem()fallback.processRss.ts: the default runner resolvesps/tasklistbeforeexecFile. Not found: it throws, whichsampleProcessRssalready turns into no samples.Every other process the engine starts at render time already goes through a resolved path (ffmpeg and ffprobe through
getFfmpegBinary/getFfprobeBinary, Chrome through its executable path, the DNS helper throughprocess.execPath). Grep:git grep -nE "(spawn|spawnSync|execFile|execFileSync|execSync|exec)\(" -- packages/engine/src packages/producer/src. The bareffmpegcalls left in producer are in the regression and parity harnesses and test fixtures, not the render path.Test plan
packages/engine/src/services/trustedHelpers.test.tswrites anvidia-smi,vm_statandpsscript into a temp project folder that is the working directory and the first PATH entry, then drivesbuildChromeArgs,getAvailableMemoryMbandsampleProcessRss. Each test asserts the planted script never ran. 3 runs in a row green. Skipped on Windows, where the planted scripts would need to be.exefiles; the Windows side of the lookup is covered inpackages/parsers/src/ffBinaries.test.ts.expected true to be false(each planted script ran).availableMemory.test.tsnow mocks the trusted lookup andexecFileSync(it mockedexecSync, whichvm_statno longer goes through), and assertsvm_statruns from the resolved path.audioFxImport.test.ts(importing the engine starts no process) now watchesexecFileSyncas well asexecSync.unitproject: 172 files passed, 1 skipped.tsc --noEmitforpackages/engine,oxfmt,oxlinton the touched files: clean.