Repository navigation
Conversation
Filter selection removed path parameters only after decoding the request path, while Spring and Jersey remove them first and decode afterwards. When a parameter held an encoded character the two could end up with different paths, so a filter mapped to a multi-segment url-pattern did not run for a request that was still routed to the handler behind it. Filter selection now also matches the path with parameters removed from the raw path and decoded afterwards, both as is and normalized, and with repeated slashes collapsed but dot segments kept, which is how Spring's AntPathMatcher reads a request. The filter chain cache is keyed on the raw path, because the decoded path alone no longer determines which filters apply. Adds end-to-end tests under both Spring path matchers and in the Jersey module, and an opt-in test (-DfuzzFilterSelection=true) that compares filter selection with the framework's routing over generated path spellings.
This was referenced Dec 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue #, if available:
Description of changes:
Filter selection now matches url-patterns against the request path the way Spring and Jersey read it when the path carries path parameters, so a filter runs for every request that reaches the handler behind it.
The problem
FilterChainManager.getFilterChain()matches each filter's url-patterns against several forms of the request path. One of them removes path parameters (;...within a segment), but it removed them after percent-decoding. Spring and Jersey remove them from the raw path and decode afterwards. Once a parameter holds an encoded character the two can end up with different paths:/api;%2F/admin/secretdecodes to/api;//admin/secret, removing the parameter from that leaves/api//admin/secret, and a filter on/api/admin/*doesn't match it. Spring and Jersey route the same request to/api/admin/secret, so the handler ran without the filter.Spring's AntPathMatcher (
spring.mvc.pathmatch.matching-strategy=ant_path_matcher) reads paths in one more way that none of the existing forms covers. It collapses repeated slashes but leaves dot segments in place, so/%2F/admin/../secretreaches an/admin/**handler as/admin/../secret.The change
/api%3B%2F/admin/secrethas no path parameter,/api;%2F/admin/secretdoes), so the decoded path alone can't be the key any more.Behavior changes for applications
Testing
FilterChainManagerPathBypassTest(core): new cases for each form and for the cache key. Each one fails without the change it covers, checked by removing them one at a time.FilterAuthorizationBypassTest: the test app gets a filter on/api/admin/*and an/api/admin/**handler, with new cases on API Gateway, ALB and HTTP API events.FilterAuthorizationBypassAntPathMatcherTestruns the whole suite again with AntPathMatcher, switched on through a test profile.JerseyFilterChainTest: the new spellings added to the protected path list.FilterSelectionFuzzTest, off by default (-DfuzzFilterSelection=true, plus-DfuzzFilterSelectionProfiles=antpathmatcherfor AntPathMatcher). It sends about 65,000 generated spellings of the protected routes through the Lambda entry point and fails if any reaches a protected handler without the filter running. On current main it finds 1,124 per event type, and none with this change under either matcher.Related
The same change applies to the other two maintained lines. The source diff is identical apart from
javaximports on 1.x, and the tests are the same apart from the module name.By submitting this pull request