ppkarwasz commented on code in PR #42:
URL: https://github.com/apache/commons-xml/pull/42#discussion_r3856963123
##########
src/test/java/org/apache/commons/xml/EntityResolverFloorTest.java:
##########
@@ -325,6 +337,18 @@ void schemaDeniesUnlisted() {
}, "Schema import", SAXException.class, SecurityException.class);
}
+ @Test
+ @Tag("schema")
+ void schemaTreatsIdentifierOnlyOptInAsUnresolved() {
+ // Opting in requires supplying content: an identifier-only LSInput is
treated as unresolved, so the import stays empty and the compile fails.
+ assertParseFails(() -> {
+ final SchemaFactory factory =
XmlFactories.newSchemaFactory(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ factory.setResourceResolver((type, namespaceURI, publicId,
systemId, baseURI) ->
+ systemId != null && systemId.endsWith("included.xsd") ?
identifierOnlyLsInput(ALLOWED_SCHEMA) : null);
+
factory.newSchema(AttackTestSupport.resourceSource("with-import.xsd"));
+ }, "Schema import via identifier-only LSInput", SAXException.class,
SecurityException.class);
+ }
+
// ---- XSLT channel (URIResolver)
----------------------------------------------------------------------------------------------------------------------
Review Comment:
I removed the sectioning comments in
https://github.com/apache/commons-xml/pull/42/commits/543314e5c3278a6bbd438156696c6ea3064ccf92
--
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]