Why it matters
Anyone who can read the repository can sign in to the database.
How to fix it
Read the password from the environment or a secret store, and rotate the password that was committed.
Example
The rule's own test fixtures, verbatim: the test suite requires the rule to report the first and not the second.
fun connect(): Connection =
DriverManager.getConnection("jdbc:postgresql://db.internal/shop", "shop", "Sup3rS3cret!")fun connect(): Connection =
DriverManager.getConnection("jdbc:postgresql://db.internal/shop", "shop", System.getenv("DB_PASSWORD"))What TrustIvan reads
Runs on repository scans of Kotlin source once static analysis is turned on (SAST_RULES and the separately built analyzer image); it is off by default.
Weakness classes and references
Related checks
- Hardcoded secret key (Kotlin)
KotlinSeverity: High
trustivan-kotlin-hardcoded-secret-key - JWT unverified decode (Kotlin)
KotlinSeverity: High
trustivan-kotlin-jwt-unverified-decode - Trust all certificates (Kotlin)
KotlinSeverity: High
trustivan-kotlin-trust-all-certificates - Spring CSRF disabled (Kotlin)
KotlinSeverity: Medium
trustivan-kotlin-spring-csrf-disabled - Insecure random secret (Kotlin)
KotlinSeverity: Medium
trustivan-kotlin-insecure-random-secret - WebView JavaScript interface (Kotlin)
KotlinSeverity: Medium
trustivan-kotlin-webview-javascript-interface
Terms: SAST (static application security testing), Taint analysis, CWE (Common Weakness Enumeration), OWASP Top 10
All static analysis (SAST) checks · The whole catalogue · How this works in TrustIvan · Documentation