Skip to content

WW-4858 Honor parameter filtering during JSON population#1773

Open
lukaszlenart wants to merge 8 commits into
mainfrom
WW-4858-json-parameter-filtering
Open

WW-4858 Honor parameter filtering during JSON population#1773
lukaszlenart wants to merge 8 commits into
mainfrom
WW-4858-json-parameter-filtering

Conversation

@lukaszlenart

Copy link
Copy Markdown
Member

Fixes 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

lukaszlenart and others added 8 commits July 8, 2026 19:57
…ON population

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…opulation

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…on JSON population

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ON population

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…es to JSON input

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…er comments

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Jul 8, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant