Why it matters
If this application authenticates browsers with a session cookie, another site can submit requests with the user's session.
How to fix it
Keep CSRF on for cookie-authenticated routes; disable it only for a stateless API authenticated by a bearer header, and scope that with ignoringRequestMatchers.
Example
The rule's own test fixtures, verbatim: the test suite requires the rule to report the first and not the second.
@Bean
fun filterChain(http: HttpSecurity): SecurityFilterChain {
http.csrf { it.disable() }
return http.build()
}@Bean
fun filterChain(http: HttpSecurity): SecurityFilterChain {
http.csrf { it.ignoringRequestMatchers("/webhooks/**") }
return http.build()
}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
- JWT unverified decode (Kotlin)
KotlinSeverity: High
trustivan-kotlin-jwt-unverified-decode - WebView JavaScript interface (Kotlin)
KotlinSeverity: Medium
trustivan-kotlin-webview-javascript-interface - Hardcoded password datasource (Kotlin)
KotlinSeverity: High
trustivan-kotlin-hardcoded-password-datasource - WebView file access (Kotlin)
KotlinSeverity: Medium
trustivan-kotlin-webview-file-access - Hardcoded secret key (Kotlin)
KotlinSeverity: High
trustivan-kotlin-hardcoded-secret-key - World readable mode (Kotlin)
KotlinSeverity: Medium
trustivan-kotlin-world-readable-mode
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