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 {
2323 override predicate isSink ( DataFlow:: Node node ) { any ( ) }
2424}
2525
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 ) ) )
3231}
3332
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+
3439predicate statistic ( string what , string value ) {
3540 what = "Files" and value = count ( File f ) .toString ( )
3641 or
@@ -42,6 +47,10 @@ predicate statistic(string what, string value) {
4247 or
4348 what = "Sensitive expressions" and value = count ( SensitiveExpr e ) .toString ( )
4449 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
4554 what = "Taint reach (per million nodes)" and value = taintReach ( ) .toString ( )
4655}
4756
You can’t perform that action at this time.
0 commit comments