Skip to content

Commit 6e690ae

Browse files
Fix code scanning alert no. 105: Shell command built from environment values
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent 398a0da commit 6e690ae

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

.github/deps-licenses-report.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const fs = require('fs');
22
const { join } = require('path');
33
const { last, set } = require('lodash');
44
const { google } = require('googleapis');
5-
const { exec } = require('child_process');
5+
const { execFile } = require('child_process');
66
const csvParser = require('csv-parser');
77
const { stringify } = require('csv-stringify');
88

@@ -74,17 +74,18 @@ async function runLicenseCheck(path) {
7474
`license-checker --start ${path} --csv --out ./${licenseFolderName}/${name}_dev.csv --development`,
7575
]
7676

77-
return await Promise.all(COMMANDS.map((command) =>
78-
new Promise((resolve, reject) => {
79-
exec(command, (error, stdout, stderr) => {
77+
return await Promise.all(COMMANDS.map((command) => {
78+
const [cmd, ...args] = command.split(' ');
79+
return new Promise((resolve, reject) => {
80+
execFile(cmd, args, (error, stdout, stderr) => {
8081
if (error) {
8182
console.error(`Failed command: ${command}, error:`, stderr);
8283
reject(error);
8384
}
8485
resolve();
8586
});
86-
})
87-
));
87+
});
88+
}));
8889
}
8990

9091
async function sendLicensesToGoogleSheet() {

0 commit comments

Comments
 (0)