Skip to content

WW-5754 Accept cross-site HEAD navigations in the Fetch Metadata policy - #2122

Merged
lukaszlenart merged 1 commit into
mainfrom
WW-5754-fetch-metadata-navigations
Nov 7, 2026
Merged

lukaszlenart merged 1 commit into
mainfrom
WW-5754-fetch-metadata-navigations

Conversation

@lukaszlenart

@lukaszlenart lukaszlenart commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

Fixes WW-5754

Summary

  • StrutsResourceIsolationPolicy accepts cross-site navigate requests for HEAD as well as GET, matching the Fetch Metadata interceptor documentation ([GET, HEAD]).
  • Replaces testValidTopLevelNavigation, which sent no Sec-Fetch-Site header and so never reached the navigation branch, with a cross-site GET + HEAD navigation test. testCrossSiteNavigationWithUnsafeMethodRejected is unchanged.

Decision on cross-site POST navigations

WW-5754 listed two options. This PR takes option 2: cross-site POST navigations stay rejected, as introduced by WW-5753.

Accepting navigate for any method was rejected because a cross-site POST navigation is the classic form-CSRF request, and navigate is also sent for <iframe> targets. Applications receiving SAML/OIDC form_post responses or payment-gateway returns opt out per action:

<interceptor-ref name="defaultStack">
    <param name="fetchMetadata.disabled">true</param>
</interceptor-ref>

This is a behaviour change against 7.4.0 / 6.12.0 and goes into the 7.5.0 and 6.13.0 Version Notes and Migration Guide.

exemptedPaths is not a working alternative yet: it is matched against the context path rather than the request path, so it cannot exempt a single action. WW-5846, also targeted at 7.5.0 / 6.13.0, makes it match the request path (servlet path plus path info, exact match) in a separate PR. Once both land, the Migration Guide entry offers both opt-outs: exemptedPaths by path, fetchMetadata.disabled per action.

Test plan

  • FetchMetadataInterceptorTest — HEAD case fails before the change, passes after
  • mvn test -DskipAssembly -pl core — 3743 tests, 0 failures

🤖 Generated with Claude Code

…tadata policy

The documented policy lists HEAD alongside GET as an accepted method for
cross-site navigations; WW-5753 accepted GET only.

Cross-site POST navigations stay rejected: allowing them would re-open
classic form-POST CSRF. Endpoints receiving SAML/OIDC form_post or
payment-gateway returns opt out per action with the fetchMetadata
interceptor's "disabled" parameter.

Replaces testValidTopLevelNavigation, which sent no Sec-Fetch-Site header
and so never reached the navigation branch.

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

sonarqubecloud Bot commented Nov 7, 2026

Copy link
Copy Markdown

@lukaszlenart
lukaszlenart merged commit 741cfe8 into main Nov 7, 2026
8 checks passed
@lukaszlenart
lukaszlenart deleted the WW-5754-fetch-metadata-navigations branch November 7, 2026 17:18
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