Skip to content

Conversation

@ngocnhan-tran1996
Copy link
Contributor

Related: gh-18157

  1. With PathPatternRequestMatcher

    If we define a bean like the one below:

    @Bean
    WebSecurityCustomizer configureWebSecurity() {
        return customizer -> customizer.ignoring()
            .requestMatchers(PathPatternRequestMatcher.withDefaults().matcher("/test/**"));
    }

    an exception will occur because PathPatternRequestMatcher invokes ServletRequestPathUtils#parseAndCache(request):

    java.lang.UnsupportedOperationException: public abstract void jakarta.servlet.ServletRequest.setAttribute(java.lang.String, java.lang.Object) is not supported
    
  2. Request#getServletContext can be null, so we need to perform a null check before invoking the apply method.

Signed-off-by: Tran Ngoc Nhan <ngocnhan.tran1996@gmail.com>
Signed-off-by: Tran Ngoc Nhan <ngocnhan.tran1996@gmail.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Nov 18, 2025
@lrozenblyum
Copy link
Contributor

Just wondering, will FilterChainProxy.getFilters return anything useful now or it will be always empty?

Signed-off-by: Tran Ngoc Nhan <ngocnhan.tran1996@gmail.com>
Signed-off-by: Tran Ngoc Nhan <ngocnhan.tran1996@gmail.com>
@rwinch rwinch self-assigned this Nov 21, 2025
@rwinch
Copy link
Member

rwinch commented Nov 21, 2025

Thanks for the PR @ngocnhan-tran1996 I'm closing this because, as pointed out above, it is incorrect to always return false when the ServletContext is null.

@rwinch rwinch closed this Nov 21, 2025
@rwinch rwinch added status: invalid An issue that we don't feel is valid and removed status: waiting-for-triage An issue we've not yet triaged labels Nov 21, 2025
@ngocnhan-tran1996 ngocnhan-tran1996 deleted the gh-18157 branch November 22, 2025 01:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: invalid An issue that we don't feel is valid

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants