mirror of
https://github.com/floci-io/floci.git
synced 2026-11-22 21:50:46 -05:00
fix(core): read ARNs and Step Functions integration ids in every partition (#4358)
P2 of the multi-partition initiative (#4272), the parse side. StatesIntegration replaces the literal arn:aws:states::: integration ids the ASL executor and the definition validator compared against: the CDK builds them as arn:${Aws.PARTITION}:states:::, so a China or GovCloud state machine never matched (aws-cdk task-utils.ts:36). Only AWS's three suffixes (.sync, .sync:2, .waitForTaskToken) parse, and a dispatch that does not read the suffix accepts none, so sqs:sendMessage.bogus stays unsupported as it was. AwsArnUtils .resourceIfArnFor replaces the 16 startsWith("arn:aws") probes, so bucket policies, S3 resource paths, assumed-role principals, SAML role pairs, EKS instance profiles, Security Hub, OAM and CloudTrail selectors recognise China, GovCloud and ISO ARNs, and an assumed role's underlying role is rebuilt in the session's own partition. Where a check used to pin arn:aws: and thereby the commercial partition, it now pins the partition explicitly: a root principal matches only a caller of the same partition and account, and a Security Hub resource ARN must carry the request's partition. The 25 hand-rolled partition alternations in regexes collapse onto AwsArnUtils.PARTITION_REGEX. The partition-literal baseline drops from 270 to 195 gated occurrences. Part of #4272
This commit is contained in:
1 parent
6ed4726f52
commit
eb2872f578
36 files changed
+654
-153
No files matched your search
@@ -1,5 +1,7 @@
|
||||
package io.github.hectorvent.floci.core.common;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public final class AwsArnUtils {
|
||||
|
||||
private AwsArnUtils() {}
|
||||
@@ -139,6 +141,19 @@ public final class AwsArnUtils {
|
||||
return isArn(value) && value.split(":", 6)[2].equals(service);
|
||||
}
|
||||
|
||||
/**
|
||||
* The resource segment of {@code value} when it is an ARN naming {@code service} in any
|
||||
* partition, e.g. {@code bucket/key} for {@code arn:aws-cn:s3:::bucket/key}; empty otherwise.
|
||||
* The partition-tolerant replacement for {@code startsWith("arn:aws:s3:::")} followed by a
|
||||
* {@code substring} of that literal's length.
|
||||
*/
|
||||
public static Optional<String> resourceIfArnFor(String value, String service) {
|
||||
if (!isArnFor(value, service)) {
|
||||
return Optional.empty();
|
||||
}
|
||||
return Optional.of(value.split(":", 6)[5]);
|
||||
}
|
||||
|
||||
/**
|
||||
* True when the ARN names a partition other than {@code localPartition}, the one the current
|
||||
* request belongs to ({@link RegionResolver#getPartition()}). An empty partition field is
|
||||
|
||||
@@ -553,11 +553,8 @@ public class IamEnforcementFilter implements ContainerRequestFilter {
|
||||
/** Returns [bucket, key] (key may be null if the resource is a bucket-level ARN). */
|
||||
// Package-private for unit testing.
|
||||
static String[] parseS3Resource(String resource) {
|
||||
if (resource == null || !resource.startsWith("arn:aws:s3:::")) {
|
||||
return new String[] { null, null };
|
||||
}
|
||||
String tail = resource.substring("arn:aws:s3:::".length());
|
||||
if (tail.isEmpty() || "*".equals(tail)) {
|
||||
String tail = AwsArnUtils.resourceIfArnFor(resource, "s3").orElse(null);
|
||||
if (tail == null || tail.isEmpty() || "*".equals(tail)) {
|
||||
return new String[] { null, null };
|
||||
}
|
||||
int slash = tail.indexOf('/');
|
||||
@@ -634,11 +631,8 @@ public class IamEnforcementFilter implements ContainerRequestFilter {
|
||||
}
|
||||
|
||||
private static String formatS3ResourcePath(String resourceArn) {
|
||||
if (resourceArn == null || !resourceArn.startsWith("arn:aws:s3:::")) {
|
||||
return null;
|
||||
}
|
||||
String tail = resourceArn.substring("arn:aws:s3:::".length());
|
||||
if (tail.isEmpty() || "*".equals(tail)) {
|
||||
String tail = AwsArnUtils.resourceIfArnFor(resourceArn, "s3").orElse(null);
|
||||
if (tail == null || tail.isEmpty() || "*".equals(tail)) {
|
||||
return null;
|
||||
}
|
||||
return "/" + tail;
|
||||
|
||||
+1
-1
@@ -140,7 +140,7 @@ public class ApiGatewayExecuteController {
|
||||
|
||||
/** Matches an ELBv2 listener ARN (ALB {@code app/} or NLB {@code net/}); group 1 = region. */
|
||||
static final Pattern ELB_LISTENER_ARN = Pattern.compile(
|
||||
"^arn:aws[^:]*:elasticloadbalancing:([^:]+):[^:]*:listener/(?:app|net)/.+$");
|
||||
"^arn:" + AwsArnUtils.PARTITION_REGEX + ":elasticloadbalancing:([^:]+):[^:]*:listener/(?:app|net)/.+$");
|
||||
|
||||
private record AuthorizerResult(Response errorResponse, String principalId, Map<String, Object> context) {}
|
||||
|
||||
|
||||
+3
-2
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.bedrockagentcorecontrol;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import io.github.hectorvent.floci.core.common.AwsArnUtils;
|
||||
import io.github.hectorvent.floci.core.common.AwsException;
|
||||
import io.github.hectorvent.floci.core.common.Pagination;
|
||||
import io.github.hectorvent.floci.core.common.PaginatedResult;
|
||||
@@ -247,7 +248,7 @@ public class BedrockAgentCoreGatewayRuleService {
|
||||
}
|
||||
String arn = requiredText(reference, "bundleArn", field + ".bundleArn");
|
||||
String version = requiredText(reference, "bundleVersion", field + ".bundleVersion");
|
||||
if (!arn.matches("arn:aws[a-zA-Z-]*:bedrock-agentcore:[a-z0-9-]+:[0-9]{12}:configuration-bundle/[a-zA-Z][a-zA-Z0-9-_]{0,99}-[a-zA-Z0-9]{10}")) {
|
||||
if (!arn.matches("arn:" + AwsArnUtils.PARTITION_REGEX + ":bedrock-agentcore:[a-z0-9-]+:[0-9]{12}:configuration-bundle/[a-zA-Z][a-zA-Z0-9-_]{0,99}-[a-zA-Z0-9]{10}")) {
|
||||
throw new AwsException("ValidationException", field + ".bundleArn is invalid", 400);
|
||||
}
|
||||
if (!version.matches("[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}")) {
|
||||
@@ -290,7 +291,7 @@ public class BedrockAgentCoreGatewayRuleService {
|
||||
}
|
||||
JsonNode principal = entry.get("iamPrincipal");
|
||||
String arn = requiredText(principal, "arn", "iamPrincipal.arn");
|
||||
if (arn.length() > 2048 || !arn.matches("(arn:aws[a-zA-Z-]*:iam::(\\d{12}|\\*):(user|role)/[\\w+=,.@*?/-]+|arn:aws[a-zA-Z-]*:sts::(\\d{12}|\\*):assumed-role/[\\w+=,.@*?/-]+)")) {
|
||||
if (arn.length() > 2048 || !arn.matches("(arn:" + AwsArnUtils.PARTITION_REGEX + ":iam::(\\d{12}|\\*):(user|role)/[\\w+=,.@*?/-]+|arn:" + AwsArnUtils.PARTITION_REGEX + ":sts::(\\d{12}|\\*):assumed-role/[\\w+=,.@*?/-]+)")) {
|
||||
throw new AwsException("ValidationException", "iamPrincipal.arn is invalid", 400);
|
||||
}
|
||||
if (principal.hasNonNull("operator")) {
|
||||
|
||||
+2
-1
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.bedrockagentcorecontrol;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import io.github.hectorvent.floci.core.common.AwsArnUtils;
|
||||
import io.github.hectorvent.floci.core.common.AwsException;
|
||||
import io.github.hectorvent.floci.core.common.Pagination;
|
||||
import io.github.hectorvent.floci.core.common.PaginatedResult;
|
||||
@@ -353,7 +354,7 @@ public class BedrockAgentCoreToolsService {
|
||||
}
|
||||
String arn = executionRoleArn.asText();
|
||||
if (arn.length() < 1 || arn.length() > 2048
|
||||
|| !arn.matches("arn:aws(-[^:]+)?:iam::([0-9]{12})?:role/.+")) {
|
||||
|| !arn.matches("arn:" + AwsArnUtils.PARTITION_REGEX + ":iam::([0-9]{12})?:role/.+")) {
|
||||
throw new AwsException("ValidationException", "executionRoleArn is invalid", 400);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import io.github.hectorvent.floci.core.common.AwsArnUtils;
|
||||
import io.github.hectorvent.floci.core.common.AwsException;
|
||||
import io.github.hectorvent.floci.core.common.PaginatedResult;
|
||||
import io.github.hectorvent.floci.core.common.Pagination;
|
||||
@@ -31,7 +32,7 @@ import java.util.regex.Pattern;
|
||||
public class BudgetsService implements Resettable {
|
||||
private static final Pattern ACCOUNT_ID = Pattern.compile("\\d{12}");
|
||||
private static final Pattern ACTION_ID = Pattern.compile("^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$");
|
||||
private static final Pattern IAM_POLICY_ARN = Pattern.compile("^arn:aws(?:-eusc|-cn|-us-gov|-iso|-iso-[a-z])?:iam::(?:\\d{12}|aws):policy/.+$");
|
||||
private static final Pattern IAM_POLICY_ARN = Pattern.compile("^arn:" + AwsArnUtils.PARTITION_REGEX + ":iam::(?:\\d{12}|aws):policy/.+$");
|
||||
private static final Pattern SCP_POLICY_ID = Pattern.compile("^p-[0-9a-zA-Z_]{8,128}$");
|
||||
private static final Pattern SCP_TARGET_ID = Pattern.compile("^(?:ou-[0-9a-z]{4,32}-[a-z0-9]{8,32}|\\d{12})$");
|
||||
private static final Pattern SSM_INSTANCE_ID = Pattern.compile("^(?:i-(?:\\w{8}|\\w{17})|[a-zA-Z](?:[\\w-]{0,61}\\w)?)$");
|
||||
@@ -667,7 +668,7 @@ public class BudgetsService implements Resettable {
|
||||
if (create || request.has("ExecutionRoleArn")) {
|
||||
String arn = text(request, "ExecutionRoleArn");
|
||||
String account = requireAccount(request);
|
||||
if (arn == null || !arn.matches("^arn:aws(?:-eusc|-cn|-us-gov|-iso|-iso-[a-z])?:iam::" + account + ":role/.+$")) {
|
||||
if (arn == null || !arn.matches("^arn:" + AwsArnUtils.PARTITION_REGEX + ":iam::" + account + ":role/.+$")) {
|
||||
throw invalid("ExecutionRoleArn is invalid or belongs to another account.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@ApplicationScoped
|
||||
public class CloudTrailService {
|
||||
@@ -737,20 +738,21 @@ public class CloudTrailService {
|
||||
return values == null || values.isEmpty();
|
||||
}
|
||||
|
||||
private static final Pattern BARE_S3_ARN = Pattern.compile("arn:" + AwsArnUtils.PARTITION_REGEX + ":s3");
|
||||
|
||||
// Package-private for unit testing.
|
||||
static boolean matchesS3DataResourceArn(String configured, String bucketName, String key) {
|
||||
if (configured == null) return false;
|
||||
// "arn:aws:s3" (bare, no ":::") is shorthand for all buckets + all objects.
|
||||
if (configured.equals("arn:aws:s3")) return true;
|
||||
// Forms accepted:
|
||||
// "arn:<partition>:s3" (bare, no ":::") is shorthand for all buckets + all objects.
|
||||
if (BARE_S3_ARN.matcher(configured).matches()) return true;
|
||||
// Forms accepted, in any partition:
|
||||
// arn:aws:s3::: → all buckets, all keys
|
||||
// arn:aws:s3:::* → all buckets (wildcard)
|
||||
// arn:aws:s3:::bucket/ → all keys in bucket
|
||||
// arn:aws:s3:::bucket/prefix → keys with the given prefix in bucket
|
||||
// arn:aws:s3:::*/* → all objects (wildcard bucket + any key)
|
||||
String prefix = "arn:aws:s3:::";
|
||||
if (!configured.startsWith(prefix)) return false;
|
||||
String tail = configured.substring(prefix.length());
|
||||
String tail = AwsArnUtils.resourceIfArnFor(configured, "s3").orElse(null);
|
||||
if (tail == null) return false;
|
||||
if (tail.isEmpty() || tail.equals("/")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
+2
-1
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.controltower;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import io.github.hectorvent.floci.core.common.AwsArnUtils;
|
||||
import io.github.hectorvent.floci.core.common.AwsException;
|
||||
import io.github.hectorvent.floci.core.storage.StorageBackend;
|
||||
import io.github.hectorvent.floci.core.storage.StorageFactory;
|
||||
@@ -186,7 +187,7 @@ public class ControlTowerControlService {
|
||||
}
|
||||
|
||||
private static String requireArnValue(String value, String field) {
|
||||
if (value == null || value.length() < 20 || value.length() > 2048 || !value.matches("^arn:aws[0-9a-zA-Z_\\-:\\/]+$")) {
|
||||
if (value == null || value.length() < 20 || value.length() > 2048 || !value.matches("^arn:" + AwsArnUtils.PARTITION_REGEX + "[0-9a-zA-Z_\\-:\\/]+$")) {
|
||||
throw validation(field + " must be a valid ARN.");
|
||||
}
|
||||
return value;
|
||||
|
||||
+2
-1
@@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import io.github.hectorvent.floci.config.EmulatorConfig;
|
||||
import io.github.hectorvent.floci.core.common.AwsArnUtils;
|
||||
import io.github.hectorvent.floci.core.common.AwsException;
|
||||
import io.github.hectorvent.floci.core.storage.StorageBackend;
|
||||
import io.github.hectorvent.floci.core.storage.StorageFactory;
|
||||
@@ -766,7 +767,7 @@ public class ControlTowerService {
|
||||
}
|
||||
|
||||
private static boolean isArn(String value) {
|
||||
return value.length() >= 20 && value.matches("^arn:aws[0-9a-zA-Z_\\-:\\/]+$");
|
||||
return value.length() >= 20 && value.matches("^arn:" + AwsArnUtils.PARTITION_REGEX + "[0-9a-zA-Z_\\-:\\/]+$");
|
||||
}
|
||||
|
||||
private static List<String> readRemediationTypes(JsonNode request) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.github.hectorvent.floci.services.eks;
|
||||
|
||||
import io.github.hectorvent.floci.core.common.AwsArnUtils;
|
||||
import io.github.hectorvent.floci.core.common.AwsException;
|
||||
import io.github.hectorvent.floci.services.ec2.Ec2Service;
|
||||
import io.github.hectorvent.floci.services.ec2.model.Instance;
|
||||
@@ -81,7 +82,11 @@ class EksWorkerAuthentication {
|
||||
|
||||
private boolean profileMatches(Instance instance, String account, String roleName) {
|
||||
String arn = instance.getIamInstanceProfileArn();
|
||||
if (arn == null || !arn.startsWith("arn:aws:iam::" + account + ":instance-profile/")) {
|
||||
if (!AwsArnUtils.isArnFor(arn, "iam")) {
|
||||
return false;
|
||||
}
|
||||
AwsArnUtils.Arn parsed = AwsArnUtils.parse(arn);
|
||||
if (!account.equals(parsed.accountId()) || !parsed.resource().startsWith("instance-profile/")) {
|
||||
return false;
|
||||
}
|
||||
return iam.findInstanceProfile(account, arn.substring(arn.lastIndexOf('/') + 1))
|
||||
|
||||
+2
-1
@@ -1,5 +1,6 @@
|
||||
package io.github.hectorvent.floci.services.firehose;
|
||||
|
||||
import io.github.hectorvent.floci.core.common.AwsArnUtils;
|
||||
import io.github.hectorvent.floci.core.common.AwsException;
|
||||
import io.github.hectorvent.floci.services.firehose.model.DeliveryStreamDescription.ProcessingConfiguration;
|
||||
import io.github.hectorvent.floci.services.firehose.model.DeliveryStreamDescription.Processor;
|
||||
@@ -29,7 +30,7 @@ final class ProcessingConfigurationValidator {
|
||||
* which a looser pattern would have stored.
|
||||
*/
|
||||
private static final Pattern LAMBDA_ARN = Pattern.compile(
|
||||
"arn:aws[a-zA-Z-]*:lambda:[a-z0-9-]+:\\d{12}:function:[a-zA-Z0-9_-]{1,64}"
|
||||
"arn:" + AwsArnUtils.PARTITION_REGEX + ":lambda:[a-z0-9-]+:\\d{12}:function:[a-zA-Z0-9_-]{1,64}"
|
||||
+ "(:(\\$LATEST|[a-zA-Z0-9_-]{1,128}))?");
|
||||
|
||||
private ProcessingConfigurationValidator() {}
|
||||
|
||||
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.iam;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.github.hectorvent.floci.core.common.AwsArnUtils;
|
||||
import io.github.hectorvent.floci.services.iam.model.CallerContext;
|
||||
import io.github.hectorvent.floci.services.iam.model.PolicyStatement;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
@@ -41,6 +42,10 @@ import java.util.regex.Pattern;
|
||||
@ApplicationScoped
|
||||
public class IamPolicyEvaluator {
|
||||
|
||||
/** An account's root principal ({@code arn:<partition>:iam::<account>:root}) in any partition. */
|
||||
private static final Pattern ROOT_PRINCIPAL_ARN =
|
||||
Pattern.compile("arn:" + AwsArnUtils.PARTITION_REGEX + ":iam::\\d{12}:root");
|
||||
|
||||
public enum Decision { ALLOW, DENY }
|
||||
|
||||
public enum ResourcePolicyDecision {
|
||||
@@ -582,9 +587,12 @@ public class IamPolicyEvaluator {
|
||||
if (pattern.equals(accountId)) {
|
||||
return true;
|
||||
}
|
||||
} else if (pattern.matches("arn:aws:iam::\\d{12}:root")) {
|
||||
String patternAcct = pattern.substring(13, 25);
|
||||
if (patternAcct.equals(accountId)) {
|
||||
} else if (ROOT_PRINCIPAL_ARN.matcher(pattern).matches()) {
|
||||
// An account id is scoped to its partition: arn:aws-cn:iam::123:root names
|
||||
// the China account 123, which is not the commercial account 123.
|
||||
AwsArnUtils.Arn root = AwsArnUtils.parse(pattern);
|
||||
if (root.accountId().equals(accountId)
|
||||
&& root.partition().equals(AwsArnUtils.parse(principalArn).partition())) {
|
||||
return true;
|
||||
}
|
||||
} else if (globMatches(pattern, principalArn)) {
|
||||
@@ -605,27 +613,27 @@ public class IamPolicyEvaluator {
|
||||
}
|
||||
|
||||
private static String extractAccountId(String arn) {
|
||||
if (arn == null || !arn.startsWith("arn:aws:")) {
|
||||
if (!AwsArnUtils.isArn(arn)) {
|
||||
return null;
|
||||
}
|
||||
String[] parts = arn.split(":");
|
||||
if (parts.length > 4 && parts[4].matches("\\d{12}")) {
|
||||
return parts[4];
|
||||
}
|
||||
return null;
|
||||
String account = AwsArnUtils.parse(arn).accountId();
|
||||
return account.matches("\\d{12}") ? account : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* The role an assumed-role session ARN was minted from, in the session's own partition:
|
||||
* {@code arn:aws-cn:sts::1:assumed-role/r/s} names {@code arn:aws-cn:iam::1:role/r}.
|
||||
*/
|
||||
private static String extractRoleArnFromAssumedRole(String arn) {
|
||||
if (arn == null || !arn.startsWith("arn:aws:sts:")) {
|
||||
if (!AwsArnUtils.isArnFor(arn, "sts")) {
|
||||
return null;
|
||||
}
|
||||
String[] parts = arn.split(":");
|
||||
if (parts.length >= 6 && parts[5].startsWith("assumed-role/")) {
|
||||
String accountId = parts[4];
|
||||
String sessionPath = parts[5].substring("assumed-role/".length());
|
||||
AwsArnUtils.Arn parsed = AwsArnUtils.parse(arn);
|
||||
if (parsed.resource().startsWith("assumed-role/")) {
|
||||
String sessionPath = parsed.resource().substring("assumed-role/".length());
|
||||
int nextSlash = sessionPath.indexOf('/');
|
||||
String roleName = nextSlash > 0 ? sessionPath.substring(0, nextSlash) : sessionPath;
|
||||
return "arn:aws:iam::" + accountId + ":role/" + roleName;
|
||||
return AwsArnUtils.Arn.global(parsed.partition(), "iam", parsed.accountId(), "role/" + roleName).toString();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.github.hectorvent.floci.services.iam;
|
||||
|
||||
import io.github.hectorvent.floci.core.common.AwsArnUtils;
|
||||
import io.github.hectorvent.floci.services.iam.model.SAMLProvider;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.NodeList;
|
||||
@@ -132,9 +133,9 @@ final class SAMLAssertionVerifier {
|
||||
if (pair.length != 2) {
|
||||
throw invalid("role pair format");
|
||||
}
|
||||
if (pair[0].startsWith("arn:aws:iam::") && pair[1].contains(":saml-provider/")) {
|
||||
if (AwsArnUtils.isArnFor(pair[0], "iam") && pair[1].contains(":saml-provider/")) {
|
||||
roles.add(new RolePair(pair[0], pair[1]));
|
||||
} else if (pair[1].startsWith("arn:aws:iam::") && pair[0].contains(":saml-provider/")) {
|
||||
} else if (AwsArnUtils.isArnFor(pair[1], "iam") && pair[0].contains(":saml-provider/")) {
|
||||
roles.add(new RolePair(pair[1], pair[0]));
|
||||
} else {
|
||||
throw invalid("role pair ARN");
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package io.github.hectorvent.floci.services.iam;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import io.github.hectorvent.floci.core.common.AwsArnUtils;
|
||||
import io.github.hectorvent.floci.core.common.AwsException;
|
||||
import io.github.hectorvent.floci.core.storage.AccountAwareStorageBackend;
|
||||
import io.github.hectorvent.floci.core.storage.StorageBackend;
|
||||
@@ -17,7 +18,8 @@ import java.util.regex.Pattern;
|
||||
/** Minimal IAM SAML provider registry used by STS assertion verification. */
|
||||
@ApplicationScoped
|
||||
public class SAMLProviderService {
|
||||
private static final Pattern ARN = Pattern.compile("^arn:aws:iam::(\\d{12}):saml-provider/[A-Za-z0-9+=,.@_-]{1,128}$");
|
||||
private static final Pattern ARN = Pattern.compile(
|
||||
"^arn:" + AwsArnUtils.PARTITION_REGEX + ":iam::(\\d{12}):saml-provider/[A-Za-z0-9+=,.@_-]{1,128}$");
|
||||
private final StorageBackend<String, SAMLProvider> providers;
|
||||
private final Object providerLock = new Object();
|
||||
|
||||
|
||||
@@ -388,9 +388,12 @@ public class KmsService implements ResourceProvider {
|
||||
private static final java.util.regex.Pattern GRANT_NAME_PATTERN =
|
||||
java.util.regex.Pattern.compile("^[a-zA-Z0-9:/_-]+$");
|
||||
|
||||
/** GrantConstraintSourceArnType pattern from the KMS model (kms/2014-11-01/service-2.json). */
|
||||
/**
|
||||
* GrantConstraintSourceArnType pattern from the KMS model (kms/2014-11-01/service-2.json),
|
||||
* quoted verbatim in AWS's validation message; it already accepts every partition.
|
||||
*/
|
||||
private static final java.util.regex.Pattern GRANT_CONSTRAINT_SOURCE_ARN_PATTERN =
|
||||
java.util.regex.Pattern.compile("^arn:aws[a-z0-9-]*:[a-z0-9-]+:[a-z0-9-]*:[0-9]{12}:.+$");
|
||||
java.util.regex.Pattern.compile("^arn:aws[a-z0-9-]*:[a-z0-9-]+:[a-z0-9-]*:[0-9]{12}:.+$"); // partition-literal: model pattern quoted in AWS's message
|
||||
|
||||
private static final Set<String> GRANT_CONSTRAINT_MEMBERS =
|
||||
Set.of("EncryptionContextSubset", "EncryptionContextEquals", "SourceArn");
|
||||
@@ -433,7 +436,7 @@ public class KmsService implements ResourceProvider {
|
||||
throw new AwsException("ValidationException",
|
||||
"1 validation error detected: Value at 'constraints.sourceArn' failed to satisfy "
|
||||
+ "constraint: Member must satisfy regular expression pattern: "
|
||||
+ "^arn:aws[a-z0-9-]*:[a-z0-9-]+:[a-z0-9-]*:[0-9]{12}:.+$", 400);
|
||||
+ "^arn:aws[a-z0-9-]*:[a-z0-9-]+:[a-z0-9-]*:[0-9]{12}:.+$", 400); // partition-literal: model pattern quoted in AWS's message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,11 +72,13 @@ public class LambdaService implements ResourceProvider {
|
||||
private static final String QUALIFIER_PATTERN = "\\$(LATEST(\\.PUBLISHED)?)|[a-zA-Z0-9-_$]+";
|
||||
private static final Pattern QUALIFIER = Pattern.compile(QUALIFIER_PATTERN);
|
||||
private static final Pattern EFS_ACCESS_POINT_ARN = Pattern.compile(
|
||||
"^arn:aws[a-zA-Z-]*:elasticfilesystem:(?:eusc-)?[a-z]{2}"
|
||||
"^arn:" + AwsArnUtils.PARTITION_REGEX + ":elasticfilesystem:(?:eusc-)?[a-z]{2}"
|
||||
+ "(?:(?:-gov)|(?:-iso(?:b)?))?-[a-z]+-\\d:"
|
||||
+ "\\d{12}:access-point/fsap-[a-f0-9]{17}$");
|
||||
private static final Pattern FILE_SYSTEM_LOCAL_MOUNT_PATH = Pattern.compile("^/mnt/[A-Za-z0-9._-]+$");
|
||||
private static final Pattern LOG_GROUP_PATTERN = Pattern.compile("[.\\-_/#A-Za-z0-9]+");
|
||||
// The model's own Role pattern, which AWS quotes verbatim in its validation message; it
|
||||
// already accepts every partition.
|
||||
private static final Pattern ROLE_ARN_PATTERN = Pattern.compile(
|
||||
"arn:(aws[a-zA-Z-]*)?:iam::\\d{12}:role/?[a-zA-Z_0-9+=,.@\\-_/]+");
|
||||
private static final Pattern HANDLER_PATTERN = Pattern.compile("\\S+");
|
||||
|
||||
@@ -279,7 +279,14 @@ public class OamService {
|
||||
}
|
||||
|
||||
private static boolean principalValueMatches(String value, String account) {
|
||||
return "*".equals(value) || account.equals(value) || ("arn:aws:iam::" + account + ":root").equals(value);
|
||||
if ("*".equals(value) || account.equals(value)) {
|
||||
return true;
|
||||
}
|
||||
if (!AwsArnUtils.isArnFor(value, "iam")) {
|
||||
return false;
|
||||
}
|
||||
AwsArnUtils.Arn parsed = AwsArnUtils.parse(value);
|
||||
return account.equals(parsed.accountId()) && "root".equals(parsed.resource());
|
||||
}
|
||||
|
||||
private static boolean resourceMatches(JsonNode node, String arn) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.github.hectorvent.floci.services.s3;
|
||||
|
||||
import io.github.hectorvent.floci.core.common.AwsArnUtils;
|
||||
import io.github.hectorvent.floci.services.iam.ResourcePolicyProvider;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.inject.Inject;
|
||||
@@ -34,11 +35,15 @@ public class S3ResourcePolicyProvider implements ResourcePolicyProvider {
|
||||
.orElseGet(List::of);
|
||||
}
|
||||
|
||||
private static String extractBucketName(String resourceArn) {
|
||||
if (!resourceArn.startsWith("arn:aws:s3:::")) {
|
||||
/**
|
||||
* The bucket of an S3 ARN in any partition. Keyed on a literal {@code arn:aws:} this found
|
||||
* no policy for a China or GovCloud bucket, which silently changed the access decision.
|
||||
*/
|
||||
static String extractBucketName(String resourceArn) {
|
||||
String tail = AwsArnUtils.resourceIfArnFor(resourceArn, "s3").orElse(null);
|
||||
if (tail == null) {
|
||||
return null;
|
||||
}
|
||||
String tail = resourceArn.substring("arn:aws:s3:::".length());
|
||||
int slash = tail.indexOf('/');
|
||||
return slash < 0 ? tail : tail.substring(0, slash);
|
||||
}
|
||||
|
||||
@@ -1123,14 +1123,11 @@ public class S3Service implements Resettable, ResourceProvider {
|
||||
}
|
||||
|
||||
private static String extractAccountId(String arn) {
|
||||
if (arn == null || !arn.startsWith("arn:aws:")) {
|
||||
if (!AwsArnUtils.isArn(arn)) {
|
||||
return null;
|
||||
}
|
||||
String[] parts = arn.split(":");
|
||||
if (parts.length > 4 && parts[4].matches("\\d{12}")) {
|
||||
return parts[4];
|
||||
}
|
||||
return null;
|
||||
String account = AwsArnUtils.parse(arn).accountId();
|
||||
return account.matches("\\d{12}") ? account : null;
|
||||
}
|
||||
|
||||
private static AwsException accessDeniedException(String bucketName, String key) {
|
||||
|
||||
+7
-1
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.securityhub;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import io.github.hectorvent.floci.core.common.AwsArnUtils;
|
||||
import io.github.hectorvent.floci.core.common.AwsException;
|
||||
import io.github.hectorvent.floci.core.common.PaginatedResult;
|
||||
import io.github.hectorvent.floci.core.common.Pagination;
|
||||
@@ -498,7 +499,12 @@ public class SecurityHubService implements Resettable {
|
||||
}
|
||||
|
||||
private void validateResourceArn(String region, String arn) {
|
||||
if (arn == null || !arn.startsWith("arn:aws:securityhub:" + region + ":" + regionResolver.getAccountId() + ":")) {
|
||||
if (!AwsArnUtils.isArnFor(arn, "securityhub")) {
|
||||
throw notFound("The specified Security Hub resource was not found.");
|
||||
}
|
||||
AwsArnUtils.Arn parsed = AwsArnUtils.parse(arn);
|
||||
if (!regionResolver.getPartition().equals(parsed.partition())
|
||||
|| !region.equals(parsed.region()) || !regionResolver.getAccountId().equals(parsed.accountId())) {
|
||||
throw notFound("The specified Security Hub resource was not found.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package io.github.hectorvent.floci.services.ses;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import io.github.hectorvent.floci.core.common.AwsArnUtils;
|
||||
import io.github.hectorvent.floci.core.common.AwsException;
|
||||
import io.github.hectorvent.floci.core.storage.StorageBackend;
|
||||
import io.github.hectorvent.floci.core.storage.StorageFactory;
|
||||
@@ -58,9 +59,9 @@ public class SesReceiptRuleService {
|
||||
// Probed: a value that is not a well-formed topic/function ARN (a bare name, or an ARN with
|
||||
// missing segments) gets the "Invalid ..." message before any existence lookup. There is no
|
||||
// recipient-count limit (101 recipients are accepted).
|
||||
private static final Pattern SNS_TOPIC_ARN = Pattern.compile("^arn:aws[a-zA-Z-]*:sns:[a-z0-9-]+:\\d{12}:.+$");
|
||||
private static final Pattern SNS_TOPIC_ARN = Pattern.compile("^arn:" + AwsArnUtils.PARTITION_REGEX + ":sns:[a-z0-9-]+:\\d{12}:.+$");
|
||||
private static final Pattern LAMBDA_FUNCTION_ARN =
|
||||
Pattern.compile("^arn:aws[a-zA-Z-]*:lambda:[a-z0-9-]+:\\d{12}:function:.+$");
|
||||
Pattern.compile("^arn:" + AwsArnUtils.PARTITION_REGEX + ":lambda:[a-z0-9-]+:\\d{12}:function:.+$");
|
||||
// RFC 5322 ftext: printable US-ASCII excluding the colon. Real SES rejects anything else with
|
||||
// "Invalid header name: <name>" (probed 2026-09).
|
||||
private static final Pattern HEADER_NAME_CHARS = Pattern.compile("^[\\x21-\\x39\\x3B-\\x7E]+$");
|
||||
|
||||
@@ -54,9 +54,9 @@ public class SsoAdminService implements Resettable {
|
||||
private static final String INSTANCE_ARN = globalArn("sso", "us-east-1", "", "instance/ssoins-7223b02a5d9f7c8e");
|
||||
private static final String IDENTITY_STORE_ID = "d-9067f2a3c1";
|
||||
private static final String PRIMARY_REGION = "us-east-1";
|
||||
private static final Pattern INSTANCE_ARN_PATTERN = Pattern.compile("arn:aws(?:-[a-z]{1,5}){0,3}:sso:::instance/(?:sso)?ins-[a-zA-Z0-9-.]{16}");
|
||||
private static final Pattern INSTANCE_ARN_PATTERN = Pattern.compile("arn:" + AwsArnUtils.PARTITION_REGEX + ":sso:::instance/(?:sso)?ins-[a-zA-Z0-9-.]{16}");
|
||||
private static final Pattern PERMISSION_SET_NAME = Pattern.compile("[\\w+=,.@-]+");
|
||||
private static final Pattern PERMISSION_SET_ARN = Pattern.compile("arn:aws(?:-[a-z]{1,5}){0,3}:sso:::permissionSet/(?:sso)?ins-[a-zA-Z0-9-.]{16}/ps-[a-zA-Z0-9-./]{16}");
|
||||
private static final Pattern PERMISSION_SET_ARN = Pattern.compile("arn:" + AwsArnUtils.PARTITION_REGEX + ":sso:::permissionSet/(?:sso)?ins-[a-zA-Z0-9-.]{16}/ps-[a-zA-Z0-9-./]{16}");
|
||||
private static final Pattern PRINCIPAL_ID = Pattern.compile("([0-9a-f]{10}-|)[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}");
|
||||
/**
|
||||
* The model's own {@code ManagedPolicyArn} pattern. The previous
|
||||
@@ -64,16 +64,16 @@ public class SsoAdminService implements Resettable {
|
||||
* partition, and its {@code .+} tail accepted a policy name containing characters AWS rejects.
|
||||
*/
|
||||
private static final Pattern MANAGED_POLICY_ARN = Pattern.compile(
|
||||
"arn:aws(?:-[a-z]{1,5}){0,3}:iam::aws:policy((?:/[A-Za-z0-9\\.,\\+@=_-]+)*)"
|
||||
"arn:" + AwsArnUtils.PARTITION_REGEX + ":iam::aws:policy((?:/[A-Za-z0-9\\.,\\+@=_-]+)*)"
|
||||
+ "/(?:[A-Za-z0-9\\.,\\+=@_-]+)");
|
||||
private static final Pattern CUSTOMER_MANAGED_POLICY_NAME = Pattern.compile("[\\w+=,.@-]+");
|
||||
private static final Pattern CUSTOMER_MANAGED_POLICY_PATH = Pattern.compile("((/[A-Za-z0-9\\.,\\+@=_-]+)*)/");
|
||||
private static final Pattern REGION_NAME = Pattern.compile("([a-z]+-){2,3}\\d");
|
||||
private static final Pattern APPLICATION_PROVIDER_ARN = Pattern.compile("arn:aws(?:-[a-z]{1,5}){0,3}:sso::aws:applicationProvider/[a-zA-Z0-9-/]+");
|
||||
private static final Pattern APPLICATION_ARN = Pattern.compile("arn:aws(?:-[a-z]{1,5}){0,3}:sso::\\d{12}:application/(?:sso)?ins-[a-zA-Z0-9-.]{16}/apl-[a-zA-Z0-9]{16}");
|
||||
private static final Pattern TRUSTED_TOKEN_ISSUER_ARN = Pattern.compile("arn:aws(?:-[a-z]{1,5}){0,3}:sso::\\d{12}:trustedTokenIssuer/(?:sso)?ins-[a-zA-Z0-9-.]{16}/tti-[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}");
|
||||
private static final Pattern APPLICATION_PROVIDER_ARN = Pattern.compile("arn:" + AwsArnUtils.PARTITION_REGEX + ":sso::aws:applicationProvider/[a-zA-Z0-9-/]+");
|
||||
private static final Pattern APPLICATION_ARN = Pattern.compile("arn:" + AwsArnUtils.PARTITION_REGEX + ":sso::\\d{12}:application/(?:sso)?ins-[a-zA-Z0-9-.]{16}/apl-[a-zA-Z0-9]{16}");
|
||||
private static final Pattern TRUSTED_TOKEN_ISSUER_ARN = Pattern.compile("arn:" + AwsArnUtils.PARTITION_REGEX + ":sso::\\d{12}:trustedTokenIssuer/(?:sso)?ins-[a-zA-Z0-9-.]{16}/tti-[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}");
|
||||
private static final Pattern APPLICATION_ACCESS_SCOPE = Pattern.compile("([A-Za-z0-9_]{1,50})(:[A-Za-z0-9_]{1,50}){0,1}(:[A-Za-z0-9_]{1,50}){0,1}");
|
||||
private static final Pattern APPLICATION_ACCESS_TARGET = Pattern.compile("arn:aws(?:-[a-z]{1,5}){0,3}:sso::(?:\\d{12}:application/(?:sso)?ins-[a-zA-Z0-9-.]{16}/apl-[a-zA-Z0-9]{16}|:instance/(?:sso)?ins-[a-zA-Z0-9-.]{16})");
|
||||
private static final Pattern APPLICATION_ACCESS_TARGET = Pattern.compile("arn:" + AwsArnUtils.PARTITION_REGEX + ":sso::(?:\\d{12}:application/(?:sso)?ins-[a-zA-Z0-9-.]{16}/apl-[a-zA-Z0-9]{16}|:instance/(?:sso)?ins-[a-zA-Z0-9-.]{16})");
|
||||
private static final Pattern CLIENT_TOKEN = Pattern.compile("[!-~]+");
|
||||
private static final Pattern APPLICATION_URL = Pattern.compile("http(s)?://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%?=~_|]");
|
||||
private static final Pattern TAG_VALUE = Pattern.compile("[\\p{L}\\p{Z}\\p{N}_.:/=+\\-@]*");
|
||||
@@ -84,7 +84,7 @@ public class SsoAdminService implements Resettable {
|
||||
private static final Pattern OIDC_CLAIM_ATTRIBUTE_PATH = Pattern.compile("\\p{L}+(?:(\\.|_)\\p{L}+){0,2}");
|
||||
private static final Pattern OIDC_IDENTITY_STORE_ATTRIBUTE_PATH = Pattern.compile("\\p{L}+(?:\\.\\p{L}+){0,2}");
|
||||
private static final Pattern OIDC_ISSUER_URL = Pattern.compile("https?://[-a-zA-Z0-9+&@/%=~_|!:,.;]*[-a-zA-Z0-9+&@/%=~_|]");
|
||||
private static final Pattern KMS_KEY_ARN = Pattern.compile("arn:aws(?:-[a-z]{1,5}){0,3}:kms:([a-z]{2,}(-[a-z0-9]+)+):[0-9]{12}:key/(?:mrk-[a-f0-9]{32}|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})");
|
||||
private static final Pattern KMS_KEY_ARN = Pattern.compile("arn:" + AwsArnUtils.PARTITION_REGEX + ":kms:([a-z]{2,}(-[a-z0-9]+)+):[0-9]{12}:key/(?:mrk-[a-f0-9]{32}|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})");
|
||||
private static final int PERMISSION_SET_QUOTA = 3500;
|
||||
private static final int REGION_QUOTA = 6;
|
||||
private static final int MANAGED_POLICY_QUOTA = 25;
|
||||
@@ -971,7 +971,7 @@ public class SsoAdminService implements Resettable {
|
||||
return false;
|
||||
}
|
||||
JsonNode aws = principal.get("AWS");
|
||||
Pattern rootArn = Pattern.compile("arn:aws(?:-[a-z]{1,5}){0,3}:iam::" + accountId + ":root");
|
||||
Pattern rootArn = Pattern.compile("arn:" + AwsArnUtils.PARTITION_REGEX + ":iam::" + accountId + ":root");
|
||||
return policyStringOrArrayMatches(aws, value -> "*".equals(value)
|
||||
|| accountId.equals(value) || rootArn.matcher(value).matches());
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.ssooidc;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import io.github.hectorvent.floci.config.EmulatorConfig;
|
||||
import io.github.hectorvent.floci.core.common.AwsArnUtils;
|
||||
import io.github.hectorvent.floci.core.common.Resettable;
|
||||
import io.github.hectorvent.floci.core.storage.StorageBackend;
|
||||
import io.github.hectorvent.floci.core.storage.StorageFactory;
|
||||
@@ -38,7 +39,7 @@ public class SsoOidcService implements Resettable {
|
||||
"urn:ietf:params:oauth:grant-type:device_code",
|
||||
"refresh_token");
|
||||
private static final Pattern APPLICATION_ARN = Pattern.compile(
|
||||
"arn:aws(?:-[a-z]{1,5}){0,3}:sso::[0-9]{12}:application/(?:sso)?ins-[a-zA-Z0-9-.]{16}/apl-[a-zA-Z0-9]{16}");
|
||||
"arn:" + AwsArnUtils.PARTITION_REGEX + ":sso::[0-9]{12}:application/(?:sso)?ins-[a-zA-Z0-9-.]{16}/apl-[a-zA-Z0-9]{16}");
|
||||
|
||||
private final StorageBackend<String, RegisteredClient> clients;
|
||||
private final StorageBackend<String, DeviceAuthorization> deviceAuthorizations;
|
||||
|
||||
@@ -187,9 +187,6 @@ public class AslExecutor {
|
||||
Set.of("MD5", "SHA-1", "SHA-256", "SHA-384", "SHA-512");
|
||||
|
||||
private static final String QUERY_LANGUAGE_JSONATA = "JSONata";
|
||||
private static final String AWS_SDK_RDS_DATA_PREFIX = "arn:aws:states:::aws-sdk:rdsdata:";
|
||||
private static final String AWS_SDK_SFN_PREFIX = "arn:aws:states:::aws-sdk:sfn:";
|
||||
private static final String AWS_SDK_SCHEDULER_PREFIX = "arn:aws:states:::aws-sdk:scheduler:";
|
||||
|
||||
/**
|
||||
* A timestamp inside an {@code aws-sdk:} Task result is the SDK's ISO-8601 rendering of an
|
||||
@@ -1070,12 +1067,13 @@ public class AslExecutor {
|
||||
String functionRef = null;
|
||||
JsonNode lambdaPayload = input;
|
||||
boolean optimizedLambdaInvoke = false;
|
||||
StatesIntegration integration = StatesIntegration.parse(resource).orElse(null);
|
||||
|
||||
if (resource.contains(":lambda:") && resource.contains(":function:")) {
|
||||
// Direct Lambda ARN: arn:aws:lambda:region:account:function:name[:qualifier]
|
||||
// Direct Lambda ARN: arn:<partition>:lambda:region:account:function:name[:qualifier]
|
||||
functionRef = resource;
|
||||
functionName = extractLambdaFunctionName(resource);
|
||||
} else if (resource.equals("arn:aws:states:::lambda:invoke")) {
|
||||
} else if (integration != null && integration.is("lambda", "invoke")) {
|
||||
// Optimized Lambda integration — function name and payload come from resolved input
|
||||
optimizedLambdaInvoke = true;
|
||||
String fnRef = input.path("FunctionName").asText(null);
|
||||
@@ -1090,7 +1088,7 @@ public class AslExecutor {
|
||||
}
|
||||
|
||||
if (functionName != null) {
|
||||
// Extract region from the state machine ARN: arn:aws:states:REGION:...
|
||||
// Extract region from the state machine ARN: arn:<partition>:states:REGION:...
|
||||
String region = extractRegionFromArn(sm.getStateMachineArn());
|
||||
LambdaFunction fn = resolveLambdaFunction(region, functionName, extractLambdaQualifier(functionRef));
|
||||
if (fn == null) {
|
||||
@@ -1125,9 +1123,13 @@ public class AslExecutor {
|
||||
return invokeResponse;
|
||||
}
|
||||
|
||||
if (integration == null) {
|
||||
return invokeNonIntegrationResource(resource, input, taskToken);
|
||||
}
|
||||
|
||||
// DynamoDB optimized integrations (4 actions)
|
||||
if (resource.startsWith("arn:aws:states:::dynamodb:")) {
|
||||
String operation = resource.substring("arn:aws:states:::dynamodb:".length());
|
||||
if (integration.isOptimizedService("dynamodb")) {
|
||||
String operation = integration.api();
|
||||
String region = extractRegionFromArn(sm.getStateMachineArn());
|
||||
try {
|
||||
return invokeDynamoDb(operation, input, region);
|
||||
@@ -1137,110 +1139,114 @@ public class AslExecutor {
|
||||
}
|
||||
|
||||
// AWS SDK service integrations: DynamoDB
|
||||
if (resource.startsWith("arn:aws:states:::aws-sdk:dynamodb:")) {
|
||||
String camelCaseAction = resource.substring("arn:aws:states:::aws-sdk:dynamodb:".length());
|
||||
if (integration.isSdkService("dynamodb")) {
|
||||
String camelCaseAction = integration.api();
|
||||
String region = extractRegionFromArn(sm.getStateMachineArn());
|
||||
return invokeAwsSdkDynamoDb(camelCaseAction, input, region);
|
||||
}
|
||||
|
||||
// AWS SDK service integration: RDS Data API ExecuteStatement
|
||||
if (resource.startsWith(AWS_SDK_RDS_DATA_PREFIX)) {
|
||||
String action = resource.substring(AWS_SDK_RDS_DATA_PREFIX.length());
|
||||
if (integration.isSdkService("rdsdata")) {
|
||||
String region = extractRegionFromArn(sm.getStateMachineArn());
|
||||
return invokeAwsSdkRdsData(action, input, region);
|
||||
return invokeAwsSdkRdsData(integration, input, region);
|
||||
}
|
||||
|
||||
// SQS optimized integration
|
||||
if (resource.equals("arn:aws:states:::sqs:sendMessage")) {
|
||||
if (integration.is("sqs", "sendMessage")) {
|
||||
String region = extractRegionFromArn(sm.getStateMachineArn());
|
||||
return invokeOptimizedSqsSendMessage(input, region);
|
||||
}
|
||||
|
||||
// HTTP optimized integration
|
||||
if (resource.equals("arn:aws:states:::http:invoke")) {
|
||||
if (integration.is("http", "invoke")) {
|
||||
String region = extractRegionFromArn(sm.getStateMachineArn());
|
||||
return invokeHttp(input, region);
|
||||
}
|
||||
|
||||
// AWS SDK service integration: SQS SendMessage
|
||||
if (resource.equals("arn:aws:states:::aws-sdk:sqs:sendMessage")) {
|
||||
if (integration.isSdk("sqs", "sendMessage")) {
|
||||
String region = extractRegionFromArn(sm.getStateMachineArn());
|
||||
return invokeAwsSdkSqsSendMessage(input, region);
|
||||
}
|
||||
|
||||
// SNS optimized integration
|
||||
if (resource.equals("arn:aws:states:::sns:publish")) {
|
||||
if (integration.is("sns", "publish")) {
|
||||
String region = extractRegionFromArn(sm.getStateMachineArn());
|
||||
return invokeSnsPublish(input, region, "SNS.");
|
||||
}
|
||||
|
||||
// AWS SDK service integration: SNS Publish
|
||||
if (resource.equals("arn:aws:states:::aws-sdk:sns:publish")) {
|
||||
if (integration.isSdk("sns", "publish")) {
|
||||
String region = extractRegionFromArn(sm.getStateMachineArn());
|
||||
return invokeSnsPublish(input, region, "Sns.");
|
||||
}
|
||||
|
||||
// AWS SDK service integration: CloudFormation (query protocol → JSON)
|
||||
if (resource.startsWith("arn:aws:states:::aws-sdk:cloudformation:")) {
|
||||
String action = resource.substring("arn:aws:states:::aws-sdk:cloudformation:".length());
|
||||
if (integration.isSdkService("cloudformation")) {
|
||||
String action = integration.api();
|
||||
String region = extractRegionFromArn(sm.getStateMachineArn());
|
||||
return invokeAwsSdkCloudFormation(action, input, region);
|
||||
}
|
||||
|
||||
// AWS SDK service integration: EC2 DescribeRegions
|
||||
if (resource.equals("arn:aws:states:::aws-sdk:ec2:describeRegions")) {
|
||||
if (integration.isSdk("ec2", "describeRegions")) {
|
||||
return invokeAwsSdkEc2DescribeRegions();
|
||||
}
|
||||
|
||||
// S3 PutObject — optimized and aws-sdk integrations
|
||||
if (resource.equals("arn:aws:states:::s3:putObject")
|
||||
|| resource.equals("arn:aws:states:::aws-sdk:s3:putObject")) {
|
||||
if (integration.is("s3", "putObject") || integration.isSdk("s3", "putObject")) {
|
||||
return invokeS3PutObject(input);
|
||||
}
|
||||
|
||||
// ECS optimized integration: arn:aws:states:::ecs:runTask (request-response, .sync, .waitForTaskToken).
|
||||
// ECS optimized integration: arn:<partition>:states:::ecs:runTask (request-response, .sync, .waitForTaskToken).
|
||||
// The .waitForTaskToken suffix is already stripped by executeTaskState, so a waitForTaskToken
|
||||
// variant arrives here as the bare runTask resource and simply launches the task while the token
|
||||
// future blocks for SendTaskSuccess.
|
||||
if (resource.startsWith("arn:aws:states:::ecs:runTask")) {
|
||||
if (integration.isAnySuffix("ecs", "runTask")) {
|
||||
// A non-null taskToken means the original resource ended with .waitForTaskToken (stripped
|
||||
// upstream). Its failure semantics match .sync — a task placement failure fails the state —
|
||||
// whereas request-response returns the {Tasks,Failures} envelope without failing the state.
|
||||
String mode = taskToken != null
|
||||
? ".waitForTaskToken"
|
||||
: resource.substring("arn:aws:states:::ecs:runTask".length());
|
||||
: integration.suffix();
|
||||
String region = extractRegionFromArn(sm.getStateMachineArn());
|
||||
return invokeEcsRunTask(mode, input, region, executionDeadlineNanos);
|
||||
}
|
||||
|
||||
// AWS SDK service integrations: Step Functions
|
||||
if (resource.startsWith(AWS_SDK_SFN_PREFIX)) {
|
||||
String action = resource.substring(AWS_SDK_SFN_PREFIX.length());
|
||||
if (integration.isSdkService("sfn")) {
|
||||
String region = extractRegionFromArn(sm.getStateMachineArn());
|
||||
return invokeAwsSdkSfn(action, input, region);
|
||||
return invokeAwsSdkSfn(integration, input, region);
|
||||
}
|
||||
|
||||
// AWS SDK service integrations: EventBridge Scheduler
|
||||
if (resource.startsWith(AWS_SDK_SCHEDULER_PREFIX)) {
|
||||
String action = resource.substring(AWS_SDK_SCHEDULER_PREFIX.length());
|
||||
if (integration.isSdkService("scheduler")) {
|
||||
String region = extractRegionFromArn(sm.getStateMachineArn());
|
||||
return invokeAwsSdkScheduler(action, input, region);
|
||||
return invokeAwsSdkScheduler(integration, input, region);
|
||||
}
|
||||
|
||||
// EventBridge optimized integration
|
||||
if (resource.equals("arn:aws:states:::events:putEvents")) {
|
||||
if (integration.is("events", "putEvents")) {
|
||||
String region = extractRegionFromArn(sm.getStateMachineArn());
|
||||
return invokeOptimizedPutEvents(input, region);
|
||||
}
|
||||
|
||||
// Nested state machine integration
|
||||
if (resource.startsWith("arn:aws:states:::states:startExecution")) {
|
||||
String mode = resource.substring("arn:aws:states:::states:startExecution".length());
|
||||
if (integration.isAnySuffix("states", "startExecution")) {
|
||||
String mode = integration.suffix();
|
||||
String region = extractRegionFromArn(sm.getStateMachineArn());
|
||||
return invokeNestedStateMachine(mode, input, region, executionDeadlineNanos, rawParameters);
|
||||
}
|
||||
|
||||
// Activity resource: arn:aws:states:{region}:{account}:activity:{name}
|
||||
throw new FailStateException("States.TaskFailed", "Unsupported resource: " + resource);
|
||||
}
|
||||
|
||||
/**
|
||||
* A Task resource that is not a service-integration id: an activity ARN, or something this
|
||||
* emulator does not implement.
|
||||
*/
|
||||
private JsonNode invokeNonIntegrationResource(String resource, JsonNode input, String taskToken) throws Exception {
|
||||
// Activity resource: arn:<partition>:states:{region}:{account}:activity:{name}
|
||||
if (isActivityArn(resource)) {
|
||||
if (taskToken == null) {
|
||||
throw new FailStateException("States.TaskFailed",
|
||||
@@ -1365,15 +1371,15 @@ public class AslExecutor {
|
||||
* {@code aws-sdk:sfn:startExecution} from the optimized {@code states:startExecution}
|
||||
* handled by {@link #invokeNestedStateMachine}.
|
||||
*/
|
||||
private JsonNode invokeAwsSdkSfn(String action, JsonNode input, String region) throws Exception {
|
||||
return switch (action) {
|
||||
private JsonNode invokeAwsSdkSfn(StatesIntegration integration, JsonNode input, String region) throws Exception {
|
||||
return switch (integration.api()) {
|
||||
case "startExecution" -> invokeAwsSdkSfnStartExecution(input, region);
|
||||
case "startSyncExecution" -> invokeAwsSdkSfnStartSyncExecution(input, region);
|
||||
case "sendTaskSuccess" -> invokeAwsSdkSfnSendTaskSuccess(input);
|
||||
case "sendTaskFailure" -> invokeAwsSdkSfnSendTaskFailure(input);
|
||||
case "describeMapRun" -> invokeAwsSdkSfnDescribeMapRun(input);
|
||||
default -> throw new FailStateException("States.TaskFailed",
|
||||
"Unsupported resource: " + AWS_SDK_SFN_PREFIX + action);
|
||||
"Unsupported resource: " + integration.withoutSuffix());
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1493,12 +1499,13 @@ public class AslExecutor {
|
||||
* Service and parsing failures stay inside the translation that makes them reachable for
|
||||
* {@code Retry} and {@code Catch}.
|
||||
*/
|
||||
private JsonNode invokeAwsSdkScheduler(String action, JsonNode input, String region) {
|
||||
private JsonNode invokeAwsSdkScheduler(StatesIntegration integration, JsonNode input, String region) {
|
||||
String action = integration.api();
|
||||
boolean deleting = "deleteSchedule".equals(action);
|
||||
boolean creating = "createSchedule".equals(action);
|
||||
if (!creating && !deleting && !"updateSchedule".equals(action)) {
|
||||
throw new FailStateException("States.TaskFailed",
|
||||
"Unsupported resource: " + AWS_SDK_SCHEDULER_PREFIX + action);
|
||||
"Unsupported resource: " + integration.withoutSuffix());
|
||||
}
|
||||
try {
|
||||
if (deleting) {
|
||||
@@ -2086,10 +2093,10 @@ public class AslExecutor {
|
||||
return objectMapper.createObjectNode();
|
||||
}
|
||||
|
||||
private JsonNode invokeAwsSdkRdsData(String action, JsonNode input, String region) {
|
||||
if (!"executeStatement".equals(action)) {
|
||||
private JsonNode invokeAwsSdkRdsData(StatesIntegration integration, JsonNode input, String region) {
|
||||
if (!"executeStatement".equals(integration.api())) {
|
||||
throw new FailStateException("States.TaskFailed",
|
||||
"Unsupported resource: " + AWS_SDK_RDS_DATA_PREFIX + action);
|
||||
"Unsupported resource: " + integration.withoutSuffix());
|
||||
}
|
||||
try {
|
||||
JsonNode request = recaseKeys(objectMapper, input, false);
|
||||
@@ -3310,10 +3317,11 @@ public class AslExecutor {
|
||||
JsonNode context, boolean jsonata,
|
||||
ObjectNode variables) throws Exception {
|
||||
String resource = itemReader.path("Resource").asText(null);
|
||||
if ("arn:aws:states:::s3:listObjectsV2".equals(resource)) {
|
||||
StatesIntegration integration = StatesIntegration.parse(resource).orElse(null);
|
||||
if (integration != null && integration.is("s3", "listObjectsV2")) {
|
||||
return resolveListObjectsItems(itemReader, input, context, jsonata, variables);
|
||||
}
|
||||
if (!"arn:aws:states:::s3:getObject".equals(resource)) {
|
||||
if (integration == null || !integration.is("s3", "getObject")) {
|
||||
throw new FailStateException("States.Runtime", "Unsupported ItemReader resource: " + resource);
|
||||
}
|
||||
|
||||
@@ -5174,9 +5182,9 @@ public class AslExecutor {
|
||||
if (resource.contains(":lambda:") && resource.contains(":function:")) {
|
||||
return new TaskEventProfile("LambdaFunction", null, resource);
|
||||
}
|
||||
if (resource.startsWith("arn:aws:states:::")) {
|
||||
var tail = resource.substring("arn:aws:states:::".length());
|
||||
var idx = tail.lastIndexOf(':');
|
||||
String tail = StatesIntegration.tail(resource).orElse(null);
|
||||
if (tail != null) {
|
||||
int idx = tail.lastIndexOf(':');
|
||||
if (idx < 0) {
|
||||
return new TaskEventProfile("Task", tail, tail);
|
||||
}
|
||||
|
||||
+92
@@ -0,0 +1,92 @@
|
||||
package io.github.hectorvent.floci.services.stepfunctions;
|
||||
|
||||
import io.github.hectorvent.floci.core.common.AwsArnUtils;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* An Amazon States Language service-integration id, {@code arn:<partition>:states:::<service>:<api>}
|
||||
* with the optional {@code aws-sdk:} prefix and {@code .sync}, {@code .sync:2} or
|
||||
* {@code .waitForTaskToken} suffix, the only three AWS defines: any other suffix is not an
|
||||
* integration id and does not parse. The partition segment is the state machine's, not a fixed
|
||||
* {@code aws}: the CDK builds these as {@code arn:${Aws.PARTITION}:states:::...}
|
||||
* ({@code aws-stepfunctions-tasks/lib/private/task-utils.ts}), so a China state machine carries
|
||||
* {@code arn:aws-cn:states:::lambda:invoke} and must dispatch exactly like the commercial one.
|
||||
*
|
||||
* @param partition the partition segment as written
|
||||
* @param service the integrated service ({@code lambda}, {@code dynamodb}, {@code sfn}, ...)
|
||||
* @param api the API name as written, e.g. {@code invoke} or {@code startExecution}
|
||||
* @param sdk true for the {@code aws-sdk:} family, false for an optimized integration
|
||||
* @param suffix {@code ""}, {@code .sync}, {@code .sync:2} or {@code .waitForTaskToken}
|
||||
*/
|
||||
public record StatesIntegration(String partition, String service, String api, boolean sdk, String suffix) {
|
||||
|
||||
private static final Pattern RESOURCE = Pattern.compile(
|
||||
"^arn:(" + AwsArnUtils.PARTITION_REGEX + "):states:::(aws-sdk:)?([a-z0-9-]+):([A-Za-z0-9]+)"
|
||||
+ "(\\.sync:2|\\.sync|\\.waitForTaskToken)?$");
|
||||
|
||||
private static final Pattern TAIL = Pattern.compile("^arn:" + AwsArnUtils.PARTITION_REGEX + ":states:::(.*)$");
|
||||
|
||||
public static Optional<StatesIntegration> parse(String resource) {
|
||||
if (resource == null) {
|
||||
return Optional.empty();
|
||||
}
|
||||
Matcher matcher = RESOURCE.matcher(resource);
|
||||
if (!matcher.matches()) {
|
||||
return Optional.empty();
|
||||
}
|
||||
return Optional.of(new StatesIntegration(matcher.group(1), matcher.group(3), matcher.group(4),
|
||||
matcher.group(2) != null, matcher.group(5) == null ? "" : matcher.group(5)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Everything after {@code states:::} in any partition, for a resource that has that shape
|
||||
* but is not necessarily a well-formed integration id.
|
||||
*/
|
||||
public static Optional<String> tail(String resource) {
|
||||
if (resource == null) {
|
||||
return Optional.empty();
|
||||
}
|
||||
Matcher matcher = TAIL.matcher(resource);
|
||||
return matcher.matches() ? Optional.of(matcher.group(1)) : Optional.empty();
|
||||
}
|
||||
|
||||
/**
|
||||
* True for the optimized integration {@code <service>:<api>} with no suffix. A suffixed id
|
||||
* is a different integration (a {@code .sync} sendMessage does not exist), so a dispatch
|
||||
* that does not read the suffix must not accept one; {@link #isAnySuffix} is for those that do.
|
||||
*/
|
||||
public boolean is(String service, String api) {
|
||||
return isAnySuffix(service, api) && suffix.isEmpty();
|
||||
}
|
||||
|
||||
/** True for the {@code aws-sdk:<service>:<api>} integration with no suffix. */
|
||||
public boolean isSdk(String service, String api) {
|
||||
return sdk && this.service.equals(service) && this.api.equals(api) && suffix.isEmpty();
|
||||
}
|
||||
|
||||
/** True for the optimized integration {@code <service>:<api>} whatever its suffix, for dispatches that read it. */
|
||||
public boolean isAnySuffix(String service, String api) {
|
||||
return !sdk && this.service.equals(service) && this.api.equals(api);
|
||||
}
|
||||
|
||||
public boolean isOptimizedService(String service) {
|
||||
return !sdk && this.service.equals(service);
|
||||
}
|
||||
|
||||
public boolean isSdkService(String service) {
|
||||
return sdk && this.service.equals(service);
|
||||
}
|
||||
|
||||
/** The id without its suffix, as an error message names it. */
|
||||
public String withoutSuffix() {
|
||||
return "arn:" + partition + ":states:::" + (sdk ? "aws-sdk:" : "") + service + ":" + api;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return withoutSuffix() + suffix;
|
||||
}
|
||||
}
|
||||
+13
-7
@@ -102,12 +102,8 @@ public class StepFunctionsService implements Resettable, ResourceProvider {
|
||||
// expression there and the deny list above stops applying once the walk enters one.
|
||||
private static final Set<String> JSONATA_PAYLOAD_FIELDS = Set.of(
|
||||
"Output", "Assign", "Arguments", "ItemSelector", "BatchInput");
|
||||
private static final Set<String> ITEM_READER_RESOURCES = Set.of(
|
||||
"arn:aws:states:::s3:getObject",
|
||||
"arn:aws:states:::s3:listObjectsV2");
|
||||
private static final Set<String> ITEM_READER_INPUT_TYPES = Set.of(
|
||||
"MANIFEST", "JSON", "CSV", "JSONL", "PARQUET");
|
||||
private static final String RESULT_WRITER_RESOURCE = "arn:aws:states:::s3:putObject";
|
||||
private static final Set<String> RESULT_WRITER_TRANSFORMATIONS = Set.of("NONE", "COMPACT", "FLATTEN");
|
||||
private static final Set<String> RESULT_WRITER_OUTPUT_TYPES = Set.of("JSON", "JSONL");
|
||||
// Measured against real AWS: TimeoutSeconds is accepted on Task only, Catch and Retry are
|
||||
@@ -2740,11 +2736,21 @@ public class StepFunctionsService implements Resettable, ResourceProvider {
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean isItemReaderResource(String resource) {
|
||||
return StatesIntegration.parse(resource)
|
||||
.filter(integration -> integration.is("s3", "getObject") || integration.is("s3", "listObjectsV2"))
|
||||
.isPresent();
|
||||
}
|
||||
|
||||
private static boolean isResultWriterResource(String resource) {
|
||||
return StatesIntegration.parse(resource).filter(integration -> integration.is("s3", "putObject")).isPresent();
|
||||
}
|
||||
|
||||
private void validateItemReader(String statePath, JsonNode stateDef, boolean jsonata,
|
||||
List<String> errors) {
|
||||
JsonNode itemReader = stateDef.get("ItemReader");
|
||||
String resource = itemReader.path("Resource").asText(null);
|
||||
if (resource != null && !ITEM_READER_RESOURCES.contains(resource)) {
|
||||
if (resource != null && !isItemReaderResource(resource)) {
|
||||
errors.add("The field 'Resource' does not match any of the allowed values. Examples: "
|
||||
+ "[arn:<partition>:states:::s3:getObject, arn:<partition>:states:::s3:listObjectsV2]"
|
||||
+ " at " + statePath + "/ItemReader/Resource");
|
||||
@@ -2801,9 +2807,9 @@ public class StepFunctionsService implements Resettable, ResourceProvider {
|
||||
}
|
||||
|
||||
if (hasResource && (!writer.get("Resource").isTextual()
|
||||
|| !RESULT_WRITER_RESOURCE.equals(writer.get("Resource").asText()))) {
|
||||
|| !isResultWriterResource(writer.get("Resource").asText()))) {
|
||||
errors.add("The field 'Resource' does not match the allowed value "
|
||||
+ RESULT_WRITER_RESOURCE + " at " + writerPath);
|
||||
+ "arn:<partition>:states:::s3:putObject at " + writerPath);
|
||||
}
|
||||
|
||||
if (hasDestination && !destinationIsExpression) {
|
||||
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
package io.github.hectorvent.floci.services.timestreaminfluxdb;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import io.github.hectorvent.floci.core.common.AwsArnUtils;
|
||||
import io.github.hectorvent.floci.core.common.AwsException;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -17,7 +18,7 @@ final class TimestreamInfluxDbValidation {
|
||||
static final Pattern CLUSTER_NAME = Pattern.compile("[a-zA-z][a-zA-Z0-9]*(-[a-zA-Z0-9]+)*");
|
||||
static final Pattern IDENTIFIER = Pattern.compile("[a-zA-Z0-9]+");
|
||||
static final Pattern ARN = Pattern.compile(
|
||||
"arn:aws[a-z\\-]*:timestream\\-influxdb:([a-z0-9\\-]+):([0-9]{12}):(db\\-instance|db\\-cluster|db\\-parameter\\-group|db\\-backup)/([a-zA-Z0-9]{3,64})");
|
||||
"arn:" + AwsArnUtils.PARTITION_REGEX + ":timestream\\-influxdb:([a-z0-9\\-]+):([0-9]{12}):(db\\-instance|db\\-cluster|db\\-parameter\\-group|db\\-backup)/([a-zA-Z0-9]{3,64})");
|
||||
|
||||
static final List<String> INSTANCE_TYPES = List.of("db.influx.medium", "db.influx.large", "db.influx.xlarge",
|
||||
"db.influx.2xlarge", "db.influx.4xlarge", "db.influx.8xlarge", "db.influx.12xlarge",
|
||||
|
||||
@@ -160,6 +160,22 @@ class AwsArnUtilsTest {
|
||||
PartitionMatrix.assertGlobalArnIn(partitionCase, arn.toString());
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("io.github.hectorvent.floci.testing.PartitionMatrix#cases")
|
||||
void resourceIfArnForYieldsTheResourceTailInEveryPartition(PartitionCase partitionCase) {
|
||||
String prefix = "arn:" + partitionCase.partition() + ":s3:::";
|
||||
assertEquals("bucket/key", AwsArnUtils.resourceIfArnFor(prefix + "bucket/key", "s3").orElseThrow());
|
||||
assertEquals("", AwsArnUtils.resourceIfArnFor(prefix, "s3").orElseThrow());
|
||||
assertTrue(AwsArnUtils.resourceIfArnFor(prefix + "bucket", "sqs").isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
void resourceIfArnForIsEmptyForNonArns() {
|
||||
assertTrue(AwsArnUtils.resourceIfArnFor(null, "s3").isEmpty());
|
||||
assertTrue(AwsArnUtils.resourceIfArnFor("bucket", "s3").isEmpty());
|
||||
assertTrue(AwsArnUtils.resourceIfArnFor("arn:aws:s3", "s3").isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
void aPseudoRegionResolvesToItsPartitionWhenMinting() {
|
||||
assertEquals("arn:aws-cn:sqs:aws-cn-global:000000000000:q",
|
||||
|
||||
+10
@@ -106,6 +106,16 @@ class IamEnforcementFilterUnitTest {
|
||||
IamEnforcementFilter.parseS3Resource("arn:aws:s3:::b/a/b/c.txt"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void parseObjectArn_acceptsEveryPartition() {
|
||||
assertArrayEquals(new String[] { "audit-source", "documents/hello.txt" },
|
||||
IamEnforcementFilter.parseS3Resource("arn:aws-cn:s3:::audit-source/documents/hello.txt"));
|
||||
assertArrayEquals(new String[] { "audit-source", null },
|
||||
IamEnforcementFilter.parseS3Resource("arn:aws-us-gov:s3:::audit-source"));
|
||||
assertArrayEquals(new String[] { "b", "k" },
|
||||
IamEnforcementFilter.parseS3Resource("arn:aws-iso-b:s3:::b/k"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void parseStarArn_returnsNulls() {
|
||||
assertArrayEquals(new String[] { null, null },
|
||||
|
||||
+9
@@ -20,6 +20,15 @@ class CloudTrailSelectorMatchingTest {
|
||||
assertTrue(CloudTrailService.matchesS3DataResourceArn("arn:aws:s3:::", "any-bucket", null));
|
||||
}
|
||||
|
||||
@Test
|
||||
void chinaAndGovCloudArns_matchLikeCommercialOnes() {
|
||||
assertTrue(CloudTrailService.matchesS3DataResourceArn("arn:aws-cn:s3", "any-bucket", "any/key.txt"));
|
||||
assertTrue(CloudTrailService.matchesS3DataResourceArn("arn:aws-cn:s3:::", "any-bucket", null));
|
||||
assertTrue(CloudTrailService.matchesS3DataResourceArn("arn:aws-cn:s3:::b/logs/", "b", "logs/1.txt"));
|
||||
assertFalse(CloudTrailService.matchesS3DataResourceArn("arn:aws-us-gov:s3:::b/logs/", "b", "other/1.txt"));
|
||||
assertFalse(CloudTrailService.matchesS3DataResourceArn("arn:aws-us-gov:s3:::other/", "b", "logs/1.txt"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void allBucketsArnWithSlash_matchesEverything() {
|
||||
assertTrue(CloudTrailService.matchesS3DataResourceArn("arn:aws:s3:::/", "any-bucket", "any/key.txt"));
|
||||
|
||||
@@ -547,6 +547,29 @@ class IamPolicyEvaluatorTest {
|
||||
assertEquals(ResourcePolicyDecision.NEUTRAL, evaluator.evaluateResourcePolicy(
|
||||
List.of(rolePolicy), "arn:aws:sts::123456789012:assumed-role/other/sess", "s3:GetObject", "arn:aws:s3:::b/k", null));
|
||||
|
||||
// The same in the China partition: the session's role and the root principal are matched
|
||||
// in the partition the ARNs carry, not a fixed arn:aws:
|
||||
String chinaRolePolicy = """
|
||||
{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":{"AWS":"arn:aws-cn:iam::123456789012:role/r"},"Action":"s3:*","Resource":"*"}]}""";
|
||||
assertEquals(ResourcePolicyDecision.ALLOW, evaluator.evaluateResourcePolicy(
|
||||
List.of(chinaRolePolicy), "arn:aws-cn:sts::123456789012:assumed-role/r/sess", "s3:GetObject", "arn:aws-cn:s3:::b/k", null));
|
||||
assertEquals(ResourcePolicyDecision.NEUTRAL, evaluator.evaluateResourcePolicy(
|
||||
List.of(rolePolicy), "arn:aws-cn:sts::123456789012:assumed-role/r/sess", "s3:GetObject", "arn:aws-cn:s3:::b/k", null));
|
||||
String chinaRootPolicy = """
|
||||
{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":{"AWS":"arn:aws-cn:iam::123456789012:root"},"Action":"s3:*","Resource":"*"}]}""";
|
||||
assertEquals(ResourcePolicyDecision.ALLOW, evaluator.evaluateResourcePolicy(
|
||||
List.of(chinaRootPolicy), "arn:aws-cn:iam::123456789012:user/alice", "s3:GetObject", "arn:aws-cn:s3:::b/k", null));
|
||||
assertEquals(ResourcePolicyDecision.NEUTRAL, evaluator.evaluateResourcePolicy(
|
||||
List.of(chinaRootPolicy), "arn:aws-cn:iam::999999999999:user/bob", "s3:GetObject", "arn:aws-cn:s3:::b/k", null));
|
||||
// An account id is scoped to its partition: the China root grant does not reach the
|
||||
// commercial account of the same number, nor the other way round.
|
||||
assertEquals(ResourcePolicyDecision.NEUTRAL, evaluator.evaluateResourcePolicy(
|
||||
List.of(chinaRootPolicy), "arn:aws:iam::123456789012:user/alice", "s3:GetObject", "arn:aws:s3:::b/k", null));
|
||||
String commercialRootPolicy = """
|
||||
{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":{"AWS":"arn:aws:iam::123456789012:root"},"Action":"s3:*","Resource":"*"}]}""";
|
||||
assertEquals(ResourcePolicyDecision.NEUTRAL, evaluator.evaluateResourcePolicy(
|
||||
List.of(commercialRootPolicy), "arn:aws-cn:iam::123456789012:user/alice", "s3:GetObject", "arn:aws-cn:s3:::b/k", null));
|
||||
|
||||
// 12-digit account ID and root ARN match account principals
|
||||
String acctPolicy = """
|
||||
{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":{"AWS":"123456789012"},"Action":"s3:*","Resource":"*"}]}""";
|
||||
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package io.github.hectorvent.floci.services.s3;
|
||||
|
||||
import io.github.hectorvent.floci.testing.PartitionMatrix.PartitionCase;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
import org.junit.jupiter.params.provider.NullAndEmptySource;
|
||||
import org.junit.jupiter.params.provider.ValueSource;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
|
||||
/**
|
||||
* The bucket-policy lookup is on the authorization path: a bucket ARN whose partition the
|
||||
* provider does not recognise finds no policy, which silently flips an allow or a deny.
|
||||
*/
|
||||
class S3ResourcePolicyProviderTest {
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("io.github.hectorvent.floci.testing.PartitionMatrix#cases")
|
||||
void bucketIsExtractedFromAnS3ArnInEveryPartition(PartitionCase partitionCase) {
|
||||
String prefix = "arn:" + partitionCase.partition() + ":s3:::";
|
||||
assertEquals("audit-source", S3ResourcePolicyProvider.extractBucketName(prefix + "audit-source"));
|
||||
assertEquals("audit-source", S3ResourcePolicyProvider.extractBucketName(prefix + "audit-source/documents/hello.txt"));
|
||||
assertEquals("*", S3ResourcePolicyProvider.extractBucketName(prefix + "*"));
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@NullAndEmptySource
|
||||
@ValueSource(strings = {"arn:aws:lambda:us-east-1:000000000000:function:f", "audit-source", "arn:aws:s3"})
|
||||
void nonS3ArnsYieldNoBucket(String value) {
|
||||
assertNull(S3ResourcePolicyProvider.extractBucketName(value));
|
||||
}
|
||||
}
|
||||
+12
@@ -29,6 +29,7 @@ class SecurityHubServiceTest {
|
||||
void setUp() {
|
||||
RegionResolver regionResolver = mock(RegionResolver.class);
|
||||
when(regionResolver.getAccountId()).thenReturn(ACCOUNT_ID);
|
||||
when(regionResolver.getPartition()).thenReturn("aws");
|
||||
service = new SecurityHubService(AccountAwareStorageBackend.inMemory(ACCOUNT_ID), regionResolver,
|
||||
mock(OrganizationsService.class));
|
||||
}
|
||||
@@ -48,6 +49,17 @@ class SecurityHubServiceTest {
|
||||
assertEquals(Map.of("env", "test"), service.tagsForResource(REGION, service.hubArn(REGION)));
|
||||
}
|
||||
|
||||
/** An account id is scoped to its partition: a China ARN of the same account names nothing here. */
|
||||
@Test
|
||||
void aResourceArnFromAnotherPartitionIsNotFound() throws Exception {
|
||||
service.enableSecurityHub(REGION, objectMapper.readTree("{\"Tags\": {\"env\": \"test\"}}"));
|
||||
String foreign = service.hubArn(REGION).replace("arn:aws:", "arn:aws-cn:");
|
||||
|
||||
AwsException notFound = assertThrows(AwsException.class, () -> service.tagsForResource(REGION, foreign));
|
||||
assertEquals("ResourceNotFoundException", notFound.getErrorCode());
|
||||
assertEquals(Map.of("env", "test"), service.tagsForResource(REGION, service.hubArn(REGION)));
|
||||
}
|
||||
|
||||
@Test
|
||||
void invalidReservedTagPrefixIsRejected() throws Exception {
|
||||
AwsException error = assertThrows(AwsException.class, () -> service.enableSecurityHub(REGION,
|
||||
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
package io.github.hectorvent.floci.services.stepfunctions;
|
||||
|
||||
import io.github.hectorvent.floci.testing.PartitionMatrix.PartitionCase;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.CsvSource;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
import org.junit.jupiter.params.provider.NullAndEmptySource;
|
||||
import org.junit.jupiter.params.provider.ValueSource;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
/**
|
||||
* Service-integration ids carry the state machine's partition, which the CDK builds as
|
||||
* {@code arn:${Aws.PARTITION}:states:::service:api} ({@code task-utils.ts}); the executor used
|
||||
* to compare against literal {@code arn:aws:} strings and silently failed to dispatch every
|
||||
* Task of a China or GovCloud state machine.
|
||||
*/
|
||||
class StatesIntegrationTest {
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("io.github.hectorvent.floci.testing.PartitionMatrix#cases")
|
||||
void optimizedAndSdkIdsParseInEveryPartition(PartitionCase partitionCase) {
|
||||
String prefix = "arn:" + partitionCase.partition() + ":states:::";
|
||||
StatesIntegration lambda = StatesIntegration.parse(prefix + "lambda:invoke").orElseThrow();
|
||||
assertEquals(partitionCase.partition(), lambda.partition());
|
||||
assertTrue(lambda.is("lambda", "invoke"));
|
||||
assertFalse(lambda.isSdk("lambda", "invoke"));
|
||||
assertEquals("", lambda.suffix());
|
||||
assertEquals(prefix + "lambda:invoke", lambda.toString());
|
||||
|
||||
StatesIntegration sdk = StatesIntegration.parse(prefix + "aws-sdk:dynamodb:putItem").orElseThrow();
|
||||
assertTrue(sdk.sdk());
|
||||
assertTrue(sdk.isSdk("dynamodb", "putItem"));
|
||||
assertTrue(sdk.isSdkService("dynamodb"));
|
||||
assertFalse(sdk.isOptimizedService("dynamodb"));
|
||||
assertEquals("putItem", sdk.api());
|
||||
assertEquals(prefix + "aws-sdk:dynamodb:putItem", sdk.withoutSuffix());
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@CsvSource({
|
||||
"arn:aws:states:::states:startExecution.sync, states, startExecution, .sync",
|
||||
"arn:aws-cn:states:::ecs:runTask.sync:2, ecs, runTask, .sync:2",
|
||||
"arn:aws-us-gov:states:::sqs:sendMessage.waitForTaskToken, sqs, sendMessage, .waitForTaskToken",
|
||||
"arn:aws-iso:states:::s3:listObjectsV2, s3, listObjectsV2, ''"})
|
||||
void suffixesArePreservedButNeverPartOfTheApi(String resource, String service, String api, String suffix) {
|
||||
StatesIntegration integration = StatesIntegration.parse(resource).orElseThrow();
|
||||
assertEquals(service, integration.service());
|
||||
assertEquals(api, integration.api());
|
||||
assertEquals(suffix, integration.suffix());
|
||||
assertTrue(integration.isAnySuffix(service, api));
|
||||
assertEquals(suffix.isEmpty(), integration.is(service, api), "is() is exact: a suffixed id is another integration");
|
||||
assertEquals(resource, integration.toString());
|
||||
}
|
||||
|
||||
/** Only AWS's three suffixes exist; anything else is not an integration id, as LocalStack refuses it too. */
|
||||
@ParameterizedTest
|
||||
@ValueSource(strings = {
|
||||
"arn:aws:states:::sqs:sendMessage.bogus",
|
||||
"arn:aws:states:::ecs:runTask.sync:3",
|
||||
"arn:aws:states:::s3:getObject.waitForTaskToken.sync",
|
||||
"arn:aws:states:::aws-sdk:sqs:sendMessage.Sync"})
|
||||
void unknownSuffixesDoNotParse(String resource) {
|
||||
assertTrue(StatesIntegration.parse(resource).isEmpty());
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@NullAndEmptySource
|
||||
@ValueSource(strings = {
|
||||
"arn:aws:states:us-east-1:000000000000:activity:work",
|
||||
"arn:aws:lambda:us-east-1:000000000000:function:f",
|
||||
"arn:aws:states:::lambda",
|
||||
"arn:aws:states:::Lambda:invoke",
|
||||
"arn:aws:states:::lambda:invoke:extra",
|
||||
"states:::lambda:invoke",
|
||||
"arn:mars:states:::lambda:invoke"})
|
||||
void activitiesPlainArnsAndMalformedIdsDoNotParse(String resource) {
|
||||
assertTrue(StatesIntegration.parse(resource).isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
void tailIsEverythingAfterStatesInAnyPartition() {
|
||||
assertEquals("aws-sdk:sfn:startExecution", StatesIntegration.tail("arn:aws-cn:states:::aws-sdk:sfn:startExecution").orElseThrow());
|
||||
assertEquals("oddity", StatesIntegration.tail("arn:aws:states:::oddity").orElseThrow());
|
||||
assertTrue(StatesIntegration.tail("arn:aws:states:us-east-1:000000000000:activity:work").isEmpty());
|
||||
assertTrue(StatesIntegration.tail(null).isEmpty());
|
||||
}
|
||||
}
|
||||
+163
@@ -0,0 +1,163 @@
|
||||
package io.github.hectorvent.floci.services.stepfunctions;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.github.hectorvent.floci.testing.PartitionCleanup;
|
||||
import io.github.hectorvent.floci.testing.PartitionMatrix;
|
||||
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
import io.restassured.response.Response;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.RegisterExtension;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
import static io.restassured.RestAssured.given;
|
||||
import static org.awaitility.Awaitility.await;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
/**
|
||||
* A state machine created under a China signing scope carries {@code arn:aws-cn:states:...}
|
||||
* and, as the CDK generates it, Task resources of the form {@code arn:aws-cn:states:::sqs:sendMessage}.
|
||||
* Those must dispatch exactly like their commercial spelling.
|
||||
*/
|
||||
@QuarkusTest
|
||||
class StepFunctionsPartitionIntegrationTest {
|
||||
|
||||
private static final String REGION = "cn-north-1";
|
||||
private static final String JSON_1_0 = "application/x-amz-json-1.0";
|
||||
private static final ObjectMapper MAPPER = new ObjectMapper();
|
||||
|
||||
@RegisterExtension
|
||||
final PartitionCleanup cleanup = new PartitionCleanup();
|
||||
|
||||
@BeforeAll
|
||||
static void configureRestAssured() {
|
||||
RestAssuredJsonUtils.configureAwsContentTypes();
|
||||
}
|
||||
|
||||
@Test
|
||||
void chinaStateMachineDispatchesItsOwnPartitionsIntegrationIds() throws Exception {
|
||||
String suffix = Long.toString(System.nanoTime(), 36);
|
||||
String queueUrl = createQueue("sfn-partition-" + suffix);
|
||||
|
||||
for (String resource : new String[] {
|
||||
"arn:aws-cn:states:::sqs:sendMessage",
|
||||
"arn:aws-cn:states:::aws-sdk:sqs:sendMessage"}) {
|
||||
String definition = """
|
||||
{
|
||||
"StartAt": "Send",
|
||||
"States": {
|
||||
"Send": {
|
||||
"Type": "Task",
|
||||
"Resource": "%s",
|
||||
"Parameters": {"QueueUrl": "%s", "MessageBody": "from %s"},
|
||||
"End": true
|
||||
}
|
||||
}
|
||||
}
|
||||
""".formatted(resource, queueUrl, resource);
|
||||
String stateMachineArn = createStateMachine("partition-" + suffix + "-" + (resource.contains("aws-sdk") ? "sdk" : "opt"), definition);
|
||||
assertTrue(stateMachineArn.startsWith("arn:aws-cn:states:" + REGION + ":"), stateMachineArn);
|
||||
|
||||
String executionArn = startExecution(stateMachineArn);
|
||||
JsonNode execution = awaitTerminal(executionArn);
|
||||
assertEquals("SUCCEEDED", execution.path("status").asText(),
|
||||
resource + " -> " + execution.path("error").asText() + ": " + execution.path("cause").asText());
|
||||
assertTrue(MAPPER.readTree(execution.path("output").asText()).has("MessageId"), execution.toString());
|
||||
|
||||
JsonNode message = receiveSingleMessage(queueUrl);
|
||||
assertEquals("from " + resource, message.path("Body").asText());
|
||||
}
|
||||
}
|
||||
|
||||
private static String auth(String service) {
|
||||
return PartitionMatrix.sigV4Auth(REGION, service);
|
||||
}
|
||||
|
||||
private String createQueue(String name) {
|
||||
Response response = given()
|
||||
.header("Authorization", auth("sqs"))
|
||||
.header("X-Amz-Target", "AmazonSQS.CreateQueue")
|
||||
.contentType(JSON_1_0)
|
||||
.body("{\"QueueName\":\"" + name + "\"}")
|
||||
.when().post("/");
|
||||
response.then().statusCode(200);
|
||||
String queueUrl = response.jsonPath().getString("QueueUrl");
|
||||
cleanup.register(() -> given()
|
||||
.header("Authorization", auth("sqs"))
|
||||
.header("X-Amz-Target", "AmazonSQS.DeleteQueue")
|
||||
.contentType(JSON_1_0)
|
||||
.body("{\"QueueUrl\":\"" + queueUrl + "\"}")
|
||||
.when().post("/"));
|
||||
return queueUrl;
|
||||
}
|
||||
|
||||
private JsonNode receiveSingleMessage(String queueUrl) throws Exception {
|
||||
Response response = given()
|
||||
.header("Authorization", auth("sqs"))
|
||||
.header("X-Amz-Target", "AmazonSQS.ReceiveMessage")
|
||||
.contentType(JSON_1_0)
|
||||
.body("{\"QueueUrl\":\"" + queueUrl + "\",\"MaxNumberOfMessages\":1,\"WaitTimeSeconds\":1}")
|
||||
.when().post("/");
|
||||
response.then().statusCode(200);
|
||||
JsonNode messages = MAPPER.readTree(response.body().asString()).path("Messages");
|
||||
assertEquals(1, messages.size(), "expected one message: " + messages);
|
||||
given()
|
||||
.header("Authorization", auth("sqs"))
|
||||
.header("X-Amz-Target", "AmazonSQS.DeleteMessage")
|
||||
.contentType(JSON_1_0)
|
||||
.body("{\"QueueUrl\":\"" + queueUrl + "\",\"ReceiptHandle\":\""
|
||||
+ messages.get(0).path("ReceiptHandle").asText() + "\"}")
|
||||
.when().post("/").then().statusCode(200);
|
||||
return messages.get(0);
|
||||
}
|
||||
|
||||
private String createStateMachine(String name, String definition) throws Exception {
|
||||
String body = MAPPER.writeValueAsString(MAPPER.createObjectNode()
|
||||
.put("name", name)
|
||||
.put("definition", definition)
|
||||
.put("roleArn", "arn:aws-cn:iam::000000000000:role/test-role"));
|
||||
Response response = given()
|
||||
.header("Authorization", auth("states"))
|
||||
.header("X-Amz-Target", "AWSStepFunctions.CreateStateMachine")
|
||||
.contentType(JSON_1_0)
|
||||
.body(body)
|
||||
.when().post("/");
|
||||
response.then().statusCode(200);
|
||||
String arn = response.jsonPath().getString("stateMachineArn");
|
||||
cleanup.register(() -> given()
|
||||
.header("Authorization", auth("states"))
|
||||
.header("X-Amz-Target", "AWSStepFunctions.DeleteStateMachine")
|
||||
.contentType(JSON_1_0)
|
||||
.body("{\"stateMachineArn\":\"" + arn + "\"}")
|
||||
.when().post("/"));
|
||||
return arn;
|
||||
}
|
||||
|
||||
private String startExecution(String stateMachineArn) {
|
||||
Response response = given()
|
||||
.header("Authorization", auth("states"))
|
||||
.header("X-Amz-Target", "AWSStepFunctions.StartExecution")
|
||||
.contentType(JSON_1_0)
|
||||
.body("{\"stateMachineArn\":\"" + stateMachineArn + "\",\"input\":\"{}\"}")
|
||||
.when().post("/");
|
||||
response.then().statusCode(200);
|
||||
return response.jsonPath().getString("executionArn");
|
||||
}
|
||||
|
||||
private JsonNode awaitTerminal(String executionArn) {
|
||||
return await().atMost(Duration.ofSeconds(20)).pollInterval(Duration.ofMillis(100)).until(() -> {
|
||||
Response response = given()
|
||||
.header("Authorization", auth("states"))
|
||||
.header("X-Amz-Target", "AWSStepFunctions.DescribeExecution")
|
||||
.contentType(JSON_1_0)
|
||||
.body("{\"executionArn\":\"" + executionArn + "\"}")
|
||||
.when().post("/");
|
||||
response.then().statusCode(200);
|
||||
return MAPPER.readTree(response.body().asString());
|
||||
}, execution -> !"RUNNING".equals(execution.path("status").asText()));
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
# category path count
|
||||
# Generated by tools/partition/partition_literals.py --write-baseline; do not hand-edit.
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/core/common/IamEnforcementFilter.java 8
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/core/common/IamEnforcementFilter.java 4
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayController.java 2
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/apigateway/ExecuteApiSigV4Authorizer.java 1
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/applicationautoscaling/ApplicationAutoScalingService.java 1
|
||||
@@ -13,7 +13,7 @@ arn-literal src/main/java/io/github/hectorvent/floci/services/cloudformation/pro
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/cloudformation/provisioners/CodeBuildCfnProvisioner.java 1
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/cloudformation/provisioners/RedshiftClusterCfnProvisioner.java 1
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/cloudhsmv2/CloudHsmV2JsonHandler.java 1
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/cloudtrail/CloudTrailService.java 7
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/cloudtrail/CloudTrailService.java 5
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/cloudwatch/logs/CloudWatchLogsCrossAccountService.java 1
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/cloudwatch/logs/CloudWatchLogsService.java 1
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/codeartifact/CodeArtifactController.java 1
|
||||
@@ -29,14 +29,12 @@ arn-literal src/main/java/io/github/hectorvent/floci/services/ec2/Ec2IpamService
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/ec2/Ec2Service.java 1
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/ecs/EcsService.java 1
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/eks/EksClusterManager.java 1
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/eks/EksWorkerAuthentication.java 2
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/eks/EksWorkerAuthentication.java 1
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/elasticache/ElastiCacheQueryHandler.java 2
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/emrserverless/EmrServerlessService.java 1
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/guardduty/GuardDutyService.java 1
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/iam/AwsManagedPolicies.java 1
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/iam/IamPolicyEvaluator.java 4
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/iam/SAMLAssertionVerifier.java 2
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/iam/SAMLProviderService.java 2
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/iam/SAMLProviderService.java 1
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/kinesisanalytics/KinesisAnalyticsV2JsonHandler.java 2
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/kinesisanalytics/container/FlinkContainerManager.java 1
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/kms/KmsService.java 1
|
||||
@@ -51,7 +49,6 @@ arn-literal src/main/java/io/github/hectorvent/floci/services/marketplace/Market
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/marketplace/MarketplaceReportingService.java 1
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/marketplace/MarketplaceService.java 1
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/networkfirewall/NetworkFirewallService.java 1
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/oam/OamService.java 1
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/ram/RamService.java 2
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/rds/RdsService.java 1
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/rds/proxy/RdsSigV4Validator.java 1
|
||||
@@ -62,33 +59,18 @@ arn-literal src/main/java/io/github/hectorvent/floci/services/resourceexplorer2/
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/route53resolver/Route53ResolverService.java 5
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/s3/S3ControlController.java 2
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/s3/S3PublicAccessEvaluator.java 1
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/s3/S3ResourcePolicyProvider.java 2
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/s3/S3Service.java 4
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/s3/S3Service.java 3
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/sagemaker/SageMakerService.java 1
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/securityhub/SecurityHubService.java 4
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/securityhub/SecurityHubService.java 3
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/servicecatalog/ServiceCatalogService.java 7
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/servicequotas/ServiceQuotasService.java 2
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/ses/SesService.java 1
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/ses/SesTenantService.java 1
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/signin/SigninService.java 3
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/ssm/SsmService.java 3
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/stepfunctions/AslExecutor.java 32
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/stepfunctions/StepFunctionsService.java 3
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/stepfunctions/AslExecutor.java 5
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/swf/SwfService.java 1
|
||||
arn-literal src/main/java/io/github/hectorvent/floci/services/verifiedpermissions/VerifiedPermissionsService.java 2
|
||||
arn-regex-dialect src/main/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayExecuteController.java 1
|
||||
arn-regex-dialect src/main/java/io/github/hectorvent/floci/services/bedrockagentcorecontrol/BedrockAgentCoreGatewayRuleService.java 3
|
||||
arn-regex-dialect src/main/java/io/github/hectorvent/floci/services/bedrockagentcorecontrol/BedrockAgentCoreToolsService.java 1
|
||||
arn-regex-dialect src/main/java/io/github/hectorvent/floci/services/budgets/BudgetsService.java 2
|
||||
arn-regex-dialect src/main/java/io/github/hectorvent/floci/services/controltower/ControlTowerControlService.java 1
|
||||
arn-regex-dialect src/main/java/io/github/hectorvent/floci/services/controltower/ControlTowerService.java 1
|
||||
arn-regex-dialect src/main/java/io/github/hectorvent/floci/services/firehose/ProcessingConfigurationValidator.java 1
|
||||
arn-regex-dialect src/main/java/io/github/hectorvent/floci/services/kms/KmsService.java 2
|
||||
arn-regex-dialect src/main/java/io/github/hectorvent/floci/services/lambda/LambdaService.java 1
|
||||
arn-regex-dialect src/main/java/io/github/hectorvent/floci/services/ses/SesReceiptRuleService.java 2
|
||||
arn-regex-dialect src/main/java/io/github/hectorvent/floci/services/ssoadmin/SsoAdminService.java 9
|
||||
arn-regex-dialect src/main/java/io/github/hectorvent/floci/services/ssooidc/SsoOidcService.java 1
|
||||
arn-regex-dialect src/main/java/io/github/hectorvent/floci/services/timestreaminfluxdb/TimestreamInfluxDbValidation.java 1
|
||||
dns-suffix src/main/java/io/github/hectorvent/floci/config/EmulatorConfig.java 2
|
||||
dns-suffix src/main/java/io/github/hectorvent/floci/core/common/AwsRegions.java 1
|
||||
dns-suffix src/main/java/io/github/hectorvent/floci/services/account/AccountService.java 1
|
||||
|
||||
|
Reference in new issue
Block a user