[
https://issues.apache.org/jira/browse/WW-5875?focusedWorklogId=1056826&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1056826
]
ASF GitHub Bot logged work on WW-5875:
--------------------------------------
Author: ASF GitHub Bot
Created on: 24/Nov/26 10:14
Start Date: 24/Nov/26 10:14
Worklog Time Spent: 10m
Work Description: shadowe1ite opened a new pull request, #2162:
URL: https://github.com/apache/struts/pull/2162
Fixes [WW-5875](https://issues.apache.org/jira/browse/WW-5875)
REST bodies only authorize a scalar container at its own path (`tags`),
never at the element path (`tags[0]`). So with `@StrutsParameter` on the setter
only, `{"tags":["admin"]}` still fills the list.
Indexed form params and the JSON plugin both require `tags[0]` here, and
`ContentTypeInterceptor` already checks `path[0]` for bean elements, just not
for scalars.
This adds the `[0]` check for scalar elements in
`AuthorizingValueDeserializer`, the `ContentTypeInterceptor` two-phase copy and
`JuneauXmlHandler`. Bean containers are unchanged.
Added tests for lists, maps and arrays on all three paths. 7 fail without
the fix; the full REST suite passes with it.
This is a behavior change: a scalar container annotated only on the setter
will now drop its elements from REST bodies. Adding `@StrutsParameter(depth =
1)` on the getter fixes it, same as for indexed form params.
Issue Time Tracking
-------------------
Worklog Id: (was: 1056826)
Remaining Estimate: 0h
Time Spent: 10m
> REST plugin does not authorize scalar container elements at their indexed path
> ------------------------------------------------------------------------------
>
> Key: WW-5875
> URL: https://issues.apache.org/jira/browse/WW-5875
> Project: Struts 2
> Issue Type: Bug
> Components: Plugin - REST
> Affects Versions: 7.5.0
> Reporter: ALAN S
> Priority: Major
> Time Spent: 10m
> Remaining Estimate: 0h
>
> For a REST body, a scalar container property (\{{List<String>}},
> \{{Map<String, String>}}, \{{String[]}}) is only authorized at its own path
> (\{{tags}}), not at the element path (\{{tags[0]}}). With
> \{{@StrutsParameter}} on the setter only, this body still fills the list:
> {code:json}
> {"tags":["admin"]}
> {code}
> Indexed form parameters and the JSON plugin require \{{tags[0]}} for this,
> and \{{ContentTypeInterceptor}} already checks \{{path[0]}} for bean
> elements. Scalar elements should get the same check in the Jackson
> deserializer, the \{{ContentTypeInterceptor}} two-phase copy and
> \{{JuneauXmlHandler}}.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)