Swift: Add some test cases.

This commit is contained in:
Geoffrey White
2023-09-11 19:33:37 +01:00
parent e038f60640
commit aa5820c061
4 changed files with 43 additions and 0 deletions

View File

@@ -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 |

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -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
}