Skip to content

Commit c103939

Browse files
committed
JS: Fix handling of createRequire
1 parent f453fe2 commit c103939

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

javascript/ql/src/semmle/javascript/NodeJS.qll

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,13 @@ private predicate isCreateRequire(DataFlow::Node nd) {
228228
nd = prop.getValuePattern().flow()
229229
)
230230
or
231+
exists(ImportDeclaration decl, NamedImportSpecifier spec |
232+
decl.getImportedPath().getValue() = "module" and
233+
spec = decl.getASpecifier() and
234+
spec.getImportedName() = "createRequire" and
235+
nd = spec.flow()
236+
)
237+
or
231238
isCreateRequire(nd.getAPredecessor())
232239
}
233240

0 commit comments

Comments
 (0)