You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
cowtowncoder
changed the title
Add MapperFeature to allow blocking use of unsafe base type for polymorphic deserialization
Add MapperFeature.BLOCK_UNSAFE_POLYMORPHIC_BASE_TYPES to allow blocking use of unsafe base type for polymorphic deserialization
Jan 9, 2020
With 2.10 there is new
PolymorphicTypeValidator
interface that is used both with@JsonTypeInfo
) when class name is usedBut 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:enableDefaultTyping()
method (which for backwards-compatibility reasons use a lenient validator)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 ofDefaultBaseTypeLimitingValidator
in 2.11 (which by default blocks unsafe base types such asjava.lang.Object
) makes it easy to try one approach that should make it much easier to opt-in for fully safe handling: add aMapperFeature
, changing of which will then useDefaultBaseTypeLimitingValidator
for legacy use cases.Note that this issue should replace #2533 as well.
The text was updated successfully, but these errors were encountered: