Skip to content

Commit 7c91a05

Browse files
committed
Bump Guava to 33.7.2 and declare Jackson 2.22.4 directly
Guava 33.4.8 is affected by GHSA-xxph-c9ww-hj94 (CVE-2026-102554: uncontrolled memory allocation when deserializing CompactHashMap, CompactHashSet or MapMakerInternalMap); 33.7.2 is the first patched version. The project compiles against Jackson directly (ObjectMapper, @JsonProperty) but only received it through feign-jackson, which pins jackson-databind 2.13.4, affected by CVE-2022-42003 (and jackson-core 2.13.4 by CVE-2025-52999). jackson-databind 2.22.4 and jackson-annotations 2.22 (annotations are released once per minor line since 2.20) are now declared as direct dependencies, which also makes them visible to the repository's dependency graph. The new versions deprecate two calls in IpdataServiceBuilder; they are replaced by their documented equivalents, available since Jackson 2.7 and Guava 25: ObjectMapper.setDefaultPropertyInclusion(Include) for setSerializationInclusion(Include), and CacheBuilder.expireAfterWrite(Duration) for expireAfterWrite(long, TimeUnit). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
1 parent c7b6446 commit 7c91a05

2 files changed

Lines changed: 23 additions & 8 deletions

File tree

‎pom.xml‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@
4040
<version.build.jacoco>0.8.14</version.build.jacoco>
4141
<version.build.surefire>3.5.5</version.build.surefire>
4242
<version.client.feign>11.10</version.client.feign>
43+
<version.client.jackson>2.22.4</version.client.jackson>
44+
<!-- jackson-annotations is released once per minor line (2.20, 2.21, 2.22, ...) -->
45+
<version.client.jackson.annotations>2.22</version.client.jackson.annotations>
4346
</properties>
4447
<dependencies>
4548
<dependency>
@@ -57,6 +60,16 @@
5760
<artifactId>feign-java11</artifactId>
5861
<version>${version.client.feign}</version>
5962
</dependency>
63+
<dependency>
64+
<groupId>com.fasterxml.jackson.core</groupId>
65+
<artifactId>jackson-databind</artifactId>
66+
<version>${version.client.jackson}</version>
67+
</dependency>
68+
<dependency>
69+
<groupId>com.fasterxml.jackson.core</groupId>
70+
<artifactId>jackson-annotations</artifactId>
71+
<version>${version.client.jackson.annotations}</version>
72+
</dependency>
6073
<dependency>
6174
<groupId>io.github.openfeign</groupId>
6275
<artifactId>feign-httpclient</artifactId>
@@ -66,7 +79,7 @@
6679
<dependency>
6780
<groupId>com.google.guava</groupId>
6881
<artifactId>guava</artifactId>
69-
<version>33.4.8-jre</version>
82+
<version>33.7.2-jre</version>
7083
</dependency>
7184
<dependency>
7285
<groupId>org.slf4j</groupId>

‎src/main/java/io/ipdata/client/service/IpdataServiceBuilder.java‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import org.slf4j.LoggerFactory;
2020

2121
import java.net.URL;
22+
import java.time.Duration;
2223

2324
import static com.fasterxml.jackson.databind.PropertyNamingStrategies.SNAKE_CASE;
2425

@@ -64,7 +65,7 @@ public static IpdataServiceBuilder of(URL url, String key, CacheConfig cacheConf
6465
public IpdataService build() {
6566
final ObjectMapper mapper = new ObjectMapper();
6667
mapper.setPropertyNamingStrategy(SNAKE_CASE);
67-
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
68+
mapper.setDefaultPropertyInclusion(JsonInclude.Include.NON_NULL);
6869
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
6970
mapper.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY);
7071

@@ -98,13 +99,14 @@ public IpdataService build() {
9899
.target(IpdataInternalSingleFieldClient.class, url.toString());
99100

100101
if (cacheConfig != null) {
102+
final Duration expiry = Duration.of(cacheConfig.timeout(), cacheConfig.unit().toChronoUnit());
101103
CachingInternalClient cachingInternalClient = CachingInternalClient.builder()
102104
.expiry(cacheConfig.timeout())
103105
.unit(cacheConfig.unit())
104106
.maxSize(cacheConfig.maxSize())
105107
.ipdataCache(
106108
CacheBuilder.newBuilder()
107-
.expireAfterWrite(cacheConfig.timeout(), cacheConfig.unit())
109+
.expireAfterWrite(expiry)
108110
.maximumSize(cacheConfig.maxSize())
109111
.build(new CacheLoader<String, IpdataModel>() {
110112
@Override
@@ -115,7 +117,7 @@ public IpdataModel load(String key) throws Exception {
115117
)
116118
.fieldsCache(
117119
CacheBuilder.newBuilder()
118-
.expireAfterWrite(cacheConfig.timeout(), cacheConfig.unit())
120+
.expireAfterWrite(expiry)
119121
.maximumSize(cacheConfig.maxSize())
120122
.build(new CacheLoader<HashPair<String, String>, IpdataModel>() {
121123
@Override
@@ -126,7 +128,7 @@ public IpdataModel load(HashPair<String, String> key) throws Exception {
126128
)
127129
.asnCache(
128130
CacheBuilder.newBuilder()
129-
.expireAfterWrite(cacheConfig.timeout(), cacheConfig.unit())
131+
.expireAfterWrite(expiry)
130132
.maximumSize(cacheConfig.maxSize())
131133
.build(new CacheLoader<String, AsnModel>() {
132134
@Override
@@ -137,7 +139,7 @@ public AsnModel load(String key) throws Exception {
137139
)
138140
.tzCache(
139141
CacheBuilder.newBuilder()
140-
.expireAfterWrite(cacheConfig.timeout(), cacheConfig.unit())
142+
.expireAfterWrite(expiry)
141143
.maximumSize(cacheConfig.maxSize())
142144
.build(new CacheLoader<String, TimeZone>() {
143145
@Override
@@ -148,7 +150,7 @@ public TimeZone load(String key) throws Exception {
148150
)
149151
.currencyCache(
150152
CacheBuilder.newBuilder()
151-
.expireAfterWrite(cacheConfig.timeout(), cacheConfig.unit())
153+
.expireAfterWrite(expiry)
152154
.maximumSize(cacheConfig.maxSize())
153155
.build(new CacheLoader<String, Currency>() {
154156
@Override
@@ -159,7 +161,7 @@ public Currency load(String key) throws Exception {
159161
)
160162
.threatCache(
161163
CacheBuilder.newBuilder()
162-
.expireAfterWrite(cacheConfig.timeout(), cacheConfig.unit())
164+
.expireAfterWrite(expiry)
163165
.maximumSize(cacheConfig.maxSize())
164166
.build(new CacheLoader<String, ThreatModel>() {
165167
@Override

0 commit comments

Comments
 (0)