Class SecureXMLFactory
java.lang.Object
org.episteme.core.io.SecureXMLFactory
Utility class for creating secure XML parsers.
All XML parsers created through this class are configured to prevent XML External Entity (XXE) attacks and other XML-based vulnerabilities.
- Since:
- 2.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
-
Method Summary
Modifier and TypeMethodDescriptionstatic DocumentBuilderCreates a secure DocumentBuilder with XXE protection.static DocumentBuilderFactoryCreates a secure DocumentBuilderFactory with XXE protection.static DocumentBuilderFactoryCreates a secure namespace-aware DocumentBuilderFactory with XXE protection.static SAXParserCreates a secure SAXParser with XXE protection.static SAXParserFactoryCreates a secure SAXParserFactory with XXE protection.static TransformerFactoryCreates a secure TransformerFactory with XXE protection.static XMLInputFactoryCreates a secure XMLInputFactory for StAX parsing with XXE protection.
-
Method Details
-
createSecureDocumentBuilderFactory
public static DocumentBuilderFactory createSecureDocumentBuilderFactory() throws ParserConfigurationExceptionCreates a secure DocumentBuilderFactory with XXE protection.- Returns:
- a securely configured DocumentBuilderFactory
- Throws:
ParserConfigurationException- if security features cannot be set
-
createSecureDocumentBuilder
Creates a secure DocumentBuilder with XXE protection.- Returns:
- a securely configured DocumentBuilder
- Throws:
ParserConfigurationException- if security features cannot be set
-
createSecureNamespaceAwareDocumentBuilderFactory
public static DocumentBuilderFactory createSecureNamespaceAwareDocumentBuilderFactory() throws ParserConfigurationExceptionCreates a secure namespace-aware DocumentBuilderFactory with XXE protection.- Returns:
- a securely configured DocumentBuilderFactory
- Throws:
ParserConfigurationException- if security features cannot be set
-
createSecureSAXParserFactory
public static SAXParserFactory createSecureSAXParserFactory() throws ParserConfigurationException, SAXExceptionCreates a secure SAXParserFactory with XXE protection.- Returns:
- a securely configured SAXParserFactory
- Throws:
ParserConfigurationException- if security features cannot be setSAXException- if a SAX error occurs
-
createSecureSAXParser
Creates a secure SAXParser with XXE protection.- Returns:
- a securely configured SAXParser
- Throws:
ParserConfigurationException- if security features cannot be setSAXException- if a SAX error occurs
-
createSecureXMLInputFactory
Creates a secure XMLInputFactory for StAX parsing with XXE protection.- Returns:
- a securely configured XMLInputFactory
-
createSecureTransformerFactory
Creates a secure TransformerFactory with XXE protection.- Returns:
- a securely configured TransformerFactory
-