Skip to content

Commit 46fd5bd

Browse files
committed
Move test files to the test folder
1 parent 07f45a5 commit 46fd5bd

File tree

5 files changed

+15
-18
lines changed

5 files changed

+15
-18
lines changed

csharp/ql/src/experimental/Security Features/CWE-759/HashWithoutSalt.ql

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,17 @@ class HashAlgorithmProvider extends RefType {
2222
}
2323
}
2424

25-
/** The method call `ComputeHash()` declared in `System.Security.Cryptography.SHA...`. */
26-
class ComputeHashMethodCall extends MethodCall {
27-
ComputeHashMethodCall() {
28-
this.getQualifier().getType() instanceof SHA and
29-
this.getTarget().hasName("ComputeHash")
30-
}
31-
}
32-
33-
/** The method call `ComputeHash()` declared in `System.Security.Cryptography.SHA...`. */
34-
class HashDataMethodCall extends MethodCall {
35-
HashDataMethodCall() {
36-
this.getQualifier().getType() instanceof HashAlgorithmProvider and
37-
this.getTarget().hasName("HashData")
25+
/**
26+
* The method `ComputeHash()` declared in `System.Security.Cryptography.SHA...` and
27+
* the method `HashData()` declared in `Windows.Security.Cryptography.Core.HashAlgorithmProvider`.
28+
*/
29+
class HashMethod extends Method {
30+
HashMethod() {
31+
this.getDeclaringType() instanceof SHA and
32+
this.hasName("ComputeHash")
33+
or
34+
this.getDeclaringType() instanceof HashAlgorithmProvider and
35+
this.hasName("HashData")
3836
}
3937
}
4038

@@ -55,11 +53,9 @@ class HashWithoutSaltConfiguration extends TaintTracking::Configuration {
5553
override predicate isSource(DataFlow::Node source) { source.asExpr() instanceof PasswordVarExpr }
5654

5755
override predicate isSink(DataFlow::Node sink) {
58-
exists(ComputeHashMethodCall mc |
59-
sink.asExpr() = mc.getArgument(0) // sha256Hash.ComputeHash(rawDatabytes)
60-
) or
61-
exists(HashDataMethodCall mc |
62-
sink.asExpr() = mc.getArgument(0) // algProv.HashData(rawDatabytes)
56+
exists(MethodCall mc |
57+
sink.asExpr() = mc.getArgument(0) and
58+
mc.getTarget() instanceof HashMethod
6359
)
6460
}
6561

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
experimental/Security Features/CWE-759/HashWithoutSalt.ql

0 commit comments

Comments
 (0)