DepWarden's free Kotlin SAST scanner checks Kotlin source code against 18 security rules (including 10 Android-specific rules). Every rule maps to a CWE and the findings span 5 OWASP Top 10 categories, and every finding comes with an explanation, a fix and a before-and-after example. Paste a file, upload a zip or connect a repository: no account, and the results stay in a private, session-isolated workspace.
Kotlin is the default language for modern Android apps and is widely used with Spring Boot on the server. It shares Java's injection and cryptography pitfalls, plus Android-specific ones.
18 rules cover 16 distinct weakness types (2 critical, 12 high, 4 medium and 0 low severity).
| What it checks | Rules | Examples |
|---|---|---|
| Injection (SQL, command, code) | 7 | Android dynamic DEX loading; Android WebView JavaScript interface bridging Java; LDAP filter built from untrusted input |
| Weak cryptography | 4 | Android HostnameVerifier always returns true; Android TrustManager trusts all certificates; Insecure random number generator |
| Privacy and data leaks | 3 | Android Log statement with sensitive data; Android sensitive data stored on external storage; Android SharedPreferences in world-readable mode |
| Path traversal | 2 | Android WebView file:// access enabled; File path built from untrusted input |
| Cross-site scripting | 1 | Android WebView JavaScript enabled |
| Insecure configuration | 1 | Android implicit broadcast intent |
A HostnameVerifier that always returns true accepts connections to servers whose certificate CN does not match the hostname, enabling MITM attacks.
Vulnerable:
val allowAll = HostnameVerifier { _, _ -> true }Fixed:
// Remove the custom HostnameVerifier and rely on the OkHttp/JVM defaultRemove the custom HostnameVerifier and rely on the system default.
DexClassLoader or InMemoryDexClassLoader loads and executes code at runtime. If the source path is user-controlled or network-accessible, this enables code injection.
Vulnerable:
val loader = DexClassLoader(downloadedPath, cacheDir.path, null, parentLoader)Fixed:
// Avoid runtime DEX loading; ship all code in the APK. If unavoidable,
// verify a signature over the DEX before instantiating the loader.Avoid runtime class loading. If required, verify the integrity of the DEX file with a trusted signature before loading.
Data written to external storage (SD card) is accessible to all apps and to USB-connected PCs. Never store sensitive data there.
Vulnerable:
val file = File(Environment.getExternalStorageDirectory(), "auth_token.txt")Fixed:
val file = File(context.filesDir, "auth_token.txt") // private internal storageUse getFilesDir() or getDataDir() for private app storage. Encrypt any file that must go to external storage.
- uses: Rushabh5000/depwarden-action@v1
with:
sast-dir: src
sast-fail-on: high
env:
APP_API_KEY: ${{ secrets.APP_API_KEY }}DepWarden's SAST engine uses pattern rules and taint-aware rules that require untrusted input to reach a dangerous call. It is not a full cross-file dataflow engine, so a bug that only appears when data crosses several files can be missed, and every static analyser reports some false positives. Treat findings as leads: review them, fix the real ones and suppress the rest with a written reason. SAST covers the code you write; for the packages you import, run software composition analysis too.
Yes. DepWarden's Kotlin scanner is free in the browser with no account: paste code, upload a zip or connect a repository. Running SAST from CI through an API key needs a plan that includes SAST.
.kt, .kts. Configuration and secret-bearing files such as .env and key files are also checked for hardcoded credentials, whatever language the project uses.
Each finding names the weakness (CWE), explains why the code is risky, shows a vulnerable and a fixed version of the pattern, and gives the remediation. Fix the code, then scan again to confirm the finding is gone.
Other languages: Python, Java, JavaScript and TypeScript, PHP, Go (Golang), C#, Ruby, Swift, and secret scanning. Compare the options in free SAST tools compared, or start with what is SAST and SAST vs SCA.