Backport PR #5964 into 2.18 to fix #5962 - #6039
Merged
Merged
Conversation
1 task
Member
|
@pjfanning Failure could be due to different defaults for |
Member
Author
|
@cowtowncoder FAIL_ON_UNKNOWN_PROPERTIES was the reason the test failed after the change. Is this ok to merge as is or do we need to come up with a fix that works when FAIL_ON_UNKNOWN_PROPERTIES is enabled? |
Member
|
@pjfanning I think this is sufficient -- as long as by-pass can no longer occur, exact exception (esp. in case of 2.x) does not seem that important? |
Member
|
Just need to add release notes entry (copy from 3.1.4 to 2.18.9 section) and I can merge this PR, merge forward, update wikis. EDIT: added release notes, will merge. |
Member
|
Thank you @pjfanning ! |
3 tasks
jkschneider
pushed a commit
to moderne-backpatch-alliance/backpatch-jackson-databind
that referenced
this pull request
Sep 16, 2026
…er case-insensitive matching Port of upstream bc1613c ("Backport PR FasterXML#5964 into 2.18 to fix FasterXML#5962", FasterXML#6039), shipped in 2.18.9, onto the 2.13.5 baseline. BeanDeserializerBase.createContextual() first calls _handleByNameInclusion() to apply the per-property @JsonIgnoreProperties exclusions, producing a contextual deserializer whose BeanPropertyMap no longer carries the ignored properties. If the property ALSO carries @jsonformat(with = Feature.ACCEPT_CASE_INSENSITIVE_PROPERTIES), the block that follows rebuilt the case-insensitive map from `_beanProperties` -- this deserializer's ORIGINAL, unfiltered map -- and then installed it on the contextual one. Every property the exclusion had just removed came back, and case-insensitive lookup then routed the incoming field to it. A declared @JsonIgnoreProperties("adminKey") stopped holding, which is a write to a field the application had declared off-limits to JSON. The fix reads contextual._beanProperties instead, so the rebuild starts from the filtered map. NOT A CHERRY-PICK: the commit also edits release-notes/VERSION-2.x and CREDITS-2.x, which have no 2.18 section at this baseline and conflict. The production hunk merged with no conflict and is upstream's bytes -- one changed line plus upstream's three-line comment. Binary compatibility: no API change of any kind; one expression inside an existing method body. BEHAVIOUR CHANGE: a property excluded by a per-property @JsonIgnoreProperties stays excluded when case-insensitive matching is enabled on the same property. A consumer that (knowingly or not) depended on the property being writable again will now see it ignored -- which is the CVE. Regression gate: IgnorePropertiesCaseInsensitive5962Test, upstream's own file for the issue, converted from JUnit 5 on DatabindTestUtil (neither exists at this baseline) to JUnit 3 on BaseMapTest: @test dropped, methods renamed to the testXxx form, and assertNotEquals rewritten in JUnit 4's (message, unexpected, actual) argument order. The DTOs, payloads and asserted values are upstream's, including its own negative control -- the same document against a container WITHOUT the case-insensitive format override, which passes on the unpatched baseline and is what shows the exclusion mechanism itself was never broken. Upstream-Commit: bc1613c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
backports test from 3.x branch.
#5964 #5962
One of the tests is broken:
I applied the fix from #5964 but it didn't fix the issue in the 2.18 code base.
The test fails in a different way with the 3.1 fix.