Skip to content

Commit 5a037bc

Browse files
committed
Rust: Count taint edges as well.
1 parent 72c62ac commit 5a037bc

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

rust/ql/src/queries/summary/Stats.qll

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,16 @@ int getTotalDataFlowInconsistencies() {
4444
result = sum(string type | | DataFlowConsistency::getInconsistencyCounts(type))
4545
}
4646

47+
/**
48+
* Gets the total number of taint edges in the database.
49+
*/
50+
int getTaintEdgesCount() {
51+
result =
52+
count(DataFlow::Node a, DataFlow::Node b |
53+
RustTaintTracking::defaultAdditionalTaintStep(a, b, _)
54+
)
55+
}
56+
4757
/**
4858
* Gets a kind of query for which `n` is a sink (if any).
4959
*/

rust/ql/src/queries/summary/SummaryStats.ql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ where
6060
or
6161
key = "Taint sources - active" and value = count(ActiveThreatModelSource s)
6262
or
63+
key = "Taint edges - number of edges" and value = getTaintEdgesCount()
64+
or
6365
key = "Taint reach - nodes tainted" and value = getTaintedNodesCount()
6466
or
6567
key = "Taint reach - per million nodes" and value = getTaintReach().floor()

rust/ql/test/query-tests/diagnostics/SummaryStats.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
| Macro calls - total | 9 |
1616
| Macro calls - unresolved | 1 |
1717
| Sensitive data | 0 |
18+
| Taint edges - number of edges | 2 |
1819
| Taint reach - nodes tainted | 0 |
1920
| Taint reach - per million nodes | 0 |
2021
| Taint sinks - cryptographic operations | 0 |

0 commit comments

Comments
 (0)