@@ -15,17 +15,17 @@ import swift
1515import codeql.swift.security.SensitiveExprs
1616import codeql.swift.dataflow.DataFlow
1717import codeql.swift.dataflow.TaintTracking
18- import DataFlow :: PathGraph
18+ import WeakHashingFlow :: PathGraph
1919
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 }
2222
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 }
2624}
2725
28- module WeakHashingConfig {
26+ module WeakHashingFlow = TaintTracking:: Global< WeakHashingConfig > ;
27+
28+ module WeakHashingConfigImpl {
2929 class Source extends DataFlow:: Node {
3030 Source ( ) { this .asExpr ( ) instanceof SensitiveExpr }
3131 }
@@ -52,11 +52,11 @@ module WeakHashingConfig {
5252}
5353
5454from
55- WeakHashingConfig config , DataFlow :: PathNode source , DataFlow :: PathNode sink , string algorithm ,
55+ WeakHashingFlow :: PathNode source , WeakHashingFlow :: PathNode sink , string algorithm ,
5656 SensitiveExpr expr
5757where
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
6060 expr = source .getNode ( ) .asExpr ( )
6161select sink .getNode ( ) , source , sink ,
6262 "Insecure hashing algorithm (" + algorithm + ") depends on $@." , source .getNode ( ) ,
0 commit comments