mirror of
https://github.com/github/codeql.git
synced 2026-05-05 21:55:19 +02:00
Swift: Add some test cases.
This commit is contained in:
@@ -133,6 +133,7 @@
|
||||
| testSend.swift:78:27:78:30 | .CarePlanID | label:CarePlanID, type:private information |
|
||||
| testSend.swift:79:27:79:30 | .BankCardNo | label:BankCardNo, type:private information |
|
||||
| testSend.swift:80:27:80:30 | .MyCreditRating | label:MyCreditRating, type:private information |
|
||||
| testSend.swift:94:27:94:30 | .password | label:password, type:credential |
|
||||
| testURL.swift:17:54:17:54 | passwd | label:passwd, type:credential |
|
||||
| testURL.swift:19:55:19:55 | account_no | label:account_no, type:private information |
|
||||
| testURL.swift:20:55:20:55 | credit_card_no | label:credit_card_no, type:private information |
|
||||
|
||||
@@ -80,3 +80,17 @@ func test2(password : String, license_key: String, ms: MyStruct, connection : NW
|
||||
connection.send(content: ms.MyCreditRating, completion: .idempotent) // BAD
|
||||
connection.send(content: ms.OneTimeCode, completion: .idempotent) // BAD [NOT DETECTED]
|
||||
}
|
||||
|
||||
struct MyOuter {
|
||||
struct MyInner {
|
||||
var value: String
|
||||
}
|
||||
|
||||
var password: MyInner
|
||||
var harmless: MyInner
|
||||
}
|
||||
|
||||
func test3(mo : MyOuter, connection : NWConnection) {
|
||||
connection.send(content: mo.password.value, completion: .idempotent) // BAD [NOT DETECTED]
|
||||
connection.send(content: mo.harmless.value, completion: .idempotent) // GOOD
|
||||
}
|
||||
|
||||
@@ -159,3 +159,17 @@ func test3(x: String) {
|
||||
NSLog(z.harmless) // Safe
|
||||
NSLog(z.password) // $ hasCleartextLogging=160
|
||||
}
|
||||
|
||||
struct MyOuter {
|
||||
struct MyInner {
|
||||
var value: String
|
||||
}
|
||||
|
||||
var password: MyInner
|
||||
var harmless: MyInner
|
||||
}
|
||||
|
||||
func test3(mo : MyOuter) {
|
||||
NSLog(mo.password.value) // BAD [NOT DETECTED]
|
||||
NSLog(mo.harmless.value) // GOOD
|
||||
}
|
||||
|
||||
@@ -68,3 +68,17 @@ func test4(passwd: String) {
|
||||
UserDefaults.standard.set(y, forKey: "myKey") // GOOD (not sensitive)
|
||||
UserDefaults.standard.set(z, forKey: "myKey") // GOOD (not sensitive)
|
||||
}
|
||||
|
||||
struct MyOuter {
|
||||
struct MyInner {
|
||||
var value: String
|
||||
}
|
||||
|
||||
var password: MyInner
|
||||
var harmless: MyInner
|
||||
}
|
||||
|
||||
func test5(mo : MyOuter) {
|
||||
UserDefaults.standard.set(mo.password.value, forKey: "myKey") // BAD [NOT DETECTED]
|
||||
UserDefaults.standard.set(mo.harmless.value, forKey: "myKey") // GOOD
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user