Copilot commented on code in PR #1871:
URL: https://github.com/apache/struts/pull/1871#discussion_r3878305846


##########
core/src/main/java/org/apache/struts2/ognl/accessor/XWorkMethodAccessor.java:
##########
@@ -77,21 +83,81 @@ public Object callMethod(OgnlContext context, Object 
object, String string, Obje
 
         }
 
-        //HACK - we pass indexed method access i.e. setXXX(A,B) pattern
-        if ((objects.length == 2 && string.startsWith("set")) || 
(objects.length == 1 && string.startsWith("get"))) {
-            Boolean exec = (Boolean) 
context.get(ReflectionContextState.DENY_INDEXED_ACCESS_EXECUTION);
-            boolean e = exec != null && exec;
-            if (!e) {
-                return callMethodWithDebugInfo(context, object, string, 
objects);
-            }
+        if (!ReflectionContextState.isDenyMethodExecution(context)) {
+            return callMethodWithDebugInfo(context, object, string, objects);
         }
-        boolean e = ReflectionContextState.isDenyMethodExecution(context);
 
-        if (!e) {
+        //Method execution is denied. Indexed property access, i.e. the 
getXXX(A) / setXXX(A,B) pattern, is
+        //the one exception, because reading a['k'] must keep working during 
parameter binding. It is
+        //restricted to calls which really are the indexed accessor of a 
property on the target type: a name
+        //prefix and an argument count alone would let any method be called 
while execution is denied.
+        if (isIndexedPropertyAccessor(object, string, objects)

Review Comment:
   This change touches security-sensitive framework code. Please confirm it is 
not a fix for a suspected vulnerability before merging — see `SECURITY.md`. 
Vulnerability fixes go through the private process at 
`[email protected]`, not a public pull request.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to