[
https://issues.apache.org/jira/browse/WW-4858?focusedWorklogId=1030266&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1030266
]
ASF GitHub Bot logged work on WW-4858:
--------------------------------------
Author: ASF GitHub Bot
Created on: 14/Jul/26 10:31
Start Date: 14/Jul/26 10:31
Worklog Time Spent: 10m
Work Description: lukaszlenart opened a new pull request, #1783:
URL: https://github.com/apache/struts/pull/1783
Fixes [WW-4858](https://issues.apache.org/jira/browse/WW-4858)
## What & why
Follow-up test coverage for the JSON parameter-filtering work in #1773. That
PR
tested the flat-key cases and a nested *excluded* name pattern, but left the
nested-leaf behaviour of **accepted-name** and **include** patterns
uncovered.
These two paths behave differently through `JSONInterceptor`'s recursive
tree-walk, and the difference is easy to regress silently:
- **Accepted name patterns** (`AcceptedPatternsChecker`) are raw full-match
regexes with **no hierarchy expansion**. The intermediate node (`bean`)
must
itself match an accepted pattern, otherwise the entire subtree is dropped
before the leaf (`bean.stringField`) is ever visited.
- **Include patterns** (`includeProperties`, via
`JSONUtil.processIncludePatterns`)
**do** expand across the hierarchy: `bean.stringField` compiles patterns
for
both the intermediate `bean` and the leaf, so the nested leaf populates
while
the excluded sibling `bean.intField` is dropped.
## Tests added (`JSONInterceptorTest`)
- `testAcceptedNamePatternRejectsNestedKey`
- `testIncludePropertiesAppliedToNestedInputWhenEnabled`
Both document the intermediate-node semantics in comments so the divergence
is
explicit rather than surprising.
## Testing
`mvn test -pl plugins/json -DskipAssembly -Dtest=JSONInterceptorTest` — 40
tests, all pass.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Issue Time Tracking
-------------------
Worklog Id: (was: 1030266)
Time Spent: 40m (was: 0.5h)
> 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: 40m
> 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)