Skip to content

WW-5759 Resolve @StrutsParameter accessors the way OGNL does - #1992

Merged
lukaszlenart merged 3 commits into
mainfrom
fix/parameter-authorizer-ognl-accessor-names
Oct 6, 2026
Merged

lukaszlenart merged 3 commits into
mainfrom
fix/parameter-authorizer-ognl-accessor-names

Conversation

@lukaszlenart

Copy link
Copy Markdown
Member

Summary

Fixes WW-5759

StrutsParameterAuthorizer has to predict which accessor OGNL will use for a parameter name. It derived that name differently from OGNL in two places, which this PR aligns:

Changes

  • findBindableAccessor tries set, or is then get, plus each of OGNL's accessor base names in OGNL's order, and the first name with a match wins. The existing tie-breaks within one name stay as they were: deepest declaration first, then an annotated overload.
  • The root property is normalised with Introspector.decapitalize instead of lowercasing the first character. That way the candidate list is identical to the one OGNL builds from the parameter name as written. For example, URange resolves to setURange only, exactly as in OGNL.
  • OGNL bumped from 3.4.13 to 3.4.14.

Test plan

  • New ParametersInterceptorTest cases:
    • a JavaBeans-style setter and an uppercase getter on a ModelDriven action require the annotation
    • the annotation counts only on the setter OGNL invokes
    • case variants of an accessor name bind nothing
  • Core 3405 tests, plus the JSON, REST, Tiles, Spring, CDI and Convention plugins: 0 failures
  • CI

🤖 Generated with Claude Code

lukaszlenart and others added 3 commits October 6, 2026 08:37
OGNL 3.4.14 tries setuRange before setURange for uRange, and reaches getURL() for both
uRL and URL, while StrutsParameterAuthorizer looked only for set/get plus the capitalised
name and matched nested parameters against the java.beans property name. findBindableAccessor
now tries OGNL's accessor base names in OGNL's order, and the root property is normalised
with Introspector.decapitalize so the candidates match OGNL's for the name as written.

Bumps OGNL from 3.4.13 to 3.4.14.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…othing on a ModelDriven action

They resolve to no accessor on the model or the action and take the "declared on neither"
route, which is only safe while OGNL does not bind them either.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n change

Make the non-null target contract of ultimateClass explicit, drop throws clauses the new
tests do not need and record the values the probe setters receive.

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

sonarqubecloud Bot commented Oct 6, 2026

Copy link
Copy Markdown

@lukaszlenart
lukaszlenart marked this pull request as ready for review October 6, 2026 12:47
@lukaszlenart
lukaszlenart requested a balanced review from Copilot October 6, 2026 12:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

It modifies a critical parameter-binding security boundary and requires private security triage.

Review effort: Balanced
Findings: 1 Low severity

Open (1)
What changed in this PR

Aligns @StrutsParameter authorization with OGNL accessor resolution.

Changes:

  • Matches OGNL accessor naming and precedence.
  • Adds ModelDriven regression tests.
  • Updates OGNL to 3.4.14.
File Description
pom.xml Updates OGNL.
ParametersInterceptorTest.java Adds accessor-resolution tests.
StrutsParameterAuthorizer.java Aligns authorization with OGNL.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@lukaszlenart
lukaszlenart merged commit 9aa77f7 into main Oct 6, 2026
17 checks passed
@lukaszlenart
lukaszlenart deleted the fix/parameter-authorizer-ognl-accessor-names branch October 6, 2026 13:15
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.

2 participants