Skip to content

Commit 3d93270

Browse files
Fix #2589 (#2901)
Co-authored-by: Tatu Saloranta <[email protected]>
1 parent c818d4d commit 3d93270

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

release-notes/CREDITS-2.x

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -872,3 +872,8 @@ Kaki King (kingkk9279@g)
872872
Jon Anderson (Jon901@github)
873873
* Reported #2544: java.lang.NoClassDefFoundError Thrown for compact profile1
874874
(2.9.10.2)
875+
876+
Bartosz Baranowski (baranowb@github)
877+
* Reported #2589: `DOMDeserializer`: setExpandEntityReferences(false) may not prevent
878+
external entity expansion in all cases
879+
(2.9.10.7)

release-notes/VERSION-2.x

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ Project: jackson-databind
66

77
2.9.10.7 (not yet released)
88

9+
#2589: `DOMDeserializer`: setExpandEntityReferences(false) may not prevent
10+
external entity expansion in all cases
11+
(reported by Bartosz B)
12+
913
#2854: Block one more gadget type (javax.swing, CVE-2020-xxx)
1014
(reported by Yangkun(ICSL))
1115

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ public abstract class DOMDeserializer<T> extends FromStringDeserializer<T>
3939
// 14-Jul-2016, tatu: Not sure how or why, but during code coverage runs
4040
// (via Cobertura) we get `java.lang.AbstractMethodError` so... ignore that too
4141
}
42+
43+
// [databind#2589] add two more settings just in case
44+
try {
45+
parserFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
46+
} catch (Throwable t) { } // as per previous one, nothing much to do
47+
try {
48+
parserFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
49+
} catch (Throwable t) { } // as per previous one, nothing much to do
4250
DEFAULT_PARSER_FACTORY = parserFactory;
4351
}
4452

0 commit comments

Comments
 (0)