Skip to content

Commit 7a51251

Browse files
weirdwatermlaponder
authored andcommitted
Review: Prevent shell expansion with single quotes
node:child_process.exec executes the given command in a shell. While the input here comes from npm, it is still good to make sure that the package name argument is not expanded by the shell.
1 parent d09b393 commit 7a51251

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

  • packages/pluggable-widgets-tools/src/commands

packages/pluggable-widgets-tools/src/commands/audit.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ interface UpdateablePackage {
9797
* Using the ^ version range avoids this, as the version is specific enough for npm.
9898
*/
9999
async function findSafeVersion({ name, range }: NpmAudit.Dependency): Promise<UpdateablePackage> {
100-
const versions = await promisify(exec)(`npm show ${name} versions --json`).then(
100+
const versions = await promisify(exec)(`npm show '${name}' versions --json`).then(
101101
({ stdout }) => JSON.parse(stdout) as string[]
102102
);
103103

0 commit comments

Comments
 (0)