Skip to content

Commit 01b1e8a

Browse files
committed
JS: Improve Closure support in GlobalAccessPaths
1 parent 31aebc7 commit 01b1e8a

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

javascript/ql/lib/semmle/javascript/GlobalAccessPaths.qll

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,10 +273,21 @@ module AccessPath {
273273
root.isGlobal()
274274
)
275275
or
276-
exists(Closure::ClosureModule mod |
276+
exists(Closure::ClosureModule mod | root.isGlobal() |
277277
node = mod.getExportsVariable().getAnAssignedExpr().flow() and
278-
root.isGlobal() and
279278
result = mod.getClosureNamespace()
279+
or
280+
exists(ExportNamedDeclaration decl, string name |
281+
decl.getContainer() = mod and
282+
node = decl.getSourceNode(name) and
283+
result = join(mod.getClosureNamespace(), name)
284+
)
285+
or
286+
exists(ExportDefaultDeclaration decl |
287+
decl.getContainer() = mod and
288+
node = DataFlow::valueNode(decl.getOperand()) and
289+
result = mod.getClosureNamespace()
290+
)
280291
)
281292
}
282293

0 commit comments

Comments
 (0)