fix: bring the partition literals that merged past the gate back under it (#4314)

Three pull requests merged after the partition-literal gate (#4270) without ever
running it, because their CI started before the gate existed on their base, so
main has failed the gate for every pull request since: CostAnomalyService
(#4221) spelled its own partition alternation in the SNS topic ARN pattern,
EcrService (#4304) did the same in the pull-through-cache credential ARN pattern
and compared a host against public.ecr.aws, and IamService (#4298) built the
credential report's root ARN with a literal arn:aws:. The two patterns now use
AwsArnUtils.PARTITION_REGEX, the root ARN is minted through AwsArnUtils like
every other IAM ARN in the file, and the ECR Public host carries the gate's
escape comment: it is that registry's fixed name and the service exists only in
the commercial partition.
This commit is contained in:
Hector Ventura authored and GitHub committed 2026-09-24 10:17:30 -04:00
1 parent 204e509e82
commit e73b80d5ee
3 files changed
+4 -4

No files matched your search

@@ -36,7 +36,7 @@ public class CostAnomalyService implements Resettable {
private static final Pattern EMAIL = Pattern.compile(
"^[a-zA-Z0-9.!#$%&'*+=?^_`{|}~-]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$");
private static final Pattern SNS = Pattern.compile(
"^arn:aws[a-zA-Z-]*:sns:[a-zA-Z0-9-]+:[0-9]{12}:[a-zA-Z0-9_-]+(\\.fifo)?$");
"^arn:" + AwsArnUtils.PARTITION_REGEX + ":sns:[a-zA-Z0-9-]+:[0-9]{12}:[a-zA-Z0-9_-]+(\\.fifo)?$");
private final AccountAwareStorageBackend<ObjectNode> monitors;
private final AccountAwareStorageBackend<ObjectNode> subscriptions;
@@ -47,7 +47,7 @@ public class EcrService implements ResourceProvider {
+ "(?:(?:\\.|_|__|-+)[a-z0-9]+)*)*/?|ROOT)");
private static final Pattern REGISTRY_ID = Pattern.compile("[0-9]{12}");
private static final Pattern CREDENTIAL_ARN = Pattern.compile(
"arn:aws(?:-\\w+)*:secretsmanager:[a-zA-Z0-9-:]+:secret:ecr-pullthroughcache/"
"arn:" + AwsArnUtils.PARTITION_REGEX + ":secretsmanager:[a-zA-Z0-9-:]+:secret:ecr-pullthroughcache/"
+ "[a-zA-Z0-9/_+=.@-]+");
private static final Set<String> UPSTREAM_REGISTRIES = Set.of(
"ecr", "ecr-public", "quay", "k8s", "docker-hub",
@@ -954,7 +954,7 @@ public class EcrService implements ResourceProvider {
if (host.equals("registry-1.docker.io")) {
return "docker-hub";
}
if (host.equals("public.ecr.aws")) {
if (host.equals("public.ecr.aws")) { // partition-literal: ECR Public's fixed registry host; the service exists only in the commercial partition
return "ecr-public";
}
if (host.equals("quay.io")) {
@@ -2959,7 +2959,7 @@ public class IamService implements SessionAccountLookup, ResourceProvider {
}
private String rootAccountReportRow() {
String arn = "arn:aws:iam::" + regionResolver.getAccountId() + ":root";
String arn = AwsArnUtils.Arn.of("iam", "", regionResolver.getAccountId(), "root").toString();
return String.join(",",
"<root_account>", arn, "N/A",
"FALSE", "N/A", "N/A", "not_supported",