Skip to main content

SKY-D433 · Security in code

Spring Security CSRF disabled

MediumCWE-352

Skylos reports Java Spring Security configurations that explicitly disable cross-site request forgery protection. The finding points to the Java call that configures CSRF.

Languages
Java
Quality gate
counted toward the gate limits (full and diff scans)
Finding type
review
Wrong result? Report itA false positive, a missed case or a confusing message: it goes privately to the founder.

Why it matters

When a browser attaches credentials automatically, an application needs a separate way to verify that a state-changing request was intentional.

What Skylos flags

src/main/java/SecurityConfig.java · JavaReported on line 5
import org.springframework.security.config.annotation.web.builders.HttpSecurity; class SecurityConfig {    void configure(HttpSecurity http) {        http.csrf(csrf -> csrf.disable());    }}

What Skylos leaves alone

src/main/java/SecurityConfig.java · Java
import org.springframework.security.config.Customizer;import org.springframework.security.config.annotation.web.builders.HttpSecurity; class SecurityConfig {    void configure(HttpSecurity http) {        http.csrf(Customizer.withDefaults());    }}

Why Skylos leaves it alone

The configuration keeps Spring Security's default CSRF protection enabled.

How Skylos decides

  1. Requires a resolved Spring Security HttpSecurity receiver.
  2. Recognizes legacy csrf().disable() and supported callbacks that call disable on the CSRF configurer.
  3. Reports a review finding. The scanner does not establish how the chain authenticates requests at runtime.

How to fix it

Keep CSRF protection for browser-authenticated routes. If a chain uses only credentials that browsers do not attach automatically, review that chain explicitly.

When it can be wrong

  • An isolated API chain may intentionally use only explicit authorization headers. Check the chain matching and credential types before accepting the finding.

Seeing a case that isn't listed here? Report the wrong result so the rule can be fixed. Don't paste company code: describe the shape of it.

How to silence it

  • Mark the reviewed line with a rule-scoped Skylos ignore for SKY-D433. Record the evidence that justifies the exception.

From the Skylos rule handbook, Skylos 5.8.0 (commit 5b880b0). All rules.