This is an automated email from the ASF dual-hosted git repository. garydgregory pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/commons-xml.git
commit d813b2b273f2d42c7ce1977dab08da14244dd522 Author: Gary Gregory <[email protected]> AuthorDate: Fri Aug 28 14:43:41 2026 -0400 Rename test methods. --- .../apache/commons/xml/AssociatedStylesheetTest.java | 4 ++-- .../java/org/apache/commons/xml/DoctypeOnlyTest.java | 16 ++++++++-------- .../java/org/apache/commons/xml/ExternalDtdTest.java | 16 ++++++++-------- .../commons/xml/ExternalGeneralEntityTest.java | 16 ++++++++-------- .../commons/xml/ExternalParameterEntityTest.java | 16 ++++++++-------- .../java/org/apache/commons/xml/NoDoctypeTest.java | 16 ++++++++-------- .../commons/xml/OverrideDefaultParserTest.java | 2 +- .../commons/xml/SaxonAlternateFactoryTest.java | 2 +- .../commons/xml/SaxonXPathExternalCallsTest.java | 6 +++--- .../org/apache/commons/xml/SchemaImportTest.java | 2 +- .../org/apache/commons/xml/SchemaIncludeTest.java | 2 +- .../apache/commons/xml/SchemaLocationDomTest.java | 2 +- .../commons/xml/SchemaLocationPropertyTest.java | 8 ++++---- .../apache/commons/xml/SchemaLocationSaxTest.java | 2 +- .../org/apache/commons/xml/SchemaRedefineTest.java | 2 +- .../org/apache/commons/xml/TemplatesHandlerTest.java | 4 ++-- .../org/apache/commons/xml/TemplatesImportTest.java | 2 +- .../org/apache/commons/xml/TemplatesIncludeTest.java | 2 +- .../apache/commons/xml/TransformerDocumentTest.java | 2 +- .../apache/commons/xml/TransformerHandlerTest.java | 6 +++--- .../java/org/apache/commons/xml/XIncludeTest.java | 20 ++++++++++---------- .../apache/commons/xml/XMLFilterParseStringTest.java | 2 +- .../java/org/apache/commons/xml/XMLFilterTest.java | 6 +++--- .../org/apache/commons/xml/XPathInputSourceTest.java | 6 +++--- 24 files changed, 81 insertions(+), 81 deletions(-) diff --git a/src/test/java/org/apache/commons/xml/AssociatedStylesheetTest.java b/src/test/java/org/apache/commons/xml/AssociatedStylesheetTest.java index 036228d..27e5411 100644 --- a/src/test/java/org/apache/commons/xml/AssociatedStylesheetTest.java +++ b/src/test/java/org/apache/commons/xml/AssociatedStylesheetTest.java @@ -56,7 +56,7 @@ private static TransformerFactory hardenedFactory() { } @Test - void hardenedGetAssociatedStylesheetIgnoresExternalDtd() throws TransformerConfigurationException { + void secureGetAssociatedStylesheetIgnoresExternalDtd() throws TransformerConfigurationException { // The prolog declares an unreachable external DTD; the secure parse resolves it to empty rather than fetching it, so the PI scan completes and finds // the stylesheet instead of throwing on a fetch. (The returned Source's shape is engine-specific: XSLTC and Xalan point it at included.xsl, while Saxon // resolves the href through its own floor and returns an empty source; both mean the scan ran without fetching the DTD.) @@ -66,7 +66,7 @@ void hardenedGetAssociatedStylesheetIgnoresExternalDtd() throws TransformerConfi } @Test - void hardenedGetAssociatedStylesheetReturnsStylesheet() throws TransformerConfigurationException { + void secureGetAssociatedStylesheetReturnsStylesheet() throws TransformerConfigurationException { // Positive control: a plain document with no DOCTYPE resolves its xml-stylesheet PI end to end. final Source associated = hardenedFactory() .getAssociatedStylesheet(AttackTestSupport.resourceSource("associated-stylesheet-plain.xml"), null, null, null); diff --git a/src/test/java/org/apache/commons/xml/DoctypeOnlyTest.java b/src/test/java/org/apache/commons/xml/DoctypeOnlyTest.java index 1c78212..ea96bf5 100644 --- a/src/test/java/org/apache/commons/xml/DoctypeOnlyTest.java +++ b/src/test/java/org/apache/commons/xml/DoctypeOnlyTest.java @@ -53,7 +53,7 @@ private static String xsltPayload() { @Test @Tag("dom") - void hardenedDomParses() { + void secureDomParses() { Assumptions.assumeTrue(AttackTestSupport.DOM_RESOLVES_INTERNAL_ENTITIES, "Skipped: platform DOM does not resolve user-defined entities"); AttackTestSupport.assertDomParses(payload()); @@ -61,43 +61,43 @@ void hardenedDomParses() { @Test @Tag("sax") - void hardenedSaxParses() { + void secureSaxParses() { AttackTestSupport.assertSaxParses(payload()); } @Test @Tag("schema") - void hardenedSchemaCompiles() { + void secureSchemaCompiles() { AttackTestSupport.assertSchemaCompiles(AttackTestSupport.streamSource(xsdPayload())); } @Test @Tag("stax") - void hardenedStaxParses() { + void secureStaxParses() { AttackTestSupport.assertStaxParses(payload()); } @Test @Tag("trax") - void hardenedTemplatesCompiles() { + void secureTemplatesCompiles() { AttackTestSupport.assertTemplatesCompiles(AttackTestSupport.streamSource(xsltPayload())); } @Test @Tag("trax") - void hardenedTransformerTransforms() { + void secureTransformerTransforms() { AttackTestSupport.assertTransformerTransforms(payload()); } @Test @Tag("schema") - void hardenedValidatorValidates() { + void secureValidatorValidates() { AttackTestSupport.assertValidatorValidates(payload()); } @Test @Tag("sax") - void hardenedXmlReaderParses() { + void secureXmlReaderParses() { AttackTestSupport.assertXmlReaderParses(payload()); } } diff --git a/src/test/java/org/apache/commons/xml/ExternalDtdTest.java b/src/test/java/org/apache/commons/xml/ExternalDtdTest.java index 26c771f..ce3acbe 100644 --- a/src/test/java/org/apache/commons/xml/ExternalDtdTest.java +++ b/src/test/java/org/apache/commons/xml/ExternalDtdTest.java @@ -65,7 +65,7 @@ private static String xsltPayload() { @Test @Tag("dom") - void hardenedDomDoesNotLeak() { + void secureDomDoesNotLeak() { Assumptions.assumeTrue(AttackTestSupport.DOM_RESOLVES_INTERNAL_ENTITIES, "Skipped: platform DOM does not resolve user-defined entities"); AttackTestSupport.assertDomDoesNotLeak(xmlPayload()); @@ -73,19 +73,19 @@ void hardenedDomDoesNotLeak() { @Test @Tag("sax") - void hardenedSaxDoesNotLeak() { + void secureSaxDoesNotLeak() { AttackTestSupport.assertSaxDoesNotLeak(xmlPayload()); } @Test @Tag("schema") - void hardenedSchemaDoesNotLeak() { + void secureSchemaDoesNotLeak() { AttackTestSupport.assertSchemaDoesNotLeak(AttackTestSupport.streamSource(xsdPayload())); } @Test @Tag("stax") - void hardenedStaxBlocksOrDoesNotLeak() { + void secureStaxBlocksOrDoesNotLeak() { // Woodstox rejects a reference to an entity declared only in the emptied external subset; the Xerces lineage skips it as an unreported validity // constraint because the DOCTYPE has a system identifier. AttackTestSupport.assertStaxBlocksOrDoesNotLeak(xmlPayload()); @@ -93,25 +93,25 @@ void hardenedStaxBlocksOrDoesNotLeak() { @Test @Tag("trax") - void hardenedTemplatesDoesNotLeak() { + void secureTemplatesDoesNotLeak() { AttackTestSupport.assertTemplatesDoesNotLeak(AttackTestSupport.streamSource(xsltPayload())); } @Test @Tag("trax") - void hardenedTransformerDoesNotLeak() { + void secureTransformerDoesNotLeak() { AttackTestSupport.assertTransformerDoesNotLeak(xmlPayload()); } @Test @Tag("schema") - void hardenedValidatorDoesNotLeak() { + void secureValidatorDoesNotLeak() { AttackTestSupport.assertValidatorDoesNotLeak(xmlPayload()); } @Test @Tag("sax") - void hardenedXmlReaderDoesNotLeak() { + void secureXmlReaderDoesNotLeak() { AttackTestSupport.assertXmlReaderDoesNotLeak(xmlPayload()); } diff --git a/src/test/java/org/apache/commons/xml/ExternalGeneralEntityTest.java b/src/test/java/org/apache/commons/xml/ExternalGeneralEntityTest.java index ea335a9..3fec8dc 100644 --- a/src/test/java/org/apache/commons/xml/ExternalGeneralEntityTest.java +++ b/src/test/java/org/apache/commons/xml/ExternalGeneralEntityTest.java @@ -66,7 +66,7 @@ private static String xsltPayload() { @Test @Tag("dom") - void hardenedDomDoesNotLeak() { + void secureDomDoesNotLeak() { Assumptions.assumeTrue(AttackTestSupport.DOM_RESOLVES_INTERNAL_ENTITIES, "Skipped: platform DOM does not resolve user-defined entities"); AttackTestSupport.assertDomDoesNotLeak(xmlPayload()); @@ -74,43 +74,43 @@ void hardenedDomDoesNotLeak() { @Test @Tag("sax") - void hardenedSaxDoesNotLeak() { + void secureSaxDoesNotLeak() { AttackTestSupport.assertSaxDoesNotLeak(xmlPayload()); } @Test @Tag("schema") - void hardenedSchemaDoesNotLeak() { + void secureSchemaDoesNotLeak() { AttackTestSupport.assertSchemaDoesNotLeak(AttackTestSupport.streamSource(xsdPayload())); } @Test @Tag("stax") - void hardenedStaxDoesNotLeak() { + void secureStaxDoesNotLeak() { AttackTestSupport.assertStaxDoesNotLeak(xmlPayload()); } @Test @Tag("trax") - void hardenedTemplatesDoesNotLeak() { + void secureTemplatesDoesNotLeak() { AttackTestSupport.assertTemplatesDoesNotLeak(AttackTestSupport.streamSource(xsltPayload())); } @Test @Tag("trax") - void hardenedTransformerDoesNotLeak() { + void secureTransformerDoesNotLeak() { AttackTestSupport.assertTransformerDoesNotLeak(xmlPayload()); } @Test @Tag("schema") - void hardenedValidatorDoesNotLeak() { + void secureValidatorDoesNotLeak() { AttackTestSupport.assertValidatorDoesNotLeak(xmlPayload()); } @Test @Tag("sax") - void hardenedXmlReaderDoesNotLeak() { + void secureXmlReaderDoesNotLeak() { AttackTestSupport.assertXmlReaderDoesNotLeak(xmlPayload()); } diff --git a/src/test/java/org/apache/commons/xml/ExternalParameterEntityTest.java b/src/test/java/org/apache/commons/xml/ExternalParameterEntityTest.java index 1c6b95f..846c1f6 100644 --- a/src/test/java/org/apache/commons/xml/ExternalParameterEntityTest.java +++ b/src/test/java/org/apache/commons/xml/ExternalParameterEntityTest.java @@ -144,7 +144,7 @@ private static String xsltPayload() { @Test @Tag("dom") - void hardenedDomBlocksOrDoesNotLeak() { + void secureDomBlocksOrDoesNotLeak() { Assumptions.assumeTrue(DOM_ACCEPTS_PARAMETER_ENTITIES, "Skipped: platform DOM does not accept parameter entities"); AttackTestSupport.assertDomBlocksOrDoesNotLeak(xmlPayload()); @@ -152,7 +152,7 @@ void hardenedDomBlocksOrDoesNotLeak() { @Test @Tag("sax") - void hardenedSaxBlocksOrDoesNotLeak() { + void secureSaxBlocksOrDoesNotLeak() { Assumptions.assumeTrue(SAX_RESOLVES_PARAMETER_ENTITIES, "Skipped: platform SAX parser does not invoke the entity resolver for parameter entities"); AttackTestSupport.assertSaxBlocksOrDoesNotLeak(xmlPayload()); @@ -160,7 +160,7 @@ void hardenedSaxBlocksOrDoesNotLeak() { @Test @Tag("schema") - void hardenedSchemaBlocksOrDoesNotLeak() { + void secureSchemaBlocksOrDoesNotLeak() { Assumptions.assumeTrue(SAX_RESOLVES_PARAMETER_ENTITIES, "Skipped: platform SAX parser does not invoke the entity resolver for parameter entities"); AttackTestSupport.assertSchemaBlocksOrDoesNotLeak(AttackTestSupport.streamSource(xsdPayload())); @@ -168,13 +168,13 @@ void hardenedSchemaBlocksOrDoesNotLeak() { @Test @Tag("stax") - void hardenedStaxBlocksOrDoesNotLeak() { + void secureStaxBlocksOrDoesNotLeak() { AttackTestSupport.assertStaxBlocksOrDoesNotLeak(xmlPayload()); } @Test @Tag("trax") - void hardenedTemplatesBlocksOrDoesNotLeak() { + void secureTemplatesBlocksOrDoesNotLeak() { Assumptions.assumeTrue(SAX_RESOLVES_PARAMETER_ENTITIES, "Skipped: platform SAX parser does not invoke the entity resolver for parameter entities"); AttackTestSupport.assertTemplatesBlocksOrDoesNotLeak(AttackTestSupport.streamSource(xsltPayload())); @@ -182,7 +182,7 @@ void hardenedTemplatesBlocksOrDoesNotLeak() { @Test @Tag("trax") - void hardenedTransformerBlocksOrDoesNotLeak() { + void secureTransformerBlocksOrDoesNotLeak() { Assumptions.assumeTrue(SAX_RESOLVES_PARAMETER_ENTITIES, "Skipped: platform SAX parser does not invoke the entity resolver for parameter entities"); AttackTestSupport.assertTransformerBlocksOrDoesNotLeak(xmlPayload()); @@ -190,7 +190,7 @@ void hardenedTransformerBlocksOrDoesNotLeak() { @Test @Tag("schema") - void hardenedValidatorBlocksOrDoesNotLeak() { + void secureValidatorBlocksOrDoesNotLeak() { Assumptions.assumeTrue(SAX_RESOLVES_PARAMETER_ENTITIES, "Skipped: platform SAX parser does not invoke the entity resolver for parameter entities"); AttackTestSupport.assertValidatorBlocksOrDoesNotLeak(xmlPayload()); @@ -198,7 +198,7 @@ void hardenedValidatorBlocksOrDoesNotLeak() { @Test @Tag("sax") - void hardenedXmlReaderBlocksOrDoesNotLeak() { + void secureXmlReaderBlocksOrDoesNotLeak() { Assumptions.assumeTrue(SAX_RESOLVES_PARAMETER_ENTITIES, "Skipped: platform SAX parser does not invoke the entity resolver for parameter entities"); AttackTestSupport.assertXmlReaderBlocksOrDoesNotLeak(xmlPayload()); diff --git a/src/test/java/org/apache/commons/xml/NoDoctypeTest.java b/src/test/java/org/apache/commons/xml/NoDoctypeTest.java index 5cda005..abf3656 100644 --- a/src/test/java/org/apache/commons/xml/NoDoctypeTest.java +++ b/src/test/java/org/apache/commons/xml/NoDoctypeTest.java @@ -45,49 +45,49 @@ private static String xsltPayload() { @Test @Tag("dom") - void hardenedDomParses() { + void secureDomParses() { AttackTestSupport.assertDomParses(payload()); } @Test @Tag("sax") - void hardenedSaxParses() { + void secureSaxParses() { AttackTestSupport.assertSaxParses(payload()); } @Test @Tag("schema") - void hardenedSchemaCompiles() { + void secureSchemaCompiles() { AttackTestSupport.assertSchemaCompiles(AttackTestSupport.streamSource(xsdPayload())); } @Test @Tag("stax") - void hardenedStaxParses() { + void secureStaxParses() { AttackTestSupport.assertStaxParses(payload()); } @Test @Tag("trax") - void hardenedTemplatesCompiles() { + void secureTemplatesCompiles() { AttackTestSupport.assertTemplatesCompiles(AttackTestSupport.streamSource(xsltPayload())); } @Test @Tag("trax") - void hardenedTransformerTransforms() { + void secureTransformerTransforms() { AttackTestSupport.assertTransformerTransforms(payload()); } @Test @Tag("schema") - void hardenedValidatorValidates() { + void secureValidatorValidates() { AttackTestSupport.assertValidatorValidates(payload()); } @Test @Tag("sax") - void hardenedXmlReaderParses() { + void secureXmlReaderParses() { AttackTestSupport.assertXmlReaderParses(payload()); } } diff --git a/src/test/java/org/apache/commons/xml/OverrideDefaultParserTest.java b/src/test/java/org/apache/commons/xml/OverrideDefaultParserTest.java index 144d104..b754587 100644 --- a/src/test/java/org/apache/commons/xml/OverrideDefaultParserTest.java +++ b/src/test/java/org/apache/commons/xml/OverrideDefaultParserTest.java @@ -62,7 +62,7 @@ private static String transform(final TransformerFactory factory, final String t } @Test - void hardenedReaderFollowsFlag() throws Exception { + void secureReaderFollowsFlag() throws Exception { assumeFalse(AttackTestSupport.IS_ANDROID); final XMLReader pinned = ((SecureXMLReader) SecureSAXParserFactory.newSecureXMLReader(false)).getDelegate(); assertTrue(pinned.getClass().getName().startsWith(JDK_INTERNAL_PREFIX), pinned.getClass().getName()); diff --git a/src/test/java/org/apache/commons/xml/SaxonAlternateFactoryTest.java b/src/test/java/org/apache/commons/xml/SaxonAlternateFactoryTest.java index 4b89c21..96630bf 100644 --- a/src/test/java/org/apache/commons/xml/SaxonAlternateFactoryTest.java +++ b/src/test/java/org/apache/commons/xml/SaxonAlternateFactoryTest.java @@ -84,7 +84,7 @@ private static String transform(final TransformerFactory factory) throws Transfo } @Test - void hardenedBasicFactoryDoesNotLeakCollection() { + void secureBasicFactoryDoesNotLeakCollection() { assumeSaxonPresent(); try { final String result = transform(SecureTransformerFactory.secure(basicSaxonFactory())); diff --git a/src/test/java/org/apache/commons/xml/SaxonXPathExternalCallsTest.java b/src/test/java/org/apache/commons/xml/SaxonXPathExternalCallsTest.java index 08c2783..029d450 100644 --- a/src/test/java/org/apache/commons/xml/SaxonXPathExternalCallsTest.java +++ b/src/test/java/org/apache/commons/xml/SaxonXPathExternalCallsTest.java @@ -116,17 +116,17 @@ private static String unparsedTextExpression() { } @Test - void hardenedXPathBlocksDoc() { + void secureXPathBlocksDoc() { assertCallExcludesMarker(hardenedSaxonXPathFactory(), docExpression()); } @Test - void hardenedXPathBlocksJsonDoc() { + void secureXPathBlocksJsonDoc() { assertCallExcludesMarker(hardenedSaxonXPathFactory(), jsonDocExpression()); } @Test - void hardenedXPathBlocksUnparsedText() { + void secureXPathBlocksUnparsedText() { assertCallExcludesMarker(hardenedSaxonXPathFactory(), unparsedTextExpression()); } diff --git a/src/test/java/org/apache/commons/xml/SchemaImportTest.java b/src/test/java/org/apache/commons/xml/SchemaImportTest.java index a75a739..5312c4c 100644 --- a/src/test/java/org/apache/commons/xml/SchemaImportTest.java +++ b/src/test/java/org/apache/commons/xml/SchemaImportTest.java @@ -30,7 +30,7 @@ class SchemaImportTest { private static final String RESOURCE = "with-import.xsd"; @Test - void hardenedSchemaBlocks() { + void secureSchemaBlocks() { AttackTestSupport.assertSchemaBlocks(AttackTestSupport.resourceSource(RESOURCE)); } diff --git a/src/test/java/org/apache/commons/xml/SchemaIncludeTest.java b/src/test/java/org/apache/commons/xml/SchemaIncludeTest.java index 2bc358f..ad8be5d 100644 --- a/src/test/java/org/apache/commons/xml/SchemaIncludeTest.java +++ b/src/test/java/org/apache/commons/xml/SchemaIncludeTest.java @@ -30,7 +30,7 @@ class SchemaIncludeTest { private static final String RESOURCE = "with-include.xsd"; @Test - void hardenedSchemaBlocks() { + void secureSchemaBlocks() { AttackTestSupport.assertSchemaBlocks(AttackTestSupport.resourceSource(RESOURCE)); } diff --git a/src/test/java/org/apache/commons/xml/SchemaLocationDomTest.java b/src/test/java/org/apache/commons/xml/SchemaLocationDomTest.java index 1581dfb..47d76c5 100644 --- a/src/test/java/org/apache/commons/xml/SchemaLocationDomTest.java +++ b/src/test/java/org/apache/commons/xml/SchemaLocationDomTest.java @@ -85,7 +85,7 @@ private static boolean supportsSchemaLanguage() { } @Test - void hardenedDoesNotFetchExternalSchema() { + void secureDoesNotFetchExternalSchema() { assumeTrue(supportsSchemaLanguage(), "parser does not support JAXP 1.2 schema-language XSD validation"); final DocumentBuilderFactory factory = enableXsdValidation(SecureDocumentBuilderFactory.newInstance()); // The schemaLocation reference resolves to empty rather than being fetched. Either the empty schema fails the validating parse (acceptable), or the diff --git a/src/test/java/org/apache/commons/xml/SchemaLocationPropertyTest.java b/src/test/java/org/apache/commons/xml/SchemaLocationPropertyTest.java index 6b817c9..b382027 100644 --- a/src/test/java/org/apache/commons/xml/SchemaLocationPropertyTest.java +++ b/src/test/java/org/apache/commons/xml/SchemaLocationPropertyTest.java @@ -138,25 +138,25 @@ private static XMLReader permissiveValidatingSax(final String property, final St } @Test - void hardenedDomRefusesNoNamespaceSchemaLocation() { + void secureDomRefusesNoNamespaceSchemaLocation() { final DocumentBuilder builder = hardenedValidatingDom(EXTERNAL_NO_NS, noNamespaceLocation()); assertParseFails(() -> builder.parse(inputSource(NO_NS_INSTANCE)), "DOM external-noNamespaceSchemaLocation", SAXException.class); } @Test - void hardenedDomRefusesSchemaLocation() { + void secureDomRefusesSchemaLocation() { final DocumentBuilder builder = hardenedValidatingDom(EXTERNAL_SCHEMA_LOCATION, namespacedLocation()); assertParseFails(() -> builder.parse(inputSource(NAMESPACED_INSTANCE)), "DOM external-schemaLocation", SAXException.class); } @Test - void hardenedSaxRefusesNoNamespaceSchemaLocation() { + void secureSaxRefusesNoNamespaceSchemaLocation() { final XMLReader reader = hardenedValidatingSax(EXTERNAL_NO_NS, noNamespaceLocation()); assertParseFails(() -> reader.parse(inputSource(NO_NS_INSTANCE)), "SAX external-noNamespaceSchemaLocation", SAXException.class); } @Test - void hardenedSaxRefusesSchemaLocation() { + void secureSaxRefusesSchemaLocation() { final XMLReader reader = hardenedValidatingSax(EXTERNAL_SCHEMA_LOCATION, namespacedLocation()); assertParseFails(() -> reader.parse(inputSource(NAMESPACED_INSTANCE)), "SAX external-schemaLocation", SAXException.class); } diff --git a/src/test/java/org/apache/commons/xml/SchemaLocationSaxTest.java b/src/test/java/org/apache/commons/xml/SchemaLocationSaxTest.java index 3bb2f60..e3b87ff 100644 --- a/src/test/java/org/apache/commons/xml/SchemaLocationSaxTest.java +++ b/src/test/java/org/apache/commons/xml/SchemaLocationSaxTest.java @@ -98,7 +98,7 @@ private static boolean supportsSchemaLanguage() { } @Test - void hardenedDoesNotFetchExternalSchema() throws Exception { + void secureDoesNotFetchExternalSchema() throws Exception { assumeTrue(supportsSchemaLanguage(), "parser does not support JAXP 1.2 schema-language XSD validation"); final SAXParser parser = newValidatingParser(SecureSAXParserFactory.newInstance()); // The schemaLocation reference resolves to empty rather than being fetched. Either the empty schema fails the validating parse (acceptable), or the diff --git a/src/test/java/org/apache/commons/xml/SchemaRedefineTest.java b/src/test/java/org/apache/commons/xml/SchemaRedefineTest.java index f76858e..d656c1e 100644 --- a/src/test/java/org/apache/commons/xml/SchemaRedefineTest.java +++ b/src/test/java/org/apache/commons/xml/SchemaRedefineTest.java @@ -30,7 +30,7 @@ class SchemaRedefineTest { private static final String RESOURCE = "with-redefine.xsd"; @Test - void hardenedSchemaBlocks() { + void secureSchemaBlocks() { AttackTestSupport.assertSchemaBlocks(AttackTestSupport.resourceSource(RESOURCE)); } diff --git a/src/test/java/org/apache/commons/xml/TemplatesHandlerTest.java b/src/test/java/org/apache/commons/xml/TemplatesHandlerTest.java index ea1cf0e..2972dd9 100644 --- a/src/test/java/org/apache/commons/xml/TemplatesHandlerTest.java +++ b/src/test/java/org/apache/commons/xml/TemplatesHandlerTest.java @@ -54,7 +54,7 @@ private static String compileAndTransform(final TemplatesHandler handler, final } @Test - void hardenedTemplatesHandlerDoesNotLeakDocument() throws Exception { + void secureTemplatesHandlerDoesNotLeakDocument() throws Exception { // The f004 product path: the Templates from getTemplates() must produce floored Transformers for runtime document(). final TemplatesHandler handler = SaxSurfaceTestSupport.hardenedFactory().newTemplatesHandler(); assertFalse(compileAndTransform(handler, "with-document.xsl").contains(AttackTestSupport.LEAKED_MARKER), @@ -62,7 +62,7 @@ void hardenedTemplatesHandlerDoesNotLeakDocument() throws Exception { } @Test - void hardenedTemplatesHandlerDoesNotLeakInclude() throws Exception { + void secureTemplatesHandlerDoesNotLeakInclude() throws Exception { final TemplatesHandler handler = SaxSurfaceTestSupport.hardenedFactory().newTemplatesHandler(); assertFalse(compileAndTransform(handler, "with-include.xsl").contains(AttackTestSupport.LEAKED_MARKER), "xsl:include through TemplatesHandler leaked"); diff --git a/src/test/java/org/apache/commons/xml/TemplatesImportTest.java b/src/test/java/org/apache/commons/xml/TemplatesImportTest.java index 98181ce..c715e66 100644 --- a/src/test/java/org/apache/commons/xml/TemplatesImportTest.java +++ b/src/test/java/org/apache/commons/xml/TemplatesImportTest.java @@ -28,7 +28,7 @@ class TemplatesImportTest { @Test - void hardenedTemplatesBlocks() { + void secureTemplatesBlocks() { AttackTestSupport.assertTemplatesDoesNotLeak(AttackTestSupport.resourceSource("with-import.xsl")); } } diff --git a/src/test/java/org/apache/commons/xml/TemplatesIncludeTest.java b/src/test/java/org/apache/commons/xml/TemplatesIncludeTest.java index bd2ed18..7a2c46e 100644 --- a/src/test/java/org/apache/commons/xml/TemplatesIncludeTest.java +++ b/src/test/java/org/apache/commons/xml/TemplatesIncludeTest.java @@ -28,7 +28,7 @@ class TemplatesIncludeTest { @Test - void hardenedTemplatesBlocks() { + void secureTemplatesBlocks() { AttackTestSupport.assertTemplatesDoesNotLeak(AttackTestSupport.resourceSource("with-include.xsl")); } } diff --git a/src/test/java/org/apache/commons/xml/TransformerDocumentTest.java b/src/test/java/org/apache/commons/xml/TransformerDocumentTest.java index f258e41..2490682 100644 --- a/src/test/java/org/apache/commons/xml/TransformerDocumentTest.java +++ b/src/test/java/org/apache/commons/xml/TransformerDocumentTest.java @@ -28,7 +28,7 @@ class TransformerDocumentTest { @Test - void hardenedTransformerBlocks() { + void secureTransformerBlocks() { AttackTestSupport.assertTemplatesDoesNotLeak(AttackTestSupport.resourceSource("with-document.xsl")); } } diff --git a/src/test/java/org/apache/commons/xml/TransformerHandlerTest.java b/src/test/java/org/apache/commons/xml/TransformerHandlerTest.java index 87b67ec..060c2fd 100644 --- a/src/test/java/org/apache/commons/xml/TransformerHandlerTest.java +++ b/src/test/java/org/apache/commons/xml/TransformerHandlerTest.java @@ -49,7 +49,7 @@ private static String transformViaHandler(final TransformerHandler handler) thro } @Test - void hardenedGetTransformerDoesNotLeakDocument() throws Exception { + void secureGetTransformerDoesNotLeakDocument() throws Exception { // The f004 bypass: pull the inner Transformer out of the handler and transform directly; the floor must ride along. final SAXTransformerFactory factory = SaxSurfaceTestSupport.hardenedFactory(); final TransformerHandler handler = factory.newTransformerHandler(AttackTestSupport.resourceSource("with-document.xsl")); @@ -59,14 +59,14 @@ void hardenedGetTransformerDoesNotLeakDocument() throws Exception { } @Test - void hardenedTransformerHandlerDoesNotLeakDocument() throws Exception { + void secureTransformerHandlerDoesNotLeakDocument() throws Exception { final SAXTransformerFactory factory = SaxSurfaceTestSupport.hardenedFactory(); final TransformerHandler handler = factory.newTransformerHandler(AttackTestSupport.resourceSource("with-document.xsl")); assertFalse(transformViaHandler(handler).contains(AttackTestSupport.LEAKED_MARKER), "document() through TransformerHandler leaked"); } @Test - void hardenedTransformerHandlerFromTemplatesDoesNotLeakDocument() throws Exception { + void secureTransformerHandlerFromTemplatesDoesNotLeakDocument() throws Exception { final SAXTransformerFactory factory = SaxSurfaceTestSupport.hardenedFactory(); final Templates templates = factory.newTemplates(AttackTestSupport.resourceSource("with-document.xsl")); assertNotNull(templates, "stylesheet failed to compile"); diff --git a/src/test/java/org/apache/commons/xml/XIncludeTest.java b/src/test/java/org/apache/commons/xml/XIncludeTest.java index 8361853..1b70973 100644 --- a/src/test/java/org/apache/commons/xml/XIncludeTest.java +++ b/src/test/java/org/apache/commons/xml/XIncludeTest.java @@ -180,7 +180,7 @@ void baselineSaxLeaksParseXml() throws Exception { @Test @Tag("dom") - void hardenedDomBlocksParseText() throws Exception { + void secureDomBlocksParseText() throws Exception { final InputSource input = inputSource(xiIncludeXml(REFERENCED_TEXT, "text")); final DocumentBuilderFactory factory = SecureDocumentBuilderFactory.newInstance(); @@ -194,7 +194,7 @@ void hardenedDomBlocksParseText() throws Exception { @Test @Tag("dom") - void hardenedDomBlocksParseXml() throws Exception { + void secureDomBlocksParseXml() throws Exception { final InputSource input = inputSource(xiIncludeXml(REFERENCED_XML, "xml")); final DocumentBuilderFactory factory = SecureDocumentBuilderFactory.newInstance(); @@ -208,7 +208,7 @@ void hardenedDomBlocksParseXml() throws Exception { @Test @Tag("dom") - void hardenedDomNullResolverDoesNotLeak() throws Exception { + void secureDomNullResolverDoesNotLeak() throws Exception { final InputSource input = inputSource(xiIncludeXml(REFERENCED_XML, "xml")); final DocumentBuilderFactory factory = SecureDocumentBuilderFactory.newInstance(); @@ -222,7 +222,7 @@ void hardenedDomNullResolverDoesNotLeak() throws Exception { @Test @Tag("dom") - void hardenedDomWithAllowListResolvesParseText() throws Exception { + void secureDomWithAllowListResolvesParseText() throws Exception { final InputSource input = inputSource(xiIncludeXml(REFERENCED_TEXT, "text")); final DocumentBuilderFactory factory = SecureDocumentBuilderFactory.newInstance(); @@ -237,7 +237,7 @@ void hardenedDomWithAllowListResolvesParseText() throws Exception { @Test @Tag("dom") - void hardenedDomWithAllowListResolvesParseXml() throws Exception { + void secureDomWithAllowListResolvesParseXml() throws Exception { final InputSource input = inputSource(xiIncludeXml(REFERENCED_XML, "xml")); final DocumentBuilderFactory factory = SecureDocumentBuilderFactory.newInstance(); @@ -252,7 +252,7 @@ void hardenedDomWithAllowListResolvesParseXml() throws Exception { @Test @Tag("sax") - void hardenedSaxBlocksParseText() throws Exception { + void secureSaxBlocksParseText() throws Exception { final String input = xiIncludeXml(REFERENCED_TEXT, "text"); final SAXParserFactory factory = SecureSAXParserFactory.newInstance(); @@ -265,7 +265,7 @@ void hardenedSaxBlocksParseText() throws Exception { @Test @Tag("sax") - void hardenedSaxBlocksParseXml() throws Exception { + void secureSaxBlocksParseXml() throws Exception { final InputSource input = inputSource(xiIncludeXml(REFERENCED_XML, "xml")); final SAXParserFactory factory = SecureSAXParserFactory.newInstance(); @@ -279,7 +279,7 @@ void hardenedSaxBlocksParseXml() throws Exception { @Test @Tag("sax") - void hardenedSaxNullResolverDoesNotLeak() throws Exception { + void secureSaxNullResolverDoesNotLeak() throws Exception { final InputSource input = inputSource(xiIncludeXml(REFERENCED_XML, "xml")); final SAXParserFactory factory = SecureSAXParserFactory.newInstance(); @@ -293,7 +293,7 @@ void hardenedSaxNullResolverDoesNotLeak() throws Exception { @Test @Tag("sax") - void hardenedSaxWithAllowListResolvesParseText() throws Exception { + void secureSaxWithAllowListResolvesParseText() throws Exception { final String input = xiIncludeXml(REFERENCED_TEXT, "text"); final SAXParserFactory factory = SecureSAXParserFactory.newInstance(); @@ -308,7 +308,7 @@ void hardenedSaxWithAllowListResolvesParseText() throws Exception { @Test @Tag("sax") - void hardenedSaxWithAllowListResolvesParseXml() throws Exception { + void secureSaxWithAllowListResolvesParseXml() throws Exception { final String input = xiIncludeXml(REFERENCED_XML, "xml"); final SAXParserFactory factory = SecureSAXParserFactory.newInstance(); diff --git a/src/test/java/org/apache/commons/xml/XMLFilterParseStringTest.java b/src/test/java/org/apache/commons/xml/XMLFilterParseStringTest.java index 0620349..45244de 100644 --- a/src/test/java/org/apache/commons/xml/XMLFilterParseStringTest.java +++ b/src/test/java/org/apache/commons/xml/XMLFilterParseStringTest.java @@ -52,7 +52,7 @@ private static String entityPayload() { } @Test - void hardenedFilterParseStringDoesNotLeakExternalEntity(@TempDir final Path tmpDir) throws Exception { + void secureFilterParseStringDoesNotLeakExternalEntity(@TempDir final Path tmpDir) throws Exception { final SAXTransformerFactory factory = (SAXTransformerFactory) SecureTransformerFactory.newInstance(); final Templates templates = factory.newTemplates(new StreamSource(new StringReader(IDENTITY_XSLT))); final XMLFilter filter = factory.newXMLFilter(templates); diff --git a/src/test/java/org/apache/commons/xml/XMLFilterTest.java b/src/test/java/org/apache/commons/xml/XMLFilterTest.java index 98a741c..75f26c7 100644 --- a/src/test/java/org/apache/commons/xml/XMLFilterTest.java +++ b/src/test/java/org/apache/commons/xml/XMLFilterTest.java @@ -75,20 +75,20 @@ private static void setPermissiveParentOnAndroid(final XMLFilter filter) { } @Test - void hardenedFilterDoesNotLeakDocument() throws Exception { + void secureFilterDoesNotLeakDocument() throws Exception { final XMLFilter filter = SaxSurfaceTestSupport.hardenedFactory().newXMLFilter(AttackTestSupport.resourceSource("with-document.xsl")); assertFalse(filterAndCapture(filter, "<root/>").contains(AttackTestSupport.LEAKED_MARKER), "document() through XMLFilter leaked"); } @Test - void hardenedFilterDoesNotLeakExternalEntity() throws Exception { + void secureFilterDoesNotLeakExternalEntity() throws Exception { // The f003 vector: with no caller-set parent, the input must be parsed by a secure reader, not a self-provisioned permissive one. final XMLFilter filter = SaxSurfaceTestSupport.hardenedFactory().newXMLFilter(AttackTestSupport.streamSource(IDENTITY_XSLT)); assertFalse(filterAndCapture(filter, entityPayload()).contains(AttackTestSupport.LEAKED_MARKER), "external entity through XMLFilter leaked"); } @Test - void hardenedFilterFromTemplatesDoesNotLeakDocument() throws Exception { + void secureFilterFromTemplatesDoesNotLeakDocument() throws Exception { final SAXTransformerFactory factory = SaxSurfaceTestSupport.hardenedFactory(); final Templates templates = factory.newTemplates(AttackTestSupport.resourceSource("with-document.xsl")); assertNotNull(templates, "stylesheet failed to compile"); diff --git a/src/test/java/org/apache/commons/xml/XPathInputSourceTest.java b/src/test/java/org/apache/commons/xml/XPathInputSourceTest.java index 4cee3af..c21aada 100644 --- a/src/test/java/org/apache/commons/xml/XPathInputSourceTest.java +++ b/src/test/java/org/apache/commons/xml/XPathInputSourceTest.java @@ -49,7 +49,7 @@ private static String entityPayload() { } @Test - void hardenedXPathEvaluateDoesNotLeak() throws Exception { + void secureXPathEvaluateDoesNotLeak() throws Exception { // Deterministic on every engine: the entity is declared in the internal subset and the floor resolves only its // external content — to empty replacement text — so the pre-parse completes and the reference expands to nothing. final String result = SecureXPathFactory.newInstance().newXPath().evaluate(EXPRESSION, AttackTestSupport.inputSource(entityPayload())); @@ -57,7 +57,7 @@ void hardenedXPathEvaluateDoesNotLeak() throws Exception { } @Test - void hardenedXPathEvaluatesPlainDocument() throws Exception { + void secureXPathEvaluatesPlainDocument() throws Exception { // Positive control: the secure pre-parse still evaluates an entity-free document end to end. final String result = SecureXPathFactory.newInstance().newXPath().evaluate(EXPRESSION, AttackTestSupport.inputSource(AttackTestSupport.xmlBody("plain text"))); @@ -65,7 +65,7 @@ void hardenedXPathEvaluatesPlainDocument() throws Exception { } @Test - void hardenedXPathExpressionEvaluateDoesNotLeak() throws Exception { + void secureXPathExpressionEvaluateDoesNotLeak() throws Exception { // Same declared-entity outcome as above on the compiled-expression entry point. final String result = SecureXPathFactory.newInstance().newXPath().compile(EXPRESSION).evaluate(AttackTestSupport.inputSource(entityPayload())); assertFalse(result.contains(AttackTestSupport.LEAKED_MARKER), "external entity leaked into the compiled XPath result: " + result);
