Why it matters
Any claims a caller writes are trusted.
How to fix it
Verify with JWT.require(algorithm).build().verify(token), or jjwt's parser().verifyWith(key).build().parseSignedClaims(token).
Example
The rule's own test fixtures, verbatim: the test suite requires the rule to report the first and not the second.
fun subject(token: String): String = JWT.decode(token).subjectfun subject(token: String, algorithm: Algorithm): String =
JWT.require(algorithm).build().verify(token).subjectWhat 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 password datasource (Kotlin)
KotlinSeverity: High
trustivan-kotlin-hardcoded-password-datasource - Spring CSRF disabled (Kotlin)
KotlinSeverity: Medium
trustivan-kotlin-spring-csrf-disabled - Hardcoded secret key (Kotlin)
KotlinSeverity: High
trustivan-kotlin-hardcoded-secret-key - WebView JavaScript interface (Kotlin)
KotlinSeverity: Medium
trustivan-kotlin-webview-javascript-interface - Trust all certificates (Kotlin)
KotlinSeverity: High
trustivan-kotlin-trust-all-certificates - WebView file access (Kotlin)
KotlinSeverity: Medium
trustivan-kotlin-webview-file-access
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