Skip to content

Commit 530897a

Browse files
committed
remove potential shell injection risk
1 parent 2159df6 commit 530897a

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

packages/build/src/extensions/python.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,21 +86,18 @@ class PythonExtension implements BuildExtension {
8686
}
8787
}
8888

89-
export const run = async (
90-
args?: string,
91-
options: Parameters<typeof $>[1] = {}
92-
) => {
93-
const cmd = `${process.env.PYTHON_BIN_PATH || "python"} ${args}`;
89+
export const run = async (scriptArgs: string[] = [], options: Parameters<typeof $>[1] = {}) => {
90+
const pythonBin = process.env.PYTHON_BIN_PATH || "python";
9491

9592
logger.debug(
96-
`Running python:\t${cmd} ${options.input ? `(with stdin)` : ""}`,
93+
`Running ${pythonBin} \t${JSON.stringify(scriptArgs)} ${options.input ? `(with stdin)` : ""}`,
9794
options
9895
);
9996

10097
const result = await $({
10198
shell: true,
10299
...options,
103-
})`${cmd}`;
100+
})(pythonBin, ...scriptArgs);
104101

105102
try {
106103
assert(!result.failed, `Command failed: ${result.stderr}`);

0 commit comments

Comments
 (0)