JS: Do not track instance methods

This commit is contained in:
Asger F
2024-03-04 10:32:27 +01:00
parent f5d014baa5
commit 4ab7acedb6

View File

@@ -249,7 +249,13 @@ module CallGraph {
or
result = node.(DataFlow::ObjectLiteralNode).getPropertySetter(_)
) and
not node.getTopLevel().isExterns()
not node.getTopLevel().isExterns() and
// Do not track instance methods on classes
not exists(DataFlow::ClassNode cls |
node = cls.getConstructor().getReceiver()
or
node = cls.(DataFlow::ClassNode::FunctionStyleClass).getAPrototypeReference()
)
}
private predicate shouldTrackObjectWithMethods(DataFlow::SourceNode node) {