Skip to content

Potential fix for code scanning alert no. 106: Disabled Spring CSRF protection#3946

Draft
strehle wants to merge 1 commit into
developfrom
alert-autofix-106
Draft

Potential fix for code scanning alert no. 106: Disabled Spring CSRF protection#3946
strehle wants to merge 1 commit into
developfrom
alert-autofix-106

Conversation

@strehle

@strehle strehle commented Jun 12, 2026

Copy link
Copy Markdown
Member

Potential fix for https://github.com/cloudfoundry/uaa/security/code-scanning/106

General fix: do not disable CSRF globally on this security chain. For Spring Security, the safest default is to leave CSRF enabled unless there is a tightly scoped and well-justified ignore rule.

Best fix here without broad functional redesign: remove the explicit disable call from ratelimitSecurity(...) so Spring’s default CSRF protection remains active for this filter chain.

File/region to change

  • server/src/main/java/org/cloudfoundry/identity/uaa/ratelimiting/beans/RateLimiterSecurityConfiguration.java
  • In method ratelimitSecurity(HttpSecurity http), remove .csrf(CsrfConfigurer::disable).
  • Also remove the now-unused CsrfConfigurer import.

No new methods, classes, or dependencies are required.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…rotection

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@strehle strehle requested review from a team and Copilot June 12, 2026 16:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses code scanning alert #106 by no longer globally disabling Spring Security CSRF protection on the rate limiting status security filter chain, allowing Spring’s default CSRF protection to apply.

Changes:

  • Removed explicit .csrf(CsrfConfigurer::disable) from the ratelimitSecurity(HttpSecurity http) filter chain so CSRF is no longer disabled on that chain.
  • Removed the now-unused CsrfConfigurer import.

Comment on lines 54 to 56
.sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
.addFilterBefore(oauthWithoutResourceAuthenticationFilter.getFilter(), BasicAuthenticationFilter.class)
.anonymous(AnonymousConfigurer::disable)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants