Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,18 @@ void testNotSerializableClasses() throws IOException {
byte[] recordBytes = serializeRecord(
"{ \"org.apache.avro.specific.TestUnionRecord\": { \"amount\": { \"bytes\": \"\\u0000\" } } }", schema);

// Use a fresh SpecificData so class resolution is not served from
// SpecificData.get()'s cache (other tests in this class may have resolved
// TestUnionRecord already, and surefire 3.6.x JUnit Platform ordering can
// run them first). The test must exercise the security validator on lookup.
SpecificDatumReader<SpecificRecord> reader = new SpecificDatumReader<>(schema, schema, new SpecificData());

ClassSecurityPredicate originalValidator = ClassSecurityValidator.getGlobal();
try {
ClassSecurityValidator.setGlobal(ClassSecurityValidator.builder().build());
assertThrows(SecurityException.class, () -> deserializeRecord(schema, recordBytes));
ByteArrayInputStream in = new ByteArrayInputStream(recordBytes);
Decoder decoder = DecoderFactory.get().binaryDecoder(in, null);
assertThrows(SecurityException.class, () -> reader.read(null, decoder));
} finally {
ClassSecurityValidator.setGlobal(originalValidator);
}
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
<maven-toolchains-plugin.version>3.3.0</maven-toolchains-plugin.version>
<plugin-tools-javadoc.version>3.5.2</plugin-tools-javadoc.version>
<spotless-maven-plugin.version>3.11.0</spotless-maven-plugin.version>
<maven-surefire-plugin.version>3.5.6</maven-surefire-plugin.version>
<maven-surefire-plugin.version>3.6.1</maven-surefire-plugin.version>

<!-- Pin output timestamp to make the Java build reproducible -->
<project.build.outputTimestamp>1723122283</project.build.outputTimestamp>
Expand Down
Loading