Skip to content

Commit c533334

Browse files
committed
Swift: Implementation classes should be private.
1 parent c21ec1c commit c533334

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class CleartextStorageDatabaseAdditionalTaintStep extends Unit {
3232
/**
3333
* A `DataFlow::Node` that is an expression stored with the Core Data library.
3434
*/
35-
class CoreDataStore extends CleartextStorageDatabaseSink {
35+
private class CoreDataStore extends CleartextStorageDatabaseSink {
3636
CoreDataStore() {
3737
// values written into Core Data objects through `set*Value` methods are a sink.
3838
exists(CallExpr call |
@@ -60,7 +60,7 @@ class CoreDataStore extends CleartextStorageDatabaseSink {
6060
* A `DataFlow::Node` that is an expression stored with the Realm database
6161
* library.
6262
*/
63-
class RealmStore extends CleartextStorageDatabaseSink instanceof DataFlow::PostUpdateNode {
63+
private class RealmStore extends CleartextStorageDatabaseSink instanceof DataFlow::PostUpdateNode {
6464
RealmStore() {
6565
// any write into a class derived from `RealmSwiftObject` is a sink. For
6666
// example in `realmObj.data = sensitive` the post-update node corresponding
@@ -77,7 +77,7 @@ class RealmStore extends CleartextStorageDatabaseSink instanceof DataFlow::PostU
7777
/**
7878
* A `DataFlow::Node` that is an expression stored with the GRDB library.
7979
*/
80-
class GrdbStore extends CleartextStorageDatabaseSink {
80+
private class GrdbStore extends CleartextStorageDatabaseSink {
8181
GrdbStore() {
8282
exists(CallExpr call, MethodDecl method |
8383
call.getStaticTarget() = method and
@@ -132,7 +132,7 @@ class GrdbStore extends CleartextStorageDatabaseSink {
132132
/**
133133
* An encryption sanitizer for cleartext database storage vulnerabilities.
134134
*/
135-
class CleartextStorageDatabaseEncryptionSanitizer extends CleartextStorageDatabaseSanitizer {
135+
private class CleartextStorageDatabaseEncryptionSanitizer extends CleartextStorageDatabaseSanitizer {
136136
CleartextStorageDatabaseEncryptionSanitizer() {
137137
this.asExpr() instanceof EncryptedExpr
138138
}
@@ -142,7 +142,7 @@ class CleartextStorageDatabaseEncryptionSanitizer extends CleartextStorageDataba
142142
* An additional taint step for cleartext database storage vulnerabilities.
143143
* Needed until we have proper content flow through arrays.
144144
*/
145-
class CleartextStorageDatabaseArrayAdditionalTaintStep extends CleartextStorageDatabaseAdditionalTaintStep {
145+
private class CleartextStorageDatabaseArrayAdditionalTaintStep extends CleartextStorageDatabaseAdditionalTaintStep {
146146
override predicate step(DataFlow::Node nodeFrom, DataFlow::Node nodeTo) {
147147
exists(ArrayExpr arr |
148148
nodeFrom.asExpr() = arr.getAnElement() and

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class CleartextStoragePreferencesAdditionalTaintStep extends Unit {
3333
}
3434

3535
/** The `DataFlow::Node` of an expression that gets written to the user defaults database */
36-
class UserDefaultsStore extends CleartextStoragePreferencesSink {
36+
private class UserDefaultsStore extends CleartextStoragePreferencesSink {
3737
UserDefaultsStore() {
3838
exists(CallExpr call |
3939
call.getStaticTarget().(MethodDecl).hasQualifiedName("UserDefaults", "set(_:forKey:)") and
@@ -45,7 +45,7 @@ class UserDefaultsStore extends CleartextStoragePreferencesSink {
4545
}
4646

4747
/** The `DataFlow::Node` of an expression that gets written to the iCloud-backed NSUbiquitousKeyValueStore */
48-
class NSUbiquitousKeyValueStore extends CleartextStoragePreferencesSink {
48+
private class NSUbiquitousKeyValueStore extends CleartextStoragePreferencesSink {
4949
NSUbiquitousKeyValueStore() {
5050
exists(CallExpr call |
5151
call.getStaticTarget()
@@ -64,7 +64,7 @@ class NSUbiquitousKeyValueStore extends CleartextStoragePreferencesSink {
6464
* object via reflection (`perform(Selector)`) or the `NSKeyValueCoding`,
6565
* `NSKeyValueBindingCreation` APIs. (TODO)
6666
*/
67-
class NSUserDefaultsControllerStore extends CleartextStoragePreferencesSink {
67+
private class NSUserDefaultsControllerStore extends CleartextStoragePreferencesSink {
6868
NSUserDefaultsControllerStore() { none() }
6969

7070
override string getStoreName() { result = "the user defaults database" }
@@ -73,7 +73,7 @@ class NSUserDefaultsControllerStore extends CleartextStoragePreferencesSink {
7373
/**
7474
* An encryption sanitizer for cleartext preferences storage vulnerabilities.
7575
*/
76-
class CleartextStoragePreferencesEncryptionSanitizer extends CleartextStoragePreferencesSanitizer {
76+
private class CleartextStoragePreferencesEncryptionSanitizer extends CleartextStoragePreferencesSanitizer {
7777
CleartextStoragePreferencesEncryptionSanitizer() {
7878
this.asExpr() instanceof EncryptedExpr
7979
}

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ class CleartextTransmissionAdditionalTaintStep extends Unit {
3232
/**
3333
* An `Expr` that is transmitted with `NWConnection.send`.
3434
*/
35-
class NWConnectionSend extends CleartextTransmissionSink {
36-
NWConnectionSend() {
35+
private class NWConnectionSendSink extends CleartextTransmissionSink {
36+
NWConnectionSendSink() {
3737
// `content` arg to `NWConnection.send` is a sink
3838
exists(CallExpr call |
3939
call.getStaticTarget()
@@ -48,8 +48,8 @@ class NWConnectionSend extends CleartextTransmissionSink {
4848
* An `Expr` that is used to form a `URL`. Such expressions are very likely to
4949
* be transmitted over a network, because that's what URLs are for.
5050
*/
51-
class Url extends CleartextTransmissionSink {
52-
Url() {
51+
private class UrlSink extends CleartextTransmissionSink {
52+
UrlSink() {
5353
// `string` arg in `URL.init` is a sink
5454
// (we assume here that the URL goes on to be used in a network operation)
5555
exists(CallExpr call |
@@ -64,8 +64,8 @@ class Url extends CleartextTransmissionSink {
6464
/**
6565
* An `Expr` that transmitted through the Alamofire library.
6666
*/
67-
class AlamofireTransmitted extends CleartextTransmissionSink {
68-
AlamofireTransmitted() {
67+
private class AlamofireTransmittedSink extends CleartextTransmissionSink {
68+
AlamofireTransmittedSink() {
6969
// sinks are the first argument containing the URL, and the `parameters`
7070
// and `headers` arguments to appropriate methods of `Session`.
7171
exists(CallExpr call, string fName |
@@ -82,7 +82,7 @@ class AlamofireTransmitted extends CleartextTransmissionSink {
8282
/**
8383
* An encryption sanitizer for cleartext transmission vulnerabilities.
8484
*/
85-
class CleartextTransmissionEncryptionSanitizer extends CleartextTransmissionSanitizer {
85+
private class CleartextTransmissionEncryptionSanitizer extends CleartextTransmissionSanitizer {
8686
CleartextTransmissionEncryptionSanitizer() {
8787
this.asExpr() instanceof EncryptedExpr
8888
}

0 commit comments

Comments
 (0)