Invalid State Param in request after upgrade to UAA 78.1.0
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 38/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Domain
- authentication, backend, security
Research direction
Start at ExternalOAuthAuthenticationFilter.checkRequestStateParameter in ExternalOAuthAuthenticationFilter.java and trace how the callback request obtains its session after the upgrade from UAA 77.10.0 to 78.1.0. Reproduce the Keycloak flow with database session storage and a custom identity zone; done means the callback can retrieve the stored state parameter and no longer fails with Invalid State Param in request.
Written by the indexing model from the issue text.
Description
UAA Version:
Previously working: 77.10.0
Issue observed: 78.1.0
Setup:
- Session storage enabled in the database.
- Created a custom identity zone.
- Configured an external identity provider (Keycloak).
Steps to Reproduce:
- Make an authorization request to UAA in the created identity zone.
- UAA creates a session and stores it in the database.
- UAA generates a state parameter, stores it in the session attributes, and includes it in the authorization call to Keycloak.
- User authenticates with Keycloak.
- Keycloak redirects back to UAA with the authorization code and the same state parameter in the callback URL.
- UAA calls ExternalOAuthAuthenticationFilter.checkRequestStateParameter to validate the state parameter.
Observed Behavior:
- In checkRequestStateParameter, request.getSession() does not return the session stored in the database.
- Because of this, stateInSession is null.
- UAA fails with the error:
Error : Invalid State Param in request
2025-08-14 16:15:04.867 | {"logtimestamp": "2025-08-14 10:45:04.867","class": "org.springframework.security.web.context.SecurityContextPersistenceFilter", "method": "doFilter", "msg": "Cleared SecurityContextHolder to complete request", "thread": "http-nio-8080-exec-4","level": "DEBUG","traceId": " ","spanId": "c7f4f190949a499b","logref": "0988626e-4aaa-42ac-bb46-64dab3a96886","area": "xf-iam","service": "xf-uaa"}
2025-08-14 16:15:04.872 | 14-Aug-2025 10:45:04.871 INFO [http-nio-8080-exec-4] brave.Tracing$LogSpanHandler.end {"traceId":"c7f4f190949a499b","id":"c7f4f190949a499b","kind":"SERVER","name":"GET","timestamp":1755168304856795,"duration":14678,"localEndpoint":{"serviceName":"uaa","ipv4":"172.18.0.5"},"remoteEndpoint":{"ipv4":"172.18.0.10","port":50902},"tags":{"http.method":"GET","http.path":"/uaa_app/login/callback/OIDC10_KEYCLOAK","http.status_code":"500","error":"Invalid State Param in request."}}
2025-08-14 16:15:04.874 | {"logtimestamp": "2025-08-14 10:45:04.872","class": "org.cloudfoundry.identity.uaa.security.web.SecurityFilterChainPostProcessor$UaaLoggingFilter", "method": "doFilter", "msg": "Uncaught Exception:", "thread": "http-nio-8080-exec-4","level": "ERROR","traceId": " ","spanId": "","logref": "a4a5e484-bc45-43d9-9987-27de0f380865","area": "xf-iam","service": "xf-uaa"}
2025-08-14 16:15:04.874 | org.springframework.security.web.csrf.CsrfException: Invalid State Param in request.
2025-08-14 16:15:04.874 | at org.cloudfoundry.identity.uaa.provider.oauth.ExternalOAuthAuthenticationFilter.checkRequestStateParameter(ExternalOAuthAuthenticationFilter.java:80) ~[cloudfoundry-identity-server-1.0.2.jar:?]
2025-08-14 16:15:04.874 | at org.cloudfoundry.identity.uaa.provider.oauth.ExternalOAuthAuthenticationFilter.doFilter(ExternalOAuthAuthenticationFilter.java:63) ~[cloudfoundry-identity-server-1.0.2.jar:?]
2025-08-14 16:15:04.874 | at org.springframework.security.web.ObservationFilterChainDecorator$ObservationFilter.wrapFilter(ObservationFilterChainDecorator.java:240) ~[spring-security-web-6.5.1.jar:6.5.1]
2025-08-14 16:15:04.874 | at org.springframework.security.web.ObservationFilterChainDecorator$ObservationFilter.doFilter(ObservationFilterChainDecorator.java:227) ~[spring-security-web-6.5.1.jar:6.5.1]
2025-08-14 16:15:04.875 | at org.springframework.security.web.ObservationFilterChainDecorator$VirtualFilterChain.doFilter(ObservationFilterChainDecorator.java:137) ~[spring-security-web-6.5.1.jar:6.5.1]
2025-08-14 16:15:04.875 | at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:107) ~[spring-security-web-6.5.1.jar:6.5.1]
2025-08-14 16:15:04.875 | at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:93) ~[spring-security-web-6.5.1.jar:6.5.1]
2025-08-14 16:15:04.875 | at org.springframework.security.web.ObservationFilterChainDecorator$ObservationFilter.wrapFilter(ObservationFilterChainDecorator.java:240) ~[spring-security-web-6.5.1.jar:6.5.1]
2025-08-14 16:15:04.875 | at org.springframework.security.web.ObservationFilterChainDecorator$ObservationFilter.doFilter(ObservationFilterChainDecorator.java:227) ~[spring-security-web-6.5.1.jar:6.5.1]
2025-08-14 16:15:04.875 | at org.springframework.security.web.ObservationFilterChainDecorator$VirtualFilterChain.doFilter(ObservationFilterChainDecorator.java:137) ~[spring-security-web-6.5.1.jar:6.5.1]
2025-08-14 16:15:04.875 | at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90) ~[spring-security-web-6.5.1.jar:6.5.1]
2025-08-14 16:15:04.875 | at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75) ~[spring-security-web-6.5.1.jar:6.5.1]
2025-08-14 16:15:04.875 | at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[spring-web-6.2.8.jar:6.2.8]
please refer the database session and debug screenshot.
- Dominant language
- Java
- Stars
- 1.6k
- Forks
- 847
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 48
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from cloudfoundry/uaa
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
cloudfoundry/uaa#4194 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
cloudfoundry/uaa#4189 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
cloudfoundry/uaa#4156 ·
Maintainers usually reply within 1 day
-
Support named allowed-resource policies for mTLS clientsPossibly taken @strehle claimed this 24 days ago. Open
Difficulty 5/5 Over a week Newbie friendliness 35/100
cloudfoundry/uaa#4125 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 52/100
cloudfoundry/uaa#4086 · 1 comment ·
Maintainers usually reply within 1 day
All issues in cloudfoundry/uaa
Similar issues
-
triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
eclipse-edc/IdentityHub#1296 ·
Maintainers usually reply within 1 day
-
area: ui priority: medium
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
tetsuji16/microProject#1721 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 2 days
-
The engine's "loaded, but had errors" message leaves out which library and line each error is inOpen
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
cqframework/clinical_quality_language#1980 ·
Maintainers usually reply within 3 days
-
windows-sys 0.101.0Open
Difficulty 2/5 1-3 hours Newbie friendliness 61/100