Skip to content
Permalink
Browse files Browse the repository at this point in the history
fix: quote args
  • Loading branch information
danlucian committed Nov 29, 2022
1 parent eb1737c commit c73e049
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
10 changes: 8 additions & 2 deletions .snyk
@@ -1,6 +1,12 @@
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
version: v1.13.5
ignore: {}
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: 2022-12-29T09:11:54.820Z
created: 2022-11-29T09:11:54.829Z
# patches apply the minimum changes required to fix a vulnerability
patch:
SNYK-JS-LODASH-450202:
Expand Down
3 changes: 3 additions & 0 deletions lib/sub-process.ts
@@ -1,4 +1,5 @@
import * as childProcess from 'child_process';
import { quoteAll } from 'shescape';

export function execute(
command: string,
Expand All @@ -13,6 +14,8 @@ export function execute(
spawnOptions.cwd = options.cwd;
}

args = quoteAll(args, spawnOptions);

return new Promise((resolve, reject) => {
let stdout = '';
let stderr = '';
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -34,6 +34,7 @@
"@snyk/cli-interface": "^2.11.0",
"@snyk/cocoapods-lockfile-parser": "3.6.2",
"@snyk/dep-graph": "^1.23.1",
"shescape": "1.6.1",
"source-map-support": "^0.5.7",
"tslib": "^2.0.0"
},
Expand Down
2 changes: 1 addition & 1 deletion test/lib/sub-process.test.ts
Expand Up @@ -27,7 +27,7 @@ describe('execute()', () => {

test('Considers option.cwd', async () => {
await expect(
subProcess.execute('basename', ['$PWD'], { cwd: __dirname }),
subProcess.execute('basename $PWD', [], { cwd: __dirname }),
).resolves.toEqual('lib\n');
});

Expand Down

0 comments on commit c73e049

Please sign in to comment.