Skip to content

Commit 5628d0c

Browse files
committed
build: avoid command injection in golden script
Avoids command injection in the API golden script by using `exec` instead of interpolating the entire command. (cherry picked from commit fe9b50a)
1 parent b0f30c8 commit 5628d0c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

scripts/approve-api-golden.mts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#!/usr/bin/env node
22

33
import chalk from 'chalk';
4+
import {execFileSync} from 'child_process';
45
import {join} from 'path';
56
import sh from 'shelljs';
67
import {guessPackageName} from './util.mjs';
78

8-
const bazel = process.env['BAZEL'] || 'pnpm -s bazel';
99
const targetsToRun = new Set<string>();
1010

1111
if (process.argv.length < 3) {
@@ -34,5 +34,5 @@ for (const searchPackageName of process.argv.slice(2)) {
3434
}
3535

3636
for (const target of targetsToRun) {
37-
sh.exec(`${bazel} run ${target}`);
37+
execFileSync('pnpm', ['-s', 'bazel', 'run', target], {stdio: 'inherit'});
3838
}

0 commit comments

Comments
 (0)