ppkarwasz commented on code in PR #766:
URL: https://github.com/apache/commons-text/pull/766#discussion_r3960947738
##########
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:
Cool, I have a prototype of the `PathFenceResolver` locally.
There is only one edge case to solve: if the `Path[]` is `null`, does it
mean entities can be in any `file:` or in no file?
Passing `null` as `Path[]` means the XML file can be anywhere on the
filesystem, but that is probably fine (`/etc/passwd` is not an XML file). On
the other hand external entities don't have a format, so it might be more
prudent disallow entities unless a non-empty fence has been created.
--
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]