fix(acm): reject empty SAN arrays in certificate requests (#5688)

RequestCertificate answers an explicit empty SubjectAlternativeNames
array with a 400 ValidationException, as ACM does: the API requires at
least one name in the list. CloudFormation certificate resources keep
accepting an empty list and request the certificate for the domain
name alone, as before.

Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>
This commit is contained in:
Jackson Price authored and GitHub committed 2026-10-14 20:57:53 -04:00
1 parent 190ed52249
commit e15c081d33
5 files changed
+107 -1

No files matched your search

@@ -100,7 +100,13 @@ public class AcmJsonHandler {
"Value null at 'domainName' failed to satisfy constraint: Member must not be null"))
.build();
}
List<String> sans = parseStringList(request.path("SubjectAlternativeNames"));
JsonNode sanNode = request.path("SubjectAlternativeNames");
if (sanNode.isArray() && sanNode.isEmpty()) {
throw new AwsException("ValidationException",
"1 validation error detected: Value '[]' at 'subjectAlternativeNames' failed to satisfy "
+ "constraint: Member must have length greater than or equal to 1", 400);
}
List<String> sans = parseStringList(sanNode);
ValidationMethod validationMethod = parseValidationMethod(request.path("ValidationMethod").asText(null));
String idempotencyToken = request.path("IdempotencyToken").asText(null);
KeyAlgorithm keyAlgorithm = KeyAlgorithm.fromAwsName(request.path("KeyAlgorithm").asText(null));