Skip to content

Commit

Permalink
Merge pull request #197 from snyk/fix/quote-spawn-args
Browse files Browse the repository at this point in the history
fix: quote spawn args
  • Loading branch information
xzhou-snyk committed Nov 29, 2022
2 parents 43d4b85 + 8591abd commit 6144e09
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .snyk
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
version: v1.25.0
# ignores vulnerabilities until expiry date; change duration by modifying expiry date
ignore:
'snyk:lic:npm:shescape:MPL-2.0':
- '*':
reason: None Given
expires: 2122-12-29T08:08:41.608Z
created: 2022-11-29T08:08:41.611Z
patch: {}

3 changes: 3 additions & 0 deletions lib/dependencies/sub-process.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { spawn, spawnSync, SpawnOptions } from 'child_process';
import { quoteAll } from 'shescape';

interface ProcessOptions {
cwd?: string;
Expand All @@ -22,6 +23,7 @@ export function execute(
options?: ProcessOptions
): Promise<string> {
const spawnOptions = makeSpawnOptions(options);
args = quoteAll(args, spawnOptions);
return new Promise((resolve, reject) => {
let stdout = '';
let stderr = '';
Expand Down Expand Up @@ -49,6 +51,7 @@ export function executeSync(
options?: ProcessOptions
) {
const spawnOptions = makeSpawnOptions(options);
args = quoteAll(args, spawnOptions);

return spawnSync(command, args, spawnOptions);
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"dependencies": {
"@snyk/cli-interface": "^2.11.2",
"@snyk/dep-graph": "^1.28.1",
"shescape": "1.6.1",
"snyk-poetry-lockfile-parser": "^1.1.7",
"tmp": "0.2.1"
},
Expand Down

0 comments on commit 6144e09

Please sign in to comment.