@@ -14,26 +14,24 @@ import swift
1414import codeql.swift.dataflow.DataFlow
1515import codeql.swift.dataflow.TaintTracking
1616import codeql.swift.dataflow.FlowSources
17- import DataFlow :: PathGraph
17+ import InsecureTlsFlow :: PathGraph
1818
1919/**
2020 * A taint config to detect insecure configuration of `NSURLSessionConfiguration`
2121 */
22- class InsecureTlsConfig extends TaintTracking:: Configuration {
23- InsecureTlsConfig ( ) { this = "InsecureTLSConfig" }
24-
22+ module InsecureTlsConfig implements DataFlow:: ConfigSig {
2523 /**
2624 * Holds for enum values that represent an insecure version of TLS
2725 */
28- override predicate isSource ( DataFlow:: Node node ) {
26+ predicate isSource ( DataFlow:: Node node ) {
2927 node .asExpr ( ) .( MethodLookupExpr ) .getMember ( ) .( EnumElementDecl ) .getName ( ) =
3028 [ "TLSv10" , "TLSv11" , "tlsProtocol10" , "tlsProtocol11" ]
3129 }
3230
3331 /**
3432 * Holds for assignment of TLS-related properties of `NSURLSessionConfiguration`
3533 */
36- override predicate isSink ( DataFlow:: Node node ) {
34+ predicate isSink ( DataFlow:: Node node ) {
3735 exists ( AssignExpr assign |
3836 assign .getSource ( ) = node .asExpr ( ) and
3937 assign .getDest ( ) .( MemberRefExpr ) .getMember ( ) .( ConcreteVarDecl ) .getName ( ) =
@@ -45,6 +43,8 @@ class InsecureTlsConfig extends TaintTracking::Configuration {
4543 }
4644}
4745
48- from InsecureTlsConfig config , DataFlow:: PathNode sourceNode , DataFlow:: PathNode sinkNode
49- where config .hasFlowPath ( sourceNode , sinkNode )
46+ module InsecureTlsFlow = TaintTracking:: Global< InsecureTlsConfig > ;
47+
48+ from InsecureTlsFlow:: PathNode sourceNode , InsecureTlsFlow:: PathNode sinkNode
49+ where InsecureTlsFlow:: flowPath ( sourceNode , sinkNode )
5050select sinkNode .getNode ( ) , sourceNode , sinkNode , "This TLS configuration is insecure."
0 commit comments