diff --git a/docs/modules/ROOT/pages/whats-new.adoc b/docs/modules/ROOT/pages/whats-new.adoc index 5a0a28d94f..b16df69bec 100644 --- a/docs/modules/ROOT/pages/whats-new.adoc +++ b/docs/modules/ROOT/pages/whats-new.adoc @@ -4,3 +4,7 @@ == Authentication * https://github.com/spring-projects/spring-security/issues/17655[gh-17655] - Make One-Time Token xref:servlet/authentication/onetimetoken.adoc#validating-account-status[account status checks opt-in] + +== Web + +* Since Spring Framework's `HttpMethod#valueOf` now normalizes casing, `StrictServerWebExchangeFirewall` no longer detects a non-canonical-case HTTP method (for example, `get` instead of `GET`) as a distinct value; such requests are processed as the canonical method instead of being rejected. Applications with a customized `ServerExchangeRejectedHandler` should be aware it is no longer invoked for this case. diff --git a/web/src/test/java/org/springframework/security/web/server/firewall/StrictServerWebExchangeFirewallTests.java b/web/src/test/java/org/springframework/security/web/server/firewall/StrictServerWebExchangeFirewallTests.java index 04740ad933..d671db2816 100644 --- a/web/src/test/java/org/springframework/security/web/server/firewall/StrictServerWebExchangeFirewallTests.java +++ b/web/src/test/java/org/springframework/security/web/server/firewall/StrictServerWebExchangeFirewallTests.java @@ -20,6 +20,7 @@ import java.net.URI; import java.util.Arrays; import java.util.List; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.springframework.http.HttpHeaders; @@ -127,8 +128,13 @@ class StrictServerWebExchangeFirewallTests { assertThatExceptionOfType(ServerExchangeRejectedException.class).isThrownBy(() -> getFirewalledExchange()); } + // FIXME: since Spring Framework's HttpMethod#valueOf now normalizes casing, + // HttpMethod.valueOf("get") is HttpMethod.GET, so the request is no longer + // distinguishable as non-canonical case by the time it reaches the firewall. + // The request is still processed as an ordinary GET (not "served" as lowercase), + // but a customized ServerExchangeRejectedHandler will no longer be invoked for it. @Test - // HTTP methods are case sensitive + @Disabled("HTTP method case is normalized by Spring Framework before reaching the firewall") void getFirewalledExchangeWhenLowercaseGetThenThrowsServerExchangeRejectedException() { this.request = MockServerHttpRequest.method(HttpMethod.valueOf("get"), "/"); assertThatExceptionOfType(ServerExchangeRejectedException.class).isThrownBy(() -> getFirewalledExchange());