Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Deserializers.hasDeserializerFor() (and something for DeserializerFactory) to allow detection of explicitly supported types #2539

Closed
cowtowncoder opened this issue Nov 9, 2019 · 1 comment
Labels
3.x Issues to be only tackled for Jackson 3.x, not 2.x

Comments

@cowtowncoder
Copy link
Member

Addition of "Safe Default Typing" in 2.10 is good for security, but can add complexity to actual allow-listing of types considered safe for purposes of polymorphic deserialization.

One thing that could significantly simplify adding rules would be ability to figure out types supported with explicit deserializers, provided by modules (esp. datatype ones). This should indicate all explicitly handled cases, but specifically NOT introspection based "POJO" (and similar for Scala, Kotlin) values.
If support method was added in Deserializers (and something for DeserializerFactory), we could add a mechanism in BasicPolymorphicTypeValidator to indicate something like "if type is explicitly supported, allow. This would then support things like:

  1. Basic JDK String-like types (java.net.URL, java.util.UUID)
  2. Basic (JDK) date/time types (java.util.Date / Calendar)
  3. Strings, Booleans, number wrappers
  4. JsonNode types.

and 3rd party types of Joda, Guava, etc.

cowtowncoder added a commit that referenced this issue Nov 9, 2019
cowtowncoder added a commit that referenced this issue Nov 9, 2019
cowtowncoder added a commit that referenced this issue Nov 9, 2019
cowtowncoder added a commit that referenced this issue Nov 10, 2019
cowtowncoder added a commit that referenced this issue Nov 11, 2019
@cowtowncoder cowtowncoder added 3.x Issues to be only tackled for Jackson 3.x, not 2.x and removed 2.11 labels Nov 19, 2019
@cowtowncoder
Copy link
Member Author

Alas... while I was able to add supporting functionality wrt registered deserializers in 2.11, there is a big design flaw in PolymorphicTypeValidator which prevents implements this in 2.x without backwards incompatible change: PTV actually needs DeserializationContext as DeserializationConfig is NOT enough. Too bad it is not being passed even though it would actually be available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.x Issues to be only tackled for Jackson 3.x, not 2.x
Projects
None yet
Development

No branches or pull requests

1 participant