[
https://issues.apache.org/jira/browse/WW-5846?focusedWorklogId=1053274&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1053274
]
ASF GitHub Bot logged work on WW-5846:
--------------------------------------
Author: ASF GitHub Bot
Created on: 07/Nov/26 17:47
Start Date: 07/Nov/26 17:47
Worklog Time Spent: 10m
Work Description: lukaszlenart opened a new pull request, #371:
URL: https://github.com/apache/struts-site/pull/371
Documents [WW-5846](https://issues.apache.org/jira/browse/WW-5846)
(apache/struts#2124, #2125) and
[WW-5754](https://issues.apache.org/jira/browse/WW-5754) /
[WW-5753](https://issues.apache.org/jira/browse/WW-5753) on the Fetch Metadata,
COOP and COEP interceptor pages.
**Merge together with the 7.5.0 / 6.13.0 release** — the pages describe
behaviour of those versions.
## Changes
- **All three pages:** `exemptedPaths` entries are compared exactly with the
request path inside the application (servlet path plus path info, extension
included); an entry equal to the context path no longer disables the
interceptor app-wide, use `disabled` instead. Examples move `exemptedPaths` to
a stack-level configuration. COOP page gains the `disabled` parameter.
- **Fetch Metadata page:**
- policy pseudo-code matches the implementation (`navigate` +
`GET`/`HEAD`, `object`/`embed` excluded; the obsolete `nested-navigate` is
dropped);
- states the interceptor is in `defaultStack` rather than opt-in;
- new "Cross-site form posts" section: cross-site POST navigations
(SAML/OIDC `form_post`, payment returns) get a `403` since 7.5.0 / 6.13.0, with
`exemptedPaths` and `disabled` as the opt-outs;
- one line on `struts.mapper.action.prefix.enabled` and exempted paths.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Issue Time Tracking
-------------------
Worklog Id: (was: 1053274)
Time Spent: 0.5h (was: 20m)
> FetchMetadata, COOP and COEP interceptors match exemptedPaths against the
> context path instead of the request path
> ------------------------------------------------------------------------------------------------------------------
>
> Key: WW-5846
> URL: https://issues.apache.org/jira/browse/WW-5846
> Project: Struts 2
> Issue Type: Bug
> Components: Core
> Reporter: Lukasz Lenart
> Assignee: Lukasz Lenart
> Priority: Major
> Fix For: 6.13.0, 7.5.0
>
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
> Spun off from [WW-5754|https://issues.apache.org/jira/browse/WW-5754].
> {{FetchMetadataInterceptor}}, {{CoopInterceptor}} and {{CoepInterceptor}} all
> compare each {{exemptedPaths}} entry with the web application's context path:
> {code:java}String contextPath = request.getContextPath();
> if (exemptedPaths.contains(contextPath)) {
> return invocation.invoke();
> }
> {code}
> The context path is the same for every request to the application, so since
> [WW-5083|https://issues.apache.org/jira/browse/WW-5083] (6.0.0):
> * An entry naming an action or URL path, for example {{/saml/acs}}, never
> matches and silently has no effect.
> * An entry equal to the context path, for example {{/myapp}}, matches every
> request and disables the interceptor for the whole application.
> The tests mask this: {{struts-testing.xml}} configures action-like entries
> ({{/fetchMetadataExempted}}), and {{FetchMetadataInterceptorTest}} sets
> {{request.setContextPath("/fetchMetadataExempted")}} to produce a match.
> All three interceptors are in {{defaultStack}}. Since WW-5753 / WW-5754 the
> Fetch Metadata policy rejects cross-site POST navigations (SAML/OIDC
> {{form_post}}, payment-gateway returns), which makes a working per-path
> exemption more important.
> h2. Proposed fix
> * Match entries in all three interceptors against the request path inside the
> application, {{RequestUtils.getServletPath(request)}} (servlet path plus path
> info, as used for action mapping since WW-5842).
> * Use the same value in the log messages, which currently log the context
> path.
> * Rewrite the exemption tests to set the servlet path / path info and leave
> the context path alone; add a case where the context path equals an entry and
> the request path does not.
> h2. Compatibility
> This changes behaviour in both directions and needs a Version Notes /
> Migration Guide entry:
> * Applications that listed their context path to disable an interceptor
> app-wide lose that. The replacement is the interceptor's {{disabled}}
> parameter, e.g. {{<param name="fetchMetadata.disabled">true</param>}}.
> * Entries that never matched will start exempting the paths they name. For
> COOP / COEP that means the headers are no longer sent on those paths.
> The matching semantics (exact match vs. prefix/wildcard) are documented on
> the Fetch Metadata, COOP and COEP interceptor pages.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)