Skip to content

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

Merged
lukaszlenart merged 2 commits into
mainfrom
WW-5718
Sep 16, 2026
Merged

lukaszlenart merged 2 commits into
mainfrom
WW-5718

Conversation

@lukaszlenart

Copy link
Copy Markdown
Member

Fixes WW-5718

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

This is a 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 Version Notes; the same change is due on support/struts-6-x-x (fix version 6.12.0).

Observed, left out

  • csp (2020) and httpMethod (2014) are absent from both plugin stacks for the same reason; datetime/multiselect from restDefaultStack too. Not in this ticket's scope.
  • JacksonXmlHandler.fromObject and JuneauXmlHandler.fromObject dereference obj.getClass() and NPE on a null target (XStreamHandler guards it). Pre-existing on main for every XML POST/PUT/DELETE under the default restrictToGet=true; a rejected cross-site XML GET now reaches the same path. Separate ticket.
  • On the HTML path a 403 code without a mapped result still ends in ConfigurationException("No result defined …"), exactly as in core's DefaultActionInvocation.

Testing

mvn test -DskipAssembly -pl plugins/rest,plugins/bean-validation — green (286 + 17 tests).

🤖 Generated with Claude Code

lukaszlenart and others added 2 commits September 16, 2026 18:37
…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.

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.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@lukaszlenart
lukaszlenart merged commit 5c99114 into main Sep 16, 2026
13 checks passed
@lukaszlenart
lukaszlenart deleted the WW-5718 branch September 16, 2026 17:32
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