Files
codeql/java/ql/test/query-tests/security/CWE-312/CleartextStorageSharedPrefsTestKt.kt
2022-05-25 10:56:18 +02:00

12 lines
487 B
Kotlin

import android.app.Activity
import android.content.Context
import android.content.SharedPreferences
class CleartextStorageSharedPrefsTestKt : Activity() {
fun testSetSharedPrefs1(context: Context, name: String, password: String) {
val sharedPrefs = context.getSharedPreferences("user_prefs", Context.MODE_PRIVATE);
sharedPrefs.edit().putString("name", name).apply(); // Safe
sharedPrefs.edit().putString("password", password).apply(); // $ hasCleartextStorageSharedPrefs
}
}