Go: Add tentative support for speculative taint flow.

This commit is contained in:
Anders Schack-Mulligen 2024-10-04 10:54:10 +02:00
Родитель 635071fe8a
Коммит fae71756eb
1 изменённых файлов: 22 добавлений и 0 удалений

Просмотреть файл

@ -428,3 +428,25 @@ private class ClearSanitizer extends DefaultTaintSanitizer {
)
}
}
import SpeculativeTaintFlow
private module SpeculativeTaintFlow {
private import semmle.go.dataflow.internal.DataFlowDispatch as DataFlowDispatch
predicate speculativeTaintStep(DataFlow::Node src, DataFlow::Node sink) {
exists(DataFlowPrivate::DataFlowCall call, DataFlowDispatch::ArgumentPosition argpos |
// TODO: exclude neutrals and anything that has QL modeling.
not exists(DataFlowDispatch::viableCallable(call)) and
src.(DataFlow::ArgumentNode).argumentOf(call, argpos)
|
argpos != -1 and
sink.(DataFlow::PostUpdateNode)
.getPreUpdateNode()
.(DataFlow::ArgumentNode)
.argumentOf(call, -1)
or
sink.(DataFlowPrivate::OutNode).getCall() = call
)
}
}