Skip to content

Commit ad8dc6f

Browse files
committed
DataFlow: Include PathGraph in GlobalFlowSig
This aims to remove the need for `::PathGraph` in common cases, so users just have to import the result of Global<...>.
1 parent aaf0cd5 commit ad8dc6f

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

shared/dataflow/codeql/dataflow/DataFlow.qll

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,16 @@ module DataFlowMake<LocationSig Location, InputSig<Location> Lang> {
615615
* A `Node` augmented with a call context (except for sinks) and an access path.
616616
* Only those `PathNode`s that are reachable from a source, and which can reach a sink, are generated.
617617
*/
618-
class PathNode;
618+
class PathNode {
619+
/** Gets a textual representation of this element. */
620+
string toString();
621+
622+
/** Gets the underlying `Node`. */
623+
Node getNode();
624+
625+
/** Gets the location of this node. */
626+
Location getLocation();
627+
}
619628

620629
/**
621630
* Holds if data can flow from `source` to `sink`.
@@ -639,6 +648,19 @@ module DataFlowMake<LocationSig Location, InputSig<Location> Lang> {
639648
* Holds if data can flow from some source to `sink`.
640649
*/
641650
predicate flowToExpr(DataFlowExpr sink);
651+
652+
/** Holds if `(a,b)` is an edge in the graph of data flow path explanations. */
653+
predicate edges(PathNode a, PathNode b, string key, string val);
654+
655+
/** Holds if `n` is a node in the graph of data flow path explanations. */
656+
predicate nodes(PathNode n, string key, string val);
657+
658+
/**
659+
* Holds if `(arg, par, ret, out)` forms a subpath-tuple, that is, flow through
660+
* a subpath between `par` and `ret` with the connecting edges `arg -> par` and
661+
* `ret -> out` is summarized as the edge `arg -> out`.
662+
*/
663+
predicate subpaths(PathNode arg, PathNode par, PathNode ret, PathNode out);
642664
}
643665

644666
/**

shared/dataflow/codeql/dataflow/internal/DataFlowImpl.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,8 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
168168
module Impl<FullStateConfigSig Config> {
169169
private class FlowState = Config::FlowState;
170170

171+
import PathGraph
172+
171173
private module SourceSinkFiltering {
172174
private import codeql.util.AlertFiltering
173175

0 commit comments

Comments
 (0)