Fix command injection

This commit is contained in:
Sander Declerck 2025-07-18 11:15:21 +02:00
parent 8ffb0191f5
commit 41bf3252d9
No known key found for this signature in database
11 changed files with 116 additions and 29 deletions

View file

@ -1,4 +1,4 @@
import { execSync, spawnSync } from "child_process";
import { spawnSync } from "child_process";
import * as os from "os";
import fs from "fs";
@ -26,14 +26,6 @@ export function doesExecutableExistOnSystem(executableName) {
}
}
export function execAndGetOutput(command, shell) {
try {
return execSync(command, { encoding: "utf8", shell }).trim();
} catch (error) {
throw new Error(`Command failed: ${command}. Error: ${error.message}`);
}
}
export function removeLinesMatchingPattern(filePath, pattern) {
if (!fs.existsSync(filePath)) {
return;