Skip to content

Commit 4ab7ace

Browse files
committed
JS: Do not track instance methods
1 parent f5d014b commit 4ab7ace

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

javascript/ql/lib/semmle/javascript/dataflow/internal/CallGraphs.qll

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,13 @@ module CallGraph {
249249
or
250250
result = node.(DataFlow::ObjectLiteralNode).getPropertySetter(_)
251251
) and
252-
not node.getTopLevel().isExterns()
252+
not node.getTopLevel().isExterns() and
253+
// Do not track instance methods on classes
254+
not exists(DataFlow::ClassNode cls |
255+
node = cls.getConstructor().getReceiver()
256+
or
257+
node = cls.(DataFlow::ClassNode::FunctionStyleClass).getAPrototypeReference()
258+
)
253259
}
254260

255261
private predicate shouldTrackObjectWithMethods(DataFlow::SourceNode node) {

0 commit comments

Comments
 (0)