Skip to content

fix: escape request paths in generated html pages - #17

Merged
TheMeinerLP merged 3 commits into
mainfrom
fix/directory-index-escaping
Oct 16, 2026
Merged

TheMeinerLP merged 3 commits into
mainfrom
fix/directory-index-escaping

Conversation

@TheMeinerLP

Copy link
Copy Markdown

Description

Two reflected HTML injection points in 1.1.0:

  • The Maven directory index put the request path into the page title, heading and base href, and file names into link text and href, without escaping.
  • The not-found page interpolated the request path into the dashboard link's href and visible text without escaping, so a crafted URL could inject markup.

Both now percent-encode the path per segment and HTML-escape the result through the shared HtmlEscaping helper. The not-found page decodes the path once before encoding it, and the base path is escaped the same way. The # route shape is unchanged. The directory index depends on the helper, which is included here.

Intended for the 1.1.1 patch release.

Type of change

  • fix - bug fix
  • feat - new feature
  • refactor - internal change without behaviour change
  • perf - performance improvement
  • docs - documentation only
  • test - tests only
  • build / ci / chore - tooling, dependencies, pipelines
  • Breaking change (configuration, API or behaviour that existing deployments rely on)

How was this tested?

Targeted runs locally:

  • DirectoryIndexPageTest: markup in request paths and file names is rendered as literal text, and links still resolve to the escaped, percent-encoded paths.
  • NotFoundTemplateTest: a crafted request path cannot inject markup into the dashboard link, and the link keeps the # route shape.

The full suite runs in CI.

Checklist

  • Commit messages follow the Conventional Commits convention documented in CLAUDE.md (English, imperative, one of feat, fix, docs, refactor, test, build, ci, chore, perf)
  • Tests cover the change, or the change is not testable and I explained why above
  • ./gradlew build passes locally
  • Documentation and configuration samples are updated if the change is user-facing
  • Existing copyright headers are preserved; new files carry the appropriate header
  • No credentials, tokens or personal data are included in the diff

…ndex

The Maven directory listing put the request path into the title, heading and base href, and file names into the link text and href, without escaping. Paths are now percent-encoded per segment and HTML-escaped through the shared helper.

(cherry picked from commit f387e6c)

The shared HtmlEscaping helper (from 6aeadde) is included here because
the directory index depends on it.
The request path was interpolated into the dashboard href and the visible
link text without escaping, so a crafted URL could inject markup. The path
is now decoded once, percent-encoded per segment and HTML-escaped. The base
path is escaped the same way. The # route shape is unchanged.
@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Test results

 72 files   72 suites   8m 16s ⏱️
340 tests 339 ✅ 1 💤 0 ❌
342 runs  341 ✅ 1 💤 0 ❌

Results for commit 8d69282.

♻️ This comment has been updated with latest results.

@TheMeinerLP
TheMeinerLP merged commit 5b1ccad into main Oct 16, 2026
8 checks passed
@TheMeinerLP
TheMeinerLP deleted the fix/directory-index-escaping branch October 16, 2026 12:43
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