[ 
https://issues.apache.org/jira/browse/WW-5624?focusedWorklogId=1014892&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1014892
 ]

ASF GitHub Bot logged work on WW-5624:
--------------------------------------

                Author: ASF GitHub Bot
            Created on: 11/Apr/26 07:42
            Start Date: 11/Apr/26 07:42
    Worklog Time Spent: 10m 
      Work Description: lukaszlenart commented on PR #1657:
URL: https://github.com/apache/struts/pull/1657#issuecomment-4228698365

   Thanks, this is much closer now and it addresses most of the earlier 
concerns.
   
   I still see one remaining blocker in the REST path: 
`copyAuthorizedProperties(...)` still has a bulk-copy fallback when a nested 
target bean is null and a fresh instance cannot be created. In that case it 
falls back to `writeMethod.invoke(target, sourceValue)`, which copies the whole 
nested object graph in one step and bypasses per-path authorization for 
everything under that property. That still does not look equivalent to 
`ParametersInterceptor` semantics.
   
   One additional point, which I do not currently consider blocking, is scalar 
collection / map / array parity. The new helpers correctly add `"[0]"` for 
nested bean elements, but scalar elements are still copied directly. In core, 
indexed paths like `tags[0]` still contribute nesting depth even when the leaf 
value is scalar, so this may still be slightly more permissive than the 
form/query parameter path for collection-like inputs. I do not see that as a 
security blocker in the same class as unrestricted nested bean copying, but it 
may still be worth tightening later for consistency.




Issue Time Tracking
-------------------

    Worklog Id:     (was: 1014892)
    Time Spent: 2.5h  (was: 2h 20m)

> Request body population bypasses @StrutsParameter contract outside 
> ParametersInterceptor
> ----------------------------------------------------------------------------------------
>
>                 Key: WW-5624
>                 URL: https://issues.apache.org/jira/browse/WW-5624
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - JSON, Plugin - REST
>    Affects Versions: 7.1.1
>            Reporter: Tran Quac
>            Priority: Major
>             Fix For: 7.2.0
>
>          Time Spent: 2.5h
>  Remaining Estimate: 0h
>
> h2. Summary
> {{@StrutsParameter}} enforcement is currently implemented in 
> {{ParametersInterceptor}} for standard request parameter binding, but 
> request-body based binders in some plugins bypass that authorization model 
> and populate action/model objects directly.
> This creates inconsistent behavior between URL/form parameters and JSON/XML 
> request bodies, and may allow mass assignment of properties that would 
> normally be rejected by {{ParametersInterceptor}}.
> h2. Affected areas currently identified
> * JSON plugin:
> {{JSONPopulator.populateObject()}} sets properties via direct reflection and 
> does not follow the full {{@StrutsParameter}} authorization rules.
> * REST plugin:
> {{JacksonJsonHandler.toObject()}} updates target objects directly via Jackson 
> and does not follow the full {{@StrutsParameter}} authorization rules.
> h2. Problem scope
> The issue is broader than checking whether a setter is annotated. The current 
> core contract in {{ParametersInterceptor}} also includes:
> * permitted nesting depth
> * authorization based on the exposed root member
> * ModelDriven handling
> * transition mode semantics
> * related allowlisting behavior
> Any request-body binding implementation should align with that same contract, 
> otherwise Struts applies different security rules depending on how input 
> reaches the action/model.
> h2. Expected direction
> Instead of implementing separate partial checks in each plugin, Struts should 
> reuse or extract the shared parameter-binding authorization logic from 
> {{ParametersInterceptor}} and apply it consistently across request-body 
> binders.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to