Skip to content

Commit

Permalink
Revert "fix(core): added fix for xml parser (#3100)" (#3353)
Browse files Browse the repository at this point in the history
This reverts commit c3e6d69.
  • Loading branch information
tylerjroach authored Jul 8, 2023
1 parent 2befb2b commit 22a767c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,9 @@ private static List<Region> internalParse(
Document document;
try {

DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
factory.setXIncludeAware(false);
factory.setExpandEntityReferences(false);
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();

DocumentBuilder documentBuilder = factory.newDocumentBuilder();
document = documentBuilder.parse(input);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,25 +45,7 @@ public class XpathUtils {
/** Shared logger */
private static Log log = LogFactory.getLog(XpathUtils.class);

private static DocumentBuilderFactory factory = getDocumentBuilderFactory();


/**
* Creates new documentbuilderfactory object
* @return DocumentBuilderFactory.
*/
private static DocumentBuilderFactory getDocumentBuilderFactory() {
try {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
dbf.setXIncludeAware(false); // Default false for java 8. Disable XML Inclusions leading to SSRF - https://portswigger.net/web-security/xxe/lab-xinclude-attack
dbf.setExpandEntityReferences(false);
return dbf;
}
catch (ParserConfigurationException exception){
return null;
}
}
private static DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();

/**
* InputStream to Document.
Expand Down

0 comments on commit 22a767c

Please sign in to comment.