Skip to content

fix(springboot): validate trailing slash redirect target - #3098

Merged
kthoms merged 1 commit into
mainfrom
backport/orqueio-append-trailing-slash-open-redirect-4854
Jun 14, 2026
Merged

kthoms merged 1 commit into
mainfrom
backport/orqueio-append-trailing-slash-open-redirect-4854

Conversation

@hauptmedia

@hauptmedia hauptmedia commented Jun 9, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Backports OrqueIO commit OrqueIO/OrqueIO@5f12e71 to harden AppendTrailingSlashFilter.
  • Change unit: 4854
  • Keeps normal trailing-slash redirects for local absolute paths such as /operaton/app.
  • Passes unsafe or non-local redirect targets down the filter chain instead of sending a redirect.
  • Adds regression coverage for local paths, absolute URLs, scheme-relative URLs, relative paths, and missing request URIs.

Reviewer Notes

Previously, AppendTrailingSlashFilter used request.getRequestURI() directly as the redirect target after appending /. If a servlet container or proxy exposed a non-local URI here, the filter could emit an external redirect. This change only redirects local paths and rejects values such as https://example.org/app and //example.org/app, while preserving the intended Spring Boot 2-style trailing-slash behavior for normal Operaton app routes.

No original OrqueIO PR was recorded for this change unit; the source attribution is the commit above.

Tests

  • .devenv/scripts/maintenance/code-cleanup.sh
  • git diff --check
  • ./mvnw -pl spring-boot-starter/starter-webapp-core -Dtest=AppendTrailingSlashFilterTest -Dskip.frontend.build=true test

@github-actions github-actions Bot added lang:java Pull requests that update Java code scope:spring-boot Changes to the Spring Boot starter. scope:tests Changes affecting only test code labels Jun 9, 2026
@hauptmedia
hauptmedia force-pushed the backport/orqueio-append-trailing-slash-open-redirect-4854 branch 3 times, most recently from 348b08b to 0a6c71e Compare June 11, 2026 17:50
Backported commit 5f12e717c13fa4b8638b758f7c2f345b16dd67d6 from the OrqueIO repository.

Original author: Shaymabenahmed-tech <[email protected]>

Source: OrqueIO/OrqueIO@5f12e71

Change unit: 4854
@hauptmedia

Copy link
Copy Markdown
Collaborator Author

Context for this change: the trailing-slash filter is still needed for the registered webapp entry paths (/app, /app/cockpit, /app/admin, /app/tasklist, /app/welcome). Transparent trailing-slash matching was deprecated in Spring Framework 6 and removed in Spring Framework 7, so these legacy entry URLs need an explicit redirect to their canonical trailing-slash form.

The redirect target validation is a small defensive hardening around that compatibility filter: only local absolute request paths are reflected into the Location header; absolute or protocol-relative values continue through the filter chain instead of becoming redirect targets.

@hauptmedia
hauptmedia force-pushed the backport/orqueio-append-trailing-slash-open-redirect-4854 branch from 0a6c71e to 4a497fc Compare June 11, 2026 17:51
@sonarqubecloud

Copy link
Copy Markdown

@kthoms

kthoms commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Thank you for the clarification

@kthoms kthoms left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kthoms kthoms added this to the 2.1.2 milestone Jun 14, 2026
@kthoms kthoms added the backport:patch-release Should be ported back to the latest feature release branch. label Jun 14, 2026
@kthoms
kthoms merged commit 3c64587 into main Jun 14, 2026
18 checks passed
@kthoms
kthoms deleted the backport/orqueio-append-trailing-slash-open-redirect-4854 branch June 14, 2026 14:39
kthoms pushed a commit that referenced this pull request Jun 14, 2026
Backported commit 5f12e717c13fa4b8638b758f7c2f345b16dd67d6 from the OrqueIO repository.

Original author: Shaymabenahmed-tech <[email protected]>

Source: OrqueIO/OrqueIO@5f12e71

Change unit: 4854

(cherry picked from commit 3c64587)
@kthoms

kthoms commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Cherry-picked for 2.1.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:patch-release Should be ported back to the latest feature release branch. lang:java Pull requests that update Java code scope:spring-boot Changes to the Spring Boot starter. scope:tests Changes affecting only test code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants