File tree 1 file changed +7
-0
lines changed
src/main/java/com/fasterxml/jackson/databind/ext
1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change 2
2
3
3
import java .io .StringReader ;
4
4
5
+ import javax .xml .XMLConstants ;
5
6
import javax .xml .parsers .DocumentBuilder ;
6
7
import javax .xml .parsers .DocumentBuilderFactory ;
7
8
import javax .xml .parsers .ParserConfigurationException ;
@@ -29,6 +30,12 @@ public abstract class DOMDeserializer<T> extends FromStringDeserializer<T>
29
30
parserFactory .setNamespaceAware (true );
30
31
// [databind#1279]: make sure external entities NOT expanded by default
31
32
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
+ }
32
39
DEFAULT_PARSER_FACTORY = parserFactory ;
33
40
}
34
41
You can’t perform that action at this time.
0 commit comments