Skip to content

Instantly share code, notes, and snippets.

@conikeec
Created May 6, 2018 00:52
Show Gist options
  • Save conikeec/48bbdbdf954942100100d059b1622b8c to your computer and use it in GitHub Desktop.
Save conikeec/48bbdbdf954942100100d059b1622b8c to your computer and use it in GitHub Desktop.
protected void checkIllegalTypes(DeserializationContext ctxt, JavaType type, BeanDescription beanDesc)
throws JsonMappingException
{
// There are certain nasty classes that could cause problems, mostly
// via default typing -- catch them here.
Class<?> raw = type.getRawClass();
String name = raw.getSimpleName();
if ("TemplatesImpl".equals(name)) { // [databind#1599]
if (raw.getName().startsWith("com.sun.org.apache.xalan")) {
throw JsonMappingException.from(ctxt,
String.format("Illegal type (%s) to deserialize: prevented for security reasons", name));
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment