mirror of
https://github.com/github/codeql.git
synced 2026-04-28 02:05:14 +02:00
Rust: Add both totals to rust/summary/summary-statistics.
This commit is contained in:
@@ -11,15 +11,7 @@
|
||||
|
||||
import rust
|
||||
import codeql.rust.dataflow.DataFlow
|
||||
import codeql.rust.security.SqlInjectionExtensions
|
||||
import Stats
|
||||
|
||||
/**
|
||||
* Gets a kind of query for which `n` is a sink (if any).
|
||||
*/
|
||||
string getAQuerySinkKind(DataFlow::Node n) {
|
||||
(n instanceof SqlInjection::Sink and result = "SqlInjection")
|
||||
}
|
||||
|
||||
from DataFlow::Node n
|
||||
select n, "sink for " + strictconcat(getAQuerySinkKind(n), ", ")
|
||||
|
||||
@@ -3,11 +3,13 @@
|
||||
*/
|
||||
|
||||
import rust
|
||||
private import codeql.rust.dataflow.DataFlow
|
||||
private import codeql.rust.dataflow.internal.DataFlowImpl
|
||||
private import codeql.rust.dataflow.internal.TaintTrackingImpl
|
||||
private import codeql.rust.AstConsistency as AstConsistency
|
||||
private import codeql.rust.controlflow.internal.CfgConsistency as CfgConsistency
|
||||
private import codeql.rust.dataflow.internal.DataFlowConsistency as DataFlowConsistency
|
||||
private import codeql.rust.security.SqlInjectionExtensions
|
||||
|
||||
/**
|
||||
* Gets a count of the total number of lines of code in the database.
|
||||
@@ -41,3 +43,15 @@ int getTotalCfgInconsistencies() {
|
||||
int getTotalDataFlowInconsistencies() {
|
||||
result = sum(string type | | DataFlowConsistency::getInconsistencyCounts(type))
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a kind of query for which `n` is a sink (if any).
|
||||
*/
|
||||
string getAQuerySinkKind(DataFlow::Node n) {
|
||||
(n instanceof SqlInjection::Sink and result = "SqlInjection")
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a count of the total number of query sinks in the database.
|
||||
*/
|
||||
int getQuerySinksCount() { result = count(DataFlow::Node n | exists(getAQuerySinkKind(n)) | n) }
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
import rust
|
||||
import codeql.rust.Concepts
|
||||
import codeql.rust.security.SensitiveData
|
||||
import codeql.rust.security.WeakSensitiveDataHashingExtensions
|
||||
import codeql.rust.Diagnostics
|
||||
import Stats
|
||||
|
||||
@@ -59,4 +60,9 @@ where
|
||||
key = "Taint sources - active" and value = count(ActiveThreatModelSource s)
|
||||
or
|
||||
key = "Sensitive data" and value = count(SensitiveData d)
|
||||
or
|
||||
key = "Taint sinks - query sinks" and value = getQuerySinksCount()
|
||||
or
|
||||
key = "Taint sinks - cryptographic operations" and
|
||||
value = count(Cryptography::CryptographicOperation o)
|
||||
select key, value order by key
|
||||
|
||||
@@ -15,5 +15,7 @@
|
||||
| Macro calls - total | 9 |
|
||||
| Macro calls - unresolved | 1 |
|
||||
| Sensitive data | 0 |
|
||||
| Taint sinks - cryptographic operations | 0 |
|
||||
| Taint sinks - query sinks | 0 |
|
||||
| Taint sources - active | 0 |
|
||||
| Taint sources - total | 0 |
|
||||
|
||||
Reference in New Issue
Block a user