diff --git a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/ExternalFlow.qll b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/ExternalFlow.qll index ccc0a333b9e7..a68d761588e7 100644 --- a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/ExternalFlow.qll +++ b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/ExternalFlow.qll @@ -88,7 +88,7 @@ */ import csharp -import ExternalFlowExtensions +private import ExternalFlowExtensions as ExternalFlowExtensions private import DataFlowDispatch private import DataFlowPrivate private import DataFlowPublic @@ -102,6 +102,35 @@ private import semmle.code.csharp.frameworks.System private import codeql.dataflow.internal.AccessPathSyntax as AccessPathSyntax private import codeql.mad.ModelValidation as SharedModelVal +private predicate sourceModel( + string namespace, string type, boolean subtypes, string name, string signature, string ext, + string output, string kind, string provenance, QlBuiltins::ExtensionId madId +) { + subtypes = true and + ExternalFlowExtensions::sourceModel(namespace, type, _, name, signature, ext, output, kind, + provenance, madId) +} + +private predicate sinkModel( + string namespace, string type, boolean subtypes, string name, string signature, string ext, + string input, string kind, string provenance, QlBuiltins::ExtensionId madId +) { + subtypes = true and + ExternalFlowExtensions::sinkModel(namespace, type, _, name, signature, ext, input, kind, + provenance, madId) +} + +private predicate summaryModel( + string namespace, string type, boolean subtypes, string name, string signature, string ext, + string input, string output, string kind, string provenance, QlBuiltins::ExtensionId madId +) { + subtypes = true and + ExternalFlowExtensions::summaryModel(namespace, type, _, name, signature, ext, input, output, + kind, provenance, madId) +} + +private predicate neutralModel = ExternalFlowExtensions::neutralModel/6; + /** * Holds if the given extension tuple `madId` should pretty-print as `model`. * diff --git a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/FlowSummaryImpl.qll b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/FlowSummaryImpl.qll index d777566a336a..9a768e7fe958 100644 --- a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/FlowSummaryImpl.qll +++ b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/FlowSummaryImpl.qll @@ -11,6 +11,7 @@ private import DataFlowImplSpecific as DataFlowImplSpecific private import DataFlowImplSpecific::Private private import DataFlowImplSpecific::Public private import semmle.code.csharp.Unification +private import semmle.code.csharp.dataflow.internal.ExternalFlowExtensions as ExternalFlowExtensions private import semmle.code.csharp.dataflow.internal.ExternalFlow module Input implements InputSig { @@ -198,7 +199,8 @@ module SourceSinkInterpretationInput implements string namespace, string type, boolean subtypes, string name, string signature, string ext, QlBuiltins::ExtensionId madId | - sourceModel(namespace, type, subtypes, name, signature, ext, output, kind, provenance, madId) and + ExternalFlowExtensions::sourceModel(namespace, type, _, name, signature, ext, output, kind, + provenance, madId) and model = "MaD:" + madId.toString() and e = interpretElement(namespace, type, subtypes, name, signature, ext) ) @@ -211,7 +213,8 @@ module SourceSinkInterpretationInput implements string namespace, string type, boolean subtypes, string name, string signature, string ext, QlBuiltins::ExtensionId madId | - sinkModel(namespace, type, subtypes, name, signature, ext, input, kind, provenance, madId) and + ExternalFlowExtensions::sinkModel(namespace, type, _, name, signature, ext, input, kind, + provenance, madId) and model = "MaD:" + madId.toString() and e = interpretElement(namespace, type, subtypes, name, signature, ext) ) diff --git a/csharp/ql/src/utils/modelconverter/InterpretModel.qll b/csharp/ql/src/utils/modelconverter/InterpretModel.qll index 3bbffe7fe676..c43bf32e7479 100644 --- a/csharp/ql/src/utils/modelconverter/InterpretModel.qll +++ b/csharp/ql/src/utils/modelconverter/InterpretModel.qll @@ -1,4 +1,5 @@ import csharp +import semmle.code.csharp.dataflow.internal.ExternalFlowExtensions import semmle.code.csharp.dataflow.internal.ExternalFlow bindingset[namespace0, type0, name0, signature0]