1818 */
1919public class SubTypeValidator
2020{
21- protected final static String PREFIX_STRING = "org.springframework." ;
21+ protected final static String PREFIX_SPRING = "org.springframework." ;
22+
23+ protected final static String PREFIX_C3P0 = "com.mchange.v2.c3p0." ;
24+
2225 /**
2326 * Set of well-known "nasty classes", deserialization of which is considered dangerous
2427 * and should (and is) prevented by default.
@@ -45,11 +48,13 @@ public class SubTypeValidator
4548 // [databind#1737]; 3rd party
4649//s.add("org.springframework.aop.support.AbstractBeanFactoryPointcutAdvisor"); // deprecated by [databind#1855]
4750 s .add ("org.springframework.beans.factory.config.PropertyPathFactoryBean" );
48- s .add ("com.mchange.v2.c3p0.JndiRefForwardingDataSource" );
49- s .add ("com.mchange.v2.c3p0.WrapperConnectionPoolDataSource" );
51+
52+ // s.add("com.mchange.v2.c3p0.JndiRefForwardingDataSource"); // deprecated by [databind#1931]
53+ // s.add("com.mchange.v2.c3p0.WrapperConnectionPoolDataSource"); // - "" -
5054 // [databind#1855]: more 3rd party
5155 s .add ("org.apache.tomcat.dbcp.dbcp2.BasicDataSource" );
5256 s .add ("com.sun.org.apache.bcel.internal.util.ClassLoader" );
57+
5358 DEFAULT_NO_DESER_CLASS_NAMES = Collections .unmodifiableSet (s );
5459 }
5560
@@ -80,7 +85,9 @@ public void validateSubType(DeserializationContext ctxt, JavaType type) throws J
8085 // 18-Dec-2017, tatu: As per [databind#1855], need bit more sophisticated handling
8186 // for some Spring framework types
8287 // 05-Jan-2017, tatu: ... also, only applies to classes, not interfaces
83- if (!raw .isInterface () && full .startsWith (PREFIX_STRING )) {
88+ if (raw .isInterface ()) {
89+ ;
90+ } else if (full .startsWith (PREFIX_SPRING )) {
8491 for (Class <?> cls = raw ; (cls != null ) && (cls != Object .class ); cls = cls .getSuperclass ()){
8592 String name = cls .getSimpleName ();
8693 // looking for "AbstractBeanFactoryPointcutAdvisor" but no point to allow any is there?
@@ -90,6 +97,16 @@ public void validateSubType(DeserializationContext ctxt, JavaType type) throws J
9097 break main_check ;
9198 }
9299 }
100+ } else if (full .startsWith (PREFIX_C3P0 )) {
101+ // [databind#1737]; more 3rd party
102+ // s.add("com.mchange.v2.c3p0.JndiRefForwardingDataSource");
103+ // s.add("com.mchange.v2.c3p0.WrapperConnectionPoolDataSource");
104+ // [databind#1931]; more 3rd party
105+ // com.mchange.v2.c3p0.ComboPooledDataSource
106+ // com.mchange.v2.c3p0.debug.AfterCloseLoggingComboPooledDataSource
107+ if (full .endsWith ("DataSource" )) {
108+ break main_check ;
109+ }
93110 }
94111 return ;
95112 } while (false );
0 commit comments