ppkarwasz commented on code in PR #766:
URL: https://github.com/apache/commons-text/pull/766#discussion_r3961316295


##########
src/test/java/org/apache/commons/text/lookup/StringLookupFactoryTest.java:
##########
@@ -293,12 +293,13 @@ void testXmlStringLookup() {
 
     @Test
     void testXmlStringLookupExternalEntityOff() {
-        assertThrows(IllegalArgumentException.class,
-                () -> 
StringLookupFactory.INSTANCE.xmlStringLookup().apply(XmlStringLookupTest.DOC_DIR
 + "document-entity-ref.xml:/document/content"));
+        XmlStringLookupTest.assertDoesNotLeak(
+                () -> 
StringLookupFactory.INSTANCE.xmlStringLookup().apply(XmlStringLookupTest.DOC_DIR
 + "document-entity-ref.xml:/document/content"),
+                XmlStringLookupTest.DATA);
     }
 
     @Test
-    @SetSystemProperty(key = "XmlStringLookup.secure", value = "false")
+    @Disabled("External entities are blocked by Commons Secure XML through an 
entity resolver and can no longer be re-enabled.")

Review Comment:
   That is not what I read from the code:
   
   
https://github.com/apache/commons-text/blob/9c9a0047b2c4ae5b6be0382177cd6d19439601f7/src/main/java/org/apache/commons/text/lookup/PathFence.java#L96-L99
   
   So I would propose:
   
   1. If `Path[]` is empty, then the XML can be fetched, but no external 
entities.
   2. If `Path[]` is not empty, then both the XML and external entities must be 
inside the fence.



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