[
https://issues.apache.org/jira/browse/WW-5846?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Lukasz Lenart updated WW-5846:
------------------------------
Summary: FetchMetadata, COOP and COEP interceptors match exemptedPaths
against the context path instead of the request path (was:
FetchMetadataInterceptor exemptedPaths is matched against the context path
instead of the request path)
> 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
>
>
> Spun off from [WW-5754|https://issues.apache.org/jira/browse/WW-5754].
> {{FetchMetadataInterceptor}} compares 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.
> h2. Proposed fix
> * Match entries against the request path inside the application (servlet path
> plus path info), as the name {{exemptedPaths}} suggests.
> * Use the same value in the rejection log message, which currently logs 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 the interceptor
> app-wide will start receiving 403s for cross-site non-navigation requests.
> The replacement is {{<param name="fetchMetadata.disabled">true</param>}}.
> * Entries that never matched will start exempting the paths they name.
> Decide whether entries are exact matches only or also support a prefix or
> wildcard form, and document the chosen semantics on the Fetch Metadata
> interceptor page.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)