mirror of
https://github.com/github/codeql.git
synced 2026-04-27 17:55:19 +02:00
JS: add execa.shell tests
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
| query-tests/Security/CWE-078/tst_shell-command-injection-from-environment.js:8 | expected an alert, but found none | NOT OK | ComandInjection |
|
||||
| query-tests/Security/CWE-078/tst_shell-command-injection-from-environment.js:9 | expected an alert, but found none | NOT OK | ComandInjection |
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
nodes
|
||||
| tst_shell-command-injection-from-environment.js:5:14:5:53 | 'rm -rf ... "temp") |
|
||||
| tst_shell-command-injection-from-environment.js:5:14:5:53 | 'rm -rf ... "temp") |
|
||||
| tst_shell-command-injection-from-environment.js:5:26:5:53 | path.jo ... "temp") |
|
||||
| tst_shell-command-injection-from-environment.js:5:36:5:44 | __dirname |
|
||||
| tst_shell-command-injection-from-environment.js:5:36:5:44 | __dirname |
|
||||
| tst_shell-command-injection-from-environment.js:6:14:6:53 | 'rm -rf ... "temp") |
|
||||
| tst_shell-command-injection-from-environment.js:6:14:6:53 | 'rm -rf ... "temp") |
|
||||
| tst_shell-command-injection-from-environment.js:6:26:6:53 | path.jo ... "temp") |
|
||||
| tst_shell-command-injection-from-environment.js:6:36:6:44 | __dirname |
|
||||
| tst_shell-command-injection-from-environment.js:6:36:6:44 | __dirname |
|
||||
edges
|
||||
| tst_shell-command-injection-from-environment.js:5:26:5:53 | path.jo ... "temp") | tst_shell-command-injection-from-environment.js:5:14:5:53 | 'rm -rf ... "temp") |
|
||||
| tst_shell-command-injection-from-environment.js:5:26:5:53 | path.jo ... "temp") | tst_shell-command-injection-from-environment.js:5:14:5:53 | 'rm -rf ... "temp") |
|
||||
| tst_shell-command-injection-from-environment.js:5:36:5:44 | __dirname | tst_shell-command-injection-from-environment.js:5:26:5:53 | path.jo ... "temp") |
|
||||
| tst_shell-command-injection-from-environment.js:5:36:5:44 | __dirname | tst_shell-command-injection-from-environment.js:5:26:5:53 | path.jo ... "temp") |
|
||||
| tst_shell-command-injection-from-environment.js:6:26:6:53 | path.jo ... "temp") | tst_shell-command-injection-from-environment.js:6:14:6:53 | 'rm -rf ... "temp") |
|
||||
| tst_shell-command-injection-from-environment.js:6:26:6:53 | path.jo ... "temp") | tst_shell-command-injection-from-environment.js:6:14:6:53 | 'rm -rf ... "temp") |
|
||||
| tst_shell-command-injection-from-environment.js:6:36:6:44 | __dirname | tst_shell-command-injection-from-environment.js:6:26:6:53 | path.jo ... "temp") |
|
||||
| tst_shell-command-injection-from-environment.js:6:36:6:44 | __dirname | tst_shell-command-injection-from-environment.js:6:26:6:53 | path.jo ... "temp") |
|
||||
#select
|
||||
| tst_shell-command-injection-from-environment.js:5:14:5:53 | 'rm -rf ... "temp") | tst_shell-command-injection-from-environment.js:5:36:5:44 | __dirname | tst_shell-command-injection-from-environment.js:5:14:5:53 | 'rm -rf ... "temp") | This shell command depends on an uncontrolled $@. | tst_shell-command-injection-from-environment.js:5:36:5:44 | __dirname | absolute path |
|
||||
| tst_shell-command-injection-from-environment.js:6:14:6:53 | 'rm -rf ... "temp") | tst_shell-command-injection-from-environment.js:6:36:6:44 | __dirname | tst_shell-command-injection-from-environment.js:6:14:6:53 | 'rm -rf ... "temp") | This shell command depends on an uncontrolled $@. | tst_shell-command-injection-from-environment.js:6:36:6:44 | __dirname | absolute path |
|
||||
|
||||
@@ -58,8 +58,9 @@ syncCommand
|
||||
| other.js:12:5:12:30 | require ... nc(cmd) |
|
||||
| other.js:30:5:30:36 | require ... ")(cmd) |
|
||||
| third-party-command-injection.js:6:9:6:28 | cp.execSync(command) |
|
||||
| tst_shell-command-injection-from-environment.js:4:2:4:62 | cp.exec ... emp")]) |
|
||||
| tst_shell-command-injection-from-environment.js:5:2:5:54 | cp.exec ... temp")) |
|
||||
| tst_shell-command-injection-from-environment.js:5:2:5:62 | cp.exec ... emp")]) |
|
||||
| tst_shell-command-injection-from-environment.js:6:2:6:54 | cp.exec ... temp")) |
|
||||
| tst_shell-command-injection-from-environment.js:9:2:9:58 | execa.s ... temp")) |
|
||||
| uselesscat.js:16:1:16:29 | execSyn ... uinfo') |
|
||||
| uselesscat.js:18:1:18:26 | execSyn ... path}`) |
|
||||
| uselesscat.js:20:1:20:36 | execSyn ... wc -l') |
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
var cp = require('child_process'),
|
||||
path = require('path');
|
||||
path = require('path'),
|
||||
execa = require("execa");
|
||||
(function() {
|
||||
cp.execFileSync('rm', ['-rf', path.join(__dirname, "temp")]); // GOOD
|
||||
cp.execSync('rm -rf ' + path.join(__dirname, "temp")); // BAD
|
||||
|
||||
execa.shell('rm -rf ' + path.join(__dirname, "temp")); // NOT OK
|
||||
execa.shellSync('rm -rf ' + path.join(__dirname, "temp")); // NOT OK
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user