Skip to content

Commit eb2a0af

Browse files
committed
Swift: Additional test case.
1 parent 6a0e480 commit eb2a0af

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

swift/ql/test/query-tests/Security/CWE-311/SensitiveExprs.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
| testRealm.swift:34:11:34:11 | myPassword | label:myPassword, type:credential |
1414
| testRealm.swift:42:11:42:11 | myPassword | label:myPassword, type:credential |
1515
| testRealm.swift:52:12:52:12 | myPassword | label:myPassword, type:credential |
16+
| testRealm.swift:59:11:59:11 | myPassword | label:myPassword, type:credential |
1617
| testSend.swift:29:19:29:19 | passwordPlain | label:passwordPlain, type:credential |
1718
| testSend.swift:33:19:33:19 | passwordPlain | label:passwordPlain, type:credential |
1819
| testSend.swift:45:13:45:13 | password | label:password, type:credential |

swift/ql/test/query-tests/Security/CWE-311/testRealm.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ func test1(realm : Realm, myPassword : String, myHashedPassword : String) {
5353

5454
var f = realm.object(ofType: MyRealmSwiftObject.self, forPrimaryKey: "key")
5555
f!.data = myHashedPassword // GOOD (not sensitive)
56+
57+
let g = MyRealmSwiftObject()
58+
g.data = "" // GOOD (not sensitive)
59+
g.data = myPassword // BAD [NOT DETECTED]
60+
g.data = "" // GOOD (not sensitive)
5661
}
5762

5863
// limitation: its possible to configure a Realm DB to be stored encrypted, if this is done correctly

0 commit comments

Comments
 (0)