Skip to content

Commit ad26822

Browse files
committed
Rust: Address QL-for-QL comments.
1 parent 39a38c4 commit ad26822

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

rust/ql/lib/codeql/rust/security/WeakSensitiveDataHashingExtensions.qll

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ module NormalHashFunction {
5757
abstract class Barrier extends DataFlow::Node { }
5858

5959
/**
60-
* A flow source modelled by the `SensitiveData` library.
60+
* A flow source modeled by the `SensitiveData` library.
6161
*/
6262
class SensitiveDataAsSource extends Source instanceof SensitiveData {
6363
SensitiveDataAsSource() {
@@ -71,7 +71,7 @@ module NormalHashFunction {
7171
}
7272

7373
/**
74-
* A flow sink modelled by the `Cryptography` module.
74+
* A flow sink modeled by the `Cryptography` module.
7575
*/
7676
class WeakHashingOperationInputAsSink extends Sink {
7777
Cryptography::HashingAlgorithm algorithm;
@@ -134,7 +134,7 @@ module ComputationallyExpensiveHashFunction {
134134
abstract class Barrier extends DataFlow::Node { }
135135

136136
/**
137-
* A flow source modelled by the `SensitiveData` library.
137+
* A flow source modeled by the `SensitiveData` library.
138138
*/
139139
class PasswordAsSource extends Source instanceof SensitiveData {
140140
PasswordAsSource() {
@@ -147,7 +147,7 @@ module ComputationallyExpensiveHashFunction {
147147
}
148148

149149
/**
150-
* A flow sink modelled by the `Cryptography` module.
150+
* A flow sink modeled by the `Cryptography` module.
151151
*/
152152
class WeakPasswordHashingOperationInputSink extends Sink {
153153
Cryptography::CryptographicAlgorithm algorithm;
@@ -174,19 +174,20 @@ module ComputationallyExpensiveHashFunction {
174174
}
175175

176176
/**
177-
* An externally modelled operation that hashes data, for example a call to `md5::Md5::digest(data)`.
177+
* An externally modeled operation that hashes data, for example a call to `md5::Md5::digest(data)`.
178178
*/
179-
class ModelledHashOperation extends Cryptography::CryptographicOperation::Range {
179+
class ModeledHashOperation extends Cryptography::CryptographicOperation::Range {
180180
DataFlow::Node input;
181-
CallExpr call;
182181
string algorithmName;
183182

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()
183+
ModeledHashOperation() {
184+
exists(CallExpr call |
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+
)
190191
}
191192

192193
override DataFlow::Node getInitialization() { result = this }

0 commit comments

Comments
 (0)