@@ -121,44 +121,26 @@ func test1(password: String, passwordHash : String) {
121
121
log. critical ( " \( password, privacy: . public) " ) // $ MISSING: hasCleartextLogging=121
122
122
log. fault ( " \( password, privacy: . public) " ) // $ MISSING: hasCleartextLogging=122
123
123
}
124
- /*
124
+
125
125
class MyClass {
126
126
var harmless = " abc "
127
127
var password = " 123 "
128
128
}
129
129
130
+ func getPassword( ) -> String { return " " }
131
+ func doSomething( password: String ) { }
132
+
130
133
func test3( x: String ) {
131
134
// alternative evidence of sensitivity...
132
135
133
- UserDefaults.standard.set(x, forKey: "myKey" ) // $ MISSING: hasCleartextLogging
136
+ NSLog ( x ) // $ MISSING: hasCleartextLogging=137
134
137
doSomething ( password: x) ;
135
- UserDefaults.standard.set(x, forKey: "myKey" ) // $ hasCleartextLogging
138
+ NSLog ( x ) // $ hasCleartextLogging=137
136
139
137
140
let y = getPassword ( ) ;
138
- UserDefaults.standard.set(y, forKey: "myKey" ) // $ hasCleartextLogging
141
+ NSLog ( y ) // $ hasCleartextLogging=140
139
142
140
143
let z = MyClass ( )
141
- UserDefaults.standard.set(z.harmless, forKey: "myKey") // Safe
142
- UserDefaults.standard.set(z.password, forKey: "myKey") // $ hasCleartextLogging
143
- }
144
-
145
- func test4(passwd: String) {
146
- // sanitizers...
147
-
148
- var x = passwd;
149
- var y = passwd;
150
- var z = passwd;
151
-
152
- UserDefaults.standard.set(x, forKey: "myKey") // $ hasCleartextLogging
153
- UserDefaults.standard.set(y, forKey: "myKey") // $ hasCleartextLogging
154
- UserDefaults.standard.set(z, forKey: "myKey") // $ hasCleartextLogging
155
-
156
- x = encrypt(x);
157
- hash(data: &y);
158
- z = "";
159
-
160
- UserDefaults.standard.set(x, forKey: "myKey") // Safe
161
- UserDefaults.standard.set(y, forKey: "myKey") // Safe
162
- UserDefaults.standard.set(z, forKey: "myKey") // Safe
144
+ NSLog ( z. harmless) // Safe
145
+ NSLog ( z. password) // $ hasCleartextLogging=145
163
146
}
164
- */
0 commit comments