Skip to content

Regression in 4.5.5: SpringTemplateLoader rejects valid classpath tem… - #1208

Merged
jknack merged 1 commit into
masterfrom
1199
Oct 26, 2026
Merged

jknack merged 1 commit into
masterfrom
1199

Conversation

@jknack

@jknack jknack commented Oct 26, 2026

Copy link
Copy Markdown
Owner

…plates (Spring Boot & Multi-module)

Context

  • The security patch in 4.5.5 (for GHSA-pvrx-3g7m-fpgv) introduced strict OS-level canonical file checks for all template prefixes.

Bug

  • This breaks legitimate template resolution for classpath: resources in packaged Spring Boot applications (Fat JARs) and multi-module project environments. resolveBaseDirectory() attempts to map virtual or multi-root classpath locations to a single absolute OS directory, causing the startsWith() containment check to fail and throw false-positive IllegalArgumentException path traversal errors.

…plates (Spring Boot & Multi-module)

Context

- The security patch in 4.5.5 (for GHSA-pvrx-3g7m-fpgv) introduced strict OS-level canonical file checks for all template prefixes.

Bug

- This breaks legitimate template resolution for classpath: resources in packaged Spring Boot applications (Fat JARs) and multi-module project environments. resolveBaseDirectory() attempts to map virtual or multi-root classpath locations to a single absolute OS directory, causing the startsWith() containment check to fail and throw false-positive IllegalArgumentException path traversal errors.
@jknack

jknack commented Oct 26, 2026

Copy link
Copy Markdown
Owner Author

@glitke-dev can you check?

@jknack jknack added the bug label Oct 26, 2026
@jknack jknack added this to the 4.6.8 milestone Oct 26, 2026
@jknack jknack added the spring label Oct 26, 2026
@glitke-dev

Copy link
Copy Markdown

Verified the PR head (81ac705) against all cases from #1199: directory and JAR, two classpath roots with the template in the second, JAR + directory mixed, and a real Spring Boot fat JAR (BOOT-INF/classes plus two library JARs). All templates load, ../ is rejected, %2e%2e is not found.

Looks good to me, thanks!

@jknack
jknack merged commit 956b480 into master Oct 26, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants