Skip to content

fix(engine): start nvidia-smi, vm_stat, ps and tasklist from trusted folders only - #7788

Merged
miguel-heygen merged 2 commits into
mainfrom
fix/sechard-helper-abs-path
Nov 15, 2026
Merged

miguel-heygen merged 2 commits into
mainfrom
fix/sechard-helper-abs-path

Conversation

@miguel-heygen

@miguel-heygen miguel-heygen commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

What

The renderer now starts nvidia-smi, vm_stat, ps and tasklist from the absolute path the shared trusted lookup returns (findTrustedExecutable in @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 resolves nvidia-smi first and calls execFileSync with 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: the freemem() fallback.
  • processRss.ts: the default runner resolves ps / tasklist before execFile. Not found: it throws, which sampleProcessRss already 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 through process.execPath). Grep: git grep -nE "(spawn|spawnSync|execFile|execFileSync|execSync|exec)\(" -- packages/engine/src packages/producer/src. The bare ffmpeg calls left in producer are in the regression and parity harnesses and test fixtures, not the render path.

Test plan

  • Unit tests added/updated: packages/engine/src/services/trustedHelpers.test.ts writes a nvidia-smi, vm_stat and ps script into a temp project folder that is the working directory and the first PATH entry, then drives buildChromeArgs, getAvailableMemoryMb and sampleProcessRss. 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 .exe files; the Windows side of the lookup is covered in packages/parsers/src/ffBinaries.test.ts.
    • fails without the fix: with main's three source files, all three tests fail with expected true to be false (each planted script ran).
  • availableMemory.test.ts now mocks the trusted lookup and execFileSync (it mocked execSync, which vm_stat no longer goes through), and asserts vm_stat runs from the resolved path. audioFxImport.test.ts (importing the engine starts no process) now watches execFileSync as well as execSync.
  • The whole engine unit project: 172 files passed, 1 skipped.
  • tsc --noEmit for packages/engine, oxfmt, oxlint on the touched files: clean.
  • Manual testing performed
  • Comments follow CONTRIBUTING.md "Comments"

…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.
@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Edit accuracy: accurate 267 (base branch 267), smooth 124 of those

The gate passes.
Smoothness is reported in the artifact, not gated. A case fails only if it fails 2 of 3 runs.

Quarantined, measured but not gated (8)

@miguel-heygen
miguel-heygen merged commit e3ff9c8 into main Nov 15, 2026
132 of 133 checks passed
@miguel-heygen
miguel-heygen deleted the fix/sechard-helper-abs-path branch November 15, 2026 01:14
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.

1 participant