Skip to content

Commit 7f18999

Browse files
committed
DataFlow: Add has{Source,Sink}InDiffRange
1 parent d2a0f57 commit 7f18999

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

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

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
171171
private module SourceSinkFiltering {
172172
private import codeql.util.AlertFiltering
173173

174-
private module AlertFiltering = AlertFilteringImpl<Location>;
174+
module AlertFiltering = AlertFilteringImpl<Location>;
175175

176176
pragma[nomagic]
177177
private predicate isFilteredSource(Node source) {
@@ -4647,6 +4647,34 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
46474647
/** DEPRECATED: Use `flowToExpr` instead. */
46484648
deprecated predicate hasFlowToExpr = flowToExpr/1;
46494649

4650+
/**
4651+
* Holds if the configuration has at least one source in the diff range as
4652+
* determined by `AlertFiltering`. This predicate is independent of whether
4653+
* diff-informed mode is observed by the configuration and is also
4654+
* independent whether there was flow.
4655+
*/
4656+
pragma[nomagic]
4657+
predicate hasSourceInDiffRange() {
4658+
exists(Node source |
4659+
Config::isSource(source, _) and
4660+
AlertFiltering::filterByLocation(Config::getASelectedSourceLocation(source))
4661+
)
4662+
}
4663+
4664+
/**
4665+
* Holds if the configuration has at least one sink in the diff range as
4666+
* determined by `AlertFiltering`. This predicate is independent of whether
4667+
* diff-informed mode is observed by the configuration and is also
4668+
* independent whether there was flow.
4669+
*/
4670+
pragma[nomagic]
4671+
predicate hasSinkInDiffRange() {
4672+
exists(Node sink |
4673+
Config::isSink(sink, _) and
4674+
AlertFiltering::filterByLocation(Config::getASelectedSinkLocation(sink))
4675+
)
4676+
}
4677+
46504678
/**
46514679
* INTERNAL: Only for debugging.
46524680
*

0 commit comments

Comments
 (0)