Skip to content

fix(parsers): helper lookups skip the project above the working folder, not only the folder - #7854

Merged
jrusso1020 merged 3 commits into
mainfrom
fix-trusted-path-ancestor-project
Nov 15, 2026
Merged

jrusso1020 merged 3 commits into
mainfrom
fix-trusted-path-ancestor-project

Conversation

@michaelwang11394

@michaelwang11394 michaelwang11394 commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

What changed

The CLI and engine find helper programs (ffmpeg, ffprobe, ps, git and others) only in absolute PATH folders outside the working folder's project. This builds on #7845, which made the whole project above a subfolder untrusted when it carries a marker (.git, package.json, node_modules or hyperframes.json). Three changes in packages/parsers/src/trustedExecutable.ts:

  • Every ancestor's node_modules is skipped, with or without a marker. npx, bunx and npm run put each ancestor's node_modules/.bin on PATH. That includes the home folder and above, where fix(parsers): helper programs never come from the project a subfolder sits in #7845's project search stops.
  • A folder that does not exist yet is compared through its nearest existing parent. Before, such a folder kept the spelling it was given. So a Windows short name such as RUNNER~1, or a linked parent, never matched the working folder's real path.
  • The rule is worked out once per PATH, not once per entry.

The home folder and the filesystem root still never count as a project, so per-user install folders such as ~/.local/bin and ~/.bun/bin still resolve. Overrides such as HYPERFRAMES_FFMPEG_PATH are unchanged.

Testing

Not exercised: a real Windows or macOS machine for the Windows branches. They run with process.platform stubbed, and in this PR's Windows CI jobs.

Note: #7801 also changes trustedPathDirs (new platform and env arguments). The two touch the same function, so whichever lands second needs a small merge that keeps both.

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Edit accuracy: accurate 267 (base branch 267), smooth 100 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)

Unstable (2)

  • seqfastkeys-none-px-r0-root-z100: tracking 0.07, pressJump 0.05, drop 0, reload 0, render 0.02, renderKey -, undo false, teleport true / tracking 0.06, pressJump 0.05, drop 0, reload 0, render 0.02, renderKey -, undo true, teleport true / tracking 0.06, pressJump 0.05, drop 0, reload 0, render 0.02, renderKey -, undo true, teleport true
  • seqab-none-pct-r0-root-z100: tracking 0.05, pressJump 0, drop 0, reload 0, render 0.03, renderKey -, undo true, teleport true / tracking 0.05, pressJump 0, drop 0, reload 0, render 0.03, renderKey -, undo true, teleport true / tracking 0.05, pressJump 0, drop 0, reload 0, render 0.03, renderKey -, undo true, teleport true

@jrusso1020 jrusso1020 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at 8029d511325df67a1397b7fd8917950120ff18d4.

Need: yes · Size: ok · Reuse: shared trusted-directory rule · Simpler: compute the ancestry rule once per PATH · Structure: fine (checked CLI startup, ff-binary discovery and trusted helper lookup; no split)
Risk: high — helper-program selection across project boundaries.

Important — resolve the current main conflict: main now contains #7845 (96cc8cb85242fc72bb2e1371048d733cb4993c68), and GitHub plus merge-tree report a conflict in packages/parsers/src/trustedExecutable.ts. Rebase and preserve both the newly merged broader outermost-project marker coverage and this patch’s unconditional ancestor-node_modules exclusions / nearest-existing-parent normalization; choosing either file wholesale would discard part of the protection. Re-run both sets of ancestry tests at that resolved head. The validation below covers this pinned head before integration.

The changed rule removes ancestor node_modules independently of markers, and rejects the outermost package.json/.git project beneath home. Home/root markers do not absorb per-user installations. Missing paths are compared by resolving their nearest existing parent and appending the remaining names; the missing path is not promoted to that parent. The startup trim, trusted helper lookup and ff-binary discovery share the rule; configured binary overrides remain intentionally unchanged.

Validation: full build passed. Parser suite: 1,543 passed, 5 skipped, 3 todo. Focused CLI tests and reviewer controls: 64 passed. The positive controls retain global-npx/per-user tools, use the outside copy through both binary resolvers, and run a bare-name child through the trimmed PATH. Reverting the rule fails four parser ancestry cases and all three startup platform cases; restored controls pass 32 parser and 18 CLI cases. Windows/macOS branches are partly exercised with platform stubs; I did not run either OS locally.

A first parser run had five fixture failures because the shared temporary tree already had an ancestor project marker. An isolated unmarked temporary root passes without production or test edits. Nit: isolate those fixtures at a home boundary so unrelated markers cannot change their expected project root.

Integration/scope note: #7801 is still open and conflicts with this head; #7845 has now merged and causes the current main conflict (verified with merge-tree). Preserve #7801's platform/environment parameters and Windows handling when combining. #7845 also recognizes additional project markers; this patch currently uses only package.json/.git. Without either marker it rejects ancestor node_modules but does not reject every other parent-project folder. Retain the broader marker coverage when combining the fixes; this is not a blanket claim about every unmarked project.

CI checked at this SHA: Windows core, render and npx-shim jobs pass. Both Windows engine/CLI jobs were still running, so full Windows CI is not yet confirmed green. No live deployment or workflow was started.

Verdict: REQUEST CHANGES
Reasoning: The scoped code checks out in the executed controls, but the current head cannot integrate with the overlapping protection now on main. Resolve that conflict without losing either rule before a fresh approval.

— Rames / pr-review

…stor-project

# Conflicts:
#	packages/parsers/src/trustedExecutable.ts
@michaelwang11394

Copy link
Copy Markdown
Contributor Author

Merged main (with #7845) in 4a140f6, keeping both rules: #7845's outermost-project search with its four markers, plus this PR's unconditional ancestor node_modules list and nearest-existing-parent comparison, all worked out once per PATH. Both sets of ancestry tests pass at that head (parsers 1545, CLI 63), and removing either half fails its tests. My new fixtures now set the home folder to their own temp root, per your nit.

🤖 Addressed by Claude Code

@jrusso1020 jrusso1020 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at 4a140f6dee4a96685ff7877ed5caa20daab50475.

Need: yes · Size: ok · Reuse: shared trusted-directory rule · Simpler: ancestry calculated once per PATH · Structure: fine (checked trustedExecutable, startup trim and ff-binary discovery; no split)
Risk: high — helper selection across project boundaries.

The previous integration blocker is resolved: this head retains the outermost-project search with all four markers, unconditional ancestor node_modules exclusions, and nearest-existing-parent comparison for missing folders. Home markers preserve per-user installations. GitHub now reports this head mergeable.

Validation at this head: bun run build passed; bunx vitest run src/trustedExecutable.test.ts --maxWorkers=2 passed all 12 ancestry tests. Removing the outermost-project rule fails its controls; removing the ancestor-node_modules exclusion fails three controls; restoring both returns 12 passes. An isolated temporary root avoids unrelated ancestor markers on this shared machine. The new fixtures have their own home boundary; two inherited fixtures still depend on the surrounding temporary tree (non-blocking fixture nit).

Windows CI run 43746374704 is on this exact head and completed successfully, including core and both studio and engine/CLI jobs; the Windows npx shim passed in exact-head run 43746374664. The later run 43746419768 skips these jobs. This is CI evidence; the focused parser unit run above was on Linux, not native Windows. No dev deployment tested; local build and ancestry mutation controls were used instead.

Integration note: #7801 still overlaps the PATH helper. Preserve its platform/environment handling and both ancestry protections when combining it.

Verdict: APPROVE
Reasoning: The merge resolution preserves both protections, and independent mutations demonstrate that each remains necessary.

— Rames / pr-review

@jrusso1020
jrusso1020 added this pull request to the merge queue Nov 15, 2026
Merged via the queue into main with commit 7184b66 Nov 15, 2026
132 checks passed
@jrusso1020
jrusso1020 deleted the fix-trusted-path-ancestor-project branch November 15, 2026 19:31
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.

2 participants