Skip to content

Commit f4e8de5

Browse files
committed
Prepare for 2.7.9.1
1 parent 6ce32ff commit f4e8de5

File tree

3 files changed

+33
-12
lines changed

3 files changed

+33
-12
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
<groupId>com.fasterxml.jackson.core</groupId>
1212
<artifactId>jackson-databind</artifactId>
13-
<version>2.7.10-SNAPSHOT</version>
13+
<version>2.7.9.1-SNAPSHOT</version>
1414
<name>jackson-databind</name>
1515
<packaging>bundle</packaging>
1616
<description>General data-binding functionality for Jackson: works on core streaming API</description>

release-notes/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Project: jackson-databind
44
=== Releases ===
55
------------------------------------------------------------------------
66

7-
2.7.10 (not yet released)
7+
2.7.9.1 (18-Apr-2017)
88

99
#1599: Jackson Deserializer security vulnerability
1010
(reported by ayound@github)

src/main/java/com/fasterxml/jackson/databind/deser/BeanDeserializerFactory.java

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,32 @@ public class BeanDeserializerFactory
3939
private final static Class<?>[] INIT_CAUSE_PARAMS = new Class<?>[] { Throwable.class };
4040

4141
private final static Class<?>[] NO_VIEWS = new Class<?>[0];
42-
42+
43+
/**
44+
* Set of well-known "nasty classes", deserialization of which is considered dangerous
45+
* and should (and is) prevented by default.
46+
*/
47+
protected final static Set<String> DEFAULT_NO_DESER_CLASS_NAMES;
48+
static {
49+
Set<String> s = new HashSet<String>();
50+
// Courtesy of [https://github.com/kantega/notsoserial]:
51+
// (and wrt [databind#1599]
52+
s.add("org.apache.commons.collections.functors.InvokerTransformer");
53+
s.add("org.apache.commons.collections.functors.InstantiateTransformer");
54+
s.add("org.apache.commons.collections4.functors.InvokerTransformer");
55+
s.add("org.apache.commons.collections4.functors.InstantiateTransformer");
56+
s.add("org.codehaus.groovy.runtime.ConvertedClosure");
57+
s.add("org.codehaus.groovy.runtime.MethodClosure");
58+
s.add("org.springframework.beans.factory.ObjectFactory");
59+
s.add("com.sun.org.apache.xalan.internal.xsltc.trax.TemplatesImpl");
60+
DEFAULT_NO_DESER_CLASS_NAMES = Collections.unmodifiableSet(s);
61+
}
62+
63+
/**
64+
* Set of class names of types that are never to be deserialized.
65+
*/
66+
protected Set<String> _cfgIllegalClassNames = DEFAULT_NO_DESER_CLASS_NAMES;
67+
4368
/*
4469
/**********************************************************
4570
/* Life-cycle
@@ -846,15 +871,11 @@ protected void checkIllegalTypes(DeserializationContext ctxt, JavaType type,
846871
{
847872
// There are certain nasty classes that could cause problems, mostly
848873
// via default typing -- catch them here.
849-
Class<?> raw = type.getRawClass();
850-
String name = raw.getSimpleName();
851-
852-
if ("TemplatesImpl".equals(name)) { // [databind#1599]
853-
if (raw.getName().startsWith("com.sun.org.apache.xalan")) {
854-
throw JsonMappingException.from(ctxt,
855-
String.format("Illegal type (%s) to deserialize: prevented for security reasons",
856-
name));
857-
}
874+
String full = type.getRawClass().getName();
875+
876+
if (_cfgIllegalClassNames.contains(full)) {
877+
throw JsonMappingException.from(ctxt,
878+
String.format("Illegal type (%s) to deserialize: prevented for security reasons", full));
858879
}
859880
}
860881
}

0 commit comments

Comments
 (0)