lukaszlenart commented on code in PR #1237:
URL: https://github.com/apache/struts/pull/1237#discussion_r1981270038
##########
core/src/test/java/org/apache/struts2/ognl/SecurityMemberAccessTest.java:
##########
@@ -967,6 +969,22 @@ public void
classInclusion_hibernateProxy_allowProxyObjectAccess() throws Except
assertTrue(sma.checkAllowlist(proxyObject, proxyMethod));
}
+ /**
+ * When the allowlist is enabled and proxy object access is allowed,
Spring proxies should be allowlisted based
+ * on their underlying target object. Class allowlisting should work as
expected.
+ */
+ @Test
+ public void classInclusion_springProxy_allowProxyObjectAccess() throws
Exception {
+ SpringService proxyObject = newSpringService();
+ Method proxyMethod = proxyObject.getClass().getMethod("doSomething");
+
+ sma.useEnforceAllowlistEnabled(Boolean.TRUE.toString());
+ sma.useDisallowProxyObjectAccess(Boolean.FALSE.toString());
+ sma.useAllowlistClasses(SpringServiceImpl.class.getName());
+
+ assertTrue(sma.checkAllowlist(proxyObject, proxyMethod));
+ }
+
Review Comment:
There is a dedicated `SecurityMemberAccessProxyTest` and maybe it would be
good to move proxy related test cases there as well.
--
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]