File tree Expand file tree Collapse file tree
lib/semmle/javascript/frameworks
test/library-tests/frameworks/NodeJSLib Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import javascript
66import semmle.javascript.frameworks.HTTP
77import semmle.javascript.security.SensitiveActions
88private import semmle.javascript.dataflow.internal.PreCallGraphStep
9+ private import semmle.javascript.security.dataflow.CodeInjectionCustomizations
910
1011module NodeJSLib {
1112 private GlobalVariable processVariable ( ) { variables ( result , "process" , any ( GlobalScope sc ) ) }
@@ -763,16 +764,8 @@ module NodeJSLib {
763764 /**
764765 * The dynamic import expression input can be a `data:` URL which loads any module from that data
765766 */
766- class DynamicImport extends SystemCommandExecution , DataFlow:: ExprNode {
767+ class DynamicImport extends CodeInjection :: Sink , DataFlow:: ExprNode {
767768 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 ( ) }
776769 }
777770
778771 /**
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
230230| exec.js:5:1:5:23 | cp.fork ... "arg"]) | exec.js:5:9:5:13 | "foo" |
231231| exec.js:6:1:6:28 | cp.spaw ... "], cb) | exec.js:6:10:6:15 | "echo" |
232232| 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!");' |
234233test_HeaderDefinition_defines
235234| src/http.js:13:3:13:44 | res.set ... /html') | content-type | text/html |
236235| src/https.js:13:3:13:44 | res.set ... /html') | content-type | text/html |
@@ -418,3 +417,5 @@ test_SystemCommandExecution_getAnArgumentForCommand
418417| exec.js:5:1:5:23 | cp.fork ... "arg"]) | exec.js:5:16:5:22 | ["arg"] |
419418| exec.js:6:1:6:28 | cp.spaw ... "], cb) | exec.js:6:18:6:23 | ["Hi"] |
420419| 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
2222import SystemCommandExecution_getAnArgumentForCommand
2323import Credentials
2424import RouteHandler_getARequestExpr
25+ import CodeInjectionSink
You can’t perform that action at this time.
0 commit comments