@@ -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 ConstantPasswordFlow :: PathGraph
18
18
19
19
/**
20
20
* A constant password is created through either a byte array or string literals.
@@ -60,18 +60,16 @@ class ConstantPasswordSink extends Expr {
60
60
* A taint configuration from the source of constants passwords to expressions that use
61
61
* them to initialize password-based encryption keys.
62
62
*/
63
- class ConstantPasswordConfig extends TaintTracking :: Configuration {
64
- ConstantPasswordConfig ( ) { this = "ConstantPasswordConfig" }
63
+ module ConstantPasswordConfig implements DataFlow :: ConfigSig {
64
+ predicate isSource ( DataFlow :: Node node ) { node . asExpr ( ) instanceof ConstantPasswordSource }
65
65
66
- override predicate isSource ( DataFlow:: Node node ) {
67
- node .asExpr ( ) instanceof ConstantPasswordSource
68
- }
69
-
70
- override predicate isSink ( DataFlow:: Node node ) { node .asExpr ( ) instanceof ConstantPasswordSink }
66
+ predicate isSink ( DataFlow:: Node node ) { node .asExpr ( ) instanceof ConstantPasswordSink }
71
67
}
72
68
69
+ module ConstantPasswordFlow = TaintTracking:: Global< ConstantPasswordConfig > ;
70
+
73
71
// The query itself
74
- from ConstantPasswordConfig config , DataFlow :: PathNode sourceNode , DataFlow :: PathNode sinkNode
75
- where config . hasFlowPath ( sourceNode , sinkNode )
72
+ from ConstantPasswordFlow :: PathNode sourceNode , ConstantPasswordFlow :: PathNode sinkNode
73
+ where ConstantPasswordFlow :: flowPath ( sourceNode , sinkNode )
76
74
select sinkNode .getNode ( ) , sourceNode , sinkNode ,
77
75
"The value '" + sourceNode .getNode ( ) .toString ( ) + "' is used as a constant password."
0 commit comments