Package de.businesscode.util.xml
Class SecureXmlFactory
java.lang.Object
de.businesscode.util.xml.SecureXmlFactory
Factory methods preventing XXE attacks, according to OWASP
Cheat Sheet
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic DocumentBuilderFactorystatic SAXParserFactorystatic SAXTransformerFactorystatic TransformerFactorystatic XMLInputFactoryCreate an XMLInputFactory which is save against injection attacks If you need XInclude, enable it explicitly after retrieving thisstatic XMLReader
-
Constructor Details
-
SecureXmlFactory
public SecureXmlFactory()
-
-
Method Details
-
newXMLInputFactory
Create an XMLInputFactory which is save against injection attacks If you need XInclude, enable it explicitly after retrieving this- Returns:
-
newDocumentBuilderFactory
- Returns:
DocumentBuilderFactorywith following options set- XInclude: disabled
- Validation: disabled
- DTD: disabled
- External Entities (general+params): disabled
- Ignoring comments: true
-
newSaxParserFactory
- Returns:
SAXParserFactorywith following options set- XInclude: disabled
- Validation: disabled
- DTD: disabled
- External Entities (general+params): disabled
-
newTransformerFactory
- Returns:
TransformerFactorywith following options set- External DTD: disabled
- External Stylesheet: disabled
-
newSaxTransformerFactory
- Returns:
SAXTransformerFactorywith following options set- External DTD: disabled
- External Stylesheet: disabled
-
newXmlReader
- Returns:
XMLReaderwith following options set- XInclude: disabled
- Validation: disabled
- DTD: disabled
- External Entities (general+params): disabled
-