@@ -15,17 +15,17 @@ import swift
15
15
import codeql.swift.security.SensitiveExprs
16
16
import codeql.swift.dataflow.DataFlow
17
17
import codeql.swift.dataflow.TaintTracking
18
- import DataFlow :: PathGraph
18
+ import WeakHashingFlow :: PathGraph
19
19
20
- class WeakHashingConfig extends TaintTracking :: Configuration {
21
- WeakHashingConfig ( ) { this = "WeakHashingConfig" }
20
+ module WeakHashingConfig implements DataFlow :: ConfigSig {
21
+ predicate isSource ( DataFlow :: Node node ) { node instanceof WeakHashingConfigImpl :: Source }
22
22
23
- override predicate isSource ( DataFlow:: Node node ) { node instanceof WeakHashingConfig:: Source }
24
-
25
- override predicate isSink ( DataFlow:: Node node ) { node instanceof WeakHashingConfig:: Sink }
23
+ predicate isSink ( DataFlow:: Node node ) { node instanceof WeakHashingConfigImpl:: Sink }
26
24
}
27
25
28
- module WeakHashingConfig {
26
+ module WeakHashingFlow = TaintTracking:: Global< WeakHashingConfig > ;
27
+
28
+ module WeakHashingConfigImpl {
29
29
class Source extends DataFlow:: Node {
30
30
Source ( ) { this .asExpr ( ) instanceof SensitiveExpr }
31
31
}
@@ -52,11 +52,11 @@ module WeakHashingConfig {
52
52
}
53
53
54
54
from
55
- WeakHashingConfig config , DataFlow :: PathNode source , DataFlow :: PathNode sink , string algorithm ,
55
+ WeakHashingFlow :: PathNode source , WeakHashingFlow :: PathNode sink , string algorithm ,
56
56
SensitiveExpr expr
57
57
where
58
- config . hasFlowPath ( source , sink ) and
59
- algorithm = sink .getNode ( ) .( WeakHashingConfig :: Sink ) .getAlgorithm ( ) and
58
+ WeakHashingFlow :: flowPath ( source , sink ) and
59
+ algorithm = sink .getNode ( ) .( WeakHashingConfigImpl :: Sink ) .getAlgorithm ( ) and
60
60
expr = source .getNode ( ) .asExpr ( )
61
61
select sink .getNode ( ) , source , sink ,
62
62
"Insecure hashing algorithm (" + algorithm + ") depends on $@." , source .getNode ( ) ,
0 commit comments