Skip to content

Commit d317ad8

Browse files
committed
Swift: Convert to CSV sinks.
1 parent 380bf21 commit d317ad8

File tree

2 files changed

+13
-177
lines changed

2 files changed

+13
-177
lines changed

swift/ql/lib/codeql/swift/security/InsecureTLSExtensions.qll

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -45,27 +45,24 @@ private class EnumInsecureTlsExtensionsSource extends InsecureTlsExtensionsSourc
4545
}
4646
}
4747

48-
/**
49-
* A sink for assignment of TLS-related properties of `NSURLSessionConfiguration`.
50-
*/
51-
private class NsUrlTlsExtensionsSink extends InsecureTlsExtensionsSink {
52-
NsUrlTlsExtensionsSink() {
53-
exists(MemberRefExpr e |
54-
e.getBase().getType().getABaseType*().getUnderlyingType().getName() =
55-
"URLSessionConfiguration" and
56-
e.getMember().(ConcreteVarDecl).getName() =
57-
[
58-
"tlsMinimumSupportedProtocolVersion", "tlsMinimumSupportedProtocol",
59-
"tlsMaximumSupportedProtocolVersion", "tlsMaximumSupportedProtocol"
60-
] and
61-
this.(DataFlow::PostUpdateNode).getPreUpdateNode().asExpr() = e.getBase()
62-
)
48+
private class TlsExtensionsSinks extends SinkModelCsv {
49+
override predicate row(string row) {
50+
row =
51+
[
52+
// TLS-related properties of `URLSessionConfiguration`
53+
";URLSessionConfiguration;false;tlsMinimumSupportedProtocolVersion;;;;tls-protocol-version",
54+
";URLSessionConfiguration;false;tlsMinimumSupportedProtocol;;;;tls-protocol-version",
55+
";URLSessionConfiguration;false;tlsMaximumSupportedProtocolVersion;;;;tls-protocol-version",
56+
";URLSessionConfiguration;false;tlsMaximumSupportedProtocol;;;;tls-protocol-version",
57+
]
6358
}
6459
}
6560

6661
/**
6762
* A sink defined in a CSV model.
6863
*/
6964
private class DefaultTlsExtensionsSink extends InsecureTlsExtensionsSink {
70-
DefaultTlsExtensionsSink() { sinkNode(this, "tls-protocol-version") }
65+
DefaultTlsExtensionsSink() {
66+
sinkNode(this.(DataFlow::PostUpdateNode).getPreUpdateNode(), "tls-protocol-version")
67+
}
7168
}

0 commit comments

Comments
 (0)