From 74daedff76db61cef4777526787266580e65dd2c Mon Sep 17 00:00:00 2001 From: Shahab Kondri Date: Wed, 25 Jun 2025 13:14:40 -0400 Subject: [PATCH 1/2] Include /fonts/** to common static locations This commit updates StaticResourceLocation to include a new entry for the common locations of fonts. As a result, StaticResourceRequest#atCommonLocations now includes /fonts/** as well. See gh-46208 Signed-off-by: Shahab Kondri --- .../security/autoconfigure/StaticResourceLocation.java | 7 ++++++- .../autoconfigure/reactive/StaticResourceRequestTests.java | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/module/spring-boot-security/src/main/java/org/springframework/boot/security/autoconfigure/StaticResourceLocation.java b/module/spring-boot-security/src/main/java/org/springframework/boot/security/autoconfigure/StaticResourceLocation.java index 89ae4f2c898..9b6dba98da1 100644 --- a/module/spring-boot-security/src/main/java/org/springframework/boot/security/autoconfigure/StaticResourceLocation.java +++ b/module/spring-boot-security/src/main/java/org/springframework/boot/security/autoconfigure/StaticResourceLocation.java @@ -50,7 +50,12 @@ public enum StaticResourceLocation { /** * The {@code "favicon.ico"} resource. */ - FAVICON("/favicon.*", "/*/icon-*"); + FAVICON("/favicon.*", "/*/icon-*"), + + /** + * Resources under {@code "/fonts"}. + */ + FONTS("/fonts/**"); private final String[] patterns; diff --git a/module/spring-boot-security/src/test/java/org/springframework/boot/security/autoconfigure/reactive/StaticResourceRequestTests.java b/module/spring-boot-security/src/test/java/org/springframework/boot/security/autoconfigure/reactive/StaticResourceRequestTests.java index 552cbedccd9..8d182e5c587 100644 --- a/module/spring-boot-security/src/test/java/org/springframework/boot/security/autoconfigure/reactive/StaticResourceRequestTests.java +++ b/module/spring-boot-security/src/test/java/org/springframework/boot/security/autoconfigure/reactive/StaticResourceRequestTests.java @@ -57,6 +57,7 @@ class StaticResourceRequestTests { assertMatcher(matcher).matches("/favicon.ico"); assertMatcher(matcher).matches("/favicon.png"); assertMatcher(matcher).matches("/icons/icon-48x48.png"); + assertMatcher(matcher).matches("/fonts/font.woff2"); assertMatcher(matcher).doesNotMatch("/bar"); } From 3f2e1b246673defb153d1db8df36adcd2cea9930 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Nicoll?= Date: Mon, 6 Oct 2025 08:51:17 +0200 Subject: [PATCH 2/2] Polish "Include /fonts/** to common static locations" See gh-46208 --- .../autoconfigure/servlet/StaticResourceRequestTests.java | 1 + 1 file changed, 1 insertion(+) diff --git a/module/spring-boot-security/src/test/java/org/springframework/boot/security/autoconfigure/servlet/StaticResourceRequestTests.java b/module/spring-boot-security/src/test/java/org/springframework/boot/security/autoconfigure/servlet/StaticResourceRequestTests.java index 9576b2babbb..50b3005bbdf 100644 --- a/module/spring-boot-security/src/test/java/org/springframework/boot/security/autoconfigure/servlet/StaticResourceRequestTests.java +++ b/module/spring-boot-security/src/test/java/org/springframework/boot/security/autoconfigure/servlet/StaticResourceRequestTests.java @@ -51,6 +51,7 @@ class StaticResourceRequestTests { assertMatcher(matcher).matches("/favicon.ico"); assertMatcher(matcher).matches("/favicon.png"); assertMatcher(matcher).matches("/icons/icon-48x48.png"); + assertMatcher(matcher).matches("/fonts/font.woff2"); assertMatcher(matcher).doesNotMatch("/bar"); }