Skip to content

fix: escape executable name in libnpmexec run-script#9436

Merged
owlstronaut merged 1 commit into
npm:latestfrom
rootvector2:escape-exec-name-in-run-script
Jun 2, 2026
Merged

fix: escape executable name in libnpmexec run-script#9436
owlstronaut merged 1 commit into
npm:latestfrom
rootvector2:escape-exec-name-in-run-script

Conversation

@rootvector2
Copy link
Copy Markdown
Contributor

run() in libnpmexec wraps the executable name in double quotes before it becomes the npx script string, but double quotes still expand $(), backticks, $var and a closing quote, so a package whose bin key holds shell metacharacters breaks out once the name reaches sh -c. The bin name comes straight from a published package.json. Switch the non-Windows branch to single-quote escaping so the name is taken literally.

@rootvector2 rootvector2 requested review from a team as code owners May 29, 2026 19:14
@owlstronaut owlstronaut changed the title escape executable name in libnpmexec run-script fix: escape executable name in libnpmexec run-script Jun 2, 2026
@owlstronaut owlstronaut merged commit 6901bb1 into npm:latest Jun 2, 2026
18 of 19 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 2, 2026

🎉 Backport to release/v11 created: #9467

owlstronaut pushed a commit that referenced this pull request Jun 2, 2026
Backport of #9436 to `release/v11`.

Co-authored-by: Dexter.k <164054284+rootvector2@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants