Files
codeql/javascript/ql/test/query-tests/Security/CWE-078/ShellCommandInjectionFromEnvironment/tst_shell-command-injection-from-environment.js
2025-02-28 13:27:28 +01:00

14 lines
476 B
JavaScript

var cp = require('child_process'),
path = require('path'),
execa = require("execa");
(function() {
cp.execFileSync('rm', ['-rf', path.join(__dirname, "temp")]);
cp.execSync('rm -rf ' + path.join(__dirname, "temp")); // $ Alert
execa.shell('rm -rf ' + path.join(__dirname, "temp")); // $ Alert
execa.shellSync('rm -rf ' + path.join(__dirname, "temp")); // $ Alert
const safe = "\"" + path.join(__dirname, "temp") + "\"";
execa.shellSync('rm -rf ' + safe);
});