What changed, and why it matters
This commit updates the Jackson JSON library and removes its default limit on how long a single string in JSON can be. The stated reason is that Monero's large hexadecimal fields (like transaction data) can exceed Jackson's new default cap. Removing the cap could, in principle, allow a malicious JSON response to force the library to allocate very large amounts of memory, leading to a denial-of-service crash. However, the commit itself is framed as a build/compat fix, not a security patch, and no exploit or incident is described.
Treat this as a configuration hardening review item. If Monero hex fields can exceed the default cap, set a finite upper bound based on the largest legitimate field size rather than Integer.MAX_VALUE, or enforce a separate content-length / response-size check before parsing. Verify that all RPC endpoints and JSON inputs are from trusted sources or rate-limited.
Security signals we found
Disables a built-in Jackson DoS protection (maxStringLength)
Library version bump crosses the Jackson 2.15 StreamReadConstraints introduction boundary
Change touches JSON parsing paths used for RPC and general JSON utilities
No input-size validation is added to compensate for the lifted cap
Evidence from the diff
The change bumps jackson-version from a pinned 2.13.x range to 2.21.7 and disables StreamReadConstraints.maxStringLength by setting it to Integer.MAX_VALUE in two ObjectMapper instances (JsonUtils.DEFAULT_MAPPER and MoneroRpcConnection.MAPPER). Jackson 2.15+ introduced a default maximum string length (around 5 MB) to mitigate stream-reading DoS. Lifting that cap re-enables the possibility that an attacker-supplied JSON payload containing an enormous string causes excessive memory allocation when parsed. The project justifies this because Monero hex fields can legitimately exceed the default limit.
Changed components
pom.xml dependency versioncommon.utils.JsonUtils.DEFAULT_MAPPERmonero.common.MoneroRpcConnection.MAPPERInspect captured patch +5 / −1
### pom.xml
@@ -12,7 +12,7 @@
<java-version>8</java-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<apachelog-version>2.11.0</apachelog-version>
- <jackson-version>[2.13.1, 2.13.2.2]</jackson-version>
+ <jackson-version>2.21.7</jackson-version>
<maven.test.skip>true</maven.test.skip>
</properties>
<build>
### src/main/java/common/utils/JsonUtils.java
@@ -3,6 +3,7 @@
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.core.StreamReadConstraints;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -20,6 +21,7 @@ public class JsonUtils {
static {
DEFAULT_MAPPER = new ObjectMapper();
DEFAULT_MAPPER.setSerializationInclusion(Include.NON_NULL);
+ DEFAULT_MAPPER.getFactory().setStreamReadConstraints(StreamReadConstraints.builder().maxStringLength(Integer.MAX_VALUE).build()); // hex fields can exceed jackson's default string length
}
/**
### src/main/java/monero/common/MoneroRpcConnection.java
@@ -1,6 +1,7 @@
package monero.common;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.core.StreamReadConstraints;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import common.utils.JsonUtils;
@@ -65,6 +66,7 @@ public class MoneroRpcConnection {
MAPPER = new ObjectMapper();
MAPPER.setSerializationInclusion(Include.NON_NULL);
MAPPER.configure(DeserializationFeature.USE_BIG_INTEGER_FOR_INTS, true);
+ MAPPER.getFactory().setStreamReadConstraints(StreamReadConstraints.builder().maxStringLength(Integer.MAX_VALUE).build()); // hex fields can exceed jackson's default string length
}
// instance variablesWhy this scored 34/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.