Skip to content

Commit bed2546

Browse files
authored
Upgrade Jackson dependency to a safe version (#703)
# Summary Upgrades Jackson from 2.15.2 to 2.18.6 to fix GHSA-72hv-8253-57qq (High severity, CVSS 8.7), a denial-of-service vulnerability in jackson-core's async JSON parser. # Motivation The async JSON parser in jackson-core versions prior to 2.18.6 does not enforce the maxNumberLength constraint (default: 1000 characters), while the synchronous parser does. This allows an attacker to submit JSON with arbitrarily long numeric values, causing memory and CPU exhaustion — particularly in reactive/non-blocking applications (e.g. Spring WebFlux). This is classified as CWE-770 (Allocation of Resources Without Limits or Throttling). The SDK currently pins Jackson at 2.15.2, which falls in the vulnerable range (2.0.0–2.18.5). All consumers of the SDK inherit this version, so the fix must be applied upstream here rather than overridden at each consumer. # Changes - databricks-sdk-java/pom.xml: Bumps jackson.version from 2.15.2 to 2.18.6 (affects jackson-core, jackson-databind, jackson-annotations, jackson-datatype-jsr310, jackson-datatype-guava). Adds jackson-datatype-jdk8 as a new dependency. - SerDeUtils.java: Registers Jdk8Module on the shared ObjectMapper. This is required because Jackson 2.18.x no longer serializes/deserializes java.util.Optional types by default — the SDK's Request class uses Optional<Boolean> for redirectionBehavior, which fails without this module. # Test plan - All 1093 existing unit tests pass with no changes needed. - The jackson-datatype-jdk8 module addition was validated by the ApiClientTest.errorDetails test, which exercises serialization of Request objects containing Optional fields. NO_CHANGELOG=true
1 parent 0afd4ef commit bed2546

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

databricks-sdk-java/pom.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<name>Databricks SDK for Java</name>
1212
<properties>
1313
<httpclient.version>4.5.14</httpclient.version>
14-
<jackson.version>2.15.2</jackson.version>
14+
<jackson.version>2.18.6</jackson.version>
1515
<junit-bom.version>5.10.0</junit-bom.version>
1616
<maven.compiler.source>1.8</maven.compiler.source>
1717
<maven.compiler.target>1.8</maven.compiler.target>
@@ -110,6 +110,12 @@
110110
<artifactId>jackson-datatype-guava</artifactId>
111111
<version>${jackson.version}</version>
112112
</dependency>
113+
<!-- Jackson JDK8 module needed to serialize/deserialize java.util.Optional -->
114+
<dependency>
115+
<groupId>com.fasterxml.jackson.datatype</groupId>
116+
<artifactId>jackson-datatype-jdk8</artifactId>
117+
<version>${jackson.version}</version>
118+
</dependency>
113119
<!-- Google Auto Value -->
114120
<dependency>
115121
<groupId>com.google.auto.value</groupId>

databricks-sdk-java/src/main/java/com/databricks/sdk/core/utils/SerDeUtils.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import com.fasterxml.jackson.databind.ObjectMapper;
77
import com.fasterxml.jackson.databind.SerializationFeature;
88
import com.fasterxml.jackson.datatype.guava.GuavaModule;
9+
import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
910
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
1011

1112
/** Utilities for serialization and deserialization in the Databricks Java SDK. */
@@ -16,6 +17,7 @@ public static ObjectMapper createMapper() {
1617
mapper
1718
.registerModule(new JavaTimeModule())
1819
.registerModule(new GuavaModule())
20+
.registerModule(new Jdk8Module())
1921
.registerModule(new ProtobufModule())
2022
.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false)
2123
.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false)

0 commit comments

Comments
 (0)