Skip to content
vetkitChecksChangelogDocumentationBlogComparisons

Android SharedPreferences plaintext secret in Kotlin

Rule ID: vetkit.kotlin.android.shared-preferences-plaintext-secret

A password, token, API key or similar secret is written to SharedPreferences in plain text. The XML file is readable on rooted devices and from extracted backups.

Last updated:

Suite: Security

kotlin

A password, token, API key or similar secret is written to SharedPreferences in plain text. The XML file is readable on rooted devices and from extracted backups.

Category: SECURITY · Engine rule severity: WARNING

How to fix it

Store secrets with EncryptedSharedPreferences (androidx.security) or in the Android Keystore, keep only non-sensitive preferences in plain SharedPreferences, and prefer short-lived tokens.

References

Source: packages/engine/rules/sast/kotlin.yml.

Related checks

Check your own repository for this

vetkit runs this rule as part of a repository audit, alongside secret scanning, dependency vulnerabilities, code quality and AI code risk checks. It reads a temporary checkout and never executes your code.

Start with the free Security Quick Scan · See how the platform works

Generated from shipped rule definitions at build time. Matching is a review signal, not proof of exploitability. “generic” denotes text matching, not complete language or framework coverage. Runtime configuration and available tools affect whether a rule runs.