With 2.10 there is new PolymorphicTypeValidator interface that is used both with
- Default Typing
- Explicit per-type/per-property polymorphic handling (
@JsonTypeInfo) when class name is used
But although use of PTV is needed for new methods to enable (1), and may be used when building ObjectMapper for (2), there are existing use cases that are not affected:
- Legacy
enableDefaultTyping() method (which for backwards-compatibility reasons use a lenient validator)
- Cases where no PTV is configured for annotation-based approach (similarly, default PTV is lenient for backwards compatibility).
Now: we can not really change the behavior to override lenient PTV for legacy usage, but what we can do is add a MapperFeature that will do this. Introduction of DefaultBaseTypeLimitingValidator in 2.11 (which by default blocks unsafe base types such as java.lang.Object) makes it easy to try one approach that should make it much easier to opt-in for fully safe handling: add a MapperFeature, changing of which will then use DefaultBaseTypeLimitingValidator for legacy use cases.
Note that this issue should replace #2533 as well.