@@ -14,7 +14,7 @@ import swift
1414import codeql.swift.dataflow.DataFlow
1515import codeql.swift.dataflow.TaintTracking
1616import codeql.swift.dataflow.FlowSteps
17- import DataFlow :: PathGraph
17+ import ConstantPasswordFlow :: PathGraph
1818
1919/**
2020 * A constant password is created through either a byte array or string literals.
@@ -60,18 +60,16 @@ class ConstantPasswordSink extends Expr {
6060 * A taint configuration from the source of constants passwords to expressions that use
6161 * them to initialize password-based encryption keys.
6262 */
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 }
6565
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 }
7167}
7268
69+ module ConstantPasswordFlow = TaintTracking:: Global< ConstantPasswordConfig > ;
70+
7371// 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 )
7674select sinkNode .getNode ( ) , sourceNode , sinkNode ,
7775 "The value '" + sourceNode .getNode ( ) .toString ( ) + "' is used as a constant password."
0 commit comments