Skip to content

fix: pass cwd to npmRunPathEnv to prevent PATH hijack @W-23797722@ - #1386

Merged
jfeingold35 merged 1 commit into
mainfrom
wr/passCwdToNpmRunPathEnv
Aug 14, 2026
Merged

fix: pass cwd to npmRunPathEnv to prevent PATH hijack @W-23797722@#1386
jfeingold35 merged 1 commit into
mainfrom
wr/passCwdToNpmRunPathEnv

Conversation

@WillieRuemmele

Copy link
Copy Markdown
Contributor

Summary

  • Pass cwd to npmRunPathEnv() in src/spawn.ts so the child process PATH is built relative to the plugin install directory, not process.cwd()
  • Prevents an attacker-controlled node_modules/.bin/node in the repository from being resolved before the trusted Node runtime during JIT plugin installation

Work Item

@W-23797722@: [Bug Bounty / H1] SF CLI - Automatic JIT plugin installation executes repository-local node before the trusted runtime

Test plan

  • Clone a repo with a malicious node_modules/.bin/node executable
  • Run a JIT command (e.g. sf dev audit messages) and verify the malicious node is NOT executed
  • Verify normal JIT plugin installation still works correctly

@jfeingold35
jfeingold35 merged commit f312141 into main Aug 14, 2026
17 checks passed
@jfeingold35
jfeingold35 deleted the wr/passCwdToNpmRunPathEnv branch August 14, 2026 15:01
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