Skip to content

Commit 193cd46

Browse files
author
Alex Eyers-Taylor
committed
DataFlow: Adress comments on overlay informed dataflow
1 parent 7a8d239 commit 193cd46

File tree

4 files changed

+19
-20
lines changed

4 files changed

+19
-20
lines changed

shared/dataflow/codeql/dataflow/DataFlow.qll

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -657,10 +657,8 @@ private module PathGraphSigMod {
657657
}
658658
}
659659

660-
module DataFlowMakeCore<LocationSig Location, InputSig<Location> Lang> {
660+
private module DataFlowMakeCore<LocationSig Location, InputSig<Location> Lang> {
661661
private import Lang
662-
private import internal.DataFlowImpl::MakeImpl<Location, Lang>
663-
private import internal.DataFlowImplStage1::MakeImplStage1<Location, Lang>
664662
import Configs<Location, Lang>
665663

666664
/**
@@ -1166,7 +1164,7 @@ module DataFlowMake<LocationSig Location, InputSig<Location> Lang> {
11661164
}
11671165

11681166
module DataFlowMakeOverlay<LocationSig Location, InputSig<Location> Lang> {
1169-
import DataFlowMakeCore<Location, Lang>
1167+
import DataFlowMake<Location, Lang>
11701168
private import Lang
11711169
private import internal.DataFlowImpl::MakeImpl<Location, Lang>
11721170
private import internal.DataFlowImplStage1::MakeImplStage1<Location, Lang>

shared/dataflow/codeql/dataflow/TaintTracking.qll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ private module TaintFlowMakeCore<
5252
InputSig<Location, DataFlowLang> TaintTrackingLang>
5353
{
5454
import TaintTrackingLang
55-
import DF::DataFlowMakeCore<Location, DataFlowLang> as DataFlow
55+
import DF::DataFlowMake<Location, DataFlowLang> as DataFlow
5656
import MakeImpl<Location, DataFlowLang> as DataFlowInternal
5757
import MakeImplStage1<Location, DataFlowLang> as DataFlowInternalStage1
5858

@@ -295,7 +295,7 @@ module TaintFlowMake<
295295

296296
import Stage1::PartialFlow
297297

298-
private module Flow = DataFlowInternal::OverlayImpl<C, Stage1::Stage1WithState>;
298+
private module Flow = DataFlowInternal::Impl<C, Stage1::Stage1WithState>;
299299

300300
import Flow
301301
}
@@ -407,7 +407,7 @@ module TaintFlowMakeOverlay<
407407

408408
import Stage1::PartialFlow
409409

410-
private module Flow = DataFlowInternal::Impl<C, Stage1::Stage1WithState>;
410+
private module Flow = DataFlowInternal::OverlayImpl<C, Stage1::Stage1WithState>;
411411

412412
import Flow
413413
}

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

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ private import DataFlowImplStage1
1515

1616
module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
1717
private import Lang
18-
private import DataFlowMakeCore<Location, Lang>
18+
private import DataFlowMake<Location, Lang>
1919
private import MakeImplStage1<Location, Lang>
2020
private import DataFlowImplCommon::MakeImplCommon<Location, Lang>
2121
private import DataFlowImplCommonPublic
@@ -145,7 +145,8 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
145145

146146
/**
147147
* Holds if sources and sinks should be filtered to only include those that
148-
* are in the overlay database. This only has an effect when running
148+
* may lead to a flow path with either a source or a sink in the overlay database.
149+
* This only has an effect when running
149150
* in overlay-informed incremental mode. This should be used in conjunction
150151
* with the `OverlayImpl` implementation to merge the base results back in.
151152
*/
@@ -184,22 +185,22 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
184185
* an initial stage 1 pruning with merging of overlay and base results.
185186
*/
186187
module OverlayImpl<FullStateConfigSig Config, Stage1Output<Config::FlowState> Stage1> {
187-
module Base = Impl<Config, Stage1>;
188+
private module Flow = Impl<Config, Stage1>;
188189

189-
import Base
190+
import Flow
190191

191192
/**
192193
* Holds if data can flow from `source` to `sink`.
193194
*
194195
* This is a local predicate that only has results local to the overlay/base database.
195196
*/
196-
predicate flowLocal(Node source, Node sink) = forceLocal(Base::flow/2)(source, sink)
197+
private predicate flowLocal(Node source, Node sink) = forceLocal(Flow::flow/2)(source, sink)
197198

198199
/**
199200
* Holds if data can flow from `source` to `sink`.
200201
*/
201202
predicate flow(Node source, Node sink) {
202-
Base::flow(source, sink)
203+
Flow::flow(source, sink)
203204
or
204205
// If we are overlay informed (i.e. we are not diff-informed), we
205206
// merge in the local results which includes the base database results.
@@ -208,15 +209,15 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
208209

209210
/**
210211
* Holds if data can flow from some source to `sink`.
211-
* This predicate that only has results local to the overlay/base database.
212+
* This is a local predicate that only has results local to the overlay/base database.
212213
*/
213-
predicate flowToLocal(Node sink) = forceLocal(Base::flowTo/1)(sink)
214+
predicate flowToLocal(Node sink) = forceLocal(Flow::flowTo/1)(sink)
214215

215216
/**
216217
* Holds if data can flow from some source to `sink`.
217218
*/
218219
predicate flowTo(Node sink) {
219-
Base::flowTo(sink)
220+
Flow::flowTo(sink)
220221
or
221222
// If we are overlay informed (i.e. we are not diff-informed), we
222223
// merge in the local results which includes the base database results.

shared/dataflow/codeql/dataflow/internal/DataFlowImplStage1.qll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,17 +149,17 @@ module MakeImplStage1<LocationSig Location, InputSig<Location> Lang> {
149149
*
150150
* Shared between sources and sinks.
151151
*/
152-
pragma[inline]
153152
overlay[global]
153+
pragma[inline]
154154
private predicate nonDiffInformedFilter(Node node) {
155-
// If we are in base-only global evaluation, do not filter out any sources.
155+
// If we are in base-only global evaluation, do not filter out any sources/sinks.
156156
not isEvaluatingInOverlay()
157157
or
158-
// If the configuration doesn't merge overlays, do not filter out any sources.
158+
// If the configuration doesn't merge overlays, do not filter out any sources/sinks.
159159
not Config::observeOverlayInformedIncrementalMode()
160160
or
161161
// If we are in global evaluation with an overlay present, restrict
162-
// sources to those visible in the overlay.
162+
// sources/sinks to those visible in the overlay.
163163
isOverlayNode(node)
164164
}
165165

0 commit comments

Comments
 (0)