@@ -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
@@ -18,6 +19,7 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
1819 private import DataFlowImplCommon:: MakeImplCommon< Location , Lang >
1920 private import DataFlowImplCommonPublic
2021 private import Aliases
22+ private module AlertFiltering = AlertFilteringImpl< Location > ;
2123
2224 /**
2325 * An input configuration for data flow using flow state. This signature equals
@@ -3389,6 +3391,38 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
33893391 */
33903392 predicate flowToExpr ( Expr sink ) { flowTo ( exprNode ( sink ) ) }
33913393
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+
33923426 /**
33933427 * INTERNAL: Only for debugging.
33943428 *
0 commit comments