fix(glue): bound DeleteSchemaVersions ranges before expanding them (#3508)

A Versions expression such as 1-9223372036854775807 was expanded into a
list before the 25 version limit was checked, so a single request could
exhaust memory. Reject any range that would expand to more than
MAX_DELETE_SCHEMA_VERSIONS entries with InvalidInputException up front,
and cover the exact 25 version boundary.
This commit is contained in:
Niels Kootstra authored and GitHub committed 2026-09-12 23:44:59 -04:00
1 parent 2a4ca61baf
commit 76c1907214
2 files changed
+31 -2

No files matched your search

@@ -693,6 +693,27 @@ class GlueSchemaRegistryServiceTest {
assertEquals("InvalidInputException", ex.getErrorCode());
}
@Test
void deleteSchemaVersionsRejectsHugeRangeBeforeExpansion() {
preCreateRegistry();
service.createSchema(new RegistryId("reg", null), "a", "AVRO", "BACKWARD", null, AVRO_V1, null, REGION);
AwsException ex = assertThrows(AwsException.class, () ->
service.deleteSchemaVersions(new SchemaId("reg", "a", null), "1-9223372036854775807", REGION));
assertEquals("InvalidInputException", ex.getErrorCode());
}
@Test
void deleteSchemaVersionsAcceptsRangeOfExactlyTwentyFiveVersions() {
preCreateRegistry();
service.createSchema(new RegistryId("reg", null), "a", "AVRO", "BACKWARD", null, AVRO_V1, null, REGION);
var results = service.deleteSchemaVersions(new SchemaId("reg", "a", null), "1-25", REGION);
assertEquals(25, results.size());
}
@Test
void deleteSchemaVersionsReportsErrorsForMissingVersions() {
preCreateRegistry();