Skip to content

Commit d05de1b

Browse files
committed
JS: moved execa test cases outside experimental
1 parent d8b5cb5 commit d05de1b

File tree

9 files changed

+189
-142
lines changed

9 files changed

+189
-142
lines changed

javascript/ql/test/experimental/Execa/CommandInjection/tests.expected

Lines changed: 0 additions & 22 deletions
This file was deleted.

javascript/ql/test/experimental/Execa/CommandInjection/tests.js

Lines changed: 0 additions & 36 deletions
This file was deleted.

javascript/ql/test/experimental/Execa/CommandInjection/tests.ql

Lines changed: 0 additions & 38 deletions
This file was deleted.

javascript/ql/test/experimental/Execa/PathInjection/tests.expected

Lines changed: 0 additions & 6 deletions
This file was deleted.

javascript/ql/test/experimental/Execa/PathInjection/tests.ql

Lines changed: 0 additions & 34 deletions
This file was deleted.

javascript/ql/test/query-tests/Security/CWE-022/TaintedPath/TaintedPath.expected

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@
4848
| TaintedPath.js:214:29:214:42 | improperEscape | TaintedPath.js:212:24:212:30 | req.url | TaintedPath.js:214:29:214:42 | improperEscape | This path depends on a $@. | TaintedPath.js:212:24:212:30 | req.url | user-provided value |
4949
| TaintedPath.js:216:29:216:43 | improperEscape2 | TaintedPath.js:212:24:212:30 | req.url | TaintedPath.js:216:29:216:43 | improperEscape2 | This path depends on a $@. | TaintedPath.js:212:24:212:30 | req.url | user-provided value |
5050
| examples/TaintedPath.js:10:29:10:43 | ROOT + filePath | examples/TaintedPath.js:8:28:8:34 | req.url | examples/TaintedPath.js:10:29:10:43 | ROOT + filePath | This path depends on a $@. | examples/TaintedPath.js:8:28:8:34 | req.url | user-provided value |
51+
| execa.js:9:26:9:33 | filePath | execa.js:6:30:6:36 | req.url | execa.js:9:26:9:33 | filePath | This path depends on a $@. | execa.js:6:30:6:36 | req.url | user-provided value |
52+
| execa.js:12:37:12:44 | filePath | execa.js:6:30:6:36 | req.url | execa.js:12:37:12:44 | filePath | This path depends on a $@. | execa.js:6:30:6:36 | req.url | user-provided value |
53+
| execa.js:15:50:15:57 | filePath | execa.js:6:30:6:36 | req.url | execa.js:15:50:15:57 | filePath | This path depends on a $@. | execa.js:6:30:6:36 | req.url | user-provided value |
54+
| execa.js:18:62:18:69 | filePath | execa.js:6:30:6:36 | req.url | execa.js:18:62:18:69 | filePath | This path depends on a $@. | execa.js:6:30:6:36 | req.url | user-provided value |
5155
| express.js:8:20:8:32 | req.query.bar | express.js:8:20:8:32 | req.query.bar | express.js:8:20:8:32 | req.query.bar | This path depends on a $@. | express.js:8:20:8:32 | req.query.bar | user-provided value |
5256
| handlebars.js:11:32:11:39 | filePath | handlebars.js:29:46:29:60 | req.params.path | handlebars.js:11:32:11:39 | filePath | This path depends on a $@. | handlebars.js:29:46:29:60 | req.params.path | user-provided value |
5357
| handlebars.js:15:25:15:32 | filePath | handlebars.js:43:15:43:29 | req.params.path | handlebars.js:15:25:15:32 | filePath | This path depends on a $@. | handlebars.js:43:15:43:29 | req.params.path | user-provided value |
@@ -399,6 +403,15 @@ edges
399403
| examples/TaintedPath.js:8:18:8:52 | url.par ... ry.path | examples/TaintedPath.js:8:7:8:52 | filePath | provenance | |
400404
| examples/TaintedPath.js:8:28:8:34 | req.url | examples/TaintedPath.js:8:18:8:41 | url.par ... , true) | provenance | Config |
401405
| examples/TaintedPath.js:10:36:10:43 | filePath | examples/TaintedPath.js:10:29:10:43 | ROOT + filePath | provenance | Config |
406+
| execa.js:6:9:6:64 | filePath | execa.js:9:26:9:33 | filePath | provenance | |
407+
| execa.js:6:9:6:64 | filePath | execa.js:12:37:12:44 | filePath | provenance | |
408+
| execa.js:6:9:6:64 | filePath | execa.js:15:50:15:57 | filePath | provenance | |
409+
| execa.js:6:9:6:64 | filePath | execa.js:18:62:18:69 | filePath | provenance | |
410+
| execa.js:6:20:6:43 | url.par ... , true) | execa.js:6:20:6:49 | url.par ... ).query | provenance | Config |
411+
| execa.js:6:20:6:49 | url.par ... ).query | execa.js:6:20:6:61 | url.par ... ePath"] | provenance | Config |
412+
| execa.js:6:20:6:61 | url.par ... ePath"] | execa.js:6:20:6:64 | url.par ... th"][0] | provenance | Config |
413+
| execa.js:6:20:6:64 | url.par ... th"][0] | execa.js:6:9:6:64 | filePath | provenance | |
414+
| execa.js:6:30:6:36 | req.url | execa.js:6:20:6:43 | url.par ... , true) | provenance | Config |
402415
| handlebars.js:10:51:10:58 | filePath | handlebars.js:11:32:11:39 | filePath | provenance | |
403416
| handlebars.js:13:73:13:80 | filePath | handlebars.js:15:25:15:32 | filePath | provenance | |
404417
| handlebars.js:29:46:29:60 | req.params.path | handlebars.js:10:51:10:58 | filePath | provenance | |
@@ -944,6 +957,16 @@ nodes
944957
| examples/TaintedPath.js:8:28:8:34 | req.url | semmle.label | req.url |
945958
| examples/TaintedPath.js:10:29:10:43 | ROOT + filePath | semmle.label | ROOT + filePath |
946959
| examples/TaintedPath.js:10:36:10:43 | filePath | semmle.label | filePath |
960+
| execa.js:6:9:6:64 | filePath | semmle.label | filePath |
961+
| execa.js:6:20:6:43 | url.par ... , true) | semmle.label | url.par ... , true) |
962+
| execa.js:6:20:6:49 | url.par ... ).query | semmle.label | url.par ... ).query |
963+
| execa.js:6:20:6:61 | url.par ... ePath"] | semmle.label | url.par ... ePath"] |
964+
| execa.js:6:20:6:64 | url.par ... th"][0] | semmle.label | url.par ... th"][0] |
965+
| execa.js:6:30:6:36 | req.url | semmle.label | req.url |
966+
| execa.js:9:26:9:33 | filePath | semmle.label | filePath |
967+
| execa.js:12:37:12:44 | filePath | semmle.label | filePath |
968+
| execa.js:15:50:15:57 | filePath | semmle.label | filePath |
969+
| execa.js:18:62:18:69 | filePath | semmle.label | filePath |
947970
| express.js:8:20:8:32 | req.query.bar | semmle.label | req.query.bar |
948971
| handlebars.js:10:51:10:58 | filePath | semmle.label | filePath |
949972
| handlebars.js:11:32:11:39 | filePath | semmle.label | filePath |

javascript/ql/test/experimental/Execa/PathInjection/tests.js renamed to javascript/ql/test/query-tests/Security/CWE-022/TaintedPath/execa.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ import http from 'node:http'
33
import url from 'url'
44

55
http.createServer(async function (req, res) {
6-
let filePath = url.parse(req.url, true).query["filePath"][0];
6+
let filePath = url.parse(req.url, true).query["filePath"][0]; // $Source
77

88
// Piping to stdin from a file
9-
await $({ inputFile: filePath })`cat` // test: PathInjection
9+
await $({ inputFile: filePath })`cat` // $Alert
1010

1111
// Piping to stdin from a file
12-
await execa('cat', { inputFile: filePath }); // test: PathInjection
12+
await execa('cat', { inputFile: filePath }); // $Alert
1313

1414
// Piping Stdout to file
15-
await execa('echo', ['example3']).pipeStdout(filePath); // test: PathInjection
15+
await execa('echo', ['example3']).pipeStdout(filePath); // $Alert
1616

1717
// Piping all of command output to file
18-
await execa('echo', ['example4'], { all: true }).pipeAll(filePath); // test: PathInjection
19-
});
18+
await execa('echo', ['example4'], { all: true }).pipeAll(filePath); // $Alert
19+
});

0 commit comments

Comments
 (0)