fix(route53): compare alias target DNS names canonically (#6357)

Fold only ASCII DNS letters and accept an optional trailing dot while keeping distinct target values and rejected batches intact. Exercise compatibility cases using the suite endpoint.

Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
This commit is contained in:
Andre Kurait authored and GitHub committed 2026-10-23 13:49:29 -04:00
1 parent 7e6439cf86
commit 1f31f5bf48
4 files changed
+174 -1

No files matched your search

@@ -1033,10 +1033,31 @@ public class Route53Service implements Resettable {
return a == b;
}
return Objects.equals(a.getHostedZoneId(), b.getHostedZoneId())
&& Objects.equals(a.getDnsName(), b.getDnsName())
&& aliasDnsNamesMatch(a.getDnsName(), b.getDnsName())
&& a.isEvaluateTargetHealth() == b.isEvaluateTargetHealth();
}
private static boolean aliasDnsNamesMatch(String a, String b) {
if (a == null || b == null) {
return a == b;
}
String left = normalizeName(a);
String right = normalizeName(b);
if (left.length() != right.length()) {
return false;
}
for (int i = 0; i < left.length(); i++) {
if (asciiLower(left.charAt(i)) != asciiLower(right.charAt(i))) {
return false;
}
}
return true;
}
private static char asciiLower(char c) {
return c >= 'A' && c <= 'Z' ? (char) (c + ('a' - 'A')) : c;
}
private static boolean recordValuesMatch(List<ResourceRecord> a, List<ResourceRecord> b) {
List<String> av = a == null ? List.of() : a.stream().map(ResourceRecord::getValue).sorted().toList();
List<String> bv = b == null ? List.of() : b.stream().map(ResourceRecord::getValue).sorted().toList();