File tree Expand file tree Collapse file tree 2 files changed +28
-28
lines changed Expand file tree Collapse file tree 2 files changed +28
-28
lines changed Original file line number Diff line number Diff line change 5
5
private import rust
6
6
private import codeql.rust.Concepts
7
7
private import codeql.rust.dataflow.DataFlow
8
- private import codeql.rust.dataflow.FlowSource
9
- private import codeql.rust.dataflow.FlowSink
10
- private import codeql.rust.dataflow.internal.DataFlowImpl
11
8
12
9
bindingset [ algorithmName]
13
10
private string simplifyAlgorithmName ( string algorithmName ) {
@@ -58,28 +55,3 @@ class StreamCipherInit extends Cryptography::CryptographicOperation::Range {
58
55
59
56
override Cryptography:: BlockMode getBlockMode ( ) { result = "" }
60
57
}
61
-
62
- /**
63
- * An externally modelled operation that hashes data, for example a call to `md5::Md5::digest(data)`.
64
- */
65
- class ModelledHashOperation extends Cryptography:: CryptographicOperation:: Range {
66
- DataFlow:: Node input ;
67
- CallExpr call ;
68
- string algorithmName ;
69
-
70
- ModelledHashOperation ( ) {
71
- sinkNode ( input , "hasher-input" ) and
72
- call = input .( Node:: FlowSummaryNode ) .getSinkElement ( ) .getCall ( ) and
73
- call = this .asExpr ( ) .getExpr ( ) and
74
- algorithmName =
75
- call .getFunction ( ) .( PathExpr ) .getPath ( ) .getQualifier ( ) .getPart ( ) .getNameRef ( ) .getText ( )
76
- }
77
-
78
- override DataFlow:: Node getInitialization ( ) { result = this }
79
-
80
- override Cryptography:: CryptographicAlgorithm getAlgorithm ( ) { result .matchesName ( algorithmName ) }
81
-
82
- override DataFlow:: Node getAnInput ( ) { result = input }
83
-
84
- override Cryptography:: BlockMode getBlockMode ( ) { none ( ) } // (does not apply for hashing)
85
- }
Original file line number Diff line number Diff line change @@ -12,6 +12,9 @@ import rust
12
12
private import codeql.rust.Concepts
13
13
private import codeql.rust.security.SensitiveData
14
14
private import codeql.rust.dataflow.DataFlow
15
+ private import codeql.rust.dataflow.FlowSource
16
+ private import codeql.rust.dataflow.FlowSink
17
+ private import codeql.rust.dataflow.internal.DataFlowImpl
15
18
16
19
/**
17
20
* Provides default sources, sinks and sanitizers for detecting "use of a broken or weak
@@ -169,3 +172,28 @@ module ComputationallyExpensiveHashFunction {
169
172
}
170
173
}
171
174
}
175
+
176
+ /**
177
+ * An externally modelled operation that hashes data, for example a call to `md5::Md5::digest(data)`.
178
+ */
179
+ class ModelledHashOperation extends Cryptography:: CryptographicOperation:: Range {
180
+ DataFlow:: Node input ;
181
+ CallExpr call ;
182
+ string algorithmName ;
183
+
184
+ ModelledHashOperation ( ) {
185
+ sinkNode ( input , "hasher-input" ) and
186
+ call = input .( Node:: FlowSummaryNode ) .getSinkElement ( ) .getCall ( ) and
187
+ call = this .asExpr ( ) .getExpr ( ) and
188
+ algorithmName =
189
+ call .getFunction ( ) .( PathExpr ) .getPath ( ) .getQualifier ( ) .getPart ( ) .getNameRef ( ) .getText ( )
190
+ }
191
+
192
+ override DataFlow:: Node getInitialization ( ) { result = this }
193
+
194
+ override Cryptography:: CryptographicAlgorithm getAlgorithm ( ) { result .matchesName ( algorithmName ) }
195
+
196
+ override DataFlow:: Node getAnInput ( ) { result = input }
197
+
198
+ override Cryptography:: BlockMode getBlockMode ( ) { none ( ) } // (does not apply for hashing)
199
+ }
You can’t perform that action at this time.
0 commit comments