Skip to content

WW-5846 Match exemptedPaths against the request path in FetchMetadata, COOP and COEP interceptors (6.x) - #2125

Merged
lukaszlenart merged 1 commit into
support/struts-6-x-xfrom
WW-5846-backport-6x
Nov 7, 2026
Merged

lukaszlenart merged 1 commit into
support/struts-6-x-xfrom
WW-5846-backport-6x

Conversation

@lukaszlenart

Copy link
Copy Markdown
Member

Backport of PR #2124 to support/struts-6-x-x for 6.13.0. Conflicts were import-only (com.opensymphony.xwork2 / javax.servlet on 6.x).

Fixes WW-5846

Summary

FetchMetadataInterceptor, CoopInterceptor and CoepInterceptor compared each exemptedPaths entry with request.getContextPath(), which is the same for every request. An entry naming a path never matched; an entry equal to the context path exempted the whole application.

They now compare against RequestUtils.getUri(request), the value DefaultActionMapper uses since WW-5842: servlet path plus path info, or the included servlet path during an include dispatch.

  • Matching is exact, extension included: /saml/acs.action, not /saml/acs. Apps serving an action under several extensions list each form; an unlisted form stays protected. No prefix or wildcard entries for now.
  • The Fetch Metadata rejection log now names the request path — the exact value to add to exemptedPaths.
  • CoopInterceptor.isExempted(String) keeps its signature.

This gives applications affected by WW-5753 / WW-5754 (cross-site POST navigations rejected: SAML/OIDC form_post, payment returns) a working per-path opt-out alongside the per-action <param name="fetchMetadata.disabled">true</param>.

Breaking change

  • An exemptedPaths entry equal to the context path no longer disables the interceptor app-wide. Use the interceptor's disabled parameter instead.
  • Entries naming a request path now take effect. For COOP / COEP that means the headers are no longer sent on those paths.

Goes into the 7.5.0 / 6.13.0 Version Notes and Migration Guide; the struts-site interceptor pages are updated in a separate PR.

Test plan

  • New tests per interceptor: servlet-path match, path-info match, context-path-only entry no longer exempts; Fetch Metadata also covers an include dispatch
  • Existing exemption tests and struts-testing.xml fixtures rewritten to set the servlet path (with .action) instead of faking a context path
  • mvn test -DskipAssembly -pl core,plugins/rest,plugins/bean-validation — on support/struts-6-x-x: 2764 / 93 / 23 tests, 0 failures

🤖 Generated with Claude Code

FetchMetadataInterceptor, CoopInterceptor and CoepInterceptor compared each
exemptedPaths entry with the context path, which is the same for every
request: an entry naming a path never matched, and an entry equal to the
context path exempted the whole application.

They now compare against RequestUtils.getUri(request), the value the action
mapper uses: servlet path plus path info, or the included servlet path during
an include dispatch. Matching is exact, so an entry includes the action
extension, e.g. /saml/acs.action. The Fetch Metadata rejection log names the
request path, which is the value to add to exemptedPaths.

Tests now set the servlet path instead of faking a context path, and the
struts-testing.xml fixtures use the paths a real request carries.

BREAKING CHANGE: an exemptedPaths entry equal to the context path no longer
disables the interceptor for the whole application; use the interceptor's
"disabled" parameter instead. Entries naming a request path now take effect.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lukaszlenart
lukaszlenart marked this pull request as ready for review November 7, 2026 17:46
@sonarqubecloud

sonarqubecloud Bot commented Nov 7, 2026

Copy link
Copy Markdown

@lukaszlenart
lukaszlenart merged commit 60ec477 into support/struts-6-x-x Nov 7, 2026
10 checks passed
@lukaszlenart
lukaszlenart deleted the WW-5846-backport-6x branch November 7, 2026 18:14
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