Skip to content

escape executable name in libnpmexec run-script#9436

Open
rootvector2 wants to merge 1 commit into
npm:latestfrom
rootvector2:escape-exec-name-in-run-script
Open

escape executable name in libnpmexec run-script#9436
rootvector2 wants to merge 1 commit into
npm:latestfrom
rootvector2:escape-exec-name-in-run-script

Conversation

@rootvector2
Copy link
Copy Markdown

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
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