[
https://issues.apache.org/jira/browse/WW-5846?focusedWorklogId=1053276&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1053276
]
ASF GitHub Bot logged work on WW-5846:
--------------------------------------
Author: ASF GitHub Bot
Created on: 07/Nov/26 17:51
Start Date: 07/Nov/26 17:51
Worklog Time Spent: 10m
Work Description: sonarqubecloud[bot] commented on PR #2125:
URL: https://github.com/apache/struts/pull/2125#issuecomment-6710917171
## [](https://sonarcloud.io/dashboard?id=apache_struts&pullRequest=2125)
**Quality Gate passed**
Issues
 [0 New
issues](https://sonarcloud.io/project/issues?id=apache_struts&pullRequest=2125&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted
issues](https://sonarcloud.io/project/issues?id=apache_struts&pullRequest=2125&issueStatuses=ACCEPTED)
Measures
 [0 Security
Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_struts&pullRequest=2125&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [100.0% Coverage on New
Code](https://sonarcloud.io/component_measures?id=apache_struts&pullRequest=2125&metric=new_coverage&view=list)
 [0.0% Duplication on New
Code](https://sonarcloud.io/component_measures?id=apache_struts&pullRequest=2125&metric=new_duplicated_lines_density&view=list)
<!
Issue Time Tracking
-------------------
Worklog Id: (was: 1053276)
Time Spent: 50m (was: 40m)
> 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: 50m
> 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)