Skip to content

armgit / floci

Public Imported from GitHub
0

Light, fluffy, and always free - The AWS Local Emulator alternative

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

Hector Venturae73b80d5ee22
diff --git a/src/main/java/io/github/hectorvent/floci/services/ce/CostAnomalyService.java b/src/main/java/io/github/hectorvent/floci/services/ce/CostAnomalyService.java
index 4509d0d6ec..26496a1cff 100644
--- a/src/main/java/io/github/hectorvent/floci/services/ce/CostAnomalyService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/ce/CostAnomalyService.java
@@ -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;
diff --git a/src/main/java/io/github/hectorvent/floci/services/ecr/EcrService.java b/src/main/java/io/github/hectorvent/floci/services/ecr/EcrService.java
index 778e41d464..90ac23310e 100644
--- a/src/main/java/io/github/hectorvent/floci/services/ecr/EcrService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/ecr/EcrService.java
@@ -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")) {
diff --git a/src/main/java/io/github/hectorvent/floci/services/iam/IamService.java b/src/main/java/io/github/hectorvent/floci/services/iam/IamService.java
index 5b2e8b362e..3814f0697e 100644
--- a/src/main/java/io/github/hectorvent/floci/services/iam/IamService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/iam/IamService.java
@@ -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",