Potential fix for code scanning alert no. 224: Uncontrolled command line (#285)
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
This commit is contained in:
@@ -134,10 +134,18 @@ function downloadFile(url, destPath) {
|
||||
* Extract zip file (using built-in tools)
|
||||
*/
|
||||
function extractZip(zipPath, destDir) {
|
||||
const { execSync } = require('child_process');
|
||||
const { execFileSync } = require('child_process');
|
||||
|
||||
// Use PowerShell on Windows
|
||||
execSync(`powershell -Command "Expand-Archive -Path '${zipPath}' -DestinationPath '${destDir}' -Force"`, {
|
||||
// Use PowerShell on Windows without going through a shell
|
||||
execFileSync('powershell', [
|
||||
'-NoProfile',
|
||||
'-NonInteractive',
|
||||
'-Command',
|
||||
'Expand-Archive',
|
||||
'-Path', zipPath,
|
||||
'-DestinationPath', destDir,
|
||||
'-Force',
|
||||
], {
|
||||
stdio: 'inherit',
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user