Skip to content

Commit 424046d

Browse files
committed
Swift: Add test case.
1 parent c6bc1a3 commit 424046d

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-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
@@ -138,6 +138,7 @@
138138
| testGRDB.swift:208:81:208:81 | password | label:password, type:credential |
139139
| testGRDB.swift:210:85:210:85 | password | label:password, type:credential |
140140
| testGRDB.swift:212:99:212:99 | password | label:password, type:credential |
141+
| testRealm2.swift:18:11:18:11 | myPassword | label:myPassword, type:credential |
141142
| testRealm.swift:31:20:31:20 | .password | label:password, type:credential |
142143
| testRealm.swift:41:11:41:11 | myPassword | label:myPassword, type:credential |
143144
| testRealm.swift:49:11:49:11 | myPassword | label:myPassword, type:credential |
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//codeql-extractor-options: -module-name RealmSwift
2+
3+
// --- stubs ---
4+
5+
class Object {
6+
}
7+
8+
// --- tests ---
9+
10+
class MyRealmSwiftObject3 : Object {
11+
override init() { data = "" }
12+
13+
var data: String
14+
}
15+
16+
func test1(o: MyRealmSwiftObject3, myHarmless: String, myPassword : String) {
17+
// ...
18+
o.data = myPassword // BAD [NOT DETECTED]
19+
o.data = myHarmless
20+
// ...
21+
}

0 commit comments

Comments
 (0)