[HIVE-30027] Upgrade avro from 1.12.0 to 1.12.2 vul fix - #6760
[HIVE-30027] Upgrade avro from 1.12.0 to 1.12.2 vul fix#6760Akanksha-kedia wants to merge 2 commits into
Conversation
|
Found and fixed the Jenkins failure ( Root cause: Avro's 1.12.x line added Test fix pushed: trust the test's own fixture class via Bigger concern: I deliberately did not try to work around that in production code, since picking a trust boundary there (e.g. blanket-trusting a package) is a real design/security decision that risks reintroducing the exact class of vulnerability this Avro change closes, and affects real users' arbitrary class names — not something to decide unilaterally in a version-bump PR. Wanted to surface it explicitly so a maintainer can weigh in on whether this needs a migration note, a Hive-side default-trust mechanism, or should hold until that's resolved. @ayushtkn @uros-b flagging for your take given the security angle. |
|
Correction: my first fix (`System.setProperty(...)` in `@BeforeClass`) did not actually work — Jenkins re-ran and hit the identical `SecurityException` at the shifted line number, confirming it. `ClassSecurityValidator` reads its trusted-classes allowlist once when it's first loaded, not per-call, and something in the same Surefire fork can trigger that load before `@BeforeClass` runs — so setting it at test runtime is too late regardless of which method it's in. Fixed properly now: moved the trust declaration into `kafka-handler/pom.xml`'s own `maven-surefire-plugin` `systemPropertyVariables`, so it's present as a JVM property from fork startup. Reverted the ineffective test-file change. (Separately, the `TestLlapZookeeperRegistryImpl` failure in the same run is under Jenkins' own "Existing failures" bucket — pre-existing, unrelated to this change.) |
|
cc @abstractdog |
61e789a to
82664f5
Compare
Avro 1.12.2 fixes a CVE by rejecting unrestricted deserialization of arbitrary classes as SpecificRecord unless explicitly trusted via org.apache.avro.SERIALIZABLE_CLASSES/SERIALIZABLE_PACKAGES. AvroBytesConverterTest's SpecificDatumWriter/Reader usage now needs its fixture class trusted explicitly; this is declared as a JVM system property via kafka-handler/pom.xml's maven-surefire-plugin systemPropertyVariables so it's present from fork startup.
82664f5 to
ecc0bec
Compare
|
Rebased on latest master, fresh CI run triggered. @ayushtkn @uros-b @abstractdog could you take a look, especially the production-path SecurityException concern flagged above? |
| <plugin> | ||
| <groupId>org.apache.maven.plugins</groupId> | ||
| <artifactId>maven-surefire-plugin</artifactId> | ||
| <configuration> | ||
| <!-- Avro's ClassSecurityValidator reads the trusted-classes allowlist once when it is | ||
| first loaded, so it must be present as a JVM system property from fork startup; | ||
| setting it at test runtime (e.g. in @BeforeClass) is too late. Scoped to this | ||
| module's own SimpleRecord test fixture (used by AvroBytesConverterTest), not a | ||
| repo-wide trust grant. --> | ||
| <systemPropertyVariables> | ||
| <org.apache.avro.SERIALIZABLE_CLASSES>org.apache.hadoop.hive.kafka.SimpleRecord</org.apache.avro.SERIALIZABLE_CLASSES> | ||
| </systemPropertyVariables> | ||
| </configuration> |
There was a problem hiding this comment.
Not very straight forward, do you have idea what introduced this? I am even not sure if this is only test only fix and blast during runtime, did you reproduced it locally and verified it works by this change? I doubt
There was a problem hiding this comment.
What introduced this: Avro 1.12.x added org.apache.avro.util.ClassSecurityValidator, which as of 1.12.2 rejects resolving any class as SpecificRecord unless explicitly trusted via org.apache.avro.SERIALIZABLE_CLASSES/SERIALIZABLE_PACKAGES. AvroBytesConverterTest hits this because KafkaAvroSerializer.serialize() builds a SpecificDatumWriter, which resolves this test's SimpleRecord fixture — now forbidden by default.
Reproduced locally: reverting this systemPropertyVariables change and rerunning AvroBytesConverterTest fails deterministically with:
java.lang.SecurityException: Forbidden org.apache.hadoop.hive.kafka.SimpleRecord! This class is not trusted...
at org.apache.avro.specific.SpecificDatumWriter.<init>
at io.confluent.kafka.serializers.AbstractKafkaAvroSerializer.serializeImpl
With it restored, mvn -pl kafka-handler test -Dtest=AvroBytesConverterTest passes 5/5.
To your "test-only" question — it's not. KafkaSerDe.AvroBytesConverter.getWritable() (the production deserialization path) builds a SpecificDatumReader, going through the identical SpecificData.getClass() check. Any real user querying Kafka Avro data via Confluent Schema Registry + code-generated SpecificRecord classes will hit the same SecurityException at runtime after this bump — this test just happens to be what caught it in CI. I didn't add a production-side trust workaround because picking that trust boundary is a real security decision (risks reintroducing the CVE this Avro change closes) and affects arbitrary user class names — not something to decide unilaterally in a version-bump PR. Wanted your take on whether this needs a Hive-side default-trust mechanism, a migration note, or should block until resolved.
|
@ayushtkn — what introduced this: Avro 1.12.x added Reproduced locally just now: reverting the With the property restored, To your point — this is not just a test-only fix. |
…fka driver TestMiniHiveKafkaCliDriver (kafka_storage_handler.q) produces its test data via QTestMiniClusters#getAvroRows(), which builds a SpecificDatumWriter from Wikipedia's schema. Avro 1.12.x's ClassSecurityValidator forbids that class resolution unless explicitly trusted, same as the kafka-handler unit test fix in this PR. Declared via maven-surefire-plugin systemPropertyVariables so it's present from JVM fork startup, not via @BeforeClass (already shown unreliable for this exact failure mode earlier in this PR).
|
Found and fixed another instance of the same root cause, and confirmed the itests/qtest — Caveat: I could not run this specific test end-to-end locally — building the full
|
|



What changes were proposed in this pull request?
Bumps the
avro.versionproperty from1.12.0to1.12.2— a patch-level release within the same minor line.Why are the changes needed?
Picks up upstream Avro bug fixes from the 1.12.x line. All modules in this repo declare the bare
avro/avro-mapredartifacts with no version override, relying on the root pom'sdependencyManagementvia${avro.version}, so this single property change covers the whole build consistently.Does this PR introduce any user-facing change?
No.
How was this patch tested?
Verified no module declares an independent avro version that would need to stay in sync (checked
standalone-metastore/pom.xmlspecifically, which has its own copies of some other version properties, but not avro). Could not run a full Maven build in my environment to compile-verify.