Skip to content

Commit ba7d375

Browse files
committed
Swift: Fix QL-on-QL warnings.
1 parent 75a9809 commit ba7d375

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

swift/ql/src/queries/Security/CWE-312/CleartextStoragePreferences.ql

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ abstract class Stored extends DataFlow::Node {
2727
class UserDefaultsStore extends Stored {
2828
UserDefaultsStore() {
2929
exists(ClassDecl c, AbstractFunctionDecl f, CallExpr call |
30-
c.getName() = ["UserDefaults"] and
30+
c.getName() = "UserDefaults" and
3131
c.getAMember() = f and
32-
f.getName() = ["set(_:forKey:)"] and
32+
f.getName() = "set(_:forKey:)" and
3333
call.getStaticTarget() = f and
3434
call.getArgument(0).getExpr() = this.asExpr()
3535
)
@@ -42,9 +42,9 @@ class UserDefaultsStore extends Stored {
4242
class NSUbiquitousKeyValueStore extends Stored {
4343
NSUbiquitousKeyValueStore() {
4444
exists(ClassDecl c, AbstractFunctionDecl f, CallExpr call |
45-
c.getName() = ["NSUbiquitousKeyValueStore"] and
45+
c.getName() = "NSUbiquitousKeyValueStore" and
4646
c.getAMember() = f and
47-
f.getName() = ["set(_:forKey:)"] and
47+
f.getName() = "set(_:forKey:)" and
4848
call.getStaticTarget() = f and
4949
call.getArgument(0).getExpr() = this.asExpr()
5050
)
@@ -54,9 +54,10 @@ class NSUbiquitousKeyValueStore extends Stored {
5454
}
5555

5656
/**
57-
* TODO: A more complicated case, this is a macOS-only way of writing to
57+
* A more complicated case, this is a macOS-only way of writing to
5858
* NSUserDefaults by modifying the `NSUserDefaultsController.values: Any`
59-
* object via reflection (`perform(Selector)`) or the `NSKeyValueCoding`, `NSKeyValueBindingCreation` APIs.
59+
* object via reflection (`perform(Selector)`) or the `NSKeyValueCoding`,
60+
* `NSKeyValueBindingCreation` APIs. (TODO)
6061
*/
6162
class NSUserDefaultsControllerStore extends Stored {
6263
NSUserDefaultsControllerStore() { none() }
@@ -77,7 +78,7 @@ class CleartextStorageConfig extends TaintTracking::Configuration {
7778

7879
override predicate isSanitizerIn(DataFlow::Node node) {
7980
// make sources barriers so that we only report the closest instance
80-
isSource(node)
81+
this.isSource(node)
8182
}
8283

8384
override predicate isSanitizer(DataFlow::Node node) {
@@ -101,5 +102,5 @@ where config.hasFlowPath(sourceNode, sinkNode)
101102
select cleanupNode(sinkNode.getNode()), sourceNode, sinkNode,
102103
"This operation stores '" + sinkNode.getNode().toString() + "' in " +
103104
sinkNode.getNode().(Stored).getStoreName() +
104-
". It may contain unencrypted sensitive data from $@", sourceNode,
105+
". It may contain unencrypted sensitive data from $@.", sourceNode,
105106
sourceNode.getNode().toString()

0 commit comments

Comments
 (0)