From 633bd638a4b39d4251b86c185ea1b858bdeddc88 Mon Sep 17 00:00:00 2001 From: Shinsuke Sugaya Date: Wed, 23 Sep 2026 09:16:54 +0900 Subject: [PATCH] fix(theme): exclude JSP and similar server-side files from static themes A static theme is plain files served as they are, but nothing kept a theme archive from carrying a .jsp file. Such a file was extracted with the rest of the theme, and the servlet container could then treat it as a JSP page rather than as a theme file. - StaticThemeInstaller refuses an archive with a .jsp, .jspx or .jspf entry (EXTRACT_FAILED), for both ZIP upload and the Maven repository install, before anything is moved into the themes directory. - StaticThemeFilter answers 404 for those extensions under /themes/, for any method and whichever theme is active, so such a file already on disk is never handed to the JSP servlet. It checks the path the container decoded, which is the one the container maps to a servlet. --- .../fess/filter/StaticThemeFilter.java | 27 ++++++++ .../fess/theme/StaticThemeInstaller.java | 33 +++++++++ .../fess/filter/StaticThemeFilterTest.java | 68 ++++++++++++++++++- .../fess/theme/StaticThemeInstallerTest.java | 42 ++++++++++++ 4 files changed, 168 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/codelibs/fess/filter/StaticThemeFilter.java b/src/main/java/org/codelibs/fess/filter/StaticThemeFilter.java index 5eae4d008..855ef6f02 100644 --- a/src/main/java/org/codelibs/fess/filter/StaticThemeFilter.java +++ b/src/main/java/org/codelibs/fess/filter/StaticThemeFilter.java @@ -20,6 +20,7 @@ import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.List; +import java.util.Locale; import java.util.Set; import java.util.concurrent.atomic.AtomicBoolean; import java.util.stream.Collectors; @@ -29,6 +30,7 @@ import org.codelibs.core.lang.StringUtil; import org.codelibs.fess.helper.VirtualHostHelper; import org.codelibs.fess.mylasta.direction.FessConfig; +import org.codelibs.fess.theme.StaticThemeInstaller; import org.codelibs.fess.theme.StaticThemeResponder; import org.codelibs.fess.theme.Theme; import org.codelibs.fess.theme.ThemeRegistry; @@ -62,6 +64,8 @@ * *

Behavior summary: *