lukaszlenart commented on code in PR #1405:
URL: https://github.com/apache/struts/pull/1405#discussion_r2735325837


##########
core/src/test/java/org/apache/struts2/ognl/OgnlUtilTest.java:
##########
@@ -1647,21 +1646,46 @@ public void testOgnlDefaultCacheFactoryCoverage() {
         assertEquals("Eviction limit for cache mismatches limit for factory 
?", 15, ognlCache.getEvictionLimit());
     }
 
-    public void testCustomOgnlMapBlocked() throws Exception {
-        String vulnerableExpr = 
"#@org.apache.struts2.ognl.MyCustomMap@{}.get(\"ye\")";
-        assertEquals("System compromised", ognlUtil.getValue(vulnerableExpr, 
ognlUtil.createDefaultContext(null), null));
+    public void testAllowCustomOgnlMap() throws Exception {
+        String vulnerableExpr = "#@org.test.MyCustomMap@{}.get(\"ye\")";
+        Object result = ognlUtil.getValue(vulnerableExpr, 
ognlUtil.createDefaultContext(null), null);
+        assertNull("System compromised", result);

Review Comment:
   I updated the test and added a few other as this was combination of some 
more factors (like short circuit in OGNL in case if root is null)



-- 
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