Skip to content

Commit

Permalink
Fix DTD security issue (kitodo#5940)
Browse files Browse the repository at this point in the history
  • Loading branch information
solth authored Feb 23, 2024
1 parent 2969b18 commit e5e6d13
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ private Document stringToDocument(String xmlContent) throws ParserConfigurationE
SAXException {
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilderFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
documentBuilderFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
return documentBuilder.parse(new InputSource(new StringReader(xmlContent)));
}
Expand Down

0 comments on commit e5e6d13

Please sign in to comment.