Skip to content

Commit f031f27

Browse files
committed
Fix 1/3 of #1855
1 parent e4f83bd commit f031f27

File tree

3 files changed

+20
-10
lines changed

3 files changed

+20
-10
lines changed

release-notes/VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Project: jackson-databind
1212
(reported by Villane@github)
1313
#1680: Blacklist couple more types for deserialization
1414
#1737: Block more JDK types from polymorphic deserialization
15+
#1855: (partial) Blacklist for more serialization gadgets (dbcp/tomcat)
1516

1617
2.7.9.1 (18-Apr-2017)
1718

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ public class BeanDeserializerFactory
6868
s.add("org.springframework.beans.factory.config.PropertyPathFactoryBean");
6969
s.add("com.mchange.v2.c3p0.JndiRefForwardingDataSource");
7070
s.add("com.mchange.v2.c3p0.WrapperConnectionPoolDataSource");
71-
71+
// [databind#1855]: more 3rd party
72+
s.add("org.apache.tomcat.dbcp.dbcp2.BasicDataSource");
73+
s.add("com.sun.org.apache.bcel.internal.util.ClassLoader");
7274
DEFAULT_NO_DESER_CLASS_NAMES = Collections.unmodifiableSet(s);
7375
}
7476

src/test/java/com/fasterxml/jackson/databind/interop/IllegalTypesCheckTest.java

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,15 @@ public void testXalanTypes1599() throws Exception
5858

5959
public void testJDKTypes1737() throws Exception
6060
{
61-
_testTypes1737(java.util.logging.FileHandler.class);
62-
_testTypes1737(java.rmi.server.UnicastRemoteObject.class);
61+
_testIllegalType(java.util.logging.FileHandler.class);
62+
_testIllegalType(java.rmi.server.UnicastRemoteObject.class);
63+
}
64+
65+
// // // Tests for [databind#1855]
66+
public void testJDKTypes1855() throws Exception
67+
{
68+
// apparently included by JDK?
69+
_testIllegalType("com.sun.org.apache.bcel.internal.util.ClassLoader");
6370
}
6471

6572
// 17-Aug-2017, tatu: Ideally would test handling of 3rd party types, too,
@@ -69,22 +76,22 @@ public void testJDKTypes1737() throws Exception
6976
/*
7077
public void testSpringTypes1737() throws Exception
7178
{
72-
_testTypes1737("org.springframework.aop.support.AbstractBeanFactoryPointcutAdvisor");
73-
_testTypes1737("org.springframework.beans.factory.config.PropertyPathFactoryBean");
79+
_testIllegalType("org.springframework.aop.support.AbstractBeanFactoryPointcutAdvisor");
80+
_testIllegalType("org.springframework.beans.factory.config.PropertyPathFactoryBean");
7481
}
7582
7683
public void testC3P0Types1737() throws Exception
7784
{
78-
_testTypes1737("com.mchange.v2.c3p0.JndiRefForwardingDataSource");
79-
_testTypes1737("com.mchange.v2.c3p0.WrapperConnectionPoolDataSource");
85+
_testIllegalType("com.mchange.v2.c3p0.JndiRefForwardingDataSource");
86+
_testIllegalType("com.mchange.v2.c3p0.WrapperConnectionPoolDataSource");
8087
}
8188
*/
8289

83-
private void _testTypes1737(Class<?> nasty) throws Exception {
84-
_testTypes1737(nasty.getName());
90+
private void _testIllegalType(Class<?> nasty) throws Exception {
91+
_testIllegalType(nasty.getName());
8592
}
8693

87-
private void _testTypes1737(String clsName) throws Exception
94+
private void _testIllegalType(String clsName) throws Exception
8895
{
8996
// While usually exploited via default typing let's not require
9097
// it here; mechanism still the same

0 commit comments

Comments
 (0)