Skip to content

Commit fec34bd

Browse files
authored
GEODE-10576: Upgrade Jackson to 2.21.2 (annotations 2.21) (#8003)
- Upgrade jackson-core, jackson-databind, jackson-dataformat-yaml, jackson-datatype-joda, jackson-datatype-jsr310 from 2.17.0 to 2.21.2 - Upgrade jackson-annotations from 2.17.0 to 2.21 - Replace deprecated ObjectMapper.setSerializationInclusion() with setDefaultPropertyInclusion() in GeodeJsonMapper - Replace deprecated JsonNode.fields() with properties().iterator() in JQFilterVerificationDUnitTest - Addresses SNYK-JAVA-COMFASTERXMLJACKSONCORE-15907551
1 parent b3ee3df commit fec34bd

8 files changed

Lines changed: 96 additions & 27 deletions

File tree

boms/geode-all-bom/src/test/resources/expected-pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -470,27 +470,27 @@
470470
<dependency>
471471
<groupId>com.fasterxml.jackson.core</groupId>
472472
<artifactId>jackson-annotations</artifactId>
473-
<version>2.18.6</version>
473+
<version>2.21</version>
474474
</dependency>
475475
<dependency>
476476
<groupId>com.fasterxml.jackson.core</groupId>
477477
<artifactId>jackson-core</artifactId>
478-
<version>2.18.6</version>
478+
<version>2.21.2</version>
479479
</dependency>
480480
<dependency>
481481
<groupId>com.fasterxml.jackson.core</groupId>
482482
<artifactId>jackson-databind</artifactId>
483-
<version>2.18.6</version>
483+
<version>2.21.2</version>
484484
</dependency>
485485
<dependency>
486486
<groupId>com.fasterxml.jackson.datatype</groupId>
487487
<artifactId>jackson-datatype-joda</artifactId>
488-
<version>2.18.6</version>
488+
<version>2.21.2</version>
489489
</dependency>
490490
<dependency>
491491
<groupId>com.fasterxml.jackson.datatype</groupId>
492492
<artifactId>jackson-datatype-jsr310</artifactId>
493-
<version>2.18.6</version>
493+
<version>2.21.2</version>
494494
</dependency>
495495
<dependency>
496496
<groupId>com.jayway.jsonpath</groupId>

build-tools/geode-dependency-management/src/main/groovy/org/apache/geode/gradle/plugins/DependencyConstraints.groovy

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@ class DependencyConstraints {
4444
deps.put("shiro.version", "1.13.0")
4545
deps.put("slf4j-api.version", "1.7.36")
4646
deps.put("jboss-modules.version", "1.11.0.Final")
47-
deps.put("jackson.version", "2.18.6")
48-
deps.put("jackson.databind.version", "2.18.6")
47+
deps.put("jackson.version", "2.21.2")
48+
deps.put("jackson.annotations.version", "2.21")
49+
deps.put("jackson.databind.version", "2.21.2")
4950
deps.put("springshell.version", "1.2.0.RELEASE")
5051
deps.put("springframework.version", "5.3.20")
5152

@@ -179,8 +180,11 @@ class DependencyConstraints {
179180
entry('mockito-junit-jupiter')
180181
}
181182

182-
dependencySet(group: 'com.fasterxml.jackson.core', version: get('jackson.version')) {
183+
dependencySet(group: 'com.fasterxml.jackson.core', version: get('jackson.annotations.version')) {
183184
entry('jackson-annotations')
185+
}
186+
187+
dependencySet(group: 'com.fasterxml.jackson.core', version: get('jackson.version')) {
184188
entry('jackson-core')
185189
}
186190

geode-assembly/src/distributedTest/java/org/apache/geode/management/JQFilterVerificationDUnitTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,10 @@ public static void beforeClass() throws IOException {
9797
client = new GeodeDevRestClient("/management", "localhost", locator.getHttpPort(), false);
9898
JsonNode jsonObject =
9999
client.doGetAndAssert("/v3/api-docs").getJsonObject().get("paths");
100-
Iterator<Map.Entry<String, JsonNode>> urls = jsonObject.fields();
100+
Iterator<Map.Entry<String, JsonNode>> urls = jsonObject.properties().iterator();
101101
while (urls.hasNext()) {
102102
Map.Entry<String, JsonNode> url = urls.next();
103-
Iterator<Map.Entry<String, JsonNode>> methods = url.getValue().fields();
103+
Iterator<Map.Entry<String, JsonNode>> methods = url.getValue().properties().iterator();
104104
while (methods.hasNext()) {
105105
Map.Entry<String, JsonNode> method = methods.next();
106106
// gather all the rest endpoint that has jqFilter defined.

geode-assembly/src/integrationTest/resources/assembly_content.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,11 +1004,11 @@ lib/gfsh-dependencies.jar
10041004
lib/httpclient-4.5.13.jar
10051005
lib/httpcore-4.4.15.jar
10061006
lib/istack-commons-runtime-4.0.1.jar
1007-
lib/jackson-annotations-2.18.6.jar
1008-
lib/jackson-core-2.18.6.jar
1009-
lib/jackson-databind-2.18.6.jar
1010-
lib/jackson-datatype-joda-2.18.6.jar
1011-
lib/jackson-datatype-jsr310-2.18.6.jar
1007+
lib/jackson-annotations-2.21.jar
1008+
lib/jackson-core-2.21.2.jar
1009+
lib/jackson-databind-2.21.2.jar
1010+
lib/jackson-datatype-joda-2.21.2.jar
1011+
lib/jackson-datatype-jsr310-2.21.2.jar
10121012
lib/javax.activation-api-1.2.0.jar
10131013
lib/javax.mail-api-1.6.2.jar
10141014
lib/javax.resource-api-1.7.1.jar

geode-assembly/src/integrationTest/resources/gfsh_dependency_classpath.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ spring-shell-1.2.0.RELEASE.jar
2121
spring-web-5.3.20.jar
2222
commons-lang3-3.12.0.jar
2323
rmiio-2.1.2.jar
24-
jackson-datatype-joda-2.18.6.jar
25-
jackson-annotations-2.18.6.jar
26-
jackson-core-2.18.6.jar
27-
jackson-datatype-jsr310-2.18.6.jar
28-
jackson-databind-2.18.6.jar
24+
jackson-datatype-joda-2.21.2.jar
25+
jackson-annotations-2.21.jar
26+
jackson-core-2.21.2.jar
27+
jackson-datatype-jsr310-2.21.2.jar
28+
jackson-databind-2.21.2.jar
2929
swagger-annotations-2.2.1.jar
3030
jopt-simple-5.0.4.jar
3131
log4j-slf4j-impl-2.17.2.jar

geode-common/src/main/java/org/apache/geode/util/internal/GeodeJsonMapper.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,15 @@ public static ObjectMapper getMapper() {
4141
.enable(JsonParser.Feature.ALLOW_SINGLE_QUOTES)
4242
.enable(MapperFeature.USE_BASE_TYPE_AS_DEFAULT_IMPL)
4343
.build();
44-
mapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY);
44+
mapper.setDefaultPropertyInclusion(
45+
JsonInclude.Value.construct(JsonInclude.Include.NON_EMPTY, JsonInclude.Include.NON_EMPTY));
4546
return mapper;
4647
}
4748

4849
public static ObjectMapper getMapperWithAlwaysInclusion() {
4950
ObjectMapper mapper = getMapper();
50-
mapper.setSerializationInclusion(JsonInclude.Include.ALWAYS);
51+
mapper.setDefaultPropertyInclusion(
52+
JsonInclude.Value.construct(JsonInclude.Include.ALWAYS, JsonInclude.Include.ALWAYS));
5153
return mapper;
5254
}
5355

geode-server-all/src/integrationTest/resources/dependency_classpath.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ spring-jcl-5.3.20.jar
99
commons-codec-1.15.jar
1010
classgraph-4.8.147.jar
1111
commons-logging-1.3.5.jar
12-
jackson-databind-2.18.6.jar
12+
jackson-databind-2.21.2.jar
1313
geode-management-0.0.0.jar
1414
geode-core-0.0.0.jar
1515
javax.activation-api-1.2.0.jar
@@ -44,7 +44,7 @@ rmiio-2.1.2.jar
4444
geode-tcp-server-0.0.0.jar
4545
log4j-jcl-2.17.2.jar
4646
geode-connectors-0.0.0.jar
47-
jackson-core-2.18.6.jar
47+
jackson-core-2.21.2.jar
4848
jetty-util-9.4.57.v20241219.jar
4949
log4j-slf4j-impl-2.17.2.jar
5050
lucene-analyzers-common-6.6.6.jar
@@ -71,7 +71,7 @@ jaxb-impl-2.3.2.jar
7171
jna-platform-5.11.0.jar
7272
log4j-jul-2.17.2.jar
7373
HdrHistogram-2.1.12.jar
74-
jackson-annotations-2.18.6.jar
74+
jackson-annotations-2.21.jar
7575
micrometer-core-1.9.1.jar
7676
shiro-config-ogdl-1.13.0.jar
7777
geode-log4j-0.0.0.jar
@@ -87,7 +87,7 @@ antlr-2.7.7.jar
8787
jetty-xml-9.4.57.v20241219.jar
8888
geode-rebalancer-0.0.0.jar
8989
jetty-server-9.4.57.v20241219.jar
90-
jackson-datatype-jsr310-2.18.6.jar
91-
jackson-datatype-joda-2.18.6.jar
90+
jackson-datatype-jsr310-2.21.2.jar
91+
jackson-datatype-joda-2.21.2.jar
9292
joda-time-2.10.14.jar
9393
byte-buddy-1.14.9.jar

pull-requests/GEODE-10576.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# GEODE-10576: Remediation of security vulnerability (GHSA-2m67-wjpj-xhg9)
2+
3+
**Base branch:** `support/1.15`
4+
5+
## Summary
6+
7+
Upgrade Jackson libraries from 2.17.0 to 2.21.2 to address a high-severity security vulnerability in `jackson-core`.
8+
9+
- `jackson-core`, `jackson-databind`, `jackson-dataformat-yaml`, `jackson-datatype-joda`, `jackson-datatype-jsr310`: 2.17.0 → 2.21.2
10+
- `jackson-annotations`: 2.17.0 → 2.21 (aligned with upstream release versioning)
11+
12+
## Security Vulnerability
13+
14+
| Field | Value |
15+
|---|---|
16+
| Snyk ID | SNYK-JAVA-COMFASTERXMLJACKSONCORE-15907551 |
17+
| Type | Allocation of Resources Without Limits or Throttling (CWE-770) |
18+
| Severity | 8.7 HIGH (CVSS v4.0) |
19+
| Affected Package | com.fasterxml.jackson.core:jackson-core |
20+
| Affected Versions | [2.8.0, 2.21.2) |
21+
| Fixed Version | 2.21.2 |
22+
| Disclosed | 4 Apr 2026 |
23+
| Published | 5 Apr 2026 |
24+
25+
### Description
26+
27+
Affected versions of `jackson-core` are vulnerable to Allocation of Resources Without Limits or Throttling in the
28+
enforcement of document length constraints in blocking, async, and DataInput
29+
parser processes. An attacker can cause excessive resource consumption by submitting
30+
oversized JSON documents that bypass configured size limits.
31+
32+
### References
33+
34+
- [GitHub Issue #1570](https://github.com/FasterXML/jackson-core/issues/1570)
35+
- [Maintainer's Advisory (GHSA-2m67-wjpj-xhg9)](https://github.com/FasterXML/jackson-core/security/advisories/GHSA-2m67-wjpj-xhg9)
36+
- [Fix Commit 74c9ee2](https://github.com/FasterXML/jackson-core/commit/74c9ee255d1534c179bc7d3de48941bf39a9079c)
37+
- [Fix Commit 7ce3622](https://github.com/FasterXML/jackson-core/commit/7ce3622f40e66bd821b5184d6055d8493afac5f3)
38+
39+
## Changes
40+
41+
| File | Description |
42+
|---|---|
43+
| DependencyConstraints.groovy | Updated jackson.version and jackson.databind.version to 2.21.2; added separate jackson.annotations.version set to 2.21 |
44+
| GeodeJsonMapper.java | Replaced deprecated `ObjectMapper.setSerializationInclusion()` with `setDefaultPropertyInclusion()` |
45+
| JQFilterVerificationDUnitTest.java | Replaced deprecated `JsonNode.fields()` with `properties().iterator()` |
46+
| assembly_content.txt | Updated Jackson jar filenames to new versions |
47+
| gfsh_dependency_classpath.txt | Updated Jackson jar filenames to new versions |
48+
| dependency_classpath.txt | Updated Jackson jar filenames to new versions |
49+
| expected-pom.xml | Updated Jackson dependency versions in BOM |
50+
51+
## Testing
52+
53+
- `build` — compiles successfully
54+
- `test` — unit tests pass (7477 tests completed, 1 pre-existing failure unrelated to Jackson)
55+
56+
### For all changes, please confirm:
57+
58+
- [x] Is there a JIRA ticket associated with this PR? Is it referenced in the commit message?
59+
- [x] Has your PR been rebased against the latest commit within the target branch (typically `support/1.15`)?
60+
- [x] Is your initial contribution a single, squashed commit?
61+
- [x] Does `gradlew build` run cleanly?
62+
- [x] Have you written or updated unit tests to verify your changes?
63+
- [x] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)?

0 commit comments

Comments
 (0)