forked from github/codeql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTrackedNodes.ql
More file actions
32 lines (27 loc) · 949 Bytes
/
TrackedNodes.ql
File metadata and controls
32 lines (27 loc) · 949 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import javascript
/**
* Track all nodes that do not have flow predecessors.
*/
class TrackAllSources extends DataFlow::TrackedNode {
TrackAllSources() { not exists(getAPredecessor()) }
}
/**
* A data flow configuration that emulates the flow tracking done by
* `DataFlow::TrackedNode`.
*/
class AllSourcesTrackingConfig extends DataFlow::Configuration {
AllSourcesTrackingConfig() {
this = "TrackAllTrackedNodes"
}
override predicate isSource(DataFlow::Node src) {
src instanceof DataFlow::TrackedNode
}
override predicate isSink(DataFlow::Node snk) {
any()
}
}
from DataFlow::Node source, DataFlow::Node sink, AllSourcesTrackingConfig cfg, string problem
where cfg.hasFlow(source, sink) and not source.(DataFlow::TrackedNode).flowsTo(sink) and problem = "missing"
or
not cfg.hasFlow(source, sink) and source.(DataFlow::TrackedNode).flowsTo(sink) and problem = "spurious"
select problem, source, sink