Skip to content

Commit 9d88f01

Browse files
authored
Merge pull request #12645 from aschackmull/dataflow/renaming
Dataflow: Rename Make to Global and hasFlow to flow
2 parents 9f36acb + d440bc2 commit 9d88f01

File tree

200 files changed

+843
-553
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

200 files changed

+843
-553
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
category: deprecated
3+
---
4+
* The recently introduced new data flow and taint tracking APIs have had a
5+
number of module and predicate renamings. The old APIs remain in place for
6+
now.

cpp/ql/lib/experimental/semmle/code/cpp/security/PrivateCleartextWrite.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ module PrivateCleartextWrite {
5454
predicate isBarrier(DataFlow::Node node) { node instanceof Sanitizer }
5555
}
5656

57-
module WriteFlow = TaintTracking::Make<WriteConfig>;
57+
module WriteFlow = TaintTracking::Global<WriteConfig>;
5858

5959
class PrivateDataSource extends Source {
6060
PrivateDataSource() { this.getExpr() instanceof PrivateDataExpr }

cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlow.qll

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Provides an implementation of global (interprocedural) data flow. This file
33
* re-exports the local (intraprocedural) data flow analysis from
44
* `DataFlowImplSpecific::Public` and adds a global analysis, mainly exposed
5-
* through the `Make` and `MakeWithState` modules.
5+
* through the `Global` and `GlobalWithState` modules.
66
*/
77

88
private import DataFlowImplCommon
@@ -73,10 +73,10 @@ signature module ConfigSig {
7373
*/
7474
default FlowFeature getAFeature() { none() }
7575

76-
/** Holds if sources should be grouped in the result of `hasFlowPath`. */
76+
/** Holds if sources should be grouped in the result of `flowPath`. */
7777
default predicate sourceGrouping(Node source, string sourceGroup) { none() }
7878

79-
/** Holds if sinks should be grouped in the result of `hasFlowPath`. */
79+
/** Holds if sinks should be grouped in the result of `flowPath`. */
8080
default predicate sinkGrouping(Node sink, string sinkGroup) { none() }
8181

8282
/**
@@ -166,10 +166,10 @@ signature module StateConfigSig {
166166
*/
167167
default FlowFeature getAFeature() { none() }
168168

169-
/** Holds if sources should be grouped in the result of `hasFlowPath`. */
169+
/** Holds if sources should be grouped in the result of `flowPath`. */
170170
default predicate sourceGrouping(Node source, string sourceGroup) { none() }
171171

172-
/** Holds if sinks should be grouped in the result of `hasFlowPath`. */
172+
/** Holds if sinks should be grouped in the result of `flowPath`. */
173173
default predicate sinkGrouping(Node sink, string sinkGroup) { none() }
174174

175175
/**
@@ -182,15 +182,15 @@ signature module StateConfigSig {
182182
}
183183

184184
/**
185-
* Gets the exploration limit for `hasPartialFlow` and `hasPartialFlowRev`
185+
* Gets the exploration limit for `partialFlow` and `partialFlowRev`
186186
* measured in approximate number of interprocedural steps.
187187
*/
188188
signature int explorationLimitSig();
189189

190190
/**
191-
* The output of a data flow computation.
191+
* The output of a global data flow computation.
192192
*/
193-
signature module DataFlowSig {
193+
signature module GlobalFlowSig {
194194
/**
195195
* A `Node` augmented with a call context (except for sinks) and an access path.
196196
* Only those `PathNode`s that are reachable from a source, and which can reach a sink, are generated.
@@ -203,28 +203,28 @@ signature module DataFlowSig {
203203
* The corresponding paths are generated from the end-points and the graph
204204
* included in the module `PathGraph`.
205205
*/
206-
predicate hasFlowPath(PathNode source, PathNode sink);
206+
predicate flowPath(PathNode source, PathNode sink);
207207

208208
/**
209209
* Holds if data can flow from `source` to `sink`.
210210
*/
211-
predicate hasFlow(Node source, Node sink);
211+
predicate flow(Node source, Node sink);
212212

213213
/**
214214
* Holds if data can flow from some source to `sink`.
215215
*/
216-
predicate hasFlowTo(Node sink);
216+
predicate flowTo(Node sink);
217217

218218
/**
219219
* Holds if data can flow from some source to `sink`.
220220
*/
221-
predicate hasFlowToExpr(DataFlowExpr sink);
221+
predicate flowToExpr(DataFlowExpr sink);
222222
}
223223

224224
/**
225225
* Constructs a standard data flow computation.
226226
*/
227-
module Make<ConfigSig Config> implements DataFlowSig {
227+
module Global<ConfigSig Config> implements GlobalFlowSig {
228228
private module C implements FullStateConfigSig {
229229
import DefaultState<Config>
230230
import Config
@@ -233,17 +233,27 @@ module Make<ConfigSig Config> implements DataFlowSig {
233233
import Impl<C>
234234
}
235235

236+
/** DEPRECATED: Use `Global` instead. */
237+
deprecated module Make<ConfigSig Config> implements GlobalFlowSig {
238+
import Global<Config>
239+
}
240+
236241
/**
237242
* Constructs a data flow computation using flow state.
238243
*/
239-
module MakeWithState<StateConfigSig Config> implements DataFlowSig {
244+
module GlobalWithState<StateConfigSig Config> implements GlobalFlowSig {
240245
private module C implements FullStateConfigSig {
241246
import Config
242247
}
243248

244249
import Impl<C>
245250
}
246251

252+
/** DEPRECATED: Use `GlobalWithState` instead. */
253+
deprecated module MakeWithState<StateConfigSig Config> implements GlobalFlowSig {
254+
import GlobalWithState<Config>
255+
}
256+
247257
signature class PathNodeSig {
248258
/** Gets a textual representation of this element. */
249259
string toString();

cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImpl.qll

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,10 @@ signature module FullStateConfigSig {
9191
*/
9292
FlowFeature getAFeature();
9393

94-
/** Holds if sources should be grouped in the result of `hasFlowPath`. */
94+
/** Holds if sources should be grouped in the result of `flowPath`. */
9595
predicate sourceGrouping(Node source, string sourceGroup);
9696

97-
/** Holds if sinks should be grouped in the result of `hasFlowPath`. */
97+
/** Holds if sinks should be grouped in the result of `flowPath`. */
9898
predicate sinkGrouping(Node sink, string sinkGroup);
9999

100100
/**
@@ -3629,7 +3629,7 @@ module Impl<FullStateConfigSig Config> {
36293629
* The corresponding paths are generated from the end-points and the graph
36303630
* included in the module `PathGraph`.
36313631
*/
3632-
predicate hasFlowPath(PathNode source, PathNode sink) {
3632+
predicate flowPath(PathNode source, PathNode sink) {
36333633
exists(PathNodeImpl flowsource, PathNodeImpl flowsink |
36343634
source = flowsource and sink = flowsink
36353635
|
@@ -3639,6 +3639,9 @@ module Impl<FullStateConfigSig Config> {
36393639
)
36403640
}
36413641

3642+
/** DEPRECATED: Use `flowPath` instead. */
3643+
deprecated predicate hasFlowPath = flowPath/2;
3644+
36423645
private predicate flowsTo(PathNodeImpl flowsource, PathNodeSink flowsink, Node source, Node sink) {
36433646
flowsource.isSource() and
36443647
flowsource.getNodeEx().asNode() = source and
@@ -3649,17 +3652,26 @@ module Impl<FullStateConfigSig Config> {
36493652
/**
36503653
* Holds if data can flow from `source` to `sink`.
36513654
*/
3652-
predicate hasFlow(Node source, Node sink) { flowsTo(_, _, source, sink) }
3655+
predicate flow(Node source, Node sink) { flowsTo(_, _, source, sink) }
3656+
3657+
/** DEPRECATED: Use `flow` instead. */
3658+
deprecated predicate hasFlow = flow/2;
36533659

36543660
/**
36553661
* Holds if data can flow from some source to `sink`.
36563662
*/
3657-
predicate hasFlowTo(Node sink) { sink = any(PathNodeSink n).getNodeEx().asNode() }
3663+
predicate flowTo(Node sink) { sink = any(PathNodeSink n).getNodeEx().asNode() }
3664+
3665+
/** DEPRECATED: Use `flowTo` instead. */
3666+
deprecated predicate hasFlowTo = flowTo/1;
36583667

36593668
/**
36603669
* Holds if data can flow from some source to `sink`.
36613670
*/
3662-
predicate hasFlowToExpr(DataFlowExpr sink) { hasFlowTo(exprNode(sink)) }
3671+
predicate flowToExpr(DataFlowExpr sink) { flowTo(exprNode(sink)) }
3672+
3673+
/** DEPRECATED: Use `flowToExpr` instead. */
3674+
deprecated predicate hasFlowToExpr = flowToExpr/1;
36633675

36643676
private predicate finalStats(
36653677
boolean fwd, int nodes, int fields, int conscand, int states, int tuples
@@ -4570,7 +4582,7 @@ module Impl<FullStateConfigSig Config> {
45704582
*
45714583
* To use this in a `path-problem` query, import the module `PartialPathGraph`.
45724584
*/
4573-
predicate hasPartialFlow(PartialPathNode source, PartialPathNode node, int dist) {
4585+
predicate partialFlow(PartialPathNode source, PartialPathNode node, int dist) {
45744586
partialFlow(source, node) and
45754587
dist = node.getSourceDistance()
45764588
}
@@ -4590,7 +4602,7 @@ module Impl<FullStateConfigSig Config> {
45904602
* Note that reverse flow has slightly lower precision than the corresponding
45914603
* forward flow, as reverse flow disregards type pruning among other features.
45924604
*/
4593-
predicate hasPartialFlowRev(PartialPathNode node, PartialPathNode sink, int dist) {
4605+
predicate partialFlowRev(PartialPathNode node, PartialPathNode sink, int dist) {
45944606
revPartialFlow(node, sink) and
45954607
dist = node.getSinkDistance()
45964608
}

cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImpl1.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* DEPRECATED: Use `Make` and `MakeWithState` instead.
2+
* DEPRECATED: Use `Global` and `GlobalWithState` instead.
33
*
44
* Provides a `Configuration` class backwards-compatible interface to the data
55
* flow library.
@@ -388,7 +388,7 @@ private predicate hasFlow(Node source, Node sink, Configuration config) {
388388
}
389389

390390
private predicate hasFlowPath(PathNode source, PathNode sink, Configuration config) {
391-
hasFlowPath(source, sink) and source.getConfiguration() = config
391+
flowPath(source, sink) and source.getConfiguration() = config
392392
}
393393

394394
private predicate hasFlowTo(Node sink, Configuration config) { hasFlow(_, sink, config) }

cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImpl2.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* DEPRECATED: Use `Make` and `MakeWithState` instead.
2+
* DEPRECATED: Use `Global` and `GlobalWithState` instead.
33
*
44
* Provides a `Configuration` class backwards-compatible interface to the data
55
* flow library.
@@ -388,7 +388,7 @@ private predicate hasFlow(Node source, Node sink, Configuration config) {
388388
}
389389

390390
private predicate hasFlowPath(PathNode source, PathNode sink, Configuration config) {
391-
hasFlowPath(source, sink) and source.getConfiguration() = config
391+
flowPath(source, sink) and source.getConfiguration() = config
392392
}
393393

394394
private predicate hasFlowTo(Node sink, Configuration config) { hasFlow(_, sink, config) }

cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImpl3.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* DEPRECATED: Use `Make` and `MakeWithState` instead.
2+
* DEPRECATED: Use `Global` and `GlobalWithState` instead.
33
*
44
* Provides a `Configuration` class backwards-compatible interface to the data
55
* flow library.
@@ -388,7 +388,7 @@ private predicate hasFlow(Node source, Node sink, Configuration config) {
388388
}
389389

390390
private predicate hasFlowPath(PathNode source, PathNode sink, Configuration config) {
391-
hasFlowPath(source, sink) and source.getConfiguration() = config
391+
flowPath(source, sink) and source.getConfiguration() = config
392392
}
393393

394394
private predicate hasFlowTo(Node sink, Configuration config) { hasFlow(_, sink, config) }

cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImpl4.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* DEPRECATED: Use `Make` and `MakeWithState` instead.
2+
* DEPRECATED: Use `Global` and `GlobalWithState` instead.
33
*
44
* Provides a `Configuration` class backwards-compatible interface to the data
55
* flow library.
@@ -388,7 +388,7 @@ private predicate hasFlow(Node source, Node sink, Configuration config) {
388388
}
389389

390390
private predicate hasFlowPath(PathNode source, PathNode sink, Configuration config) {
391-
hasFlowPath(source, sink) and source.getConfiguration() = config
391+
flowPath(source, sink) and source.getConfiguration() = config
392392
}
393393

394394
private predicate hasFlowTo(Node sink, Configuration config) { hasFlow(_, sink, config) }

cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImplLocal.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* DEPRECATED: Use `Make` and `MakeWithState` instead.
2+
* DEPRECATED: Use `Global` and `GlobalWithState` instead.
33
*
44
* Provides a `Configuration` class backwards-compatible interface to the data
55
* flow library.
@@ -388,7 +388,7 @@ private predicate hasFlow(Node source, Node sink, Configuration config) {
388388
}
389389

390390
private predicate hasFlowPath(PathNode source, PathNode sink, Configuration config) {
391-
hasFlowPath(source, sink) and source.getConfiguration() = config
391+
flowPath(source, sink) and source.getConfiguration() = config
392392
}
393393

394394
private predicate hasFlowTo(Node sink, Configuration config) { hasFlow(_, sink, config) }

cpp/ql/lib/semmle/code/cpp/dataflow/internal/tainttracking1/TaintTracking.qll

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ private module AddTaintDefaults<DataFlowInternal::FullStateConfigSig Config> imp
3535
/**
3636
* Constructs a standard taint tracking computation.
3737
*/
38-
module Make<DataFlow::ConfigSig Config> implements DataFlow::DataFlowSig {
38+
module Global<DataFlow::ConfigSig Config> implements DataFlow::GlobalFlowSig {
3939
private module Config0 implements DataFlowInternal::FullStateConfigSig {
4040
import DataFlowInternal::DefaultState<Config>
4141
import Config
@@ -48,10 +48,15 @@ module Make<DataFlow::ConfigSig Config> implements DataFlow::DataFlowSig {
4848
import DataFlowInternal::Impl<C>
4949
}
5050

51+
/** DEPRECATED: Use `Global` instead. */
52+
deprecated module Make<DataFlow::ConfigSig Config> implements DataFlow::GlobalFlowSig {
53+
import Global<Config>
54+
}
55+
5156
/**
5257
* Constructs a taint tracking computation using flow state.
5358
*/
54-
module MakeWithState<DataFlow::StateConfigSig Config> implements DataFlow::DataFlowSig {
59+
module GlobalWithState<DataFlow::StateConfigSig Config> implements DataFlow::GlobalFlowSig {
5560
private module Config0 implements DataFlowInternal::FullStateConfigSig {
5661
import Config
5762
}
@@ -62,3 +67,8 @@ module MakeWithState<DataFlow::StateConfigSig Config> implements DataFlow::DataF
6267

6368
import DataFlowInternal::Impl<C>
6469
}
70+
71+
/** DEPRECATED: Use `GlobalWithState` instead. */
72+
deprecated module MakeWithState<DataFlow::StateConfigSig Config> implements DataFlow::GlobalFlowSig {
73+
import GlobalWithState<Config>
74+
}

0 commit comments

Comments
 (0)