Skip to content

Commit 261ea42

Browse files
committed
Minor addition to #1279
1 parent e0e2de6 commit 261ea42

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/main/java/com/fasterxml/jackson/databind/ext/DOMDeserializer.java

+7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import java.io.StringReader;
44

5+
import javax.xml.XMLConstants;
56
import javax.xml.parsers.DocumentBuilder;
67
import javax.xml.parsers.DocumentBuilderFactory;
78
import javax.xml.parsers.ParserConfigurationException;
@@ -29,6 +30,12 @@ public abstract class DOMDeserializer<T> extends FromStringDeserializer<T>
2930
parserFactory.setNamespaceAware(true);
3031
// [databind#1279]: make sure external entities NOT expanded by default
3132
parserFactory.setExpandEntityReferences(false);
33+
// ... and in general, aim for "safety"
34+
try {
35+
parserFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
36+
} catch(ParserConfigurationException pce) {
37+
// not much point to do anything; could log but...
38+
}
3239
DEFAULT_PARSER_FACTORY = parserFactory;
3340
}
3441

0 commit comments

Comments
 (0)