Skip to content

Commit 06114d9

Browse files
committed
V1
1 parent 38892bb commit 06114d9

File tree

3 files changed

+260
-241
lines changed

3 files changed

+260
-241
lines changed

javascript/ql/lib/semmle/javascript/frameworks/NodeJSLib.qll

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,21 @@ module NodeJSLib {
760760
}
761761
}
762762

763+
/**
764+
* The dynamic import expression input can be a `data:` URL which loads any module from that data
765+
*/
766+
class DynamicImport extends SystemCommandExecution, DataFlow::ExprNode {
767+
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+
}
777+
763778
/**
764779
* A call to a method from module `child_process`.
765780
*/

javascript/ql/test/library-tests/frameworks/NodeJSLib/exec.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ cp.execFileSync("sh", ["-c", "node --version"]);
55
cp.fork("foo", ["arg"]);
66
cp.spawn("echo", ["Hi"], cb);
77
cp.spawnSync("echo", ["Hi", "there"]);
8+
9+
// dynamic import
10+
await import('data:text/javascript,console.log("hello!");')

0 commit comments

Comments
 (0)