mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Implement FlowSummaryImpl stubs
This commit is contained in:
@@ -12,8 +12,14 @@ private import semmle.code.cpp.dataflow.ExternalFlow
|
||||
private import semmle.code.cpp.ir.IR
|
||||
|
||||
module Input implements InputSig<Location, DataFlowImplSpecific::CppDataFlow> {
|
||||
private import codeql.util.Void
|
||||
|
||||
class SummarizedCallableBase = Function;
|
||||
|
||||
class SourceBase = Void;
|
||||
|
||||
class SinkBase = Void;
|
||||
|
||||
ArgumentPosition callbackSelfParameterPosition() { result = TDirectPosition(-1) }
|
||||
|
||||
ReturnKind getStandardReturnValueKind() { result.(NormalReturnKind).getIndirectionIndex() = 0 }
|
||||
@@ -93,6 +99,10 @@ private module StepsInput implements Impl::Private::StepsInputSig {
|
||||
DataFlowCall getACall(Public::SummarizedCallable sc) {
|
||||
result.getStaticCallTarget().getUnderlyingCallable() = sc
|
||||
}
|
||||
|
||||
Node getSourceNode(Input::SourceBase source, Impl::Private::SummaryComponent sc) { none() }
|
||||
|
||||
Node getSinkNode(Input::SinkBase sink, Impl::Private::SummaryComponent sc) { none() }
|
||||
}
|
||||
|
||||
module SourceSinkInterpretationInput implements
|
||||
|
||||
@@ -14,8 +14,14 @@ private import semmle.code.csharp.Unification
|
||||
private import semmle.code.csharp.dataflow.internal.ExternalFlow
|
||||
|
||||
module Input implements InputSig<Location, DataFlowImplSpecific::CsharpDataFlow> {
|
||||
private import codeql.util.Void
|
||||
|
||||
class SummarizedCallableBase = UnboundCallable;
|
||||
|
||||
class SourceBase = Void;
|
||||
|
||||
class SinkBase = Void;
|
||||
|
||||
predicate neutralElement(SummarizedCallableBase c, string kind, string provenance, boolean isExact) {
|
||||
interpretNeutral(c, kind, provenance) and
|
||||
// isExact is not needed for C#.
|
||||
@@ -176,12 +182,22 @@ private module TypesInput implements Impl::Private::TypesInputSig {
|
||||
result.asGvnType() = Gvn::getGlobalValueNumber(dt.getDelegateType().getReturnType())
|
||||
)
|
||||
}
|
||||
|
||||
DataFlowType getSourceNodeType(Input::SourceBase source, Impl::Private::SummaryComponent sc) {
|
||||
none()
|
||||
}
|
||||
|
||||
DataFlowType getSinkNodeType(Input::SinkBase sink, Impl::Private::SummaryComponent sc) { none() }
|
||||
}
|
||||
|
||||
private module StepsInput implements Impl::Private::StepsInputSig {
|
||||
DataFlowCall getACall(Public::SummarizedCallable sc) {
|
||||
sc = viableCallable(result).asSummarizedCallable()
|
||||
}
|
||||
|
||||
Node getSourceNode(Input::SourceBase source, Impl::Private::SummaryComponent sc) { none() }
|
||||
|
||||
Node getSinkNode(Input::SinkBase sink, Impl::Private::SummaryComponent sc) { none() }
|
||||
}
|
||||
|
||||
module SourceSinkInterpretationInput implements
|
||||
|
||||
@@ -90,7 +90,7 @@ import internal.ExternalFlowExtensions as FlowExtensions
|
||||
private import FlowSummary as FlowSummary
|
||||
private import internal.DataFlowPrivate
|
||||
private import internal.FlowSummaryImpl
|
||||
private import internal.FlowSummaryImpl::Public
|
||||
private import internal.FlowSummaryImpl::Public as Public
|
||||
private import internal.FlowSummaryImpl::Private
|
||||
private import internal.FlowSummaryImpl::Private::External
|
||||
private import codeql.mad.ModelValidation as SharedModelVal
|
||||
@@ -583,13 +583,13 @@ predicate sourceNode(DataFlow::Node node, string kind) { sourceNode(node, kind,
|
||||
predicate sinkNode(DataFlow::Node node, string kind) { sinkNode(node, kind, _) }
|
||||
|
||||
// adapter class for converting Mad summaries to `SummarizedCallable`s
|
||||
private class SummarizedCallableAdapter extends SummarizedCallable {
|
||||
private class SummarizedCallableAdapter extends Public::SummarizedCallable {
|
||||
SummarizedCallableAdapter() { summaryElement(this, _, _, _, _, _) }
|
||||
|
||||
private predicate relevantSummaryElementManual(
|
||||
string input, string output, string kind, string model
|
||||
) {
|
||||
exists(Provenance provenance |
|
||||
exists(Public::Provenance provenance |
|
||||
summaryElement(this, input, output, kind, provenance, model) and
|
||||
provenance.isManual()
|
||||
)
|
||||
@@ -598,11 +598,11 @@ private class SummarizedCallableAdapter extends SummarizedCallable {
|
||||
private predicate relevantSummaryElementGenerated(
|
||||
string input, string output, string kind, string model
|
||||
) {
|
||||
exists(Provenance provenance |
|
||||
exists(Public::Provenance provenance |
|
||||
summaryElement(this, input, output, kind, provenance, model) and
|
||||
provenance.isGenerated()
|
||||
) and
|
||||
not exists(Provenance provenance |
|
||||
not exists(Public::Provenance provenance |
|
||||
neutralElement(this, "summary", provenance) and
|
||||
provenance.isManual()
|
||||
)
|
||||
@@ -621,7 +621,7 @@ private class SummarizedCallableAdapter extends SummarizedCallable {
|
||||
)
|
||||
}
|
||||
|
||||
override predicate hasProvenance(Provenance provenance) {
|
||||
override predicate hasProvenance(Public::Provenance provenance) {
|
||||
summaryElement(this, _, _, _, provenance, _)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,8 +21,14 @@ private string positionToString(int pos) {
|
||||
}
|
||||
|
||||
module Input implements InputSig<Location, DataFlowImplSpecific::GoDataFlow> {
|
||||
private import codeql.util.Void
|
||||
|
||||
class SummarizedCallableBase = Callable;
|
||||
|
||||
class SourceBase = Void;
|
||||
|
||||
class SinkBase = Void;
|
||||
|
||||
predicate neutralElement(
|
||||
Input::SummarizedCallableBase c, string kind, string provenance, boolean isExact
|
||||
) {
|
||||
@@ -108,6 +114,10 @@ private module StepsInput implements Impl::Private::StepsInputSig {
|
||||
call.getACalleeIncludingExternals() = sc
|
||||
)
|
||||
}
|
||||
|
||||
Node getSourceNode(Input::SourceBase source, Impl::Private::SummaryComponent sc) { none() }
|
||||
|
||||
Node getSinkNode(Input::SinkBase sink, Impl::Private::SummaryComponent sc) { none() }
|
||||
}
|
||||
|
||||
module SourceSinkInterpretationInput implements
|
||||
|
||||
@@ -27,8 +27,14 @@ private string positionToString(int pos) {
|
||||
}
|
||||
|
||||
module Input implements InputSig<Location, DataFlowImplSpecific::JavaDataFlow> {
|
||||
private import codeql.util.Void
|
||||
|
||||
class SummarizedCallableBase = FlowSummary::SummarizedCallableBase;
|
||||
|
||||
class SourceBase = Void;
|
||||
|
||||
class SinkBase = Void;
|
||||
|
||||
predicate neutralElement(
|
||||
Input::SummarizedCallableBase c, string kind, string provenance, boolean isExact
|
||||
) {
|
||||
@@ -123,12 +129,22 @@ private module TypesInput implements Impl::Private::TypesInputSig {
|
||||
result = getErasedRepr(t.(FunctionalInterface).getRunMethod().getReturnType()) and
|
||||
exists(rk)
|
||||
}
|
||||
|
||||
DataFlowType getSourceNodeType(Input::SourceBase source, Impl::Private::SummaryComponent sc) {
|
||||
none()
|
||||
}
|
||||
|
||||
DataFlowType getSinkNodeType(Input::SinkBase sink, Impl::Private::SummaryComponent sc) { none() }
|
||||
}
|
||||
|
||||
private module StepsInput implements Impl::Private::StepsInputSig {
|
||||
DataFlowCall getACall(Public::SummarizedCallable sc) {
|
||||
sc = viableCallable(result).asSummarizedCallable()
|
||||
}
|
||||
|
||||
Node getSourceNode(Input::SourceBase source, Impl::Private::SummaryComponent sc) { none() }
|
||||
|
||||
Node getSinkNode(Input::SinkBase sink, Impl::Private::SummaryComponent sc) { none() }
|
||||
}
|
||||
|
||||
private predicate relatedArgSpec(Callable c, string spec) {
|
||||
|
||||
@@ -10,8 +10,14 @@ private import DataFlowImplSpecific::Private
|
||||
private import DataFlowImplSpecific::Public
|
||||
|
||||
module Input implements InputSig<Location, DataFlowImplSpecific::PythonDataFlow> {
|
||||
private import codeql.util.Void
|
||||
|
||||
class SummarizedCallableBase = string;
|
||||
|
||||
class SourceBase = Void;
|
||||
|
||||
class SinkBase = Void;
|
||||
|
||||
ArgumentPosition callbackSelfParameterPosition() { result.isLambdaSelf() }
|
||||
|
||||
ReturnKind getStandardReturnValueKind() { any() }
|
||||
@@ -98,6 +104,10 @@ private module StepsInput implements Impl::Private::StepsInputSig {
|
||||
sc.(LibraryCallable).getACallSimple().asCfgNode()
|
||||
])
|
||||
}
|
||||
|
||||
Node getSourceNode(Input::SourceBase source, Impl::Private::SummaryComponent sc) { none() }
|
||||
|
||||
Node getSinkNode(Input::SinkBase sink, Impl::Private::SummaryComponent sc) { none() }
|
||||
}
|
||||
|
||||
module Private {
|
||||
|
||||
@@ -10,8 +10,14 @@ private import DataFlowImplSpecific::Private
|
||||
private import DataFlowImplSpecific::Public
|
||||
|
||||
module Input implements InputSig<Location, DataFlowImplSpecific::RubyDataFlow> {
|
||||
private import codeql.util.Void
|
||||
|
||||
class SummarizedCallableBase = string;
|
||||
|
||||
class SourceBase = Void;
|
||||
|
||||
class SinkBase = Void;
|
||||
|
||||
ArgumentPosition callbackSelfParameterPosition() { result.isLambdaSelf() }
|
||||
|
||||
ReturnKind getStandardReturnValueKind() { result instanceof NormalReturnKind }
|
||||
@@ -154,6 +160,10 @@ private module StepsInput implements Impl::Private::StepsInputSig {
|
||||
or
|
||||
result.asCall().getAstNode() = sc.(LibraryCallable).getACallSimple()
|
||||
}
|
||||
|
||||
Node getSourceNode(Input::SourceBase source, Impl::Private::SummaryComponent sc) { none() }
|
||||
|
||||
Node getSinkNode(Input::SinkBase sink, Impl::Private::SummaryComponent sc) { none() }
|
||||
}
|
||||
|
||||
module Private {
|
||||
|
||||
@@ -12,8 +12,14 @@ private import DataFlowImplCommon
|
||||
private import codeql.swift.dataflow.ExternalFlow
|
||||
|
||||
module Input implements InputSig<Location, DataFlowImplSpecific::SwiftDataFlow> {
|
||||
private import codeql.util.Void
|
||||
|
||||
class SummarizedCallableBase = Function;
|
||||
|
||||
class SourceBase = Void;
|
||||
|
||||
class SinkBase = Void;
|
||||
|
||||
ArgumentPosition callbackSelfParameterPosition() { result instanceof ThisArgumentPosition }
|
||||
|
||||
ReturnKind getStandardReturnValueKind() { result instanceof NormalReturnKind }
|
||||
@@ -106,6 +112,10 @@ private import Make<Location, DataFlowImplSpecific::SwiftDataFlow, Input> as Imp
|
||||
|
||||
private module StepsInput implements Impl::Private::StepsInputSig {
|
||||
DataFlowCall getACall(Public::SummarizedCallable sc) { result.asCall().getStaticTarget() = sc }
|
||||
|
||||
Node getSourceNode(Input::SourceBase source, Impl::Private::SummaryComponent sc) { none() }
|
||||
|
||||
Node getSinkNode(Input::SinkBase sink, Impl::Private::SummaryComponent sc) { none() }
|
||||
}
|
||||
|
||||
module SourceSinkInterpretationInput implements
|
||||
|
||||
Reference in New Issue
Block a user