Skip to content

Commit 96b2ae5

Browse files
fix(vulnerability): address possible failures/vulnerability (#66)
1 parent dcd01c2 commit 96b2ae5

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

core/src/main/java/io/github/project/openubl/xsender/camel/routes/RestSunatResponseProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public void process(Exchange exchange) throws Exception {
6666

6767
Metadata metadata = Metadata.builder()
6868
.responseCode(responseErrorCode.map(Integer::parseInt).orElse(statusCode))
69-
.description(responseErrorDescription.orElseGet(null))
69+
.description(responseErrorDescription.orElse(null))
7070
.notes(Collections.emptyList())
7171
.build();
7272

core/src/main/java/io/github/project/openubl/xsender/utils/ByteUtils.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,13 @@ public static byte[] getFirstXmlFileFromZip(byte[] data) throws IOException {
5353

5454
public static Document getDocumentFromBytes(byte[] cdrXml) throws ParserConfigurationException, IOException, SAXException {
5555
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
56+
57+
factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
58+
factory.setFeature("http://xml.org/sax/features/external-general-entities", false);
59+
factory.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
60+
factory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
5661
factory.setNamespaceAware(true);
62+
5763
DocumentBuilder builder = factory.newDocumentBuilder();
5864
return builder.parse(new ByteArrayInputStream(cdrXml));
5965
}

0 commit comments

Comments
 (0)