Skip to content

Commit

Permalink
Merge pull request #704 from goldmansachs/xml-security
Browse files Browse the repository at this point in the history
Disable access to external entities in XML parsing
  • Loading branch information
opatrascoiu authored Sep 9, 2024
2 parents f32dbfd + 3fa673d commit 331e322
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public void serialize(NSElement element, JsonGenerator gen, SerializerProvider s
private static String toXml(Element element) {
try {
TransformerFactory factory = TransformerFactory.newInstance();
factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
factory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, "");
factory.setAttribute(XMLConstants.ACCESS_EXTERNAL_SCHEMA, "");
StringWriter writer = new StringWriter();
Expand Down

0 comments on commit 331e322

Please sign in to comment.