@@ -121,44 +121,26 @@ func test1(password: String, passwordHash : String) {
121121 log. critical ( " \( password, privacy: . public) " ) // $ MISSING: hasCleartextLogging=121
122122 log. fault ( " \( password, privacy: . public) " ) // $ MISSING: hasCleartextLogging=122
123123}
124- /*
124+
125125class MyClass {
126126 var harmless = " abc "
127127 var password = " 123 "
128128}
129129
130+ func getPassword( ) -> String { return " " }
131+ func doSomething( password: String ) { }
132+
130133func test3( x: String ) {
131134 // alternative evidence of sensitivity...
132135
133- UserDefaults.standard.set(x, forKey: "myKey" ) // $ MISSING: hasCleartextLogging
136+ NSLog ( x ) // $ MISSING: hasCleartextLogging=137
134137 doSomething ( password: x) ;
135- UserDefaults.standard.set(x, forKey: "myKey" ) // $ hasCleartextLogging
138+ NSLog ( x ) // $ hasCleartextLogging=137
136139
137140 let y = getPassword ( ) ;
138- UserDefaults.standard.set(y, forKey: "myKey" ) // $ hasCleartextLogging
141+ NSLog ( y ) // $ hasCleartextLogging=140
139142
140143 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
163146}
164- */
0 commit comments