[
https://issues.apache.org/jira/browse/WW-5642?focusedWorklogId=1030004&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1030004
]
ASF GitHub Bot logged work on WW-5642:
--------------------------------------
Author: ASF GitHub Bot
Created on: 13/Jul/26 06:23
Start Date: 13/Jul/26 06:23
Worklog Time Spent: 10m
Work Description: lukaszlenart commented on PR #1774:
URL: https://github.com/apache/struts/pull/1774#issuecomment-4955031334
Thanks for the thorough follow-up — `0c93ea2fa` closes the completeness gaps
I raised. I re-ran both suites locally against the PR head:
- `ParameterAuthorizationContextTest` (core) — green
- `ParameterAuthorizingModuleTest` (rest) — 23/23 green
The `RedactionAwareDeserializer` + redaction-scope stack is a clean way to
handle the construction-failure case: substituting a stand-in for a dropped
creator-bound component and then treating a resulting construction failure as
"drop the whole object" is consistent with how a rejected non-creator nested
property already behaves. Good that
`testValidatingRecord_genuineClientErrorStillPropagates` pins down the other
side of it — a construction failure with nothing dropped still propagates, so
genuine client/data errors aren't masked. Coverage across records,
static-factory `@JsonCreator`, `@ConstructorProperties`, top-level records,
3-level nesting, and `List`/`Map` creator params is exactly the matrix I was
after.
Three small, non-blocking notes:
1. **Array-typed creator param.** `prefixForNested` handles
`type.isArray()`, but only `List`/`Map` element paths are exercised in tests —
an `Item[]` creator-param case would round out the collection matrix.
2. **`FAIL_ON_NULL_FOR_PRIMITIVES` off (the default).** With it disabled, a
dropped primitive creator component silently becomes the type default
(`0`/`false`) rather than dropping the object. That's fine — the point is the
client value never lands — but worth a one-line comment so it reads as a
deliberate choice rather than an oversight.
3. **Co-located failures.** If the same object both had a property dropped
*and* hit an unrelated `JsonMappingException`, the current scope is marked, so
the unrelated error is folded into "object dropped." Harmless in outcome, just
slightly less informative to the caller — fine to leave, worth being aware of.
None of these block. Nice work tightening it up.
Issue Time Tracking
-------------------
Worklog Id: (was: 1030004)
Time Spent: 1h 10m (was: 1h)
> @StrutsParameter authorization bypassed for record/creator-bound REST body
> properties
> -------------------------------------------------------------------------------------
>
> Key: WW-5642
> URL: https://issues.apache.org/jira/browse/WW-5642
> Project: Struts 2
> Issue Type: Bug
> Components: Plugin - REST
> Affects Versions: 7.2.1
> Environment: Reproducible with struts2-rest-plugin,
> struts.parameters.requireAnnotations
> enabled, and any REST action whose request body binds a Java record
> (or @JsonCreator/@ConstructorProperties type) either at the top level
> or nested. JDK 17, Jackson 2.22.0.
> Reporter: Gouri Sankar A
> Priority: Major
> Fix For: 7.3.0
>
> Time Spent: 1h 10m
> Remaining Estimate: 0h
>
> ParameterAuthorizingModule enforces @StrutsParameter on REST/JSON body
> deserialization by wrapping each Jackson property's deserializeAndSet /
> deserializeSetAndReturn (AuthorizingSettableBeanProperty). Jackson never
> calls either method for creator-bound properties — Java records,
> @JsonCreator constructors, @ConstructorProperties — it calls the final
> SettableBeanProperty#deserialize directly, which the existing wrapper
> cannot intercept.
> With struts.parameters.requireAnnotations enabled, any record-typed
> field in a REST action's request body is populated with no
> @StrutsParameter check at all, silently defeating the protection for
> that entire subtree.
> Fix: wrap the property's value deserializer (the only non-final
> interception point for the creator-bound path), scoped to
> CreatorProperty so existing setter/field/builder paths are unaffected.
> Fixed by: https://github.com/apache/struts/pull/1774
--
This message was sent by Atlassian Jira
(v8.20.10#820010)