…lines 1–16 unchanged (16 lines)
17 * @since 2.8.11
18 */
19public class SubTypeValidator
20{
21 protected final static String PREFIX_SPRING = "org.springframework.";
22
23 protected final static String PREFIX_C3P0 = "com.mchange.v2.c3p0.";
24
25 /**
26 * Set of well-known "nasty classes", deserialization of which is considered dangerous
27 * and should (and is) prevented by default.
28 */
29 protected final static Set<String> DEFAULT_NO_DESER_CLASS_NAMES;
…lines 30–92 unchanged (63 lines)
93 // looking for "AbstractBeanFactoryPointcutAdvisor" but no point to allow any is there?
94 if ("AbstractPointcutAdvisor".equals(name)
95 // ditto for "FileSystemXmlApplicationContext": block all ApplicationContexts
96 || "AbstractApplicationContext".equals(name)) {
97 break main_check;
98 }
99 }
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 }
110 }
111 return;
112 } while (false);
113
114 throw JsonMappingException.from(ctxt,
115 String.format("Illegal type (%s) to deserialize: prevented for security reasons", full));
116 }
117}
118