diff --git a/shared/dataflow/codeql/dataflow/internal/DataFlowImpl.qll b/shared/dataflow/codeql/dataflow/internal/DataFlowImpl.qll index 1373345423f7..a3c35afda9d7 100644 --- a/shared/dataflow/codeql/dataflow/internal/DataFlowImpl.qll +++ b/shared/dataflow/codeql/dataflow/internal/DataFlowImpl.qll @@ -1014,20 +1014,12 @@ module MakeImpl Lang> { private predicate sourceModel(NodeEx node, string model) { sourceNode(node, _) and - exists(Node n | n = node.asNode() | - knownSourceModel(n, model) - or - not knownSourceModel(n, _) and model = "" - ) + model = getSourceModel(node) } private predicate sinkModel(NodeEx node, string model) { sinkNode(node, _) and - exists(Node n | n = node.asNodeOrImplicitRead() | - knownSinkModel(n, model) - or - not knownSinkModel(n, _) and model = "" - ) + model = getSinkModel(node) } bindingset[label1, label2] diff --git a/shared/dataflow/codeql/dataflow/internal/DataFlowImplCommon.qll b/shared/dataflow/codeql/dataflow/internal/DataFlowImplCommon.qll index 4016199ccec6..38a9e9770e8a 100644 --- a/shared/dataflow/codeql/dataflow/internal/DataFlowImplCommon.qll +++ b/shared/dataflow/codeql/dataflow/internal/DataFlowImplCommon.qll @@ -1063,6 +1063,24 @@ module MakeImplCommon Lang> { exists(n.asParamReturnNode()) } + cached + string getSourceModel(NodeEx node) { + exists(Node n | n = node.asNode() | + knownSourceModel(n, result) + or + not knownSourceModel(n, _) and result = "" + ) + } + + cached + string getSinkModel(NodeEx node) { + exists(Node n | n = node.asNode() | + knownSinkModel(n, result) + or + not knownSinkModel(n, _) and result = "" + ) + } + cached predicate parameterNode(Node p, DataFlowCallable c, ParameterPosition pos) { isParameterNode(p, c, pos)