fix(route53): reject record sets outside the hosted zone (#6412)

* fix(route53): reject record sets outside the hosted zone

ChangeResourceRecordSets fails with InvalidChangeBatch when a record set's
name is neither the zone's name nor a name under it, comparing names
without regard to case or a trailing dot. Wildcard names under the zone
still pass.

* fix(route53): match zone names with ASCII folding and accept any name in the root zone

The hosted-zone check uses normalizeRecordName, the same ASCII-only folding
as record identity, so the Kelvin sign in a label stays distinct from the
letter k. The root zone, named with a single dot, contains every record name.
This commit is contained in:
lex00 authored and GitHub committed 2026-10-26 18:03:21 -04:00
1 parent 1bf019f89a
commit 1b7bb80f36
2 files changed
+57

No files matched your search

@@ -972,6 +972,13 @@ public class Route53Service implements Resettable {
private void validateChange(String action, ResourceRecordSet rrs,
List<ResourceRecordSet> current, String zoneName) {
String recordName = normalizeRecordName(rrs.getName());
String zone = normalizeRecordName(zoneName);
if (!".".equals(zone) && !recordName.equals(zone) && !recordName.endsWith("." + zone)) {
throw new AwsException("InvalidChangeBatch",
"RRSet with DNS name " + normalizeName(rrs.getName()) + " is not permitted in zone "
+ normalizeName(zoneName), 400);
}
if ("DELETE".equals(action) && isApexSoaOrNs(rrs, zoneName)) {
throw new AwsException("InvalidChangeBatch",
"Invalid resource record set: Deleting the SOA or NS record at the zone apex is not permitted.", 400);