[PRM-713] Upgraded PDS Adaptor to Spring Boot 4, Java 25 and Gradle 9.3#292
[PRM-713] Upgraded PDS Adaptor to Spring Boot 4, Java 25 and Gradle 9.3#292AndyFlintAnswerDigital wants to merge 19 commits intomainfrom
Conversation
| http | ||
| .csrf(AbstractHttpConfigurer::disable) |
Check failure
Code scanning / CodeQL
Disabled Spring CSRF protection High
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 7 days ago
In general, to fix this kind of issue you should avoid globally disabling CSRF. Instead, leave CSRF protection enabled and, if needed, selectively relax it for specific endpoints or authentication schemes (for example, for pure JSON APIs authenticated via headers or tokens). This preserves protection for browser-based flows while giving you flexibility for machine-to-machine calls.
In this specific configuration, the simplest safe fix that preserves the stateless API behavior is to remove the .csrf(AbstractHttpConfigurer::disable) call so that Spring Security’s default CSRF configuration applies. Because the rest of the filter chain is already stateless and using HTTP Basic, Spring Security will still enforce authentication as before, but now CSRF tokens will be required for unsafe HTTP methods when requests originate from browsers with cookies. No additional imports or methods are needed; we only adjust the securityFilterChain bean definition in SecurityConfig.java by deleting the .csrf(AbstractHttpConfigurer::disable) line.
| @@ -96,7 +96,6 @@ | ||
| @Bean | ||
| public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { | ||
| http | ||
| .csrf(AbstractHttpConfigurer::disable) | ||
| .sessionManagement(sm -> sm.sessionCreationPolicy(SessionCreationPolicy.STATELESS)) | ||
| .httpBasic(Customizer.withDefaults()) | ||
| .authorizeHttpRequests(auth -> auth |
Report for nems-event-processorTerraform Initialization ⚙️
|
Report for re-registration-serviceTerraform Initialization ⚙️
|
Report for suspension-serviceTerraform Initialization ⚙️
|
Report for nems-event-processorTerraform Initialization ⚙️
|
Report for re-registration-serviceTerraform Initialization ⚙️
|
Report for suspension-serviceTerraform Initialization ⚙️
|
Code security issues foundView full details here. |
|
Report for nems-event-processorTerraform Initialization ⚙️
|
Report for re-registration-serviceTerraform Initialization ⚙️
|
Report for suspension-serviceTerraform Initialization ⚙️
|



NOTE TO REVIEWER - REVIEW PRM-666 AND PRM-714 FIRST AS THESE CHANGES ARE BRANCHED OFF OF THEM