Skip to content

Commit 8eb0cb4

Browse files
committed
Ruby: Add tentative support for speculative taint flow.
1 parent 7b43100 commit 8eb0cb4

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

ruby/ql/lib/codeql/ruby/dataflow/internal/TaintTrackingPrivate.qll

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,3 +149,29 @@ private module Cached {
149149
}
150150

151151
import Cached
152+
import SpeculativeTaintFlow
153+
154+
private module SpeculativeTaintFlow {
155+
private import codeql.ruby.dataflow.internal.DataFlowDispatch as DataFlowDispatch
156+
private import codeql.ruby.dataflow.internal.DataFlowPublic as DataFlowPublic
157+
158+
predicate speculativeTaintStep(DataFlow::Node src, DataFlow::Node sink) {
159+
exists(
160+
DataFlowDispatch::DataFlowCall call, MethodCall srcCall,
161+
DataFlowDispatch::ArgumentPosition argpos
162+
|
163+
// TODO: exclude neutrals and anything that has QL modeling.
164+
not exists(DataFlowDispatch::viableCallable(call)) and
165+
call.asCall().getExpr() = srcCall and
166+
src.(ArgumentNode).argumentOf(call, argpos)
167+
|
168+
not argpos.isSelf() and
169+
sink.(DataFlowPublic::PostUpdateNode)
170+
.getPreUpdateNode()
171+
.(ArgumentNode)
172+
.argumentOf(call, any(DataFlowDispatch::ArgumentPosition qualpos | qualpos.isSelf()))
173+
or
174+
sink.(OutNode).getCall(_) = call
175+
)
176+
}
177+
}

0 commit comments

Comments
 (0)