Skip to content

Commit 6a986a9

Browse files
committed
JS: Avoid tracking classes into receiver of other classes
1 parent d497fd2 commit 6a986a9

File tree

1 file changed

+5
-1
lines changed
  • javascript/ql/src/semmle/javascript/dataflow

1 file changed

+5
-1
lines changed

javascript/ql/src/semmle/javascript/dataflow/Nodes.qll

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,11 @@ class ClassNode extends DataFlow::SourceNode {
716716
result = getAReceiverNode()
717717
or
718718
exists(DataFlow::TypeTracker t2 |
719-
result = getAnInstanceReference(t2).track(t2, t)
719+
result = getAnInstanceReference(t2).track(t2, t) and
720+
// Avoid tracking into the receiver of other classes.
721+
// Note that this also blocks flows into a property of the receiver,
722+
// but the `localFieldStep` rule will often compensate for this.
723+
not result = any(DataFlow::ClassNode cls).getAReceiverNode()
720724
)
721725
}
722726

0 commit comments

Comments
 (0)