mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Fix command injection
This commit is contained in:
parent
8ffb0191f5
commit
41bf3252d9
11 changed files with 116 additions and 29 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue