[
https://issues.apache.org/jira/browse/WW-5468?focusedWorklogId=937733&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-937733
]
ASF GitHub Bot logged work on WW-5468:
--------------------------------------
Author: ASF GitHub Bot
Created on: 12/Oct/24 12:06
Start Date: 12/Oct/24 12:06
Worklog Time Spent: 10m
Work Description: kusalk commented on code in PR #1072:
URL: https://github.com/apache/struts/pull/1072#discussion_r1797691170
##########
core/src/main/java/org/apache/struts2/interceptor/parameter/ParametersInterceptor.java:
##########
@@ -348,7 +349,15 @@ protected boolean isParameterAnnotatedAndAllowlist(String
name, Object action) {
}
long paramDepth = name.codePoints().mapToObj(c -> (char)
c).filter(NESTING_CHARS::contains).count();
+
+ if (action instanceof ModelDriven<?> &&
!ActionContext.getContext().getValueStack().peek().equals(action)) {
+ LOG.debug("Model driven Action detected, exempting from
@StrutsParameter annotation requirement and OGNL allowlisting model type");
+ // (Exempted by annotation on
com.opensymphony.xwork2.ModelDriven#getModel)
+ return hasValidAnnotatedMember("model", action, paramDepth + 1);
Review Comment:
This conditional block and the added annotation on the `ModelDriven`
interface comprise the core fix
Issue Time Tracking
-------------------
Worklog Id: (was: 937733)
Time Spent: 1h 40m (was: 1.5h)
> ModelDriven is not compatible with @StrutsParameter
> ---------------------------------------------------
>
> Key: WW-5468
> URL: https://issues.apache.org/jira/browse/WW-5468
> Project: Struts 2
> Issue Type: Bug
> Components: Core
> Affects Versions: 7.0.0
> Reporter: Lukasz Lenart
> Priority: Major
> Fix For: 7.0.0
>
> Time Spent: 1h 40m
> Remaining Estimate: 0h
>
> Currently if a Struts webapp uses {{ModelDriven<T>}} it won't be possible to
> use {{@StrutsParameter}} annotation on {{#getModel()}} getter.
> Use rest-angular as example
> https://github.com/apache/struts-examples/blob/master/rest-angular/src/main/resources/struts.xml#L13
--
This message was sent by Atlassian Jira
(v8.20.10#820010)