Skip to content

Commit ab5b3c9

Browse files
committed
Go: Add tentative support for speculative taint flow.
1 parent a40581a commit ab5b3c9

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
@@ -427,3 +427,25 @@ private class ClearSanitizer extends DefaultTaintSanitizer {
427427
)
428428
}
429429
}
430+
431+
import SpeculativeTaintFlow
432+
433+
private module SpeculativeTaintFlow {
434+
private import semmle.go.dataflow.internal.DataFlowDispatch as DataFlowDispatch
435+
436+
predicate speculativeTaintStep(DataFlow::Node src, DataFlow::Node sink) {
437+
exists(DataFlowPrivate::DataFlowCall call, DataFlowDispatch::ArgumentPosition argpos |
438+
// TODO: exclude neutrals and anything that has QL modeling.
439+
not exists(DataFlowDispatch::viableCallable(call)) and
440+
src.(DataFlow::ArgumentNode).argumentOf(call, argpos)
441+
|
442+
argpos != -1 and
443+
sink.(DataFlow::PostUpdateNode)
444+
.getPreUpdateNode()
445+
.(DataFlow::ArgumentNode)
446+
.argumentOf(call, -1)
447+
or
448+
sink.(DataFlowPrivate::OutNode).getCall() = call
449+
)
450+
}
451+
}

0 commit comments

Comments
 (0)