Skip to content

W-23795356- resolve binaries from PATH to prevent CWD-based RCE - #538

Merged
jfeingold35 merged 2 commits into
mainfrom
sl/W-23795356
Aug 14, 2026
Merged

W-23795356- resolve binaries from PATH to prevent CWD-based RCE#538
jfeingold35 merged 2 commits into
mainfrom
sl/W-23795356

Conversation

@soridalac

Copy link
Copy Markdown
Contributor

What does this PR do?

Summary

  • Resolve bare binary names to absolute PATH-based paths via shelljs.which() in Generator.execute() before passing to shelljs.exec(), preventing Windows CWD-first
    resolution from executing planted binaries
  • Refactor flag.ts to route through Generator.execute() instead of calling shelljs.exec directly
  • Harden bare binary usage in command.ts (sf) and plugin.ts (git)
  • Skip PATH resolution when the binary is already a relative/absolute path (e.g. bin/dev.cmd)

Verification

  • Windows VM (before fix): 3x calc.exe popups
  • Windows VM (after fix):Could not find "yarn" on PATH — no execution
  • macOS (after fix): Runs normally using real yarn from PATH — no regression

Test Plan

  • Unit tests: binary-not-found throws, dry-run skips execution
  • VM: PoC sf-yarn-rce-poc no longer triggers calc.exe
  • macOS: sf dev generate command works normally against linked plugin

What issues does this PR fix or reference?

@W-23795356@

@svc-cli-bot
svc-cli-bot requested a review from a team as a code ownerAugust 14, 2026 16:08
@jfeingold35
jfeingold35 merged commit 487ba98 into mainAug 14, 2026
9 checks passed
@jfeingold35
jfeingold35 deleted the sl/W-23795356 branch August 14, 2026 16:31
Sign up for freeto 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.

4 participants

@soridalac@jfeingold35@WillieRuemmele@svc-cli-bot