Restrict EndpointRequest links to the specified HTTP method#50095
Open
dlwldnjs1009 wants to merge 1 commit intospring-projects:3.5.xfrom
Open
Restrict EndpointRequest links to the specified HTTP method#50095dlwldnjs1009 wants to merge 1 commit intospring-projects:3.5.xfrom
dlwldnjs1009 wants to merge 1 commit intospring-projects:3.5.xfrom
Conversation
Member
|
Thanks, @dlwldnjs1009. The links endpoint only supports |
Contributor
Author
Thanks for the clarification. |
EndpointRequest.toAnyEndpoint().withHttpMethod(...) restricted endpoint paths but still allowed any HTTP method for the links path, yet the mappings for the links path are only registered for GET requests. Restrict the links path using the configured HttpMethod in both servlet and reactive matchers. Signed-off-by: Lee JiWon <dlwldnjs1009@gmail.com> See spring-projectsgh-50095
097cde1 to
24f6214
Compare
Member
|
With the proposed change, you can configure the HTTP method for links when using |
Contributor
Author
|
Thanks for the clarification. That makes sense. I'm happy to revise the PR to take that approach. |
nikitanagar08
added a commit
to nikitanagar08/spring-boot
that referenced
this pull request
Apr 19, 2026
Fixes spring-projectsgh-50095 EndpointRequest.toAnyEndpoint().withHttpMethod() now applies the configured HTTP method to the links path in addition to endpoint paths. Previously, calling toAnyEndpoint().withHttpMethod(POST) restricted endpoint paths to POST but the links path (/actuator and /actuator/) still matched any HTTP method. Changes: - Updated getLinksMatchers() to accept and use httpMethod parameter - Modified LinksServerWebExchangeMatcher to accept httpMethod in constructor - Strengthened tests to verify links path respects configured HTTP method - Both servlet and reactive implementations updated The toLinks() matcher continues to accept any HTTP method to maintain backward compatibility.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
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.
Summary
EndpointRequest.toAnyEndpoint().withHttpMethod(POST)restrictedendpoint paths to
POST, but the links path (/actuatorand/actuator/) still matched any HTTP method.HttpMethodthroughexclusion chaining but did not apply it to the links path itself.
Test plan
toAnyEndpointWithHttpMethodShouldRespectRequestMethodin both servlet and reactive tests to verify that the links path
also respects the configured HTTP method