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

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

                Author: ASF GitHub Bot
            Created on: 08/Jul/26 19:49
            Start Date: 08/Jul/26 19:49
    Worklog Time Spent: 10m 
      Work Description: lukaszlenart opened a new pull request, #1773:
URL: https://github.com/apache/struts/pull/1773

   Fixes [WW-4858](https://issues.apache.org/jira/browse/WW-4858)
   
   ## What & why
   
   `JSONInterceptor` populates action/model properties from a JSON request body 
via `JSONPopulator` (pure Java reflection over bean setters), which 
historically bypassed most of the name/value acceptability controls that 
`ParametersInterceptor` applies to ordinary HTTP parameters. WW-5624 already 
retrofitted `@StrutsParameter` authorization onto this path; this change closes 
the remaining consistency gaps.
   
   Population stays **pure-reflection** — no OGNL name evaluation is introduced 
(that is intentionally kept out of the JSON path as a security property). All 
filtering hooks into the single existing recursive tree-walk, using the same 
dotted/indexed paths (`address.city`, `items[0].name`) that 
`ParametersInterceptor` uses, so the shared pattern checkers behave 
equivalently on JSON and form input.
   
   ## Controls added to the JSON population path
   
   **Always-on (security / app-owned):**
   - Excluded + accepted **name** patterns, via the shared 
`ExcludedPatternsChecker` / `AcceptedPatternsChecker` singletons (same 
instances `ParametersInterceptor` uses).
   - Param-name max length (default 100).
   - `ParameterNameAware` / `ParameterValueAware` action callbacks.
   - `@StrutsParameter` authorization (unchanged, from WW-5624).
   
   **Opt-in (default off — preserves existing behavior for permissive JSON 
apps):**
   - Excluded / accepted **value** patterns (`setExcludedValuePatterns` / 
`setAcceptedValuePatterns`).
   - Applying the interceptor's own `excludeProperties` / `includeProperties` 
to input, gated by `applyPropertyFiltersToInput`.
   
   ## Scope notes
   
   - The JSON-RPC path (`application/json-rpc`, SMD method invocation) is out 
of scope — it binds to method arguments, not stack properties.
   - `ParametersInterceptor` is not modified.
   
   ## Testing
   
   New tests in `JSONInterceptorTest` cover each gap plus nested-object and 
list-element paths. Full JSON plugin suite passes (`mvn test -pl plugins/json 
-am -DskipAssembly`).
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   




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

            Worklog Id:     (was: 1028825)
    Remaining Estimate: 0h
            Time Spent: 10m

> JSONInterceptor must not populate value stack directly
> ------------------------------------------------------
>
>                 Key: WW-4858
>                 URL: https://issues.apache.org/jira/browse/WW-4858
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Plugin - JSON
>    Affects Versions: 2.3.1, 6.1.1
>            Reporter: Yasser Zamani
>            Assignee: Lukasz Lenart
>            Priority: Major
>              Labels: decouple, refactoring
>             Fix For: 7.3.0
>
>         Attachments: StrutsUnifiedDataModel.png
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> {{JSONInterceptor}} must populate value stack via OGNL to honor our 
> exclusions!
> So according to my current quick view and understanding, I'm planning 
> something like below which also resolves WW-3364: {{JSONInterceptor}} could 
> be an extension of {{ModelDrivenInterceptor}} via some refactoring of both. 
> From hereafter, {{JSONPopulator}} could be removed and {{JSONInterceptor}} 
> must give population up to {{ParametersInterceptor}}. This simply could be 
> achieved by something like pushing {{JSONInterceptor.root}} into top of stack 
> and also moving posted json to http params (or if was impossible some 
> refactoring of {{ParametersInterceptor}}).
> Please cast here any objections, votes or idea.



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

Reply via email to