From e0cc337c71ecda479f9b28302e808c4db0223db5 Mon Sep 17 00:00:00 2001 From: Owen Mansel-Chan Date: Wed, 26 Jul 2023 15:40:34 +0100 Subject: [PATCH 1/2] Fix DataFlow::MergePathGraph3 Need to get the signatures correct. --- .../semmle/go/dataflow/internal/DataFlow.qll | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/go/ql/lib/semmle/go/dataflow/internal/DataFlow.qll b/go/ql/lib/semmle/go/dataflow/internal/DataFlow.qll index 03975c6a54a..920cc5cdce9 100644 --- a/go/ql/lib/semmle/go/dataflow/internal/DataFlow.qll +++ b/go/ql/lib/semmle/go/dataflow/internal/DataFlow.qll @@ -429,5 +429,22 @@ module MergePathGraph3< /** * Provides the query predicates needed to include a graph in a path-problem query. */ - module PathGraph = Merged::PathGraph; + module PathGraph implements PathGraphSig { + /** Holds if `(a,b)` is an edge in the graph of data flow path explanations. */ + query predicate edges(PathNode a, PathNode b) { Merged::PathGraph::edges(a, b) } + + /** Holds if `n` is a node in the graph of data flow path explanations. */ + query predicate nodes(PathNode n, string key, string val) { + Merged::PathGraph::nodes(n, key, val) + } + + /** + * Holds if `(arg, par, ret, out)` forms a subpath-tuple, that is, flow through + * a subpath between `par` and `ret` with the connecting edges `arg -> par` and + * `ret -> out` is summarized as the edge `arg -> out`. + */ + query predicate subpaths(PathNode arg, PathNode par, PathNode ret, PathNode out) { + Merged::PathGraph::subpaths(arg, par, ret, out) + } + } } From 9b2b58a823c4c1f740c663ed480624d5d5781338 Mon Sep 17 00:00:00 2001 From: Owen Mansel-Chan Date: Wed, 26 Jul 2023 16:08:40 +0100 Subject: [PATCH 2/2] Sync files --- .../code/cpp/dataflow/internal/DataFlow.qll | 19 ++++++++++++++++++- .../cpp/ir/dataflow/internal/DataFlow.qll | 19 ++++++++++++++++++- .../csharp/dataflow/internal/DataFlow.qll | 19 ++++++++++++++++++- .../code/java/dataflow/internal/DataFlow.qll | 19 ++++++++++++++++++- .../python/dataflow/new/internal/DataFlow.qll | 19 ++++++++++++++++++- .../ruby/dataflow/internal/DataFlow.qll | 19 ++++++++++++++++++- .../swift/dataflow/internal/DataFlow.qll | 19 ++++++++++++++++++- 7 files changed, 126 insertions(+), 7 deletions(-) diff --git a/cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlow.qll b/cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlow.qll index 03975c6a54a..920cc5cdce9 100644 --- a/cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlow.qll +++ b/cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlow.qll @@ -429,5 +429,22 @@ module MergePathGraph3< /** * Provides the query predicates needed to include a graph in a path-problem query. */ - module PathGraph = Merged::PathGraph; + module PathGraph implements PathGraphSig { + /** Holds if `(a,b)` is an edge in the graph of data flow path explanations. */ + query predicate edges(PathNode a, PathNode b) { Merged::PathGraph::edges(a, b) } + + /** Holds if `n` is a node in the graph of data flow path explanations. */ + query predicate nodes(PathNode n, string key, string val) { + Merged::PathGraph::nodes(n, key, val) + } + + /** + * Holds if `(arg, par, ret, out)` forms a subpath-tuple, that is, flow through + * a subpath between `par` and `ret` with the connecting edges `arg -> par` and + * `ret -> out` is summarized as the edge `arg -> out`. + */ + query predicate subpaths(PathNode arg, PathNode par, PathNode ret, PathNode out) { + Merged::PathGraph::subpaths(arg, par, ret, out) + } + } } diff --git a/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlow.qll b/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlow.qll index 03975c6a54a..920cc5cdce9 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlow.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlow.qll @@ -429,5 +429,22 @@ module MergePathGraph3< /** * Provides the query predicates needed to include a graph in a path-problem query. */ - module PathGraph = Merged::PathGraph; + module PathGraph implements PathGraphSig { + /** Holds if `(a,b)` is an edge in the graph of data flow path explanations. */ + query predicate edges(PathNode a, PathNode b) { Merged::PathGraph::edges(a, b) } + + /** Holds if `n` is a node in the graph of data flow path explanations. */ + query predicate nodes(PathNode n, string key, string val) { + Merged::PathGraph::nodes(n, key, val) + } + + /** + * Holds if `(arg, par, ret, out)` forms a subpath-tuple, that is, flow through + * a subpath between `par` and `ret` with the connecting edges `arg -> par` and + * `ret -> out` is summarized as the edge `arg -> out`. + */ + query predicate subpaths(PathNode arg, PathNode par, PathNode ret, PathNode out) { + Merged::PathGraph::subpaths(arg, par, ret, out) + } + } } diff --git a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlow.qll b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlow.qll index 03975c6a54a..920cc5cdce9 100644 --- a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlow.qll +++ b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlow.qll @@ -429,5 +429,22 @@ module MergePathGraph3< /** * Provides the query predicates needed to include a graph in a path-problem query. */ - module PathGraph = Merged::PathGraph; + module PathGraph implements PathGraphSig { + /** Holds if `(a,b)` is an edge in the graph of data flow path explanations. */ + query predicate edges(PathNode a, PathNode b) { Merged::PathGraph::edges(a, b) } + + /** Holds if `n` is a node in the graph of data flow path explanations. */ + query predicate nodes(PathNode n, string key, string val) { + Merged::PathGraph::nodes(n, key, val) + } + + /** + * Holds if `(arg, par, ret, out)` forms a subpath-tuple, that is, flow through + * a subpath between `par` and `ret` with the connecting edges `arg -> par` and + * `ret -> out` is summarized as the edge `arg -> out`. + */ + query predicate subpaths(PathNode arg, PathNode par, PathNode ret, PathNode out) { + Merged::PathGraph::subpaths(arg, par, ret, out) + } + } } diff --git a/java/ql/lib/semmle/code/java/dataflow/internal/DataFlow.qll b/java/ql/lib/semmle/code/java/dataflow/internal/DataFlow.qll index 03975c6a54a..920cc5cdce9 100644 --- a/java/ql/lib/semmle/code/java/dataflow/internal/DataFlow.qll +++ b/java/ql/lib/semmle/code/java/dataflow/internal/DataFlow.qll @@ -429,5 +429,22 @@ module MergePathGraph3< /** * Provides the query predicates needed to include a graph in a path-problem query. */ - module PathGraph = Merged::PathGraph; + module PathGraph implements PathGraphSig { + /** Holds if `(a,b)` is an edge in the graph of data flow path explanations. */ + query predicate edges(PathNode a, PathNode b) { Merged::PathGraph::edges(a, b) } + + /** Holds if `n` is a node in the graph of data flow path explanations. */ + query predicate nodes(PathNode n, string key, string val) { + Merged::PathGraph::nodes(n, key, val) + } + + /** + * Holds if `(arg, par, ret, out)` forms a subpath-tuple, that is, flow through + * a subpath between `par` and `ret` with the connecting edges `arg -> par` and + * `ret -> out` is summarized as the edge `arg -> out`. + */ + query predicate subpaths(PathNode arg, PathNode par, PathNode ret, PathNode out) { + Merged::PathGraph::subpaths(arg, par, ret, out) + } + } } diff --git a/python/ql/lib/semmle/python/dataflow/new/internal/DataFlow.qll b/python/ql/lib/semmle/python/dataflow/new/internal/DataFlow.qll index 03975c6a54a..920cc5cdce9 100644 --- a/python/ql/lib/semmle/python/dataflow/new/internal/DataFlow.qll +++ b/python/ql/lib/semmle/python/dataflow/new/internal/DataFlow.qll @@ -429,5 +429,22 @@ module MergePathGraph3< /** * Provides the query predicates needed to include a graph in a path-problem query. */ - module PathGraph = Merged::PathGraph; + module PathGraph implements PathGraphSig { + /** Holds if `(a,b)` is an edge in the graph of data flow path explanations. */ + query predicate edges(PathNode a, PathNode b) { Merged::PathGraph::edges(a, b) } + + /** Holds if `n` is a node in the graph of data flow path explanations. */ + query predicate nodes(PathNode n, string key, string val) { + Merged::PathGraph::nodes(n, key, val) + } + + /** + * Holds if `(arg, par, ret, out)` forms a subpath-tuple, that is, flow through + * a subpath between `par` and `ret` with the connecting edges `arg -> par` and + * `ret -> out` is summarized as the edge `arg -> out`. + */ + query predicate subpaths(PathNode arg, PathNode par, PathNode ret, PathNode out) { + Merged::PathGraph::subpaths(arg, par, ret, out) + } + } } diff --git a/ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlow.qll b/ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlow.qll index 03975c6a54a..920cc5cdce9 100644 --- a/ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlow.qll +++ b/ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlow.qll @@ -429,5 +429,22 @@ module MergePathGraph3< /** * Provides the query predicates needed to include a graph in a path-problem query. */ - module PathGraph = Merged::PathGraph; + module PathGraph implements PathGraphSig { + /** Holds if `(a,b)` is an edge in the graph of data flow path explanations. */ + query predicate edges(PathNode a, PathNode b) { Merged::PathGraph::edges(a, b) } + + /** Holds if `n` is a node in the graph of data flow path explanations. */ + query predicate nodes(PathNode n, string key, string val) { + Merged::PathGraph::nodes(n, key, val) + } + + /** + * Holds if `(arg, par, ret, out)` forms a subpath-tuple, that is, flow through + * a subpath between `par` and `ret` with the connecting edges `arg -> par` and + * `ret -> out` is summarized as the edge `arg -> out`. + */ + query predicate subpaths(PathNode arg, PathNode par, PathNode ret, PathNode out) { + Merged::PathGraph::subpaths(arg, par, ret, out) + } + } } diff --git a/swift/ql/lib/codeql/swift/dataflow/internal/DataFlow.qll b/swift/ql/lib/codeql/swift/dataflow/internal/DataFlow.qll index 03975c6a54a..920cc5cdce9 100644 --- a/swift/ql/lib/codeql/swift/dataflow/internal/DataFlow.qll +++ b/swift/ql/lib/codeql/swift/dataflow/internal/DataFlow.qll @@ -429,5 +429,22 @@ module MergePathGraph3< /** * Provides the query predicates needed to include a graph in a path-problem query. */ - module PathGraph = Merged::PathGraph; + module PathGraph implements PathGraphSig { + /** Holds if `(a,b)` is an edge in the graph of data flow path explanations. */ + query predicate edges(PathNode a, PathNode b) { Merged::PathGraph::edges(a, b) } + + /** Holds if `n` is a node in the graph of data flow path explanations. */ + query predicate nodes(PathNode n, string key, string val) { + Merged::PathGraph::nodes(n, key, val) + } + + /** + * Holds if `(arg, par, ret, out)` forms a subpath-tuple, that is, flow through + * a subpath between `par` and `ret` with the connecting edges `arg -> par` and + * `ret -> out` is summarized as the edge `arg -> out`. + */ + query predicate subpaths(PathNode arg, PathNode par, PathNode ret, PathNode out) { + Merged::PathGraph::subpaths(arg, par, ret, out) + } + } }