mirror of
https://github.com/github/codeql.git
synced 2026-04-30 03:05:15 +02:00
JS: use PropWrite in exports() predicate
This commit is contained in:
@@ -118,13 +118,14 @@ module Closure {
|
||||
}
|
||||
|
||||
override predicate exports(string name, ASTNode export) {
|
||||
// exports.foo = bar
|
||||
export.(AssignExpr).getLhs().(PropAccess).accesses(getExportsVariable().getAnAccess(), name)
|
||||
or
|
||||
// exports = { foo: bar }
|
||||
exists(VarDef def |
|
||||
def.getTarget() = getExportsVariable().getAReference() and
|
||||
def.getSource().(ObjectExpr).getPropertyByName(name) = export
|
||||
exists(DataFlow::PropWrite write, Expr base |
|
||||
write.getAstNode() = export and
|
||||
write.writes(base.flow(), name, _) and
|
||||
(
|
||||
base = getExportsVariable().getAReference()
|
||||
or
|
||||
base = getExportsVariable().getAnAssignedExpr()
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user