Why AI tools produce this: AI coding tools produce this regularly, typically when prompted for a shortcut or a quick fix.
Why this matters
Spring Boot Actuator and similar diagnostic endpoints expose health, environment, configuration, thread dumps, and heap dumps. Opening them to anonymous access leaks secrets and internal state and can enable remote code execution (CWE-862, broken access control). This is a common AI-generated mistake: the management path is opened to "fix" a probe or scrape and the intended authentication is never added.
Require authentication for management endpoints (e.g. requestMatchers(EndpointRequest.toAnyEndpoint()).hasRole("ADMIN")) and expose only /actuator/health (and /info) publicly if you must.
import org.springframework.security.config.annotation.web.builders.HttpSecurity;import org.springframework.security.web.SecurityFilterChain;class SecurityConfig { // Management endpoints require authentication; only ordinary public routes // are opened. SecurityFilterChain secured(HttpSecurity http) throws Exception { // ok: auth.java.web.permit-all-actuator http.authorizeHttpRequests(auth -> auth .requestMatchers("/actuator/**").hasRole("ADMIN") .requestMatchers("/public/**").permitAll() .anyRequest().authenticated()); return http.build(); } // True-negative trap: permitAll() on a normal application path that is not a // management/diagnostics surface. SecurityFilterChain publicRoute(HttpSecurity http) throws Exception { // ok: auth.java.web.permit-all-actuator http.authorizeHttpRequests(auth -> auth .requestMatchers("/login").permitAll() .anyRequest().authenticated()); return http.build(); }}
Suppressing this rule
If a finding is a genuine false positive, scope the suppression to the exact line and leave a reason, never disable the rule project-wide. Disable directives are line-scoped by design.