@@ -14,7 +14,7 @@ import swift
14
14
import codeql.swift.dataflow.DataFlow
15
15
import codeql.swift.dataflow.TaintTracking
16
16
import codeql.swift.dataflow.FlowSteps
17
- import DataFlow :: PathGraph
17
+ import ConstantSaltFlow :: PathGraph
18
18
19
19
/**
20
20
* A constant salt is created through either a byte array or string literals.
@@ -52,19 +52,19 @@ class ConstantSaltSink extends Expr {
52
52
53
53
/**
54
54
* A taint configuration from the source of constants salts to expressions that use
55
- * them to initialize password-based enecryption keys.
55
+ * them to initialize password-based encryption keys.
56
56
*/
57
- class ConstantSaltConfig extends TaintTracking :: Configuration {
58
- ConstantSaltConfig ( ) { this = "ConstantSaltConfig" }
57
+ module ConstantSaltConfig implements DataFlow :: ConfigSig {
58
+ predicate isSource ( DataFlow :: Node node ) { node . asExpr ( ) instanceof ConstantSaltSource }
59
59
60
- override predicate isSource ( DataFlow:: Node node ) { node .asExpr ( ) instanceof ConstantSaltSource }
61
-
62
- override predicate isSink ( DataFlow:: Node node ) { node .asExpr ( ) instanceof ConstantSaltSink }
60
+ predicate isSink ( DataFlow:: Node node ) { node .asExpr ( ) instanceof ConstantSaltSink }
63
61
}
64
62
63
+ module ConstantSaltFlow = TaintTracking:: Global< ConstantSaltConfig > ;
64
+
65
65
// The query itself
66
- from ConstantSaltConfig config , DataFlow :: PathNode sourceNode , DataFlow :: PathNode sinkNode
67
- where config . hasFlowPath ( sourceNode , sinkNode )
66
+ from ConstantSaltFlow :: PathNode sourceNode , ConstantSaltFlow :: PathNode sinkNode
67
+ where ConstantSaltFlow :: flowPath ( sourceNode , sinkNode )
68
68
select sinkNode .getNode ( ) , sourceNode , sinkNode ,
69
69
"The value '" + sourceNode .getNode ( ) .toString ( ) +
70
70
"' is used as a constant salt, which is insecure for hashing passwords."
0 commit comments