9
9
import rust
10
10
import codeql.rust.Concepts
11
11
import codeql.rust.security.SensitiveData
12
- import codeql.rust.security.WeakSensitiveDataHashingExtensions
13
12
import codeql.rust.Diagnostics
14
13
import Stats
15
14
import TaintReach
@@ -22,13 +21,14 @@ class CrateElement extends Element {
22
21
}
23
22
}
24
23
25
- from string key , int value
26
- where
24
+ predicate elementStats ( string key , int value ) {
27
25
key = "Elements extracted" and
28
26
value = count ( Element e | not e instanceof Unextracted and not e instanceof CrateElement )
29
27
or
30
28
key = "Elements unextracted" and value = count ( Unextracted e )
31
- or
29
+ }
30
+
31
+ predicate extractionStats ( string key , int value ) {
32
32
key = "Extraction errors" and value = count ( ExtractionError e )
33
33
or
34
34
key = "Extraction warnings" and value = count ( ExtractionWarning w )
@@ -53,20 +53,24 @@ where
53
53
or
54
54
key = "Lines of user code extracted" and value = getLinesOfUserCode ( )
55
55
or
56
+ key = "Macro calls - total" and value = count ( MacroCall mc )
57
+ or
58
+ key = "Macro calls - resolved" and value = count ( MacroCall mc | mc .hasExpanded ( ) )
59
+ or
60
+ key = "Macro calls - unresolved" and value = count ( MacroCall mc | not mc .hasExpanded ( ) )
61
+ }
62
+
63
+ predicate inconsistencyStats ( string key , int value ) {
56
64
key = "Inconsistencies - AST" and value = getTotalAstInconsistencies ( )
57
65
or
58
66
key = "Inconsistencies - Path resolution" and value = getTotalPathResolutionInconsistencies ( )
59
67
or
60
68
key = "Inconsistencies - CFG" and value = getTotalCfgInconsistencies ( )
61
69
or
62
70
key = "Inconsistencies - data flow" and value = getTotalDataFlowInconsistencies ( )
63
- or
64
- key = "Macro calls - total" and value = count ( MacroCall mc )
65
- or
66
- key = "Macro calls - resolved" and value = count ( MacroCall mc | mc .hasExpanded ( ) )
67
- or
68
- key = "Macro calls - unresolved" and value = count ( MacroCall mc | not mc .hasExpanded ( ) )
69
- or
71
+ }
72
+
73
+ predicate taintStats ( string key , int value ) {
70
74
key = "Taint sources - active" and value = count ( ActiveThreatModelSource s )
71
75
or
72
76
key = "Taint sources - disabled" and
84
88
or
85
89
key = "Taint sinks - cryptographic operations" and
86
90
value = count ( Cryptography:: CryptographicOperation o )
91
+ }
92
+
93
+ from string key , int value
94
+ where
95
+ elementStats ( key , value )
96
+ or
97
+ extractionStats ( key , value )
98
+ or
99
+ inconsistencyStats ( key , value )
100
+ or
101
+ taintStats ( key , value )
87
102
select key , value order by key
0 commit comments