File tree Expand file tree Collapse file tree 1 file changed +15
-6
lines changed
swift/ql/src/queries/Summary Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -23,14 +23,19 @@ class TaintReachConfig extends TaintTracking::Configuration {
23
23
override predicate isSink ( DataFlow:: Node node ) { any ( ) }
24
24
}
25
25
26
- float taintReach ( ) {
27
- exists ( TaintReachConfig config , int tainted , int total |
28
- tainted = count ( DataFlow:: Node n | config .hasFlowTo ( n ) ) and
29
- total = count ( DataFlow:: Node n ) and
30
- result = ( tainted * 1000000.0 ) / total
31
- )
26
+ /**
27
+ * Gets the total number of dataflow nodes that taint reaches (from any source).
28
+ */
29
+ int taintedNodesCount ( ) {
30
+ exists ( TaintReachConfig config | result = count ( DataFlow:: Node n | config .hasFlowTo ( n ) ) )
32
31
}
33
32
33
+ /**
34
+ * Gets the proportion of dataflow nodes that taint reaches (from any source),
35
+ * expressed as a count per million nodes.
36
+ */
37
+ float taintReach ( ) { result = ( taintedNodesCount ( ) * 1000000.0 ) / count ( DataFlow:: Node n ) }
38
+
34
39
predicate statistic ( string what , string value ) {
35
40
what = "Files" and value = count ( File f ) .toString ( )
36
41
or
@@ -42,6 +47,10 @@ predicate statistic(string what, string value) {
42
47
or
43
48
what = "Sensitive expressions" and value = count ( SensitiveExpr e ) .toString ( )
44
49
or
50
+ what = "Dataflow nodes (total)" and value = count ( DataFlow:: Node n ) .toString ( )
51
+ or
52
+ what = "Dataflow nodes (tainted)" and value = taintedNodesCount ( ) .toString ( )
53
+ or
45
54
what = "Taint reach (per million nodes)" and value = taintReach ( ) .toString ( )
46
55
}
47
56
You can’t perform that action at this time.
0 commit comments