Module io.github.pixee.security
Package io.github.pixee.security
Class DocumentBuilderFactorySecurity
- java.lang.Object
-
- io.github.pixee.security.DocumentBuilderFactorySecurity
-
public final class DocumentBuilderFactorySecurity extends java.lang.ObjectThis type exposes helper methods that will help defend against XXE attacks inDocumentBuilderFactory.For more on XXE:
https://cheatsheetseries.owasp.org/cheatsheets/XML_External_Entity_Prevention_Cheat_Sheet.html
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static javax.xml.parsers.DocumentBuilderFactoryhardenDocumentBuilderFactory(javax.xml.parsers.DocumentBuilderFactory factory, boolean expandEntityReferences, boolean allowXinclude)Harden theDocumentBuilderFactoryagainst XML-based attacks, and promote directly to the API forefront the decision to allow dangerous XML features.
-
-
-
Method Detail
-
hardenDocumentBuilderFactory
public static javax.xml.parsers.DocumentBuilderFactory hardenDocumentBuilderFactory(javax.xml.parsers.DocumentBuilderFactory factory, boolean expandEntityReferences, boolean allowXinclude)Harden theDocumentBuilderFactoryagainst XML-based attacks, and promote directly to the API forefront the decision to allow dangerous XML features.- Parameters:
factory- the factory requiring hardeningexpandEntityReferences- a parameter which will be passed toDocumentBuilderFactory.setExpandEntityReferences(boolean)allowXinclude- parameter which will be passed toDocumentBuilderFactory.setXIncludeAware(boolean)- Returns:
- a factory that is hardened against XML attacks (e.g., XXE)
-
-