@@ -8,6 +8,7 @@ private import codeql.util.Unit
8
8
private import codeql.util.Option
9
9
private import codeql.util.Boolean
10
10
private import codeql.util.Location
11
+ private import codeql.util.AlertFiltering
11
12
private import codeql.dataflow.DataFlow
12
13
private import DataFlowImplStage1
13
14
@@ -18,6 +19,7 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
18
19
private import DataFlowImplCommon:: MakeImplCommon< Location , Lang >
19
20
private import DataFlowImplCommonPublic
20
21
private import Aliases
22
+ private module AlertFiltering = AlertFilteringImpl< Location > ;
21
23
22
24
/**
23
25
* An input configuration for data flow using flow state. This signature equals
@@ -3389,6 +3391,38 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
3389
3391
*/
3390
3392
predicate flowToExpr ( Expr sink ) { flowTo ( exprNode ( sink ) ) }
3391
3393
3394
+ /**
3395
+ * Holds if the configuration has at least one source in the diff range as
3396
+ * determined by `AlertFiltering`. This predicate is independent of whether
3397
+ * diff-informed mode is observed by the configuration and is also
3398
+ * independent whether there was flow.
3399
+ */
3400
+ pragma [ nomagic]
3401
+ predicate hasSourceInDiffRange ( ) {
3402
+ exists ( Node source |
3403
+ Config:: isSource ( source , _) and
3404
+ AlertFiltering:: filterByLocation ( Config:: getASelectedSourceLocation ( source ) )
3405
+ // TODO: also require `Config::isSink(_, _)`? Because if the source
3406
+ // isn't reachable, it may as well not be there.
3407
+ )
3408
+ }
3409
+
3410
+ /**
3411
+ * Holds if the configuration has at least one sink in the diff range as
3412
+ * determined by `AlertFiltering`. This predicate is independent of whether
3413
+ * diff-informed mode is observed by the configuration and is also
3414
+ * independent whether there was flow.
3415
+ */
3416
+ pragma [ nomagic]
3417
+ predicate hasSinkInDiffRange ( ) {
3418
+ exists ( Node sink |
3419
+ Config:: isSink ( sink , _) and
3420
+ AlertFiltering:: filterByLocation ( Config:: getASelectedSinkLocation ( sink ) )
3421
+ // TODO: also require `Config::isSource(_, _)`? Because if the sink
3422
+ // isn't reachable, it may as well not be there.
3423
+ )
3424
+ }
3425
+
3392
3426
/**
3393
3427
* INTERNAL: Only for debugging.
3394
3428
*
0 commit comments