Skip to content

[build] Harden Java reader codec and Avro parser dependencies - #11660

Open
Gabriel39 wants to merge 1 commit into
apache:masterfrom
Gabriel39:fix/reader-security-dependencies
Open

Gabriel39 wants to merge 1 commit into
apache:masterfrom
Gabriel39:fix/reader-security-dependencies

Conversation

@Gabriel39

Copy link
Copy Markdown
Contributor

Purpose

Harden the dependencies used by Paimon's Java file readers when an embedding application reads files from less-trusted sources.

  • Upgrade snappy-java from 1.1.10.8 to 1.1.10.12. Avro obtains an uncompressed length before allocating the destination buffer; the fixed library rejects impossible lengths before that allocation.
  • Upgrade the maintained at.yawk.lz4:lz4-java from 1.10.4 to 1.14.1, including the fix for unsafe JNI native-library extraction.
  • Import Jackson BOM 2.18.11 locally in paimon-format so the parser relocated into the Avro format enforces document-depth constraints. This is intentionally scoped to the format module rather than changing Jackson resolution in every engine integration.
  • Pin Commons Compress 1.28.0, its Commons IO 2.20.0 and Commons Codec 1.19.0 runtime dependencies, and include Codec in the relocation allowlist. Keep Snappy and Zstandard container reads working in the resulting shaded JAR.
  • Update the affected dependency NOTICE entries, including filesystem bundles that inherit ${snappy.version}.

Dependency advisories and conditions

The following are existing upstream dependency CVEs. Exposure depends on which reader/backend runs and on the embedding application's trust boundaries; see Paimon's security model.

Advisory Affected dependency versions / first fixed release Relevant path and required conditions Status on the audited master
CVE-2026-108106 org.xerial.snappy:snappy-java <= 1.1.10.8; fixed in 1.1.10.9 Avro Snappy blocks controlled by an untrusted source; the caller uses the declared uncompressed length to allocate before decoding. Excessive allocation can exhaust JVM memory. Addressed here, using 1.1.10.12.
CVE-2026-106451 at.yawk.lz4:lz4-java <= 1.11.3; fixed in 1.11.4. The legacy org.lz4:lz4-java line is affected from 1.7.0 through 1.8.1. JNI initialization falls back to extracting the bundled library; another local user can write to the same temporary directory and the host permits the replacement race. A system-installed library, private temporary directory, or Java-only backend avoids this extraction path. Addressed here, using 1.14.1.
CVE-2025-52999 com.fasterxml.jackson.core:jackson-core < 2.15.0; fixed in 2.15.0 Avro parses a deeply nested file-provided schema through its embedded Jackson parser; older parsing/schema conversion can overflow the stack. Addressed here for Avro's relocated parser, using 2.18.11. The separate shared paimon-shade-jackson-2 artifact is discussed below.
CVE-2025-67721 io.airlift:aircompressor < 2.0.3; fixed in 2.0.3 (aircompressor-v3 is a separate artifact, fixed in 3.4). Malformed Snappy/LZ4 input reaches a Java decompressor and the output buffer is reused without clearing previous contents, potentially exposing those contents. ORC's Java Snappy path is relevant in older bundles. Already fixed by master's 2.0.3; no version change here.
CVE-2025-66566 Maintained LZ4 fork <= 1.10.0; fixed in 1.10.1. Legacy LZ4 Java/pure-Java coordinates also contain affected implementations. Malformed LZ4 input reaches an affected Java decompressor with a reused, uncleared output buffer. Legacy LZ4 Parquet pages are one relevant format path. Already outside the affected range at master's 1.10.4. Retained by the upgrade to 1.14.1.
CVE-2025-12183 Legacy org.lz4:lz4-java <= 1.8.0; fixed in maintained at.yawk.lz4:lz4-java:1.8.1. Untrusted raw LZ4 blocks reach an affected fast decompression backend; out-of-bounds operations can cause denial of service or adjacent-memory disclosure. Already outside the affected range in the maintained 1.10.4 dependency. Retained by this upgrade.

These conditions apply independently: reused buffers are required for the two stale-buffer disclosures; shared temporary-directory access is required for the JNI extraction issue.

Audited Paimon release versions

The release-tag POM declarations were checked individually. This table identifies bundled dependency versions; it does not assert that every deployment of these releases is exploitable or that an external dependency override has the same versions.

Audited Paimon tags Snappy LZ4 Aircompressor Shared shaded Jackson
1.0.0, 1.0.1, 1.1.0, 1.1.1, 1.2.0, 1.3.0, 1.3.1, 1.3.2 1.1.8.4 legacy 1.8.0 0.27 2.14.2
1.4.1, 1.4.2, 2.0.0, 2.1.0, 2.1.1 1.1.10.8 maintained 1.10.4 2.0.3 2.14.2
master at a0a72519cbb2de6cc8e55a3efbbf130971441bcb 1.1.10.8 maintained 1.10.4 2.0.3 2.14.2

Examples of the inspected declarations: 1.1.1, 1.3.2, 1.4.2, 2.1.1. Avro's own transitive Jackson copy is separate from the shared shaded Jackson column; the new test reproduces a stack overflow with Jackson 2.14.3 and rejects the input with the upgraded parser.

The shared org.apache.paimon.shade.jackson2.* parser is maintained in apache/paimon-shade; its existing upgrade is tracked by paimon-shade#22 and #7431. This PR keeps its current published coordinate, so it builds independently and does not claim to fix that separate copy. Adopting a newly published shared Jackson artifact remains follow-up work.

No public Paimon API or on-disk format is changed.

Tests

Passed on JDK 17 with the normal Checkstyle, Spotless and enforcer checks enabled: 78 tests, 0 failures, 0 errors, 0 skipped, plus successful packaging of both Hadoop shaded modules.

mvn -pl paimon-format,paimon-filesystems/paimon-hadoop-shaded,paimon-filesystems/paimon-hadoop-shaded-3.4 -am \
  -Dtest=AvroDependencySecurityTest,AvroFileFormatTest,AvroFormatReadWriteTest,OrcFileFormatTest,ParquetFileFormatTest,BlockCompressionTest \
  -DfailIfNoTests=false package
  • Negative control using Jackson 2.14.3 / Snappy 1.1.10.8: the two rejection tests fail; deeply nested Avro schema parsing throws StackOverflowError, and an implausible Snappy length is accepted.
  • Re-ran the same four regression cases against the final relocated format JAR: all four passed, including Snappy/Zstandard container round trips. Verified that its relocated Commons IO and Commons Codec classes are present.
  • Byte-compared Snappy.class in both final Hadoop shaded JARs with the published 1.1.10.12 artifact: both match.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant