mirror of
https://github.com/github/codeql.git
synced 2026-03-17 04:56:58 +01:00
specialize module.createRequire support to ES2015 modules
This commit is contained in:
@@ -163,7 +163,16 @@ private predicate isRequire(DataFlow::Node nd) {
|
||||
or
|
||||
isRequire(nd.getAPredecessor())
|
||||
or
|
||||
nd = DataFlow::moduleMember("module", "createRequire").getACall()
|
||||
// `import { createRequire } from 'module';` support.
|
||||
// specialized to ES2015 modules to avoid recursion in the `DataFlow::moduleImport()` predicate.
|
||||
exists(ImportDeclaration imp | imp.getImportedPath().getValue() = "module" |
|
||||
nd =
|
||||
imp
|
||||
.getImportedModuleNode()
|
||||
.(DataFlow::SourceNode)
|
||||
.getAPropertyRead("createRequire")
|
||||
.getACall()
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user