Skip to content

Commit 8af5492

Browse files
committed
JS: Make other node types not depend on tracking predicates
1 parent c7397d0 commit 8af5492

1 file changed

Lines changed: 21 additions & 3 deletions

File tree

javascript/ql/lib/semmle/javascript/ApiGraphs.qll

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -753,9 +753,25 @@ module API {
753753
or
754754
any(TypeAnnotation n).hasUnderlyingType(m, _)
755755
} or
756-
MkClassInstance(DataFlow::ClassNode cls) { needsDefNode(cls) } or
757-
MkDef(DataFlow::Node nd) { rhs(_, _, nd) } or
758-
MkUse(DataFlow::Node nd) { use(_, _, nd) } or
756+
MkClassInstance(DataFlow::ClassNode cls) or
757+
MkDef(DataFlow::Node nd) {
758+
nd = any(DataFlow::PropWrite w).getRhs()
759+
or
760+
nd = any(DataFlow::FunctionNode fn).getReturnNode()
761+
or
762+
nd = any(DataFlow::FunctionNode fn).getAReturn()
763+
or
764+
nd = any(Module m).getAnExportedValue(_)
765+
or
766+
nd = any(Module m).getABulkExportedNode()
767+
or
768+
nd = any(DataFlow::InvokeNode i).getAnArgument()
769+
or
770+
nd = any(DataFlow::InvokeNode i).getASpreadArgument()
771+
or
772+
nd = any(EntryPoint e).getASink()
773+
} or
774+
MkUse(DataFlow::Node nd) { nd instanceof DataFlow::SourceNode } or
759775
/** A use of a TypeScript type. */
760776
MkTypeUse(string moduleName, string exportName) {
761777
any(TypeAnnotation n).hasUnderlyingType(moduleName, exportName)
@@ -984,6 +1000,7 @@ module API {
9841000
predicate rhs(TApiNode nd, DataFlow::Node rhs) {
9851001
exists(string m | nd = MkModuleExport(m) | exports(m, rhs))
9861002
or
1003+
rhs(_, _, rhs) and
9871004
nd = MkDef(rhs)
9881005
}
9891006

@@ -1246,6 +1263,7 @@ module API {
12461263
ref = cls.(DataFlow::ClassNode).getAPrototypeReference()
12471264
)
12481265
or
1266+
use(_, _, ref) and
12491267
nd = MkUse(ref)
12501268
}
12511269

0 commit comments

Comments
 (0)