Skip to content

Commit b6e07c0

Browse files
committed
Ruby: block API graph nodes from tracking through self-argument passing
1 parent 1257617 commit b6e07c0

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

ruby/ql/lib/codeql/ruby/ApiGraphs.qll

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,10 @@ module API {
639639
isUse(src) and
640640
t.start()
641641
or
642-
exists(TypeTracker t2 | result = trackUseNode(src, t2).track(t2, t))
642+
exists(TypeTracker t2 |
643+
result = trackUseNode(src, t2).track(t2, t) and
644+
not result instanceof DataFlowPrivate::SelfParameterNode
645+
)
643646
}
644647

645648
/**
@@ -658,7 +661,11 @@ module API {
658661
isDef(rhs) and
659662
result = rhs.getALocalSource()
660663
or
661-
exists(TypeBackTracker t2 | result = trackDefNode(rhs, t2).backtrack(t2, t))
664+
exists(TypeBackTracker t2, DataFlow::LocalSourceNode mid |
665+
mid = trackDefNode(rhs, t2) and
666+
not mid instanceof DataFlowPrivate::SelfParameterNode and
667+
result = mid.backtrack(t2, t)
668+
)
662669
}
663670

664671
/** Gets a data flow node reaching the RHS of the given def node. */

0 commit comments

Comments
 (0)