@@ -7,6 +7,7 @@ import swift
77import codeql.swift.security.SensitiveExprs
88import codeql.swift.dataflow.DataFlow
99import codeql.swift.dataflow.TaintTracking
10+ import codeql.swift.security.WeakPasswordHashingExtensions
1011
1112/**
1213 * A taint tracking configuration from password expressions to inappropriate
@@ -29,31 +30,3 @@ module WeakHashingPasswordConfig implements DataFlow::ConfigSig {
2930}
3031
3132module WeakHashingFlow = TaintTracking:: Global< WeakHashingPasswordConfig > ;
32-
33- // TODO: rewrite with data extensions in mind, ref the Swift implementation
34- class WeakPasswordHashingSink extends DataFlow:: Node {
35- string algorithm ;
36-
37- WeakPasswordHashingSink ( ) {
38- // a call to System.Security.Cryptography.MD5/SHA*.ComputeHash/ComputeHashAsync/HashData/HashDataAsync
39- exists ( MethodCall call , string name |
40- (
41- call .getTarget ( ) .getName ( ) = name
42- and name in [ "ComputeHash" , "ComputeHashAsync" , "HashData" , "HashDataAsync" ]
43- )
44- // with this as the first argument - not arg 0, since arg 0 is 'this' for methods
45- and call .getArgument ( 0 ) = this .asExpr ( )
46- and
47- // the call is to a method in the System.Security.Cryptography.MD* class
48- // or the System.Security.Cryptography.SHA* classes
49- (
50- call .getQualifier ( ) .getType ( ) .getName ( ) = algorithm
51- and algorithm .matches ( [ "MD%" , "SHA%" ] )
52- )
53- )
54- }
55-
56- string getAlgorithm ( ) {
57- result = algorithm
58- }
59- }
0 commit comments