Skip to content

Return REQUEST dispatcher type from FilterInvocation dummy request#19161

Open
singhvishalkr wants to merge 1 commit into
spring-projects:mainfrom
singhvishalkr:gh-19131-filter-invocation-dispatcher-type
Open

Return REQUEST dispatcher type from FilterInvocation dummy request#19161
singhvishalkr wants to merge 1 commit into
spring-projects:mainfrom
singhvishalkr:gh-19131-filter-invocation-dispatcher-type

Conversation

@singhvishalkr
Copy link
Copy Markdown

After moving to Spring Security 7, injecting WebInvocationPrivilegeEvaluator blows up when the filter chain uses authorizeHttpRequests(...).dispatcherTypeMatchers(...). AuthorizationManagerWebInvocationPrivilegeEvaluator feeds URL checks through FilterInvocation's synthetic request. That stub never implemented getDispatcherType(), so DispatcherTypeRequestMatcher consulted the unsupported servlet proxy and surfaced UnsupportedOperationException before authorization ran.

The synthetic path used to behave like a normal request dispatch because the introspector transformer wrapped calls with a dummy dispatcher type. Restoring DispatcherType.REQUEST on DummyRequest puts synthetic evaluations back in line with that expectation.

FilterInvocationTests now pins the dispatcher type so this cannot regress quietly.

Closes gh-19131

WebInvocationPrivilegeEvaluator synthesizes a DummyRequest when checking URL access. DispatcherTypeRequestMatcher matches on getDispatcherType(), which previously hit the unsupported proxy and failed for security filter chains that use dispatcherTypeMatchers (see spring-projectsgh-19131).

Signed-off-by: Vishal Kumar Singh <vishal.kr.singh2021@gmail.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting-for-triage An issue we've not yet triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WebInvocationPrivilegeEvaluator throws UnsupportedOperationException when a dispatcherTypeMatcher is configured.

2 participants