fix(iam): check SQS requests on the queue their URL reaches, from the generated table (#8943)

SQS was built by hand: ResourceArnBuilder read a request's QueueUrl or
QueueName into a queue ARN, the request resources table held no SQS
operation, and nothing gave a policy condition a queue's tags. botocore
documents every QueueUrl as "The URL of the Amazon SQS queue ...", which
the generator's documentation rule did not read: it took only a name, an
id or an identifier as what a member names, and the service's own name
stood between "the" and the type's word. It now reads a URL as one more
such kind, and a member's lead drops its model's own service name as
botocore's metadata spells it before the word it qualifies, and a
hyphenated word before the type's word qualifies it ("The URL of a
dead-letter queue"), so QueueUrl names the queue; being neither the
queue's name nor its id, SQS finds it (find). Only SQS's operations
change in the table. sqs moves from HAND_BUILT to NAMESPACES and its
ResourceArnBuilder branch goes. SqsStoredResourceArns finds the queue a
URL reaches as the handlers do, in the account the URL names, and
answers a queue's stored tags; TagQueue and UntagQueue give the queue a
new map one call at a time, and its tags field is volatile.
This commit is contained in:
Priamo Germosen authored and GitHub committed 2026-11-19 07:16:17 -04:00
1 parent 79646214e7
commit 634073fb83
11 files changed
+340 -80

No files matched your search

+14 -6
View File
@@ -2332,7 +2332,7 @@ requests retain HTTP 403 XML `AccessDenied` responses, except SNS's, which retur
action is denied. The routed protocol determines the status, not just the request's content type.
A request is checked against the resources it names. Floci builds their ARNs itself for S3,
SQS, SNS, DynamoDB, Kinesis, SSM, KMS, IAM, Resource Groups, EventBridge
SNS, DynamoDB, Kinesis, SSM, KMS, IAM, Resource Groups, EventBridge
Pipes, Aurora DSQL, EKS, API Gateway, CloudWatch Logs and STS. For Secrets Manager, Elastic Load Balancing, ECR,
Step Functions, EventBridge, EventBridge Scheduler, Amazon Cognito user pools and identity pools, Amazon Data Firehose, Cloud
Map, ACM, CodePipeline, CodeBuild, Amazon Managed Service for Apache Flink (Kinesis Data Analytics v2),
@@ -2341,7 +2341,7 @@ AWS Data Exports, AWS Pricing Calculator, Cost Explorer, CloudTrail, Global Acce
Timestream for InfluxDB, Amazon Redshift, the Amazon Redshift Data API, AWS Payment Cryptography, AWS DataSync, Amazon EMR,
Amazon Rekognition, IAM Identity Center, Amazon Inspector, Amazon Macie, AWS Fault Injection Service, AWS Resource
Access Manager, CloudWatch Observability Access Manager, AWS Resource Explorer, AWS Account Management, AWS Control
Catalog, Amazon OpenSearch Service, IAM Access Analyzer, AWS Security Hub, Amazon GuardDuty, Lambda and AWS Glue they come from a table generated from AWS's Service Reference and botocore, `src/main/resources/aws/iam-request-resources.json`, which gives each
Catalog, Amazon OpenSearch Service, IAM Access Analyzer, AWS Security Hub, Amazon GuardDuty, Lambda, AWS Glue and Amazon SQS they come from a table generated from AWS's Service Reference and botocore, `src/main/resources/aws/iam-request-resources.json`, which gives each
operation's action, the resource types that action acts on with their ARN formats, and the request
members that name them: a member holding a resource's ARN, which counts when it matches the format
of a type the action acts on, or members filling the variables of a type's format. Nothing in it is
@@ -2551,6 +2551,14 @@ request on the ARN it names. A managed MicroVM image named by its name is checke
account, where the Service Reference puts the type; named by its ARN, in `aws`, the account that ARN
names.
An SQS request is checked on the queue its `QueueUrl` reaches, found as SQS's handlers find it, and
`CreateQueue` and `GetQueueUrl` on the queue their `QueueName` names, all from the generated table.
`StartMessageMoveTask` is checked for its own action on each queue ARN it carries, a named destination
included, and on nothing more when it names no destination and the messages go back to the queues they
came from. `ListQueues`, and `CancelMessageMoveTask`, whose `TaskHandle` names no queue, are checked on
`*`, so a grant scoped to a queue, or to the account's queues, does not allow cancelling a move task: it
takes a grant on `*`.
An EKS request is checked in the caller's account, where EKS looks everything up. A cluster route is
checked against the ARN EKS holds the cluster under, or `cluster/<name>` in the request's Region for
a cluster it does not hold, and `CreateCluster` against the cluster its body names, as the EKS user
@@ -3169,7 +3177,7 @@ so a denied request gets `AccessDenied` even for a cluster that does not exist.
that `DbName` needs is not checked.
**IAM's own resources are named.** When enforcement evaluates a request, the target resource comes
from `ResourceArnBuilder`, which builds an ARN for S3, Lambda, SQS, SNS, DynamoDB, Kinesis, Secrets
from `ResourceArnBuilder`, which builds an ARN for S3, Lambda, SNS, DynamoDB, Kinesis, Secrets
Manager, SSM, KMS and IAM. Within IAM the resource type each action is evaluated against is the one
the Service Authorization Reference gives it, so a statement naming a specific user, role, group,
instance profile, managed policy, MFA device, identity provider or server certificate constrains
@@ -3526,9 +3534,9 @@ floci populates:
and endpoint groups, EMR Serverless for its applications, job runs and sessions, EMR on EKS for its virtual clusters,
job runs, managed endpoints, job templates and security configurations, Cost Explorer for its anomaly monitors and
subscriptions, Security Hub for its hubs and configuration policies, Control Tower for its landing zones and enabled
controls, GuardDuty for its detectors and Malware Protection plans, Cloud Map for its namespaces and services, and
Elastic Load Balancing for its load balancers, target groups, listeners and rules and its Classic Load Balancers. Tag
keys differing only in case are one condition key holding every value.
controls, GuardDuty for its detectors and Malware Protection plans, Cloud Map for its namespaces and services, Elastic
Load Balancing for its load balancers, target groups, listeners and rules and its Classic Load Balancers, and SQS for
its queues. Tag keys differing only in case are one condition key holding every value.
- EC2 resource keys such as a network interface's `ec2:Vpc`, `ec2:Subnet`, `ec2:AvailabilityZone` and
`ec2:NetworkInterfaceID`: for every action on a resource EC2 holds, the members of the resource the
key names, an ARN for a key the Service Reference types as one. `resourceKeys` in
@@ -57,9 +57,9 @@ import java.util.Optional;
* monitor or subscription; Security Hub, for the tags of a hub or a configuration policy; Control Tower, for the tags
* of a landing zone or an enabled control; GuardDuty, for the tags of a detector or a Malware Protection plan; Cloud
* Map, for the tags of a namespace or a service; Elastic Load Balancing, for the tags of a load balancer, a target
* group, a listener, a rule or a Classic Load Balancer); looked up lazily by {@code ResourceArnBuilder} and
* {@code IamConditionContextResolver} through {@code Instance<StoredResourceArns>} for the namespace a request or an
* ARN is of, so IAM never depends on that service directly.</p>
* group, a listener, a rule or a Classic Load Balancer; SQS, for the tags of a queue); looked up lazily by
* {@code ResourceArnBuilder} and {@code IamConditionContextResolver} through {@code Instance<StoredResourceArns>} for
* the namespace a request or an ARN is of, so IAM never depends on that service directly.</p>
*
* <p>Each answer is a lookup of what the service holds, asked for by an entry of the generated table ({@code find},
* {@code through}, a default, {@code forwarded}, a type's {@code resourceTagKeys}): never a fact about what an operation acts on, which the table alone
@@ -21,7 +21,6 @@ import io.floci.aws.services.kms.KmsService;
import io.floci.aws.services.s3.S3ControlArnUtils;
import io.floci.aws.services.s3.S3ObjectKeys;
import io.floci.aws.services.s3.S3ResourceArns;
import io.floci.aws.services.sqs.SqsService;
import io.quarkus.vertx.http.runtime.CurrentVertxRequest;
import io.vertx.ext.web.RoutingContext;
import jakarta.enterprise.context.ApplicationScoped;
@@ -186,7 +185,6 @@ public class ResourceArnBuilder {
: IamActionRegistry.decodedPath(ctx);
return switch (credentialScope) {
case "s3" -> buildS3Resources(operation, path, ctx, region);
case "sqs" -> List.of(buildSqsArn(ctx, region, accountId));
case "sns" -> List.of(buildSnsArn(ctx, region, accountId));
case "dynamodb" -> buildDynamoDbArns(ctx, region, accountId);
case "kinesis" -> List.of(buildKinesisArn(ctx, region, accountId));
@@ -1202,28 +1200,6 @@ public class ResourceArnBuilder {
return AwsArnUtils.isArn(resourceArn) ? resourceArn : "*";
}
// ── SQS ─────────────────────────────────────────────────────────────────────
private String buildSqsArn(ContainerRequestContext ctx, String region, String accountId) {
String queueUrl = firstFormParam(ctx, "QueueUrl");
if (queueUrl == null) {
JsonNode json = readJsonBody(ctx);
if (json != null && json.isObject()) {
if (json.hasNonNull("QueueUrl")) {
queueUrl = json.get("QueueUrl").asText().trim();
} else if (json.hasNonNull("QueueName")) {
String queueName = json.get("QueueName").asText().trim();
if (!queueName.isEmpty()) {
return AwsArnUtils.Arn.of("sqs", region, accountId, queueName).toString();
}
}
}
}
if (queueUrl != null && !queueUrl.isEmpty()) {
return SqsService.queueArn(queueUrl, AwsRegions.partitionFor(region), region, accountId);
}
return AwsArnUtils.Arn.of("sqs", region, accountId, "*").toString();
}
// ── SNS ─────────────────────────────────────────────────────────────────────
private String buildSnsArn(ContainerRequestContext ctx, String region, String accountId) {
String topicArn = firstFormParam(ctx, "TopicArn");
@@ -2105,32 +2105,59 @@ public class SqsService implements Resettable, ResourceProvider {
return results;
}
public void tagQueue(String queueUrl, Map<String, String> tags, String region) {
/**
* Gives the queue a new map holding its tags and {@code tags}. Tag calls run one at a time, so two of them never
* lose one's tags, and a lookup reads one whole set.
*/
public synchronized void tagQueue(String queueUrl, Map<String, String> tags, String region) {
String storageKey = regionKey(region, queueUrl);
Queue queue = queueStore.get(storageKey)
.orElseThrow(() -> new AwsException("AWS.SimpleQueueService.NonExistentQueue",
"The specified queue does not exist.", 400));
if (tags != null) {
queue.getTags().putAll(tags);
Map<String, String> merged = new LinkedHashMap<>(queue.getTags());
merged.putAll(tags);
queue.setTags(merged);
}
queueStore.put(storageKey, queue);
LOG.infov("Tagged queue: {0}", queueUrl);
}
public void untagQueue(String queueUrl, List<String> tagKeys, String region) {
/** Gives the queue a new map without {@code tagKeys}, one tag call at a time, as {@link #tagQueue}. */
public synchronized void untagQueue(String queueUrl, List<String> tagKeys, String region) {
String storageKey = regionKey(region, queueUrl);
Queue queue = queueStore.get(storageKey)
.orElseThrow(() -> new AwsException("AWS.SimpleQueueService.NonExistentQueue",
"The specified queue does not exist.", 400));
if (tagKeys != null) {
for (String key : tagKeys) {
queue.getTags().remove(key);
}
Map<String, String> remaining = new LinkedHashMap<>(queue.getTags());
tagKeys.forEach(remaining::remove);
queue.setTags(remaining);
}
queueStore.put(storageKey, queue);
LOG.infov("Untagged queue: {0}", queueUrl);
}
/**
* The ARN of the queue {@code queueUrl} reaches from {@code region}, looked up as the handlers look it up: in the
* account the URL's path names, and the queue of that name held in the Region. Empty when there is no such queue.
*/
Optional<String> heldQueueArn(String queueUrl, String region) {
return getQueueByUrl(regionKey(region, queueUrl), queueUrl).map(queue -> AwsArnUtils.Arn.of("sqs", region,
queue.getAccountId() != null ? queue.getAccountId() : regionResolver.getAccountId(),
queue.getQueueName()).toString());
}
/**
* The tags of the queue {@code queueName} held in {@code region} of {@code account}, read in place under the key
* the handlers read; none when there is no such queue.
*/
Map<String, String> queueTagsInAccount(String account, String region, String queueName) {
String storageKey = regionKey(region, "sqs://queue/" + account + "/" + queueName);
return AccountAwareStorageBackend.readInAccount(queueStore, account, storageKey)
.map(Queue::getTags).filter(Objects::nonNull).orElse(Map.of());
}
private static final ObjectMapper POLICY_MAPPER = new ObjectMapper();
public void addPermission(String queueUrl, String label, List<String> awsAccountIds,
@@ -0,0 +1,73 @@
package io.floci.aws.services.sqs;
import io.floci.aws.core.common.AwsArnUtils;
import io.floci.aws.core.common.RegionResolver;
import io.floci.aws.core.common.StoredResourceArns;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
/**
* IAM's lookups of what SQS holds, for the {@code sqs} namespace: the queue a request names by its URL, which the
* generated request-resource table asks SQS to find, and the tags of a queue.
*/
@ApplicationScoped
public class SqsStoredResourceArns implements StoredResourceArns {
private static final String NAMESPACE = "sqs";
private static final String QUEUE = "queue";
private final SqsService sqs;
private final RegionResolver regionResolver;
@Inject
public SqsStoredResourceArns(SqsService sqs, RegionResolver regionResolver) {
this.sqs = sqs;
this.regionResolver = regionResolver;
}
@Override
public String namespace() {
return NAMESPACE;
}
/**
* The ARN of the queue the one URL in {@code names} reaches from {@code region}, found as the handlers find it: in
* the account the URL's path names and held in the Region. None for another type, several URLs or a URL naming no
* queue.
*/
@Override
public Optional<String> find(String type, List<String> names, String region) {
if (!QUEUE.equals(type) || names.size() != 1) {
return Optional.empty();
}
return sqs.heldQueueArn(names.getFirst(), region);
}
/**
* The tags of the queue whose ARN is {@code arn}, in the request's account, where the tag handlers read: an ARN of
* another account names none, and neither does one other than the ARN {@link #find} gives the queue. The queue is
* read in place by the Region and the name the ARN gives. A tag without
* a value reads as an empty one. Tag calls give the queue a new map, so the read is of one whole set.
*/
@Override
public Map<String, String> storedTags(String arn) {
if (!AwsArnUtils.isArnFor(arn, NAMESPACE)) {
return Map.of();
}
AwsArnUtils.Arn parsed = AwsArnUtils.parse(arn);
String account = regionResolver.getAccountId();
if (!parsed.accountId().equals(account) || parsed.region().isBlank()
|| !arn.equals(AwsArnUtils.Arn.of(NAMESPACE, parsed.region(), account, parsed.resource()).toString())) {
return Map.of();
}
Map<String, String> copy = new LinkedHashMap<>();
sqs.queueTagsInAccount(account, parsed.region(), parsed.resource())
.forEach((key, value) -> copy.put(key, value == null ? "" : value));
return copy;
}
}
@@ -16,7 +16,7 @@ public class Queue {
private String queueUrl;
private String accountId;
private Map<String, String> attributes;
private Map<String, String> tags;
private volatile Map<String, String> tags;
private Instant createdTimestamp;
private Instant lastModifiedTimestamp;
@@ -1,11 +1,11 @@
{
"_source": {"generator": "tools/aws/regen_iam_request_resources.py", "reference": "https://servicereference.us-east-1.amazonaws.com/", "botocore": "botocore 1.43.118 (installed package)", "retrieved": "2026-11-19", "note": "make iam-request-resources-check re-derives every operation's resources from botocore; make iam-request-resources-verify checks every action, type and format against AWS."},
"namespaces": {"access-analyzer": ["accessanalyzer"], "account": ["account"], "acm": ["acm"], "application-autoscaling": ["application-autoscaling"], "athena": ["athena"], "bcm-data-exports": ["bcm-data-exports"], "bcm-pricing-calculator": ["bcm-pricing-calculator"], "budgets": ["budgets"], "ce": ["ce"], "cloudformation": ["cloudcontrol", "cloudformation"], "cloudfront": ["cloudfront"], "cloudfront-keyvaluestore": ["cloudfront-keyvaluestore"], "cloudtrail": ["cloudtrail"], "codebuild": ["codebuild"], "codepipeline": ["codepipeline"], "cognito-identity": ["cognito-identity"], "cognito-idp": ["cognito-idp"], "controlcatalog": ["controlcatalog"], "controltower": ["controltower"], "cur": ["cur"], "datasync": ["datasync"], "dynamodb": ["dynamodb"], "ec2": ["ec2"], "ecr": ["ecr"], "ecs": ["ecs"], "elasticloadbalancing": ["elb", "elbv2"], "elasticmapreduce": ["emr"], "emr-containers": ["emr-containers"], "emr-serverless": ["emr-serverless"], "es": ["es", "opensearch"], "events": ["eventbridgev2", "events"], "firehose": ["firehose"], "fis": ["fis"], "globalaccelerator": ["globalaccelerator"], "glue": ["glue"], "guardduty": ["guardduty"], "inspector2": ["inspector2"], "kinesisanalytics": ["kinesisanalytics", "kinesisanalyticsv2"], "lambda": ["lambda", "lambda-core", "lambda-microvms", "lambda-web"], "logs": ["logs"], "macie2": ["macie2"], "oam": ["oam"], "payment-cryptography": ["payment-cryptography", "payment-cryptography-data"], "quicksight": ["quicksight"], "ram": ["ram"], "rds": ["docdb", "neptune", "rds"], "redshift": ["redshift"], "redshift-data": ["redshift-data"], "redshift-serverless": ["redshift-serverless"], "rekognition": ["rekognition"], "resource-explorer-2": ["resource-explorer-2"], "route53": ["route53"], "s3tables": ["s3tables"], "s3vectors": ["s3vectors"], "scheduler": ["scheduler"], "secretsmanager": ["secretsmanager"], "securityhub": ["securityhub"], "servicediscovery": ["servicediscovery"], "servicequotas": ["service-quotas"], "signer": ["signer", "signer-data"], "ssm": ["ssm"], "sso": ["sso", "sso-admin"], "states": ["stepfunctions"], "textract": ["textract"], "timestream-influxdb": ["timestream-influxdb"], "translate": ["translate"], "xray": ["xray"]},
"handBuilt": ["apigateway", "bedrock", "dsql", "dynamodb", "eks", "iam", "kinesis", "kms", "logs", "pipes", "resource-groups", "s3", "sns", "sqs", "sts"],
"namespaces": {"access-analyzer": ["accessanalyzer"], "account": ["account"], "acm": ["acm"], "application-autoscaling": ["application-autoscaling"], "athena": ["athena"], "bcm-data-exports": ["bcm-data-exports"], "bcm-pricing-calculator": ["bcm-pricing-calculator"], "budgets": ["budgets"], "ce": ["ce"], "cloudformation": ["cloudcontrol", "cloudformation"], "cloudfront": ["cloudfront"], "cloudfront-keyvaluestore": ["cloudfront-keyvaluestore"], "cloudtrail": ["cloudtrail"], "codebuild": ["codebuild"], "codepipeline": ["codepipeline"], "cognito-identity": ["cognito-identity"], "cognito-idp": ["cognito-idp"], "controlcatalog": ["controlcatalog"], "controltower": ["controltower"], "cur": ["cur"], "datasync": ["datasync"], "dynamodb": ["dynamodb"], "ec2": ["ec2"], "ecr": ["ecr"], "ecs": ["ecs"], "elasticloadbalancing": ["elb", "elbv2"], "elasticmapreduce": ["emr"], "emr-containers": ["emr-containers"], "emr-serverless": ["emr-serverless"], "es": ["es", "opensearch"], "events": ["eventbridgev2", "events"], "firehose": ["firehose"], "fis": ["fis"], "globalaccelerator": ["globalaccelerator"], "glue": ["glue"], "guardduty": ["guardduty"], "inspector2": ["inspector2"], "kinesisanalytics": ["kinesisanalytics", "kinesisanalyticsv2"], "lambda": ["lambda", "lambda-core", "lambda-microvms", "lambda-web"], "logs": ["logs"], "macie2": ["macie2"], "oam": ["oam"], "payment-cryptography": ["payment-cryptography", "payment-cryptography-data"], "quicksight": ["quicksight"], "ram": ["ram"], "rds": ["docdb", "neptune", "rds"], "redshift": ["redshift"], "redshift-data": ["redshift-data"], "redshift-serverless": ["redshift-serverless"], "rekognition": ["rekognition"], "resource-explorer-2": ["resource-explorer-2"], "route53": ["route53"], "s3tables": ["s3tables"], "s3vectors": ["s3vectors"], "scheduler": ["scheduler"], "secretsmanager": ["secretsmanager"], "securityhub": ["securityhub"], "servicediscovery": ["servicediscovery"], "servicequotas": ["service-quotas"], "signer": ["signer", "signer-data"], "sqs": ["sqs"], "ssm": ["ssm"], "sso": ["sso", "sso-admin"], "states": ["stepfunctions"], "textract": ["textract"], "timestream-influxdb": ["timestream-influxdb"], "translate": ["translate"], "xray": ["xray"]},
"handBuilt": ["apigateway", "bedrock", "dsql", "dynamodb", "eks", "iam", "kinesis", "kms", "logs", "pipes", "resource-groups", "s3", "sns", "sts"],
"notCovered": {"airflow": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "app-integrations": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "appconfig": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "appsync": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "aps": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "autoscaling": "not read yet: AWS's group and launch configuration ARNs carry an id the service mints, `autoScalingGroup:<id>:autoScalingGroupName/<name>`, while Floci mints `autoScalingGroup:<name>`, which other services (ECS capacity providers) read back; the mint is fixed first", "aws-marketplace": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "backup": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "batch": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "bedrock-agentcore": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "cloudhsm": "not read yet: its ARN formats end in ${CloudHsmClusterInstanceName} and ${CloudHsmBackupInstanceName}, names, while its requests give ClusterId and BackupId, ids, which the rules do not fill a name from, so nearly every operation's resource would be left open", "cloudwatch": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "codeartifact": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "codedeploy": "not read yet: the Service Reference gives an on-premises instance's ARN as `instance:${InstanceName}`, while the CodeDeploy permissions reference gives arn:aws:codedeploy:region:account-id:instance/instance-ID and AWS's GetOnPremisesInstance example answers instance/<name>_<id>, an id the service mints after the name; reading it needs that format corrected", "codeguru-reviewer": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "comprehend": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "config": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "connect": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "detective": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "dlm": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "dms": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "ec2-instance-connect": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "elasticache": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "elasticbeanstalk": "not read yet: an environment's ARN carries its application's name, `environment/<application>/<name>`, while most of its requests name it by EnvironmentName or EnvironmentId alone, so reading it needs the stored environment those find", "elasticfilesystem": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST rLine truncated
"otherNamespaces": ["a4b", "account-access", "acm-pca", "aco-automation", "agent-registry", "aidevops", "aiops", "airflow-serverless", "amplify", "amplifybackend", "amplifyuibuilder", "aoss", "apiportal", "appfabric", "appflow", "application-signals", "application-signals-mcp", "appmesh", "appmesh-preview", "apprunner", "appstream", "apptest", "arc-region-switch", "arc-zonal-shift", "artifact", "assurance", "auditmanager", "aws-external-anthropic", "b2bi", "backup-gateway", "backup-search", "bcm-data-hub", "bedrock-mantle", "bedrock-websearch", "billing", "billingconductor", "braket", "bugbust", "cases", "cassandra", "chatbot", "chime", "cleanrooms", "cleanrooms-ml", "cloud9", "clouddirectory", "cloudsearch", "cloudshell", "cloudtrail-data", "codecatalyst", "codecommit", "codeconnections", "codeguru-profiler", "codeguru-security", "codestar-connections", "codestar-notifications", "codewhisperer", "cognito-sync", "connect-campaigns", "consoleapp", "continuum", "databrew", "dataexchange", "datapipeline", "datazone", "dax", "deadline", "devicefarm", "devops-guru", "directconnect", "docdb-elastic", "drs", "ds", "ds-data", "ebs", "ecr-public", "eks-auth", "elastictranscoder", "elemental-appliances-software", "elemental-inference", "elemental-support-cases", "end-user-messaging", "entityresolution", "evs", "finspace", "finspace-api", "fms", "forecast", "frauddetector", "freertos", "fsx", "gamelift", "gameliftstreams", "geo", "geo-maps", "geo-places", "geo-routes", "glacier", "grafana", "greengrass", "groundstation", "health", "health-agent", "healthlake", "honeycode", "identity-sync", "imagebuilder", "interconnect", "internetmonitor", "invoicing", "iotanalytics", "iotdeviceadvisor", "iotfleethub", "iotfleetwise", "iotjobsdata", "iotmanagedintegrations", "iotsitewise", "iottwinmaker", "iotwireless", "iq", "iq-permission", "ivs", "ivschat", "kafka-cluster", "kafkaconnect", "kendra", "kendra-ranking", "kinesisvideo", "launchwizard", "lex", "license-manager", "license-manager-linux-subscriptions", "license-manager-user-subscriptions", "lookoutequipment", "lookoutmetrics", "lookoutvision", "m2", "machinelearning", "managedblockchain", "mapcredits", "mediaconnect", "mediaconvert", "medialive", "mediapackage", "mediapackage-vod", "mediapackagev2", "mediastore", "mediatailor", "medical-imaging", "mgh", "mgn", "migrationhub-orchestrator", "mobiletargeting", "monitron", "mpa", "neptune-db", "neptune-graph", "network-security-manager", "networkflowmonitor", "networkmanager", "networkmonitor", "nimble", "notifications", "notifications-contacts", "nova-act", "observabilityadmin", "odb", "omics", "one", "opensearch", "opsworks", "osis", "osm", "outposts", "panorama", "partnercentral", "payments", "pca-connector-ad", "pca-connector-scep", "pcs", "personalize", "pi", "polly", "private-networks", "profile", "proton", "purchase-orders", "q", "qapps", "qbusiness", "qdeveloper", "qldb", "rbin", "rds-db", "refactor-spaces", "repostspace", "resiliencehub", "robomaker", "rolesanywhere", "route53-recovery-cluster", "route53-recovery-control-config", "route53-recovery-readiness", "route53globalresolver", "route53profiles", "rtbfabric", "s3-object-lambda", "s3-outposts", "s3express", "s3files", "sagemaker-geospatial", "sagemaker-mlflow", "savingsplans", "schemas", "scn", "sdb", "security-ir", "securityagent", "securitylake", "serverlessrepo", "shield", "simspaceweaver", "sms-voice", "snow-device-management", "social-messaging", "sqlworkbench", "ssm-contacts", "ssm-incidents", "ssm-quicksetup", "ssm-sap", "ssmmessages", "storagegateway", "supportauthz", "synthetics", "thinclient", "timestream", "tnb", "transform", "transform-custom", "trustedadvisor", "ts", "vendor-insights", "voiceid", "vpc-lattice", "vpc-lattice-svcs", "vpce", "waf", "waf-regional", "wellarchitected", "wickr", "wisdom", "workdocs", "worklink", "workmail", "workmailmessageflow", "workspaces", "workspaces-instances", "workspaces-web"],
"arnFormats": {"access-analyzer": {"Analyzer": "arn:${Partition}:access-analyzer:${Region}:${Account}:analyzer/${AnalyzerName}", "ArchiveRule": "arn:${Partition}:access-analyzer:${Region}:${Account}:analyzer/${AnalyzerName}/archive-rule/${RuleName}"}, "account": {"account": "arn:${Partition}:account::${Account}:account", "accountInOrganization": "arn:${Partition}:account::${ManagementAccountId}:account/o-${OrganizationId}/${MemberAccountId}"}, "acm": {"acme-domain-validation": "arn:${Partition}:acm:${Region}:${Account}:acme-endpoint/${AcmeEndpointId}/acme-domain-validation/${AcmeDomainValidationId}", "acme-endpoint": "arn:${Partition}:acm:${Region}:${Account}:acme-endpoint/${AcmeEndpointId}", "acme-external-account-binding": "arn:${Partition}:acm:${Region}:${Account}:acme-endpoint/${AcmeEndpointId}/acme-external-account-binding/${ExternalAccountBindingId}", "certificate": "arn:${Partition}:acm:${Region}:${Account}:certificate/${CertificateId}"}, "application-autoscaling": {"ScalableTarget": "arn:${Partition}:application-autoscaling:${Region}:${Account}:scalable-target/${ResourceId}"}, "athena": {"capacity-reservation": "arn:${Partition}:athena:${Region}:${Account}:capacity-reservation/${CapacityReservationName}", "datacatalog": "arn:${Partition}:athena:${Region}:${Account}:datacatalog/${DataCatalogName}", "session": "arn:${Partition}:athena:${Region}:${Account}:workgroup/${WorkGroupName}/session/${SessionId}", "system-table": "arn:${Partition}:athena:${Region}:${Account}:system-table/${TableName}", "workgroup": "arn:${Partition}:athena:${Region}:${Account}:workgroup/${WorkGroupName}"}, "bcm-data-exports": {"billingview": "arn:${Partition}:billing::${Account}:billingview/${ResourceId}", "export": "arn:${Partition}:bcm-data-exports:${Region}:${Account}:export/${Identifier}", "table": "arn:${Partition}:bcm-data-exports:${Region}:${Account}:table/${Identifier}"}, "bcm-pricing-calculator": {"bill-estimate": "arn:${Partition}:bcm-pricing-calculator::${Account}:bill-estimate/${BillEstimateId}", "bill-scenario": "arn:${Partition}:bcm-pricing-calculator::${Account}:bill-scenario/${BillScenarioId}", "workload-estimate": "arn:${Partition}:bcm-pricing-calculator::${Account}:workload-estimate/${WorkloadEstimateId}"}, "budgets": {"budget": "arn:${Partition}:budgets::${Account}:budget/${BudgetName}", "budgetAction": "arn:${Partition}:budgets::${Account}:budget/${BudgetName}/action/${ActionId}"}, "ce": {"anomalymonitor": "arn:${Partition}:ce::${Account}:anomalymonitor/${Identifier}", "anomalysubscription": "arn:${Partition}:ce::${Account}:anomalysubscription/${Identifier}", "billingview": "arn:${Partition}:billing::${Account}:billingview/${ResourceId}", "costcategory": "arn:${Partition}:ce::${Account}:costcategory/${Identifier}"}, "cloudformation": {"changeset": "arn:${Partition}:cloudformation:${Region}:${Account}:changeSet/${ChangeSetName}/${Id}", "generatedtemplate": "arn:${Partition}:cloudformation:${Region}:${Account}:generatedTemplate/${Id}", "resourcescan": "arn:${Partition}:cloudformation:${Region}:${Account}:resourceScan/${Id}", "stack": "arn:${Partition}:cloudformation:${Region}:${Account}:stack/${StackName}/${Id}", "stackset": "arn:${Partition}:cloudformation:${Region}:${Account}:stackset/${StackSetName}:${Id}", "stackset-target": "arn:${Partition}:cloudformation:${Region}:${Account}:stackset-target/${StackSetTarget}", "type": "arn:${Partition}:cloudformation:${Region}:${Account}:type/resource/${Type}", "typeHook": "arn:${Partition}:cloudformation:${Region}:${Account}:type/hook/${Type}"}, "cloudfront": {"anycast-ip-list": "arn:${Partition}:cloudfront::${Account}:anycast-ip-list/${Id}", "cache-policy": "arn:${Partition}:cloudfront::${Account}:cache-policy/${Id}", "connection-function": "arn:${Partition}:cloudfront::${Account}:connection-function/${Id}", "connection-group": "arn:${Partition}:cloudfront::${Account}:connection-group/${Id}", "continuous-deployment-policy": "arn:${Partition}:cloudfront::${Account}:continuous-deployment-policy/${Id}", "distribution": "arn:${Partition}:cloudfront::${Account}:distribution/${DistributionId}", "distribution-tenant": "arn:${Partition}:cloudfront::${Account}:distribution-tenant/${Id}", "field-level-encryption-config": "arn:${Partition}:cloudfront::${Account}:field-level-encryption-config/${Id}", "field-level-encryption-profile": "arn:${Partition}:cloudfront::${Account}:field-level-encryption-profile/${Id}", "function": "arn:${Partition}:cloudfront::${Account}:function/${Name}", "key-value-store": "arn:${Partition}:cloudfront::${Account}:key-value-store/${Name}", "origin-access-control": "arn:${Partition}:cloudfront::${Account}:origin-access-control/${Id}", "origin-access-identity": "arn:${Partition}:cloudfront::${Account}:origin-access-identity/${Id}", "origin-request-policy": "arn:${Partition}:cloudfront::${Account}:origin-request-policy/${Id}", "realtime-log-config": "arn:${Partition}:cloudfront::${Account}:realtime-log-config/${Name}", "response-headers-policy": "arn:$Line truncated
"resourceTagKeys": {"access-analyzer": {"Analyzer": ["aws:ResourceTag/"]}, "acm": {"acme-domain-validation": ["aws:ResourceTag/"], "acme-endpoint": ["aws:ResourceTag/"], "acme-external-account-binding": ["aws:ResourceTag/"], "certificate": ["aws:ResourceTag/"]}, "application-autoscaling": {"ScalableTarget": ["aws:ResourceTag/"]}, "athena": {"capacity-reservation": ["aws:ResourceTag/"], "datacatalog": ["aws:ResourceTag/"], "session": ["aws:ResourceTag/"], "system-table": ["aws:ResourceTag/"], "workgroup": ["aws:ResourceTag/"]}, "bcm-data-exports": {"billingview": ["aws:ResourceTag/"], "export": ["aws:ResourceTag/"]}, "bcm-pricing-calculator": {"bill-scenario": ["aws:ResourceTag/"], "workload-estimate": ["aws:ResourceTag/"]}, "budgets": {"budget": ["aws:ResourceTag/"], "budgetAction": ["aws:ResourceTag/"]}, "ce": {"anomalymonitor": ["aws:ResourceTag/"], "anomalysubscription": ["aws:ResourceTag/"], "billingview": ["aws:ResourceTag/"], "costcategory": ["aws:ResourceTag/"]}, "cloudformation": {"changeset": ["aws:ResourceTag/"], "stack": ["aws:ResourceTag/"], "stackset": ["aws:ResourceTag/"]}, "cloudfront": {"anycast-ip-list": ["aws:ResourceTag/"], "connection-function": ["aws:ResourceTag/"], "connection-group": ["aws:ResourceTag/"], "distribution": ["aws:ResourceTag/"], "distribution-tenant": ["aws:ResourceTag/"], "function": ["aws:ResourceTag/"], "key-value-store": ["aws:ResourceTag/"], "streaming-distribution": ["aws:ResourceTag/"], "trust-store": ["aws:ResourceTag/"], "vpcorigin": ["aws:ResourceTag/"]}, "cloudtrail": {"channel": ["aws:ResourceTag/"], "dashboard": ["aws:ResourceTag/"], "eventdatastore": ["aws:ResourceTag/"], "trail": ["aws:ResourceTag/"]}, "codebuild": {"project": ["aws:ResourceTag/"], "report-group": ["aws:ResourceTag/"]}, "codepipeline": {"action": ["aws:ResourceTag/"], "actiontype": ["aws:ResourceTag/"], "pipeline": ["aws:ResourceTag/"], "stage": ["aws:ResourceTag/"], "webhook": ["aws:ResourceTag/"]}, "cognito-identity": {"identitypool": ["aws:ResourceTag/"]}, "cognito-idp": {"userpool": ["aws:ResourceTag/"]}, "controltower": {"EnabledBaseline": ["aws:ResourceTag/"], "EnabledControl": ["aws:ResourceTag/"], "LandingZone": ["aws:ResourceTag/"]}, "datasync": {"agent": ["aws:ResourceTag/"], "discoveryjob": ["aws:ResourceTag/"], "location": ["aws:ResourceTag/"], "storagesystem": ["aws:ResourceTag/"], "task": ["aws:ResourceTag/"], "taskexecution": ["aws:ResourceTag/"]}, "dynamodb": {"index": ["aws:ResourceTag/"], "stream": ["aws:ResourceTag/"], "table": ["aws:ResourceTag/"]}, "ec2": {"application-status-check": ["aws:ResourceTag/", "ec2:ResourceTag/"], "capacity-block": ["aws:ResourceTag/", "ec2:ResourceTag/"], "capacity-manager-data-export": ["aws:ResourceTag/", "ec2:ResourceTag/"], "capacity-reservation": ["aws:ResourceTag/", "ec2:ResourceTag/"], "capacity-reservation-cancellation-quote": ["aws:ResourceTag/", "ec2:ResourceTag/"], "capacity-reservation-fleet": ["aws:ResourceTag/", "ec2:ResourceTag/"], "capacity-reservation-modification-quote": ["aws:ResourceTag/", "ec2:ResourceTag/"], "carrier-gateway": ["aws:ResourceTag/", "ec2:ResourceTag/"], "client-vpn-endpoint": ["aws:ResourceTag/", "ec2:ResourceTag/"], "coip-pool": ["aws:ResourceTag/", "ec2:ResourceTag/"], "customer-gateway": ["aws:ResourceTag/", "ec2:ResourceTag/"], "declarative-policies-report": ["aws:ResourceTag/", "ec2:ResourceTag/"], "dedicated-host": ["aws:ResourceTag/", "ec2:ResourceTag/"], "dhcp-options": ["aws:ResourceTag/", "ec2:ResourceTag/"], "egress-only-internet-gateway": ["aws:ResourceTag/", "ec2:ResourceTag/"], "elastic-gpu": ["aws:ResourceTag/", "ec2:ResourceTag/"], "elastic-ip": ["aws:ResourceTag/", "ec2:ResourceTag/"], "export-image-task": ["aws:ResourceTag/", "ec2:ResourceTag/"], "export-instance-task": ["aws:ResourceTag/", "ec2:ResourceTag/"], "fleet": ["aws:ResourceTag/", "ec2:ResourceTag/"], "fpga-image": ["aws:ResourceTag/", "ec2:ResourceTag/"], "host-reservation": ["aws:ResourceTag/", "ec2:ResourceTag/"], "image": ["aws:ResourceTag/", "ec2:ResourceTag/"], "image-usage-report": ["aws:ResourceTag/", "ec2:ResourceTag/"], "import-image-task": ["aws:ResourceTag/", "ec2:ResourceTag/"], "import-snapshot-task": ["aws:ResourceTag/", "ec2:ResourceTag/"], "instance": ["aws:ResourceTag/", "ec2:ResourceTag/"], "instance-connect-endpoint": ["aws:ResourceTag/", "ec2:ResourceTag/"], "instance-event-window": ["aws:ResourceTag/", "ec2:ResourceTag/"], "internet-gateway": ["aws:ResourceTag/", "ec2:ResourceTag/"], "ipam": ["aws:ResourceTag/", "ec2:ResourceTag/"], "ipam-external-resource-verification-token": ["aws:ResourceTag/", "ec2:ResourceTag/"], "ipam-internet-registry-association": ["aws:ResourceTag/", "ec2:ResourceTag/"], "ipam-policy": ["aws:ResourceTag/", "ec2:ResourceTag/"], "ipam-pool": ["aws:ResourceTag/", "ec2:ResourceTag/"], "ipam-pool-allocation": ["aws:ResourceTag/", "ec2:ResourceTag/"], "ipam-prefix-list-resolver": ["aws:ResourceTag/", "ec2:ResourceTag/"], "ipam-prefix-list-resolver-target": ["aws:ResourceTag/", "ec2:Line truncated
"arnFormats": {"access-analyzer": {"Analyzer": "arn:${Partition}:access-analyzer:${Region}:${Account}:analyzer/${AnalyzerName}", "ArchiveRule": "arn:${Partition}:access-analyzer:${Region}:${Account}:analyzer/${AnalyzerName}/archive-rule/${RuleName}"}, "account": {"account": "arn:${Partition}:account::${Account}:account", "accountInOrganization": "arn:${Partition}:account::${ManagementAccountId}:account/o-${OrganizationId}/${MemberAccountId}"}, "acm": {"acme-domain-validation": "arn:${Partition}:acm:${Region}:${Account}:acme-endpoint/${AcmeEndpointId}/acme-domain-validation/${AcmeDomainValidationId}", "acme-endpoint": "arn:${Partition}:acm:${Region}:${Account}:acme-endpoint/${AcmeEndpointId}", "acme-external-account-binding": "arn:${Partition}:acm:${Region}:${Account}:acme-endpoint/${AcmeEndpointId}/acme-external-account-binding/${ExternalAccountBindingId}", "certificate": "arn:${Partition}:acm:${Region}:${Account}:certificate/${CertificateId}"}, "application-autoscaling": {"ScalableTarget": "arn:${Partition}:application-autoscaling:${Region}:${Account}:scalable-target/${ResourceId}"}, "athena": {"capacity-reservation": "arn:${Partition}:athena:${Region}:${Account}:capacity-reservation/${CapacityReservationName}", "datacatalog": "arn:${Partition}:athena:${Region}:${Account}:datacatalog/${DataCatalogName}", "session": "arn:${Partition}:athena:${Region}:${Account}:workgroup/${WorkGroupName}/session/${SessionId}", "system-table": "arn:${Partition}:athena:${Region}:${Account}:system-table/${TableName}", "workgroup": "arn:${Partition}:athena:${Region}:${Account}:workgroup/${WorkGroupName}"}, "bcm-data-exports": {"billingview": "arn:${Partition}:billing::${Account}:billingview/${ResourceId}", "export": "arn:${Partition}:bcm-data-exports:${Region}:${Account}:export/${Identifier}", "table": "arn:${Partition}:bcm-data-exports:${Region}:${Account}:table/${Identifier}"}, "bcm-pricing-calculator": {"bill-estimate": "arn:${Partition}:bcm-pricing-calculator::${Account}:bill-estimate/${BillEstimateId}", "bill-scenario": "arn:${Partition}:bcm-pricing-calculator::${Account}:bill-scenario/${BillScenarioId}", "workload-estimate": "arn:${Partition}:bcm-pricing-calculator::${Account}:workload-estimate/${WorkloadEstimateId}"}, "budgets": {"budget": "arn:${Partition}:budgets::${Account}:budget/${BudgetName}", "budgetAction": "arn:${Partition}:budgets::${Account}:budget/${BudgetName}/action/${ActionId}"}, "ce": {"anomalymonitor": "arn:${Partition}:ce::${Account}:anomalymonitor/${Identifier}", "anomalysubscription": "arn:${Partition}:ce::${Account}:anomalysubscription/${Identifier}", "billingview": "arn:${Partition}:billing::${Account}:billingview/${ResourceId}", "costcategory": "arn:${Partition}:ce::${Account}:costcategory/${Identifier}"}, "cloudformation": {"changeset": "arn:${Partition}:cloudformation:${Region}:${Account}:changeSet/${ChangeSetName}/${Id}", "generatedtemplate": "arn:${Partition}:cloudformation:${Region}:${Account}:generatedTemplate/${Id}", "resourcescan": "arn:${Partition}:cloudformation:${Region}:${Account}:resourceScan/${Id}", "stack": "arn:${Partition}:cloudformation:${Region}:${Account}:stack/${StackName}/${Id}", "stackset": "arn:${Partition}:cloudformation:${Region}:${Account}:stackset/${StackSetName}:${Id}", "stackset-target": "arn:${Partition}:cloudformation:${Region}:${Account}:stackset-target/${StackSetTarget}", "type": "arn:${Partition}:cloudformation:${Region}:${Account}:type/resource/${Type}", "typeHook": "arn:${Partition}:cloudformation:${Region}:${Account}:type/hook/${Type}"}, "cloudfront": {"anycast-ip-list": "arn:${Partition}:cloudfront::${Account}:anycast-ip-list/${Id}", "cache-policy": "arn:${Partition}:cloudfront::${Account}:cache-policy/${Id}", "connection-function": "arn:${Partition}:cloudfront::${Account}:connection-function/${Id}", "connection-group": "arn:${Partition}:cloudfront::${Account}:connection-group/${Id}", "continuous-deployment-policy": "arn:${Partition}:cloudfront::${Account}:continuous-deployment-policy/${Id}", "distribution": "arn:${Partition}:cloudfront::${Account}:distribution/${DistributionId}", "distribution-tenant": "arn:${Partition}:cloudfront::${Account}:distribution-tenant/${Id}", "field-level-encryption-config": "arn:${Partition}:cloudfront::${Account}:field-level-encryption-config/${Id}", "field-level-encryption-profile": "arn:${Partition}:cloudfront::${Account}:field-level-encryption-profile/${Id}", "function": "arn:${Partition}:cloudfront::${Account}:function/${Name}", "key-value-store": "arn:${Partition}:cloudfront::${Account}:key-value-store/${Name}", "origin-access-control": "arn:${Partition}:cloudfront::${Account}:origin-access-control/${Id}", "origin-access-identity": "arn:${Partition}:cloudfront::${Account}:origin-access-identity/${Id}", "origin-request-policy": "arn:${Partition}:cloudfront::${Account}:origin-request-policy/${Id}", "realtime-log-config": "arn:${Partition}:cloudfront::${Account}:realtime-log-config/${Name}", "response-headers-policy": "arn:$Line truncated
"resourceTagKeys": {"access-analyzer": {"Analyzer": ["aws:ResourceTag/"]}, "acm": {"acme-domain-validation": ["aws:ResourceTag/"], "acme-endpoint": ["aws:ResourceTag/"], "acme-external-account-binding": ["aws:ResourceTag/"], "certificate": ["aws:ResourceTag/"]}, "application-autoscaling": {"ScalableTarget": ["aws:ResourceTag/"]}, "athena": {"capacity-reservation": ["aws:ResourceTag/"], "datacatalog": ["aws:ResourceTag/"], "session": ["aws:ResourceTag/"], "system-table": ["aws:ResourceTag/"], "workgroup": ["aws:ResourceTag/"]}, "bcm-data-exports": {"billingview": ["aws:ResourceTag/"], "export": ["aws:ResourceTag/"]}, "bcm-pricing-calculator": {"bill-scenario": ["aws:ResourceTag/"], "workload-estimate": ["aws:ResourceTag/"]}, "budgets": {"budget": ["aws:ResourceTag/"], "budgetAction": ["aws:ResourceTag/"]}, "ce": {"anomalymonitor": ["aws:ResourceTag/"], "anomalysubscription": ["aws:ResourceTag/"], "billingview": ["aws:ResourceTag/"], "costcategory": ["aws:ResourceTag/"]}, "cloudformation": {"changeset": ["aws:ResourceTag/"], "stack": ["aws:ResourceTag/"], "stackset": ["aws:ResourceTag/"]}, "cloudfront": {"anycast-ip-list": ["aws:ResourceTag/"], "connection-function": ["aws:ResourceTag/"], "connection-group": ["aws:ResourceTag/"], "distribution": ["aws:ResourceTag/"], "distribution-tenant": ["aws:ResourceTag/"], "function": ["aws:ResourceTag/"], "key-value-store": ["aws:ResourceTag/"], "streaming-distribution": ["aws:ResourceTag/"], "trust-store": ["aws:ResourceTag/"], "vpcorigin": ["aws:ResourceTag/"]}, "cloudtrail": {"channel": ["aws:ResourceTag/"], "dashboard": ["aws:ResourceTag/"], "eventdatastore": ["aws:ResourceTag/"], "trail": ["aws:ResourceTag/"]}, "codebuild": {"project": ["aws:ResourceTag/"], "report-group": ["aws:ResourceTag/"]}, "codepipeline": {"action": ["aws:ResourceTag/"], "actiontype": ["aws:ResourceTag/"], "pipeline": ["aws:ResourceTag/"], "stage": ["aws:ResourceTag/"], "webhook": ["aws:ResourceTag/"]}, "cognito-identity": {"identitypool": ["aws:ResourceTag/"]}, "cognito-idp": {"userpool": ["aws:ResourceTag/"]}, "controltower": {"EnabledBaseline": ["aws:ResourceTag/"], "EnabledControl": ["aws:ResourceTag/"], "LandingZone": ["aws:ResourceTag/"]}, "datasync": {"agent": ["aws:ResourceTag/"], "discoveryjob": ["aws:ResourceTag/"], "location": ["aws:ResourceTag/"], "storagesystem": ["aws:ResourceTag/"], "task": ["aws:ResourceTag/"], "taskexecution": ["aws:ResourceTag/"]}, "dynamodb": {"index": ["aws:ResourceTag/"], "stream": ["aws:ResourceTag/"], "table": ["aws:ResourceTag/"]}, "ec2": {"application-status-check": ["aws:ResourceTag/", "ec2:ResourceTag/"], "capacity-block": ["aws:ResourceTag/", "ec2:ResourceTag/"], "capacity-manager-data-export": ["aws:ResourceTag/", "ec2:ResourceTag/"], "capacity-reservation": ["aws:ResourceTag/", "ec2:ResourceTag/"], "capacity-reservation-cancellation-quote": ["aws:ResourceTag/", "ec2:ResourceTag/"], "capacity-reservation-fleet": ["aws:ResourceTag/", "ec2:ResourceTag/"], "capacity-reservation-modification-quote": ["aws:ResourceTag/", "ec2:ResourceTag/"], "carrier-gateway": ["aws:ResourceTag/", "ec2:ResourceTag/"], "client-vpn-endpoint": ["aws:ResourceTag/", "ec2:ResourceTag/"], "coip-pool": ["aws:ResourceTag/", "ec2:ResourceTag/"], "customer-gateway": ["aws:ResourceTag/", "ec2:ResourceTag/"], "declarative-policies-report": ["aws:ResourceTag/", "ec2:ResourceTag/"], "dedicated-host": ["aws:ResourceTag/", "ec2:ResourceTag/"], "dhcp-options": ["aws:ResourceTag/", "ec2:ResourceTag/"], "egress-only-internet-gateway": ["aws:ResourceTag/", "ec2:ResourceTag/"], "elastic-gpu": ["aws:ResourceTag/", "ec2:ResourceTag/"], "elastic-ip": ["aws:ResourceTag/", "ec2:ResourceTag/"], "export-image-task": ["aws:ResourceTag/", "ec2:ResourceTag/"], "export-instance-task": ["aws:ResourceTag/", "ec2:ResourceTag/"], "fleet": ["aws:ResourceTag/", "ec2:ResourceTag/"], "fpga-image": ["aws:ResourceTag/", "ec2:ResourceTag/"], "host-reservation": ["aws:ResourceTag/", "ec2:ResourceTag/"], "image": ["aws:ResourceTag/", "ec2:ResourceTag/"], "image-usage-report": ["aws:ResourceTag/", "ec2:ResourceTag/"], "import-image-task": ["aws:ResourceTag/", "ec2:ResourceTag/"], "import-snapshot-task": ["aws:ResourceTag/", "ec2:ResourceTag/"], "instance": ["aws:ResourceTag/", "ec2:ResourceTag/"], "instance-connect-endpoint": ["aws:ResourceTag/", "ec2:ResourceTag/"], "instance-event-window": ["aws:ResourceTag/", "ec2:ResourceTag/"], "internet-gateway": ["aws:ResourceTag/", "ec2:ResourceTag/"], "ipam": ["aws:ResourceTag/", "ec2:ResourceTag/"], "ipam-external-resource-verification-token": ["aws:ResourceTag/", "ec2:ResourceTag/"], "ipam-internet-registry-association": ["aws:ResourceTag/", "ec2:ResourceTag/"], "ipam-policy": ["aws:ResourceTag/", "ec2:ResourceTag/"], "ipam-pool": ["aws:ResourceTag/", "ec2:ResourceTag/"], "ipam-pool-allocation": ["aws:ResourceTag/", "ec2:ResourceTag/"], "ipam-prefix-list-resolver": ["aws:ResourceTag/", "ec2:ResourceTag/"], "ipam-prefix-list-resolver-target": ["aws:ResourceTag/", "ec2:Line truncated
"resourceKeys": {"ec2": {"capacity-reservation": {"ec2:AvailabilityZone": {"member": "AvailabilityZone"}, "ec2:AvailabilityZoneId": {"member": "AvailabilityZoneId"}, "ec2:CapacityReservationFleet": {"member": "CapacityReservationFleetId", "arn": "capacity-reservation-fleet"}, "ec2:EbsOptimized": {"member": "EbsOptimized"}, "ec2:EndDateType": {"member": "EndDateType"}, "ec2:EphemeralStorage": {"member": "EphemeralStorage"}, "ec2:InstanceMatchCriteria": {"member": "InstanceMatchCriteria"}, "ec2:InstanceType": {"member": "InstanceType"}, "ec2:Tenancy": {"member": "Tenancy"}}, "carrier-gateway": {"ec2:Vpc": {"member": "VpcId", "arn": "vpc"}}, "dhcp-options": {"ec2:DhcpOptionsID": {"member": "DhcpOptionsId"}}, "fpga-image": {"ec2:Owner": {"member": "OwnerId"}, "ec2:Public": {"member": "Public"}}, "image": {"ec2:ImageID": {"member": "ImageId"}, "ec2:ImageType": {"member": "ImageType"}, "ec2:Owner": {"member": "OwnerId"}, "ec2:Public": {"member": "Public"}, "ec2:RootDeviceType": {"member": "RootDeviceType"}}, "instance": {"ec2:EbsOptimized": {"member": "EbsOptimized"}, "ec2:InstanceID": {"member": "InstanceId"}, "ec2:InstanceType": {"member": "InstanceType"}, "ec2:RootDeviceType": {"member": "RootDeviceType"}}, "internet-gateway": {"ec2:InternetGatewayID": {"member": "InternetGatewayId"}}, "launch-template": {"ec2:LaunchTemplate": {"member": "LaunchTemplateId", "arn": "launch-template"}}, "network-acl": {"ec2:NetworkAclID": {"member": "NetworkAclId"}, "ec2:Vpc": {"member": "VpcId", "arn": "vpc"}}, "network-interface": {"ec2:AvailabilityZone": {"member": "AvailabilityZone"}, "ec2:NetworkInterfaceID": {"member": "NetworkInterfaceId"}, "ec2:Subnet": {"member": "SubnetId", "arn": "subnet"}, "ec2:Vpc": {"member": "VpcId", "arn": "vpc"}}, "reserved-instances": {"ec2:AvailabilityZone": {"member": "AvailabilityZone"}, "ec2:InstanceType": {"member": "InstanceType"}}, "route-table": {"ec2:RouteTableID": {"member": "RouteTableId"}, "ec2:Vpc": {"member": "VpcId", "arn": "vpc"}}, "secondary-interface": {"ec2:AvailabilityZone": {"member": "AvailabilityZone"}, "ec2:AvailabilityZoneId": {"member": "AvailabilityZoneId"}}, "security-group": {"ec2:Vpc": {"member": "VpcId", "arn": "vpc"}}, "snapshot": {"ec2:AvailabilityZone": {"member": "AvailabilityZone"}, "ec2:Encrypted": {"member": "Encrypted"}, "ec2:Owner": {"member": "OwnerId"}, "ec2:SnapshotID": {"member": "SnapshotId"}, "ec2:VolumeSize": {"member": "VolumeSize"}}, "subnet": {"ec2:AvailabilityZone": {"member": "AvailabilityZone"}, "ec2:AvailabilityZoneId": {"member": "AvailabilityZoneId"}, "ec2:SubnetID": {"member": "SubnetId"}, "ec2:Vpc": {"member": "VpcId", "arn": "vpc"}}, "transit-gateway": {"ec2:transitGatewayId": {"member": "TransitGatewayId"}}, "transit-gateway-attachment": {"ec2:transitGatewayAttachmentId": {"member": "TransitGatewayAttachmentId"}}, "transit-gateway-connect-peer": {"ec2:transitGatewayConnectPeerId": {"member": "TransitGatewayConnectPeerId"}}, "transit-gateway-metering-policy": {"ec2:transitGatewayMeteringPolicyId": {"member": "TransitGatewayMeteringPolicyId"}}, "transit-gateway-multicast-domain": {"ec2:transitGatewayMulticastDomainId": {"member": "TransitGatewayMulticastDomainId"}}, "transit-gateway-policy-table": {"ec2:transitGatewayPolicyTableId": {"member": "TransitGatewayPolicyTableId"}}, "transit-gateway-route-table": {"ec2:transitGatewayRouteTableId": {"member": "TransitGatewayRouteTableId"}}, "transit-gateway-route-table-announcement": {"ec2:transitGatewayRouteTableAnnouncementId": {"member": "TransitGatewayRouteTableAnnouncementId"}}, "volume": {"ec2:AvailabilityZone": {"member": "AvailabilityZone"}, "ec2:AvailabilityZoneId": {"member": "AvailabilityZoneId"}, "ec2:Encrypted": {"member": "Encrypted"}, "ec2:KmsKeyId": {"member": "KmsKeyId"}, "ec2:VolumeID": {"member": "VolumeId"}, "ec2:VolumeInitializationRate": {"member": "VolumeInitializationRate"}, "ec2:VolumeType": {"member": "VolumeType"}}, "vpc": {"ec2:VpcID": {"member": "VpcId"}}, "vpc-peering-connection": {"ec2:VpcPeeringConnectionID": {"member": "VpcPeeringConnectionId"}}}},
"unqualified": {"ssm": ["parameter"], "states": ["statemachine"]},
"mintedIds": {"events": ["api-destination", "connection"]},
@@ -4550,6 +4550,29 @@
"signer:StartSigningJob": {"action": "signer:StartSigningJob", "types": ["signing-profile"], "resources": [{"type": "signing-profile", "fill": {"ProfileName": "profileName"}, "account": "profileOwner"}]},
"signer:TagResource": {"action": "signer:TagResource", "types": ["signing-profile"], "resources": [{"types": ["signing-profile"], "arn": "resourceArn"}], "located": {"resourceArn": "{resourceArn}"}},
"signer:UntagResource": {"action": "signer:UntagResource", "types": ["signing-profile"], "resources": [{"types": ["signing-profile"], "arn": "resourceArn"}], "located": {"resourceArn": "{resourceArn}"}},
"sqs:AddPermission": {"action": "sqs:AddPermission", "types": ["queue"], "resources": [{"type": "queue", "fill": {}, "find": ["QueueUrl"]}]},
"sqs:CancelMessageMoveTask": {"action": "sqs:CancelMessageMoveTask", "types": ["queue"], "resources": []},
"sqs:ChangeMessageVisibility": {"action": "sqs:ChangeMessageVisibility", "types": ["queue"], "resources": [{"type": "queue", "fill": {}, "find": ["QueueUrl"]}]},
"sqs:ChangeMessageVisibilityBatch": {"action": "sqs:ChangeMessageVisibility", "types": ["queue"], "resources": [{"type": "queue", "fill": {}, "find": ["QueueUrl"]}]},
"sqs:CreateQueue": {"action": "sqs:CreateQueue", "types": ["queue"], "resources": [{"type": "queue", "fill": {"QueueName": "QueueName"}}]},
"sqs:DeleteMessage": {"action": "sqs:DeleteMessage", "types": ["queue"], "resources": [{"type": "queue", "fill": {}, "find": ["QueueUrl"]}]},
"sqs:DeleteMessageBatch": {"action": "sqs:DeleteMessage", "types": ["queue"], "resources": [{"type": "queue", "fill": {}, "find": ["QueueUrl"]}]},
"sqs:DeleteQueue": {"action": "sqs:DeleteQueue", "types": ["queue"], "resources": [{"type": "queue", "fill": {}, "find": ["QueueUrl"]}]},
"sqs:GetQueueAttributes": {"action": "sqs:GetQueueAttributes", "types": ["queue"], "resources": [{"type": "queue", "fill": {}, "find": ["QueueUrl"]}]},
"sqs:GetQueueUrl": {"action": "sqs:GetQueueUrl", "types": ["queue"], "resources": [{"type": "queue", "fill": {"QueueName": "QueueName"}}]},
"sqs:ListDeadLetterSourceQueues": {"action": "sqs:ListDeadLetterSourceQueues", "types": ["queue"], "resources": [{"type": "queue", "fill": {}, "find": ["QueueUrl"]}]},
"sqs:ListMessageMoveTasks": {"action": "sqs:ListMessageMoveTasks", "types": ["queue"], "resources": [{"types": ["queue"], "arn": "SourceArn"}]},
"sqs:ListQueueTags": {"action": "sqs:ListQueueTags", "types": ["queue"], "resources": [{"type": "queue", "fill": {}, "find": ["QueueUrl"]}]},
"sqs:ListQueues": {"action": "sqs:ListQueues", "types": [], "resources": []},
"sqs:PurgeQueue": {"action": "sqs:PurgeQueue", "types": ["queue"], "resources": [{"type": "queue", "fill": {}, "find": ["QueueUrl"]}]},
"sqs:ReceiveMessage": {"action": "sqs:ReceiveMessage", "types": ["queue"], "resources": [{"type": "queue", "fill": {}, "find": ["QueueUrl"]}]},
"sqs:RemovePermission": {"action": "sqs:RemovePermission", "types": ["queue"], "resources": [{"type": "queue", "fill": {}, "find": ["QueueUrl"]}]},
"sqs:SendMessage": {"action": "sqs:SendMessage", "types": ["queue"], "resources": [{"type": "queue", "fill": {}, "find": ["QueueUrl"]}]},
"sqs:SendMessageBatch": {"action": "sqs:SendMessage", "types": ["queue"], "resources": [{"type": "queue", "fill": {}, "find": ["QueueUrl"]}]},
"sqs:SetQueueAttributes": {"action": "sqs:SetQueueAttributes", "types": ["queue"], "resources": [{"type": "queue", "fill": {}, "find": ["QueueUrl"]}]},
"sqs:StartMessageMoveTask": {"action": "sqs:StartMessageMoveTask", "types": ["queue"], "resources": [{"types": ["queue"], "arn": "DestinationArn"}, {"types": ["queue"], "arn": "SourceArn"}]},
"sqs:TagQueue": {"action": "sqs:TagQueue", "types": ["queue"], "resources": [{"type": "queue", "fill": {}, "find": ["QueueUrl"]}]},
"sqs:UntagQueue": {"action": "sqs:UntagQueue", "types": ["queue"], "resources": [{"type": "queue", "fill": {}, "find": ["QueueUrl"]}]},
"ssm:AddTagsToResource": {"action": "ssm:AddTagsToResource", "types": ["association", "automation-execution", "cloud-connector", "document", "instance", "maintenancewindow", "managed-instance", "opsitem", "opsmetadata", "parameter", "patchbaseline", "task"], "resources": [{"type": "association", "fill": {"AssociationId": "ResourceId"}, "when": {"ResourceType": ["Association"]}}, {"type": "cloud-connector", "fill": {"CloudConnectorId": "ResourceId"}, "when": {"ResourceType": ["CloudConnector"]}}, {"type": "document", "fill": {"DocumentName": "ResourceId"}, "when": {"ResourceType": ["Document"]}}, {"type": "maintenancewindow", "fill": {"ResourceId": "ResourceId"}, "when": {"ResourceType": ["MaintenanceWindow"]}}, {"type": "managed-instance", "fill": {"InstanceId": "ResourceId"}, "when": {"ResourceType": ["ManagedInstance"]}}, {"type": "opsitem", "fill": {"ResourceId": "ResourceId"}, "when": {"ResourceType": ["OpsItem"]}}, {"type": "opsmetadata", "fill": {"ResourceId": "ResourceId"}, "when": {"ResourceType": ["OpsMetadata"]}}, {"type": "parameter", "fill": {"ParameterNameWithoutLeadingSlash": "ResourceId"}, "when": {"ResourceType": ["Parameter"]}}, {"type": "patchbaseline", "fill": {"PatchBaselineIdResourceId": "ResourceId"}, "when": {"ResourceType": ["PatchBaseline"]}}]},
"ssm:AssociateOpsItemRelatedItem": {"action": "ssm:AssociateOpsItemRelatedItem", "types": ["opsitem"], "resources": [{"type": "opsitem", "fill": {"ResourceId": "OpsItemId"}}]},
"ssm:CancelCommand": {"action": "ssm:CancelCommand", "types": [], "resources": []},
@@ -967,6 +967,46 @@ class IamRequestResourceEnforcementIntegrationTest {
.body("{\"ResourceArn\":\"" + arn + "\",\"Tags\":" + tags + "}").post("/").then().statusCode(200);
}
/**
* An SQS request is checked on the queue its QueueUrl reaches, over the Query and the JSON protocol alike, so a
* grant on one queue's ARN does not reach another; and an {@code aws:ResourceTag} condition reads the tags SQS
* holds on that queue, as TagQueue leaves them.
*/
@Test
void anSqsRequestIsCheckedOnTheQueueItsUrlReachesWithItsTags() {
String tagged = sqsQueue("res-queue-" + suffix());
String other = sqsQueue("res-queue-" + suffix());
admin("sqs").formParam("Action", "TagQueue").formParam("QueueUrl", tagged).formParam("Tag.1.Key", "team")
.formParam("Tag.1.Value", "data").post("/").then().statusCode(200);
String queues = "arn:aws:sqs:" + REGION + ":" + ACCOUNT + ":";
User user = user("res-queue");
user.policy(allowOn("sqs:SendMessage", queues + tagged.substring(tagged.lastIndexOf('/') + 1)) + ","
+ "{\"Effect\":\"Allow\",\"Action\":\"sqs:GetQueueAttributes\",\"Resource\":\"*\","
+ "\"Condition\":{\"StringEquals\":{\"aws:ResourceTag/team\":\"data\"}}}");
user.query("sqs", "SendMessage").formParam("QueueUrl", tagged).formParam("MessageBody", "x").post("/").then()
.statusCode(200);
refused(user.query("sqs", "SendMessage").formParam("QueueUrl", other).formParam("MessageBody", "x")
.post("/").then(), "sqs:SendMessage");
refusedJson(user.json("sqs", "AmazonSQS.SendMessage", "1.0").body("{\"QueueUrl\":\"" + other
+ "\",\"MessageBody\":\"x\"}").post("/").then(), "sqs:SendMessage");
user.json("sqs", "AmazonSQS.GetQueueAttributes", "1.0").body("{\"QueueUrl\":\"" + tagged + "\"}").post("/")
.then().statusCode(200);
refusedJson(user.json("sqs", "AmazonSQS.GetQueueAttributes", "1.0").body("{\"QueueUrl\":\"" + other + "\"}")
.post("/").then(), "sqs:GetQueueAttributes");
refused(user.query("sqs", "GetQueueAttributes").formParam("QueueUrl", other).post("/").then(),
"sqs:GetQueueAttributes");
}
/** An SQS queue an administrator creates, deleted after the test; its URL. */
private String sqsQueue(String name) {
String url = admin("sqs").formParam("Action", "CreateQueue").formParam("QueueName", name).post("/").then()
.statusCode(200).extract().path("CreateQueueResponse.CreateQueueResult.QueueUrl");
cleanup.register(() -> admin("sqs").formParam("Action", "DeleteQueue").formParam("QueueUrl", url).post("/")
.then().statusCode(200));
return url;
}
@Test
void aCloudMapNamespaceAndServiceAreCheckedOnTheArnsTheirIdsGive() {
String namespaceId = cloudMapNamespace("res-ns-" + suffix());
@@ -24,6 +24,9 @@ import io.floci.aws.services.iam.model.ServerCertificate;
import io.floci.aws.services.kms.KmsService;
import io.floci.aws.services.lambda.LambdaStoredResourceArns;
import io.floci.aws.services.lambdamicrovms.LambdaMicrovmsService;
import io.floci.aws.services.sqs.SqsService;
import io.floci.aws.services.sqs.SqsServiceFactory;
import io.floci.aws.services.sqs.SqsStoredResourceArns;
import io.quarkus.vertx.http.runtime.CurrentVertxRequest;
import io.vertx.core.http.HttpServerRequest;
import io.vertx.ext.web.RoutingContext;
@@ -1080,15 +1083,6 @@ class ResourceArnBuilderTest {
return builder.buildStsResources(action, ctx).getFirst();
}
@Test
void sqsBuildsArnFromFormBodyQueueUrl() {
// The handler acts on the body's QueueUrl, so a decoy in the query string must not be checked.
queryParams.add("QueueUrl", "http://localhost:4566/000000000000/allowed");
setFormBody("Action=SendMessage&QueueUrl=http%3A%2F%2Flocalhost%3A4566%2F000000000000%2Forders&MessageBody=x");
String arn = builder.build("sqs", ctx, "us-east-1", "000000000000");
assertEquals("arn:aws:sqs:us-east-1:000000000000:orders", arn);
}
// ── DynamoDB ─────────────────────────────────────────────────────────────────
@@ -1794,24 +1788,99 @@ class ResourceArnBuilderTest {
// ── SQS ─────────────────────────────────────────────────────────────────────
/** A builder reading what an in-memory SQS holds, its queues in {@code account}. */
private static ResourceArnBuilder sqsHolding(String account, String... queues) {
SqsService sqs = SqsServiceFactory.createInMemory("http://localhost:4566",
new RegionResolver("us-east-1", account));
for (String queue : queues) {
sqs.createQueue(queue, Map.of(), "us-east-1");
}
return reading(new SqsStoredResourceArns(sqs, new RegionResolver("us-east-1", ACCOUNT)));
}
/**
* A Query request is checked on the queue its body's QueueUrl reaches, which SQS finds as its handlers do; the
* handler acts on the body's QueueUrl, so a decoy in the query string is not checked.
*/
@Test
void sqsNamesTheAccountTheQueueUrlNames() {
queryParams.putSingle("QueueUrl", "http://localhost:4566/111122223333/orders");
assertEquals("arn:aws:sqs:us-east-1:111122223333:orders", builder.build("sqs", ctx, "us-east-1", "000000000000"));
void sqsChecksTheQueueAFormBodysQueueUrlReaches() {
ResourceArnBuilder builder = sqsHolding(ACCOUNT, "orders", "allowed");
queryParams.add("QueueUrl", "http://localhost:4566/000000000000/allowed");
setFormBody("Action=SendMessage&QueueUrl=http%3A%2F%2Flocalhost%3A4566%2F000000000000%2Forders&MessageBody=x");
assertEquals(List.of("arn:aws:sqs:us-east-1:000000000000:orders"),
builder.buildResources("sqs", "sqs:SendMessage", ctx, "us-east-1", ACCOUNT, "aws"));
}
@Test
void sqsBuildsArnFromJsonQueueName() {
void sqsChecksTheQueueAJsonBodysQueueUrlReaches() {
ResourceArnBuilder builder = sqsHolding(ACCOUNT, "my-queue");
setJsonBody("{\"QueueUrl\":\"http://localhost:4566/000000000000/my-queue\"}");
assertEquals(List.of("arn:aws:sqs:us-east-1:000000000000:my-queue"),
builder.buildResources("sqs", "sqs:GetQueueAttributes", ctx, "us-east-1", ACCOUNT, "aws"));
}
/** A queue URL naming another account reaches the queue that account holds, as the handlers find it. */
@Test
void sqsChecksTheQueueOfTheAccountItsUrlNames() {
ResourceArnBuilder builder = sqsHolding("111122223333", "orders");
setJsonBody("{\"QueueUrl\":\"http://localhost:4566/111122223333/orders\"}");
assertEquals(List.of("arn:aws:sqs:us-east-1:111122223333:orders"),
builder.buildResources("sqs", "sqs:SendMessage", ctx, "us-east-1", ACCOUNT, "aws"));
}
/** A URL reaching no queue leaves the queue's name open. */
@Test
void sqsChecksAnOpenQueueForAUrlReachingNone() {
ResourceArnBuilder builder = sqsHolding(ACCOUNT);
setJsonBody("{\"QueueUrl\":\"http://localhost:4566/000000000000/gone\"}");
assertEquals(List.of("arn:aws:sqs:us-east-1:000000000000:*"),
builder.buildResources("sqs", "sqs:SendMessage", ctx, "us-east-1", ACCOUNT, "aws"));
}
/** ListDeadLetterSourceQueues is checked on the dead-letter queue its QueueUrl reaches. */
@Test
void sqsChecksTheDeadLetterQueueItsUrlReaches() {
ResourceArnBuilder builder = sqsHolding(ACCOUNT, "orders-dlq");
setJsonBody("{\"QueueUrl\":\"http://localhost:4566/000000000000/orders-dlq\"}");
assertEquals(List.of("arn:aws:sqs:us-east-1:000000000000:orders-dlq"),
builder.buildResources("sqs", "sqs:ListDeadLetterSourceQueues", ctx, "us-east-1", ACCOUNT, "aws"));
}
@Test
void sqsChecksANewQueueOnItsName() {
ResourceArnBuilder builder = sqsHolding(ACCOUNT);
setJsonBody("{\"QueueName\":\"order-queue\"}");
String arn = builder.build("sqs", ctx, "us-east-1", "000000000000");
assertEquals("arn:aws:sqs:us-east-1:000000000000:order-queue", arn);
assertEquals(List.of("arn:aws:sqs:us-east-1:000000000000:order-queue"),
builder.buildResources("sqs", "sqs:CreateQueue", ctx, "us-east-1", ACCOUNT, "aws"));
}
/**
* StartMessageMoveTask is checked for its own action on each queue ARN it carries, a named destination included,
* and on the dead-letter queue alone when it names none.
*/
@Test
void sqsBuildsArnFromQueryParam() {
queryParams.putSingle("QueueUrl", "http://localhost:4566/000000000000/my-queue");
String arn = builder.build("sqs", ctx, "us-east-1", "000000000000");
assertEquals("arn:aws:sqs:us-east-1:000000000000:my-queue", arn);
void sqsChecksAMoveTaskOnTheQueueArnsItCarries() {
ResourceArnBuilder builder = sqsHolding(ACCOUNT, "orders-dlq", "orders");
String dlq = "arn:aws:sqs:us-east-1:000000000000:orders-dlq";
String destination = "arn:aws:sqs:us-east-1:000000000000:orders";
setJsonBody("{\"SourceArn\":\"" + dlq + "\",\"DestinationArn\":\"" + destination + "\"}");
assertEquals(List.of(destination, dlq),
builder.buildResources("sqs", "sqs:StartMessageMoveTask", ctx, "us-east-1", ACCOUNT, "aws"));
setJsonBody("{\"SourceArn\":\"" + dlq + "\"}");
assertEquals(List.of(dlq),
builder.buildResources("sqs", "sqs:StartMessageMoveTask", ctx, "us-east-1", ACCOUNT, "aws"));
}
/**
* CancelMessageMoveTask names its task only by its TaskHandle, which names no queue, so it is checked on every
* resource, and a grant scoped to a queue, or to the account's queues, does not allow it.
*/
@Test
void sqsChecksACancelledMoveTaskOnEveryResource() {
ResourceArnBuilder builder = sqsHolding(ACCOUNT, "orders-dlq");
setJsonBody("{\"TaskHandle\":\"eyJ0YXNrSWQiOiJ0In0=\"}");
assertEquals(List.of("*"),
builder.buildResources("sqs", "sqs:CancelMessageMoveTask", ctx, "us-east-1", ACCOUNT, "aws"));
}
// ── SNS ─────────────────────────────────────────────────────────────────────
+36 -16
View File
@@ -293,11 +293,12 @@ NAMESPACES = ("access-analyzer", "account", "acm", "application-autoscaling", "a
"payment-cryptography", "quicksight", "ram", "rds", "redshift", "redshift-data", "redshift-serverless",
"rekognition", "resource-explorer-2", "route53", "s3tables", "s3vectors", "servicediscovery",
"servicequotas", "ssm", "sso", "states", "textract", "timestream-influxdb", "translate", "signer", "xray",
"securityhub", "guardduty", "secretsmanager", "scheduler", "lambda", "cloudformation", "glue")
"securityhub", "guardduty", "secretsmanager", "scheduler", "lambda", "cloudformation", "glue",
"sqs")
# The namespaces whose resources ResourceArnBuilder builds itself.
HAND_BUILT = ("apigateway", "bedrock", "dsql", "dynamodb", "eks", "iam", "kinesis", "kms", "logs", "pipes",
"resource-groups", "s3", "sns", "sqs", "sts")
"resource-groups", "s3", "sns", "sts")
# Operations of a namespace in `HAND_BUILT` read from the reference all the same, each with its reason.
_LOGS_DELIVERY = ("CloudWatch Logs vended-log delivery: its requests name a delivery source, destination or delivery "
@@ -764,8 +765,9 @@ def with_absent_account(resources: list[dict], formats: dict[str, str], accounts
# Words that end a type's name in a member's documentation: "The name of the pipeline to start".
DOC_STOP = {"to", "that", "you", "for", "which", "created", "from", "in", "of", "about", "whose", "with", "on",
"belonging", "being", "the", "a", "an", "is", "are", "and", "or", "by", "used", "will", "should", "can", ""}
# "The name of the pipeline", "Specifies the name or the CloudTrail ARN of the trail", "The ID of the delivery".
DOC_NAMES_RE = re.compile(r"^(?:specifies )?(?:the |a |an )?(?:unique )?(?:name|id|identifier)"
# "The name of the pipeline", "Specifies the name or the CloudTrail ARN of the trail", "The ID of the delivery", "The URL of
# the queue".
DOC_NAMES_RE = re.compile(r"^(?:specifies )?(?:the |a |an )?(?:unique )?(?:name|id|identifier|url)"
r"(?: or (?:the )?(?:[a-z]+ )?arn)? (?:of|for) (?:the |a |an )?(?P<phrase>.+)$")
# "A list of service-generated unique DB Instance Ids belonging to the DB Cluster".
DOC_LIST_RE = re.compile(r"^(?:a |the )?(?:list of )?(?:service-generated |unique )*(?P<phrase>[a-z][a-z0-9 -]*?) "
@@ -796,12 +798,14 @@ def doc_head(lead: str) -> tuple[str, str | None]:
def doc_kind(lead: str) -> str | None:
"""Whether the documentation says the member is a name or an id; None when it says neither."""
"""Whether the documentation says the member is a name, an id or a URL; None when it says none of them."""
head, _ = doc_head(lead)
if re.search(r"\bname(?: or (?:the )?(?:\w+ )?arn)?$", head):
return "name"
if re.search(r"\b(?:id|identifier|ids|identifiers)(?: or (?:the )?(?:\w+ )?arn)?$", head):
return "id"
if re.search(r"\burl$", head):
return "url"
return None
@@ -821,7 +825,8 @@ def spelled(kind: str, arn: str) -> str | None:
def doc_names(lead: str, kind: str, formats: dict[str, str]) -> bool:
"""Whether a member's documentation says it names a resource of the type, by the type's name or its format's
leading resource word, word for word and followed by a word that ends it: "The name of the stream processor you
want to delete" names a `streamprocessor`, "The ID of the pipeline execution" no `pipeline`."""
want to delete" names a `streamprocessor`, "The ID of the pipeline execution" no `pipeline`. A hyphenated word
before it qualifies it: "The URL of a dead-letter queue" names a `queue`."""
word = RESOURCE_PART_RE.match(formats.get(kind, ""))
targets = {re.sub(r"[^a-z0-9]", "", kind.lower())} | ({re.sub(r"[^a-z0-9]", "", word.group(1).lower())} if word else set())
for regex in (DOC_NAMES_RE, DOC_LIST_RE):
@@ -829,19 +834,31 @@ def doc_names(lead: str, kind: str, formats: dict[str, str]) -> bool:
if not match:
continue
words = re.split(r"[\s,;()]+", match.group("phrase"))
joined = ""
for index, piece in enumerate(words[:4]):
joined += re.sub(r"[^a-z0-9]", "", piece)
if joined in targets:
return regex is DOC_LIST_RE or re.sub(r"[^a-z0-9]", "", words[index + 1] if index + 1 < len(words) else "") in DOC_STOP
if not any(target.startswith(joined) for target in targets):
break
starts = [0, 1] if len(words) > 1 and "-" in words[0] else [0]
for start in starts:
joined = ""
for index, piece in enumerate(words[start:start + 4], start):
joined += re.sub(r"[^a-z0-9]", "", piece)
if joined in targets:
return regex is DOC_LIST_RE or re.sub(r"[^a-z0-9]", "", words[index + 1] if index + 1 < len(words) else "") in DOC_STOP
if not any(target.startswith(joined) for target in targets):
break
return False
def _without_service_name(lead: str, model: dict) -> str:
"""A documentation lead without the model's own service name before the word it qualifies, as botocore's metadata
spells it: "the url of the amazon sqs queue to delete" reads "the url of the queue to delete"."""
for name in (model["metadata"].get("serviceFullName"), model["metadata"].get("serviceAbbreviation")):
if name:
lead = re.sub(r"\b" + re.escape(name.lower()) + r" (?=[a-z])", "", lead)
return lead
def documented_members(models: dict[str, dict], operation: str) -> dict[str, dict]:
"""The request's members holding a string or a list of strings, top-level and fields of a top-level structure,
each with its documentation's lead, its pattern and whether it is nested, by name or `Name.Field`."""
each with its documentation's lead, without its service's own name (`_without_service_name`), its pattern and
whether it is nested, by name or `Name.Field`."""
found: dict[str, dict] = {}
for model in models.values():
spec = model["operations"].get(operation)
@@ -863,7 +880,8 @@ def documented_members(models: dict[str, dict], operation: str) -> dict[str, dic
continue
element = model["shapes"][item_shape["member"]["shape"]] if item_shape["type"] == "list" else item_shape
found.setdefault(path, {"path": path + strings, "nested": "." in path,
"lead": _lead(item.get("documentation") or item_shape.get("documentation")),
"lead": _without_service_name(_lead(item.get("documentation")
or item_shape.get("documentation")), model),
"arnValue": bool(re.search(
r"(?:^|\. )this value is an amazon resource name \(arn\)\.",
_lead_text(item.get("documentation") or item_shape.get("documentation")))),
@@ -1707,7 +1725,7 @@ def _kinds(resource: dict) -> list[str]:
def kind_of(name: str) -> str:
"""Whether a name ends as a name, an id, or an identifier (which is either), or neither."""
"""Whether a name ends as a name, an id, or an identifier (which is either), a URL, or none of them."""
lower = name.lower()
if re.search(r"identifiers?$", lower):
return "identifier"
@@ -1715,6 +1733,8 @@ def kind_of(name: str) -> str:
return "name"
if re.search(r"ids?$", lower):
return "id"
if re.search(r"urls?$", lower):
return "url"
return ""
+25 -1
View File
@@ -1117,7 +1117,10 @@ def test_the_vendored_file_is_well_formed():
for kind in ("app", "gwy", "net")]
assert operations["elasticloadbalancing:CreateRule"]["creates"] == [
{"type": f"listener-rule/{kind}", "parent": f"listener/{kind}", "arn": "ListenerArn"} for kind in ("app", "net")]
assert set(document["handBuilt"]) >= {"s3", "sqs"}
assert set(document["handBuilt"]) >= {"s3"}
# An SQS request names its queue by URL, which SQS finds as its handlers do; a create names it by name.
assert operations["sqs:SendMessage"]["resources"] == [{"type": "queue", "fill": {}, "find": ["QueueUrl"]}]
assert operations["sqs:CreateQueue"]["resources"] == [{"type": "queue", "fill": {"QueueName": "QueueName"}}]
# A scalable target is found by the three members naming it, its ARN ending in the id the service mints.
assert operations["application-autoscaling:DeregisterScalableTarget"]["resources"] == [
{"type": "ScalableTarget", "fill": {}, "find": ["ServiceNamespace", "ResourceId", "ScalableDimension"]}]
@@ -2454,6 +2457,27 @@ def test_being_ends_a_types_name_in_documentation():
assert not r.doc_names("name of the workflowrun being run", "workflow", formats)
def test_a_url_of_the_type_is_found_by_its_service():
# "The URL of the Amazon SQS queue to which a message is sent", SQS's SendMessage's QueueUrl: a URL names the type,
# but is neither its name nor its id.
formats = {"queue": "arn:${Partition}:sqs:${Region}:${Account}:${QueueName}"}
assert r.doc_names("the url of the queue to which a message is sent", "queue", formats)
assert r.doc_kind("the url of the queue to which a message is sent") == "url"
assert r.kind_of("QueueUrl") == "url"
assert not r.compatible("QueueUrl", "QueueName")
# "The URL of a dead-letter queue", ListDeadLetterSourceQueues' QueueUrl: a hyphenated word qualifies the type.
assert r.doc_names("the url of a dead-letter queue", "queue", formats)
def test_a_lead_drops_its_own_service_name():
model = {"metadata": {"serviceFullName": "Amazon Simple Queue Service", "serviceAbbreviation": "Amazon SQS"}}
assert r._without_service_name("the url of the amazon sqs queue to delete", model) == "the url of the queue to delete"
assert r._without_service_name("the url of the amazon simple queue service queue", model) == "the url of the queue"
# Another service's name, or this one's at the end, stays.
assert r._without_service_name("the arn of the amazon sns topic", model) == "the arn of the amazon sns topic"
assert r._without_service_name("a queue of amazon sqs", model) == "a queue of amazon sqs"
def widget_model(tags: bool) -> dict:
"""A create whose action acts on the widget's kind alone, naming the widget it makes in `WidgetInput.Name`, and
carrying tags when asked, as Glue's CreateConnection does."""