mirror of
https://github.com/github/codeql.git
synced 2026-02-11 20:51:06 +01:00
JS: Localize MkModuleExport
This commit is contained in:
@@ -740,20 +740,9 @@ module API {
|
||||
MkRoot() or
|
||||
MkModuleDef(string m) { exists(MkModuleExport(m)) } or
|
||||
MkModuleUse(string m) { exists(MkModuleImport(m)) } or
|
||||
MkModuleExport(string m) {
|
||||
exists(Module mod | mod = importableModule(m) |
|
||||
// exclude modules that don't actually export anything
|
||||
exports(m, _)
|
||||
or
|
||||
exports(m, _, _)
|
||||
or
|
||||
exists(NodeModule nm | nm = mod |
|
||||
exists(Ssa::implicitInit([nm.getModuleVariable(), nm.getExportsVariable()]))
|
||||
)
|
||||
)
|
||||
} or
|
||||
MkModuleImport(string m) {
|
||||
imports(_, m)
|
||||
MkModuleExport(string m) { isDeclaredPackageName(m) } or
|
||||
or
|
||||
any(TypeAnnotation n).hasUnderlyingType(m, _)
|
||||
} or
|
||||
@@ -1965,3 +1954,8 @@ private Module importableModule(string m) {
|
||||
m = pkg.getPackageName()
|
||||
)
|
||||
}
|
||||
|
||||
overlay[local]
|
||||
private predicate isDeclaredPackageName(string m) {
|
||||
m = any(PackageJson pkg).getDeclaredPackageName()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user