Open sseelmann opened 1 month ago
Thank you for reporting this issue. I think I know why it occurs, technically speaking, but not sure how to address it.
But in the meantime... to fail on duplicate property values, generally, it's enough to enable
StreamReadFeature.STRICT_DUPLICATE_DETECTION
on JsonFactory
used to construct ObjectMapper
/ JsonMapper
.
Quoting @cowtowncoder from https://github.com/FasterXML/jackson-core/issues/60:
...JSON specification does not make duplicate Object values strictly illegal (behavior is undefined I think)...
...checking for duplicates adds non-trivial amount of cost which for valid content is pure overhead...so...add a feature to let users request that duplicate detection is enabled...
Thanks for the suggestions, but I think I won't enable the STRICT_DUPLICATE_DETECTION
feature because
Search before asking
Describe the bug
Deserialzing a JSON with a duplicated property fails for a Java Record with a single property.
Version Information
2.17.2
Reproduction
Produces the following error:
Expected behavior
Deserialization works, or a proper exception describing the problem (e.g. "duplicate property") is thrown.
Additional context
Workaround: Add a 2nd dummy property to the Java Record
Ofc the duplicate property in the JSON is not the default. It was detected during a penetration test when testing for parameter pollution vulnerabilities.