@@ -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
0 commit comments