File tree Expand file tree Collapse file tree 4 files changed +9
-10
lines changed
lib/semmle/javascript/frameworks
test/library-tests/frameworks/NodeJSLib Expand file tree Collapse file tree 4 files changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import javascript
6
6
import semmle.javascript.frameworks.HTTP
7
7
import semmle.javascript.security.SensitiveActions
8
8
private import semmle.javascript.dataflow.internal.PreCallGraphStep
9
+ private import semmle.javascript.security.dataflow.CodeInjectionCustomizations
9
10
10
11
module NodeJSLib {
11
12
private GlobalVariable processVariable ( ) { variables ( result , "process" , any ( GlobalScope sc ) ) }
@@ -763,16 +764,8 @@ module NodeJSLib {
763
764
/**
764
765
* The dynamic import expression input can be a `data:` URL which loads any module from that data
765
766
*/
766
- class DynamicImport extends SystemCommandExecution , DataFlow:: ExprNode {
767
+ class DynamicImport extends CodeInjection :: Sink , DataFlow:: ExprNode {
767
768
DynamicImport ( ) { this = any ( DynamicImportExpr e ) .getAChildExpr ( ) .flow ( ) }
768
-
769
- override DataFlow:: Node getACommandArgument ( ) { result = this }
770
-
771
- override predicate isShellInterpreted ( DataFlow:: Node arg ) { arg = this }
772
-
773
- override predicate isSync ( ) { none ( ) }
774
-
775
- override DataFlow:: Node getOptionsArg ( ) { none ( ) }
776
769
}
777
770
778
771
/**
Original file line number Diff line number Diff line change
1
+ import javascript
2
+ private import semmle.javascript.security.dataflow.CodeInjectionCustomizations
3
+
4
+ query predicate test_CodeInjectionSink ( CodeInjection:: Sink cmd , DataFlow:: Node res ) { res = cmd }
Original file line number Diff line number Diff line change @@ -230,7 +230,6 @@ test_SystemCommandExecution
230
230
| exec.js:5:1:5:23 | cp.fork ... "arg"]) | exec.js:5:9:5:13 | "foo" |
231
231
| exec.js:6:1:6:28 | cp.spaw ... "], cb) | exec.js:6:10:6:15 | "echo" |
232
232
| exec.js:7:1:7:37 | cp.spaw ... here"]) | exec.js:7:14:7:19 | "echo" |
233
- | exec.js:10:14:10:58 | 'data:t ... lo!");' | exec.js:10:14:10:58 | 'data:t ... lo!");' |
234
233
test_HeaderDefinition_defines
235
234
| src/http.js:13:3:13:44 | res.set ... /html') | content-type | text/html |
236
235
| src/https.js:13:3:13:44 | res.set ... /html') | content-type | text/html |
@@ -418,3 +417,5 @@ test_SystemCommandExecution_getAnArgumentForCommand
418
417
| exec.js:5:1:5:23 | cp.fork ... "arg"]) | exec.js:5:16:5:22 | ["arg"] |
419
418
| exec.js:6:1:6:28 | cp.spaw ... "], cb) | exec.js:6:18:6:23 | ["Hi"] |
420
419
| exec.js:7:1:7:37 | cp.spaw ... here"]) | exec.js:7:22:7:36 | ["Hi", "there"] |
420
+ test_CodeInjectionSink
421
+ | exec.js:10:14:10:58 | 'data:t ... lo!");' | exec.js:10:14:10:58 | 'data:t ... lo!");' |
Original file line number Diff line number Diff line change @@ -22,3 +22,4 @@ import RequestExpr
22
22
import SystemCommandExecution_getAnArgumentForCommand
23
23
import Credentials
24
24
import RouteHandler_getARequestExpr
25
+ import CodeInjectionSink
You can’t perform that action at this time.
0 commit comments