Skip to content

Commit fae7175

Browse files
committed
Go: Add tentative support for speculative taint flow.
1 parent 635071f commit fae7175

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

go/ql/lib/semmle/go/dataflow/internal/TaintTrackingUtil.qll

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,3 +428,25 @@ private class ClearSanitizer extends DefaultTaintSanitizer {
428428
)
429429
}
430430
}
431+
432+
import SpeculativeTaintFlow
433+
434+
private module SpeculativeTaintFlow {
435+
private import semmle.go.dataflow.internal.DataFlowDispatch as DataFlowDispatch
436+
437+
predicate speculativeTaintStep(DataFlow::Node src, DataFlow::Node sink) {
438+
exists(DataFlowPrivate::DataFlowCall call, DataFlowDispatch::ArgumentPosition argpos |
439+
// TODO: exclude neutrals and anything that has QL modeling.
440+
not exists(DataFlowDispatch::viableCallable(call)) and
441+
src.(DataFlow::ArgumentNode).argumentOf(call, argpos)
442+
|
443+
argpos != -1 and
444+
sink.(DataFlow::PostUpdateNode)
445+
.getPreUpdateNode()
446+
.(DataFlow::ArgumentNode)
447+
.argumentOf(call, -1)
448+
or
449+
sink.(DataFlowPrivate::OutNode).getCall() = call
450+
)
451+
}
452+
}

0 commit comments

Comments
 (0)