Skip to content

WW-5718 fix(rest,bean-validation): add the resource-isolation interceptors to the plugin default stacks (6.x) - #1958

Merged
lukaszlenart merged 2 commits into
support/struts-6-x-xfrom
WW-5718-6x
Sep 16, 2026
Merged

lukaszlenart merged 2 commits into
support/struts-6-x-xfrom
WW-5718-6x

Conversation

@lukaszlenart

Copy link
Copy Markdown
Member

Fixes WW-5718 on the 6.x line — backport of #1957 (fix version 6.12.0), adapted to com.opensymphony.xwork2 packages, javax.servlet and Java 8.

restDefaultStack and beanValidationDefaultStack were forked from core's defaultStack before WW-5083 added coep, coop and fetchMetadata in 6.0.0 and were never brought back in step, so a package extending rest-default or struts-bean-validation silently lost the COOP/COEP response headers and the Fetch Metadata request check.

Changes

  • The three refs are copied into both stacks with defaultStack's parameters, in the same slot: after conversionError, ahead of validation. A test per plugin loads struts-default.xml + struts-plugin.xml and pins that order.
  • RestActionInvocation now honours a bare HTTP status returned as the result code. FetchMetadataInterceptor rejects a cross-site request by returning "403" without invoking the action; the REST result path wrapped any unknown code in a DefaultHttpHeaders whose status defaults to 200, so a JSON/XML client received 200 — for a GET, with the unexecuted model serialised. Such a code now sets the status and drops the representation; a mapped 403 result still executes as before.

Migration note

Behaviour change for existing REST and Bean Validation deployments: fetchMetadata rejects requests whose Sec-Fetch-Site marks them cross-site (other than top-level navigations), so a REST API deliberately serving cross-origin browser clients will answer them with 403 unless it sets fetchMetadata.exemptedPaths or fetchMetadata.disabled=true on the stack ref. To be called out in the 6.12.0 Version Notes.

Testing

./mvnw test -DskipAssembly -pl plugins/rest,plugins/bean-validation — green.

🤖 Generated with Claude Code

lukaszlenart and others added 2 commits September 16, 2026 18:39
…ptors to the plugin default stacks

restDefaultStack and beanValidationDefaultStack were forked from core's
defaultStack before WW-5083 added coep, coop and fetchMetadata in 6.0.0
and were never brought back in step, so a package extending rest-default
or struts-bean-validation silently lost the COOP/COEP headers and the
Fetch Metadata request check. The three refs are copied with
defaultStack's parameters into the same slot: after conversionError,
ahead of validation.

(cherry picked from commit 27f3012, adapted to 6.x)

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
FetchMetadataInterceptor rejects a cross-site request by returning "403"
as the result code without invoking the action. RestActionInvocation
wrapped any unknown code in a DefaultHttpHeaders whose status defaults
to 200, so a JSON or XML client saw a 200 - carrying the unexecuted
model for a GET. A bare HTTP status returned as the result code now sets
the response status and drops the representation; a mapped "403" result
still executes as before.

(cherry picked from commit 1785661, adapted to 6.x)

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@lukaszlenart
lukaszlenart marked this pull request as ready for review September 16, 2026 16:43
@sonarqubecloud

Copy link
Copy Markdown

@lukaszlenart
lukaszlenart merged commit 84958d6 into support/struts-6-x-x Sep 16, 2026
10 checks passed
@lukaszlenart
lukaszlenart deleted the WW-5718-6x branch September 16, 2026 17:21
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