Skip to content

Fix #5962: Case-insensitive deserialization may use wrong @JsonIgnoreProperties - #5964

Merged
cowtowncoder merged 1 commit into
3.1from
tatu-claude/3.1/5962-bean-deser-base-ci-ignore-props
May 6, 2026
Merged

cowtowncoder merged 1 commit into
3.1from
tatu-claude/3.1/5962-bean-deser-base-ci-ignore-props

Conversation

@cowtowncoder

Copy link
Copy Markdown
Member

No description provided.

@github-actions

github-actions Bot commented May 6, 2026

Copy link
Copy Markdown

🧪 Code Coverage Report

Metric Coverage Change
Instructions coverage 81.32% 📈 +0.000%
Branches branches 74.47% 📈 +0.000%

Coverage data generated from JaCoCo test results

@cowtowncoder
cowtowncoder merged commit 0e1b0b2 into 3.1 May 6, 2026
6 checks passed
@cowtowncoder
cowtowncoder deleted the tatu-claude/3.1/5962-bean-deser-base-ci-ignore-props branch May 6, 2026 01:39
* container declares @JsonIgnoreProperties("adminKey") on the field.
*/
@Test
public void test5962_caseInsensitiveRebuildRestoresIgnoredProperty() throws Exception {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused by GHSA-5jmj-h7xm-6q6v, this test fails for me with Jackson 2.21.4, suggesting that version is also affected, yet the advisory says only >= 3.1.0, < 3.1.4 is affected. What am I missing here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue was specifically reported against 3.1 -- unlike other problems that included 2.21 (and often 2.18). I assumed reported had analyzed these cases; perhaps they did not?

If test can be made to fail against 2.21 branch (or maybe even 2.18), I'd be happy to address there too. Note: PR against 2.18 is likely forward mergeable to 2.21 so one pr would be fine.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sonatype now flags it: #5962 (comment)

pjfanning added a commit to pjfanning/jackson-databind that referenced this pull request Jun 18, 2026
cowtowncoder pushed a commit that referenced this pull request Jun 18, 2026
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants