@@ -8,6 +8,7 @@ private import codeql.util.Unit
88private import codeql.util.Option
99private import codeql.util.Boolean
1010private import codeql.util.Location
11+ private import codeql.util.AlertFiltering
1112private import codeql.dataflow.DataFlow
1213private import DataFlowImplStage1
1314
@@ -19,6 +20,8 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
1920 private import DataFlowImplCommonPublic
2021 private import Aliases
2122
23+ private module AlertFiltering = AlertFilteringImpl< Location > ;
24+
2225 /**
2326 * An input configuration for data flow using flow state. This signature equals
2427 * `StateConfigSig`, but requires explicit implementation of all predicates.
@@ -3389,6 +3392,38 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
33893392 */
33903393 predicate flowToExpr ( Expr sink ) { flowTo ( exprNode ( sink ) ) }
33913394
3395+ /**
3396+ * Holds if the configuration has at least one source in the diff range as
3397+ * determined by `AlertFiltering`. This predicate is independent of whether
3398+ * diff-informed mode is observed by the configuration and is also
3399+ * independent whether there was flow.
3400+ */
3401+ pragma [ nomagic]
3402+ predicate hasSourceInDiffRange ( ) {
3403+ exists ( Node source |
3404+ Config:: isSource ( source , _) and
3405+ AlertFiltering:: filterByLocation ( Config:: getASelectedSourceLocation ( source ) )
3406+ // TODO: also require `Config::isSink(_, _)`? Because if the source
3407+ // isn't reachable, it may as well not be there.
3408+ )
3409+ }
3410+
3411+ /**
3412+ * Holds if the configuration has at least one sink in the diff range as
3413+ * determined by `AlertFiltering`. This predicate is independent of whether
3414+ * diff-informed mode is observed by the configuration and is also
3415+ * independent whether there was flow.
3416+ */
3417+ pragma [ nomagic]
3418+ predicate hasSinkInDiffRange ( ) {
3419+ exists ( Node sink |
3420+ Config:: isSink ( sink , _) and
3421+ AlertFiltering:: filterByLocation ( Config:: getASelectedSinkLocation ( sink ) )
3422+ // TODO: also require `Config::isSource(_, _)`? Because if the sink
3423+ // isn't reachable, it may as well not be there.
3424+ )
3425+ }
3426+
33923427 /**
33933428 * INTERNAL: Only for debugging.
33943429 *
0 commit comments