Skip to content

WW-5645 Harden static content path handling and remove redundant URL decode#1777

Open
arunmanni-ai wants to merge 7 commits into
apache:mainfrom
arunmanni-ai:harden-static-content-traversal
Open

WW-5645 Harden static content path handling and remove redundant URL decode#1777
arunmanni-ai wants to merge 7 commits into
apache:mainfrom
arunmanni-ai:harden-static-content-traversal

Conversation

@arunmanni-ai

Copy link
Copy Markdown
Contributor

The buildPath() method in DefaultStaticContentLoader applied
URLDecoder.decode() to resource paths that the servlet container
had already decoded. This redundant decode served no purpose and
conflicted with the servlet spec's path handling contract.

This patch:

  • Removes the unnecessary URLDecoder.decode() call from buildPath()
  • Adds a shared Validator.containsMalformedPathSegment() utility
    that rejects dot-dot sequences, backslash separators, and
    percent-encoded forms that have no place in normalised resource paths
  • Applies the check in both the static content and WebJar serving paths
  • Documents the encoding contract on RequestUtils.getServletPath()
  • Adds test coverage for malformed path rejection

@arunmanni-ai arunmanni-ai changed the title Harden static content path handling and remove redundant URL decode WW-5645 Harden static content path handling and remove redundant URL decode Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant