fix(scheduler): check EventBridge Scheduler requests from the generated request resources (#8406)

EventBridge Scheduler was built by hand in ResourceArnBuilder. It now moves
out of HAND_BUILT into NAMESPACES, so every operation's resources come from
iam-request-resources.json, and the hand builder and the enforcement filter's
routing to it are gone.

A schedule a request names with no group is in the default group, as
botocore documents GroupName: "If you omit this, the default schedule group
is used" (CreateSchedule, DeleteSchedule), and "EventBridge Scheduler
assumes that the schedule is associated with the default group"
(GetSchedule, UpdateSchedule). The rule that reads ECS's "If you do not
specify a cluster, the default cluster is assumed" now reads this phrasing
too, and SchedulerService answers the default group's ARN, reading only. A
resource already chosen by whether its member names the default (an
EventBridge rule on the default bus or on another) takes no default of its
own, so EventBridge's entries stay as they are.

Tagging is checked on the group Scheduler's modeled /tags/{ResourceArn}
carries, the only tagging route AWS gives it. The shared tags controller
now serves a namespace the generated table reads whole only on the routes
its model gives: the bare /tags, or an ARN whose slash is not encoded, is
refused for Scheduler, EMR Serverless, GuardDuty and Security Hub with the
controller's existing "Invalid resource ARN", and tags nothing, rather than
being checked on * where a Deny on the resource would not apply.
This commit is contained in:
Priamo Germosen authored and GitHub committed 2026-11-14 23:59:33 -04:00
1 parent 1b8e4fa503
commit 4a70910c53
24 files changed
+511 -176

No files matched your search

+11 -5
View File
@@ -1926,9 +1926,9 @@ 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, Lambda,
SQS, SNS, DynamoDB, Kinesis, SSM, KMS, IAM, Resource Groups, EventBridge Scheduler, EventBridge
SQS, 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, Amazon Cognito user pools and identity pools, Amazon Data Firehose, Cloud
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),
Application Auto Scaling, AWS Budgets, Cost and Usage Reports, Service Quotas, Amazon Textract, Amazon Translate, Amazon Athena,
AWS Data Exports, AWS Pricing Calculator, Cost Explorer, CloudTrail, Global Accelerator, Amazon
@@ -2122,8 +2122,10 @@ tagging route names, everything after `/tags/` whether its slashes are sent enco
re-encoded, in SigV4 canonical form, as the `Tags` resource's `/tags/<UrlEncodedResourceARN>` gives it.
A Scheduler request is checked against `schedule/<group>/<name>`, the group from the body's
`GroupName` on a create or an update, from `groupName` otherwise, and `default` when neither names
one, or `schedule-group/<name>`. A Pipes request is checked against `pipe/<name>`. A DSQL request
`GroupName` on a create or an update, from `groupName` otherwise, and the `default` group when neither
names one, as botocore documents ("If you omit this, the default schedule group is used"), or
`schedule-group/<name>`, all from the generated table. Its tagging is checked on the group its modeled
`/tags/{ResourceArn}` carries, the ARN encoded as an SDK sends it. A Pipes request is checked against `pipe/<name>`. A DSQL request
is checked against `cluster/<id>`, `cluster/<id>/stream/<id>` for a stream, or the ARN a tagging
route names; `CreateCluster` and `ListClusters` against `cluster/*`, as DSQL checks them. A MicroVM image
or network connector request is checked against `microvm-image:<name>` or `network-connector:<id>`
@@ -2158,7 +2160,11 @@ The shared tagging routes, `/tags` and `/v1/tags`, hand a request to the service
and it is checked as that service, against that ARN, or for EKS the cluster it tags, whatever scope
it is signed with. The ARN is
the one after `/tags/` or `/v1/tags/`, the body's `resourceArn` on `POST /tags`, and the
`resourceArn` query parameter on the other bare routes.
`resourceArn` query parameter on the other bare routes. A service whose resources the generated table reads
whole is served there only on the routes its model gives, as AWS, which tells these services apart by hostname,
serves no other: EventBridge Scheduler, EMR Serverless, GuardDuty and Security Hub tag only on
`/tags/{resourceArn}`, the ARN encoded, and a request on the bare `/tags`, or naming an ARN whose `/` is not
encoded, is refused with `BadRequestException` ("Invalid resource ARN") and tags nothing.
A REST request names its resources in its path and its query as well as its body. For the REST
services the table reads, OpenSearch Service, IAM Access Analyzer, Security Hub and GuardDuty among them, a member its path carries, the
@@ -35,7 +35,8 @@ public abstract class AbstractTagsController {
@GET
@Path("/{arn: .+}")
public Response listTags(@Context HttpHeaders headers, @PathParam("arn") String arn) {
public Response listTags(@Context HttpHeaders headers, @Context UriInfo uriInfo, @PathParam("arn") String arn) {
dispatcher.resolveHandler(arn, uriInfo);
return dispatcher.listTagsForArn(headers, arn);
}
@@ -43,9 +44,10 @@ public abstract class AbstractTagsController {
@Path("/{arn: .+}")
@Consumes(MediaType.APPLICATION_JSON)
public Response tagResourcePost(@Context HttpHeaders headers,
@Context UriInfo uriInfo,
@PathParam("arn") String arn,
String body) {
TagHandler handler = dispatcher.resolveHandler(arn);
TagHandler handler = dispatcher.resolveHandler(arn, uriInfo);
return dispatcher.tagResourcePost(headers, arn, body,
Response.status(handler.tagResourceSuccessStatus()).build());
}
@@ -54,9 +56,10 @@ public abstract class AbstractTagsController {
@Path("/{arn: .+}")
@Consumes(MediaType.APPLICATION_JSON)
public Response tagResourcePut(@Context HttpHeaders headers,
@Context UriInfo uriInfo,
@PathParam("arn") String arn,
String body) {
TagHandler handler = dispatcher.resolveHandler(arn);
TagHandler handler = dispatcher.resolveHandler(arn, uriInfo);
return dispatcher.tagResourcePut(headers, arn, body,
Response.status(handler.tagResourceSuccessStatus()).build());
}
@@ -66,7 +69,7 @@ public abstract class AbstractTagsController {
public Response untagResource(@Context HttpHeaders headers,
@Context UriInfo uriInfo,
@PathParam("arn") String arn) {
TagHandler handler = dispatcher.resolveHandler(arn);
TagHandler handler = dispatcher.resolveHandler(arn, uriInfo);
return dispatcher.untagResourceForArn(headers, uriInfo, arn,
Response.status(handler.untagResourceSuccessStatus()).build(), handler);
}
@@ -1839,7 +1839,7 @@ public class IamEnforcementFilter implements ContainerRequestFilter {
/**
* Logs, Secrets Manager and KMS targets depend on the serving operation and the request's partition, STS
* targets on the serving operation;
* Scheduler and Pipes targets on the request's partition, which those services mint their ARNs in, as are
* Pipes and DSQL targets on the request's partition, which those services mint their ARNs in, as are
* API Gateway's path ARNs; and the
* targets of a namespace the table of request resources reads on {@code operation}, the one the request is
* dispatched as (see {@link RequestResources}).
@@ -1855,8 +1855,7 @@ public class IamEnforcementFilter implements ContainerRequestFilter {
if ("sts".equals(credentialScope)) {
return arnBuilder.buildStsResources(action, ctx);
}
if ("scheduler".equals(credentialScope) || "pipes".equals(credentialScope) || "dsql".equals(credentialScope)
|| "apigateway".equals(credentialScope)) {
if ("pipes".equals(credentialScope) || "dsql".equals(credentialScope) || "apigateway".equals(credentialScope)) {
return arnBuilder.buildResources(credentialScope, ctx, region, accountId, requestPartition());
}
// ARNs the table renders take the request's partition, which a Region Floci does not know cannot be mapped to.
@@ -72,6 +72,15 @@ public final class RequestResources {
return namespace != null && RequestResourceMembers.table().handBuilt().contains(namespace);
}
/**
* Whether the table reads this namespace whole, every operation's resources from its request as modeled: one it
* covers that {@code ResourceArnBuilder} does not build by hand, which a few of its operations may be read for.
*/
public static boolean readsNamespace(String namespace) {
return namespace != null && RequestResourceMembers.table().namespaces().contains(namespace)
&& !builtByHand(namespace);
}
/**
* The ARNs of the resources a request names, in the request's partition, Region and account: empty when the
* table does not read the operation or its request names none, so it is checked on {@code *}. The operation,
@@ -26,6 +26,10 @@ import jakarta.ws.rs.core.UriInfo;
* ({@code arn:aws:<service>:<region>:<account>:<resource>}) and dispatches to the
* matching {@link TagHandler}.
*
* <p>A service whose IAM resources the generated table reads whole is served here only on the routes its AWS model
* gives ({@link TagDispatcher#resolveHandler(String, UriInfo)}): the bare {@code /tags}, or an ARN whose
* {@code /} is not encoded, is refused for it, as AWS has no such route for that service.
*
* <p>The resolution and wire-shape logic lives in {@link TagDispatcher}, shared with
* {@link V1TagsController}, which does the same job for the services AWS puts on
* {@code /v1/tags/{resourceArn}} instead.
@@ -43,15 +47,17 @@ public class SharedTagsController extends AbstractTagsController {
@GET
public Response listTagsByQuery(@Context HttpHeaders headers,
@Context UriInfo uriInfo,
@QueryParam("resourceArn") String arn) {
dispatcher().resolveHandler(arn, uriInfo);
return dispatcher().listTagsForArn(headers, arn);
}
@POST
@Consumes(MediaType.APPLICATION_JSON)
public Response tagResourceByBody(@Context HttpHeaders headers, String body) {
public Response tagResourceByBody(@Context HttpHeaders headers, @Context UriInfo uriInfo, String body) {
String arn = dispatcher().readResourceArn(body);
TagHandler handler = dispatcher().resolveHandler(arn);
TagHandler handler = dispatcher().resolveHandler(arn, uriInfo);
return dispatcher().doTagResource(headers, handler, arn, body,
Response.ok(dispatcher().emptyObject()).build());
}
@@ -60,7 +66,8 @@ public class SharedTagsController extends AbstractTagsController {
public Response untagResourceByQuery(@Context HttpHeaders headers,
@Context UriInfo uriInfo,
@QueryParam("resourceArn") String arn) {
TagHandler handler = dispatcher().resolveHandler(arn, uriInfo);
return dispatcher().untagResourceForArn(headers, uriInfo, arn,
Response.ok(dispatcher().emptyObject()).build());
Response.ok(dispatcher().emptyObject()).build(), handler);
}
}
@@ -4,6 +4,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.floci.aws.services.iam.IamActionRegistry;
import jakarta.ws.rs.core.HttpHeaders;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.core.UriInfo;
@@ -209,16 +210,36 @@ public class TagDispatcher {
try {
serviceKey = AwsArnUtils.parse(arn).service();
} catch (IllegalArgumentException e) {
throw new AwsException("BadRequestException",
"Invalid resource ARN: " + arn, 400);
throw invalidArn(arn);
}
TagHandler handler = handlersByServiceKey.get(serviceKey);
if (handler == null) {
// Surface an unregistered service as an invalid-ARN error so floci's
// internal routing isn't leaked to the client.
throw new AwsException("BadRequestException",
"Invalid resource ARN: " + arn, 400);
throw invalidArn(arn);
}
return handler;
}
/**
* The handler of the service the ARN names, for a request on a path that service's AWS model gives. AWS serves
* a service's tagging on its own routes only, telling the services apart by hostname, so a service whose IAM
* resources the generated table reads from its modeled routes ({@link RequestResources#readsNamespace}) is
* served on those paths alone: the bare {@code /tags}, or a path whose ARN's {@code /} is not encoded, is
* refused as an ARN this path does not serve when its model has no such path
* ({@link IamActionRegistry#modelRoutes}). A method its model does not give on the path is the handler's to
* answer.
*/
public TagHandler resolveHandler(String arn, UriInfo uriInfo) {
TagHandler handler = resolveHandler(arn);
String service = AwsArnUtils.parse(arn).service();
if (RequestResources.readsNamespace(service) && !IamActionRegistry.modelRoutes(service, uriInfo)) {
throw invalidArn(arn);
}
return handler;
}
private static AwsException invalidArn(String arn) {
return new AwsException("BadRequestException", "Invalid resource ARN: " + arn, 400);
}
}
@@ -12,6 +12,7 @@ import jakarta.ws.rs.core.Context;
import jakarta.ws.rs.core.HttpHeaders;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.core.UriInfo;
/**
* Dispatcher for the AWS services that put their tag endpoints on {@code /v1/tags/{resourceArn}}
@@ -46,7 +47,9 @@ public class V1TagsController extends AbstractTagsController {
@POST
@Consumes(MediaType.APPLICATION_JSON)
public Response listTagsForResourceByQuery(@Context HttpHeaders headers,
@Context UriInfo uriInfo,
@QueryParam("resourceArn") String resourceArn) {
dispatcher().resolveHandler(resourceArn, uriInfo);
return dispatcher().listTagsForArn(headers, resourceArn);
}
}
@@ -743,6 +743,18 @@ public class IamActionRegistry {
.map(IamRestRoutes.Match::labels).orElse(Map.of());
}
/**
* Whether the path of a request sent to the URI {@code uriInfo} gives is one of the credential scope's vendored
* model, whatever method it is sent with: matched still percent-encoded, so an encoded {@code /} stays inside
* its label and an unencoded one ends it. True for a scope whose routes are not vendored, which the model
* cannot answer for.
*/
public static boolean modelRoutes(String credentialScope, UriInfo uriInfo) {
IamRestRoutes routes = IamRestRoutes.vendored();
return !routes.routes(credentialScope)
|| routes.takesPath(credentialScope, sentPath(uriInfo), uriInfo.getQueryParameters());
}
/** Keep the modeled operation when AWS authorizes its route under a different action name. */
public String operationForRoute(String credentialScope, String action, ContainerRequestContext ctx) {
if (credentialScope == null || action == null) {
@@ -185,6 +185,15 @@ final class IamRestRoutes {
return routes.containsKey(scope);
}
/**
* Whether a route of the credential scope, of any method, takes the path and query: the path is one of its
* model's, whatever method a request sends to it.
*/
boolean takesPath(String scope, String path, MultivaluedMap<String, String> query) {
return routes.getOrDefault(scope, Map.of()).keySet().stream()
.anyMatch(method -> match(scope, method, path, query).isPresent());
}
static IamRestRoutes parse(InputStream in) throws IOException {
JsonNode document = MAPPER.readTree(in);
JsonNode handRouted = document == null ? null : document.path("handRouted");
@@ -177,7 +177,7 @@ public class ResourceArnBuilder {
}
/**
* The resources a request is checked against. Scheduler, Pipes and DSQL ARNs are minted in
* The resources a request is checked against. Pipes and DSQL ARNs are minted in
* {@code partition}, the request's, as those services mint theirs, so a Region no partition publishes gets
* the deployment's partition rather than {@code aws}.
*/
@@ -210,7 +210,6 @@ public class ResourceArnBuilder {
case "kinesis" -> List.of(buildKinesisArn(ctx, region, accountId));
case "iam" -> buildIamArns(ctx, region, accountId);
case "resource-groups" -> List.of(buildResourceGroupArn(ctx, region, accountId));
case "scheduler" -> List.of(buildSchedulerArn(path, ctx, region, accountId, partition));
case "pipes" -> List.of(buildPipesArn(path, ctx, region, accountId, partition));
case "dsql" -> List.of(buildDsqlArn(path, ctx, region, accountId, partition));
case "eks" -> List.of(buildEksArn(path, ctx, region, accountId));
@@ -1227,37 +1226,6 @@ public class ResourceArnBuilder {
}
}
/**
* The resource of an EventBridge Scheduler route: {@code schedule/<group>/<name>}, the group read where
* Scheduler reads it, the body's {@code GroupName} on a create or an update and {@code groupName}
* otherwise, and {@code default} when the request names none; {@code schedule-group/<name>}; or the
* ARN a tagging route names. The list routes name no resource.
*/
private String buildSchedulerArn(String path, ContainerRequestContext ctx, String region, String accountId,
String partition) {
String schedule = segmentAfterPrefix(path, "/schedules/");
if (schedule != null) {
String group;
if ("POST".equalsIgnoreCase(ctx.getMethod()) || "PUT".equalsIgnoreCase(ctx.getMethod())) {
JsonNode body = readJsonBody(ctx);
group = body == null ? null : body.path("GroupName").asText(null);
} else {
group = ctx.getUriInfo().getQueryParameters().getFirst("groupName");
}
if (group == null || group.isBlank()) {
group = "default";
}
return new AwsArnUtils.Arn(partition, "scheduler", region, accountId,
"schedule/" + group + "/" + schedule).toString();
}
String scheduleGroup = segmentAfterPrefix(path, "/schedule-groups/");
if (scheduleGroup != null) {
return new AwsArnUtils.Arn(partition, "scheduler", region, accountId,
"schedule-group/" + scheduleGroup).toString();
}
return taggedResource(ctx);
}
/**
* The resource of an Aurora DSQL route, as the Service Authorization Reference names it: the cluster
* a cluster route names, the stream a stream route names (its cluster, to create or list streams), or
@@ -12,6 +12,7 @@ import io.floci.aws.core.common.PaginatedResult;
import io.floci.aws.core.common.Pagination;
import io.floci.aws.core.common.RegionResolver;
import io.floci.aws.core.common.SmithyValidationErrors;
import io.floci.aws.core.common.StoredResourceArns;
import io.floci.aws.core.storage.AccountAwareStorageBackend;
import io.floci.aws.core.storage.StorageBackend;
import io.floci.aws.core.storage.StorageFactory;
@@ -26,10 +27,11 @@ import java.time.DateTimeException;
import java.time.Instant;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.regex.Pattern;
@ApplicationScoped
public class SchedulerService {
public class SchedulerService implements StoredResourceArns {
private static final Logger LOG = Logger.getLogger(SchedulerService.class);
@@ -71,6 +73,28 @@ public class SchedulerService {
this.regionResolver = regionResolver;
}
// ──────────────────────────── IAM lookups ────────────────────────────
@Override
public String namespace() {
return "scheduler";
}
/** Scheduler mints no part of an ARN a request names, so there is nothing to look up by name. */
@Override
public Optional<String> find(String type, List<String> names, String region) {
return Optional.empty();
}
/**
* The schedule group Scheduler acts on for a request naming none, {@code default}, which every account has in
* every Region. Reads only: the group is not stored until a request uses it.
*/
@Override
public Optional<String> findDefault(String type, String region) {
return "schedule-group".equals(type) ? Optional.of(buildGroupArn(region, DEFAULT_GROUP)) : Optional.empty();
}
// ──────────────────────────── Schedule Groups ────────────────────────────
public ScheduleGroup getOrCreateDefaultGroup(String region) {
@@ -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-14", "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"], "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-serverless": ["emr-serverless"], "es": ["es", "opensearch"], "events": ["eventbridgev2", "events"], "firehose": ["firehose"], "fis": ["fis"], "globalaccelerator": ["globalaccelerator"], "guardduty": ["guardduty"], "inspector2": ["inspector2"], "kinesisanalytics": ["kinesisanalytics", "kinesisanalyticsv2"], "lambda": ["lambda"], "logs": ["logs"], "macie2": ["macie2"], "oam": ["oam"], "payment-cryptography": ["payment-cryptography", "payment-cryptography-data"], "quicksight": ["quicksight"], "ram": ["ram"], "redshift": ["redshift"], "redshift-data": ["redshift-data"], "redshift-serverless": ["redshift-serverless"], "rekognition": ["rekognition"], "resource-explorer-2": ["resource-explorer-2"], "route53": ["route53"], "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", "lambda", "logs", "pipes", "resource-groups", "s3", "scheduler", "sns", "sqs", "sts"],
"_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-15", "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"], "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-serverless": ["emr-serverless"], "es": ["es", "opensearch"], "events": ["eventbridgev2", "events"], "firehose": ["firehose"], "fis": ["fis"], "globalaccelerator": ["globalaccelerator"], "guardduty": ["guardduty"], "inspector2": ["inspector2"], "kinesisanalytics": ["kinesisanalytics", "kinesisanalyticsv2"], "lambda": ["lambda"], "logs": ["logs"], "macie2": ["macie2"], "oam": ["oam"], "payment-cryptography": ["payment-cryptography", "payment-cryptography-data"], "quicksight": ["quicksight"], "ram": ["ram"], "redshift": ["redshift"], "redshift-data": ["redshift-data"], "redshift-serverless": ["redshift-serverless"], "rekognition": ["rekognition"], "resource-explorer-2": ["resource-explorer-2"], "route53": ["route53"], "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", "lambda", "logs", "pipes", "resource-groups", "s3", "sns", "sqs", "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", "cloudformation": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "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 namLine truncated
"otherNamespaces": ["a4b", "account-access", "acm-pca", "aco-automation", "agent-registry", "aidevops", "aiops", "airflow-serverless", "amplify", "amplifybackend", "amplifyuibuilder", "aoss", "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", "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", "emr-containers", "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", "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}"}, "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:${Partition}:cloudfront::${Account}:response-headers-policy/${Id}", "streaming-distribution": "arn:${Partition}:cloudfront::${Account}:streaming-distribution/${DistributionId}", "trust-store": "arn:${Partition}:cloudfront::${Account}:trust-store/${Id}", "vpcorigin": "arn:${Partition}:cloudfront::${Account}:vpcorigin/${Id}"}, "cloudfront-keyvaluestore": {"key-value-store": "arn:${Partition}:cloudfront::${Account}:key-value-store/${ResourceId}"}, "cloudtrail": {"channel": "arn:${Partition}:cloudtrail:${Region}:${Account}:channel/${ChannelId}", "dashboard": "arn:${Partition}:cloudtrail:${Region}:${Account}:dashboard/${DashboardName}", "eventdatastore": "arn:${Partition}:cloudtrail:${Region}:${Account}:eventdatastore/${EventDataStoreId}", "trail": "arn:${Partition}:cloudtrail:${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/"]}, "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:ResourceTag/"], "ipam-resource-discovery": ["aws:ResourceTag/", "ec2:ResourceTag/"], "ipam-resource-discovery-associatioLine 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}"}, "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:${Partition}:cloudfront::${Account}:response-headers-policy/${Id}", "streaming-distribution": "arn:${Partition}:cloudfront::${Account}:streaming-distribution/${DistributionId}", "trust-store": "arn:${Partition}:cloudfront::${Account}:trust-store/${Id}", "vpcorigin": "arn:${Partition}:cloudfront::${Account}:vpcorigin/${Id}"}, "cloudfront-keyvaluestore": {"key-value-store": "arn:${Partition}:cloudfront::${Account}:key-value-store/${ResourceId}"}, "cloudtrail": {"channel": "arn:${Partition}:cloudtrail:${Region}:${Account}:channel/${ChannelId}", "dashboard": "arn:${Partition}:cloudtrail:${Region}:${Account}:dashboard/${DashboardName}", "eventdatastore": "arn:${Partition}:cloudtrail:${Region}:${Account}:eventdatastore/${EventDataStoreId}", "trail": "arn:${Partition}:cloudtrail:${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/"]}, "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:ResourceTag/"], "ipam-resource-discovery": ["aws:ResourceTag/", "ec2:ResourceTag/"], "ipam-resource-discovery-associatioLine 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": {"lambda": ["function"], "ssm": ["parameter"], "states": ["statemachine"]},
"mintedIds": {"events": ["api-destination", "connection"]},
@@ -3459,6 +3459,18 @@
"route53:UpdateHostedZoneFeatures": {"action": "route53:UpdateHostedZoneFeatures", "types": ["hostedzone"], "resources": [{"type": "hostedzone", "fill": {"Id": "HostedZoneId"}}], "located": {"HostedZoneId": "{Id}"}},
"route53:UpdateTrafficPolicyComment": {"action": "route53:UpdateTrafficPolicyComment", "types": ["trafficpolicy"], "resources": [{"type": "trafficpolicy", "fill": {"Id": "Id"}}], "located": {"Id": "{Id}"}},
"route53:UpdateTrafficPolicyInstance": {"action": "route53:UpdateTrafficPolicyInstance", "types": ["trafficpolicyinstance"], "resources": [{"type": "trafficpolicyinstance", "fill": {"Id": "Id"}}], "located": {"Id": "{Id}"}},
"scheduler:CreateSchedule": {"action": "scheduler:CreateSchedule", "types": ["schedule"], "resources": [{"types": ["schedule"], "arn": "Target.Arn"}, {"type": "schedule", "fill": {"GroupName": "GroupName", "ScheduleName": "Name"}, "defaults": {"GroupName": "schedule-group"}}], "located": {"Name": "{Name}"}},
"scheduler:CreateScheduleGroup": {"action": "scheduler:CreateScheduleGroup", "types": ["schedule-group"], "resources": [{"type": "schedule-group", "fill": {"GroupName": "Name"}}], "located": {"Name": "{Name}"}},
"scheduler:DeleteSchedule": {"action": "scheduler:DeleteSchedule", "types": ["schedule"], "resources": [{"type": "schedule", "fill": {"GroupName": "GroupName", "ScheduleName": "Name"}, "defaults": {"GroupName": "schedule-group"}}], "located": {"GroupName": "?groupName", "Name": "{Name}"}},
"scheduler:DeleteScheduleGroup": {"action": "scheduler:DeleteScheduleGroup", "types": ["schedule-group"], "resources": [{"type": "schedule-group", "fill": {"GroupName": "Name"}}], "located": {"Name": "{Name}"}},
"scheduler:GetSchedule": {"action": "scheduler:GetSchedule", "types": ["schedule"], "resources": [{"type": "schedule", "fill": {"GroupName": "GroupName", "ScheduleName": "Name"}, "defaults": {"GroupName": "schedule-group"}}], "located": {"GroupName": "?groupName", "Name": "{Name}"}},
"scheduler:GetScheduleGroup": {"action": "scheduler:GetScheduleGroup", "types": ["schedule-group"], "resources": [{"type": "schedule-group", "fill": {"GroupName": "Name"}}], "located": {"Name": "{Name}"}},
"scheduler:ListScheduleGroups": {"action": "scheduler:ListScheduleGroups", "types": [], "resources": []},
"scheduler:ListSchedules": {"action": "scheduler:ListSchedules", "types": [], "resources": []},
"scheduler:ListTagsForResource": {"action": "scheduler:ListTagsForResource", "types": ["schedule-group"], "resources": [{"types": ["schedule-group"], "arn": "ResourceArn"}], "located": {"ResourceArn": "{ResourceArn}"}},
"scheduler:TagResource": {"action": "scheduler:TagResource", "types": ["schedule-group"], "resources": [{"types": ["schedule-group"], "arn": "ResourceArn"}], "located": {"ResourceArn": "{ResourceArn}"}},
"scheduler:UntagResource": {"action": "scheduler:UntagResource", "types": ["schedule-group"], "resources": [{"types": ["schedule-group"], "arn": "ResourceArn"}], "located": {"ResourceArn": "{ResourceArn}"}},
"scheduler:UpdateSchedule": {"action": "scheduler:UpdateSchedule", "types": ["schedule"], "resources": [{"types": ["schedule"], "arn": "Target.Arn"}, {"type": "schedule", "fill": {"GroupName": "GroupName", "ScheduleName": "Name"}, "defaults": {"GroupName": "schedule-group"}}], "located": {"Name": "{Name}"}},
"secretsmanager:AssociateCrossAccountReplica": {"action": "secretsmanager:AssociateCrossAccountReplica", "types": ["Secret"], "resources": []},
"secretsmanager:BatchGetSecretValue": {"action": "secretsmanager:BatchGetSecretValue", "types": [], "resources": []},
"secretsmanager:CancelRotateSecret": {"action": "secretsmanager:CancelRotateSecret", "types": ["Secret"], "resources": [{"type": "Secret", "fill": {"SecretId": "SecretId"}}]},
@@ -8,9 +8,12 @@ import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -34,29 +37,45 @@ class AbstractTagsControllerTest {
}
@Test
void listTagsDelegatesToDispatcher() {
void listTagsDelegatesToDispatcherOnARouteOfTheArnsService() {
HttpHeaders headers = mock(HttpHeaders.class);
UriInfo uriInfo = mock(UriInfo.class);
String arn = "arn:aws:apigateway:us-east-1::/restapis/123";
Response expected = Response.ok().build();
when(dispatcher.resolveHandler(arn, uriInfo)).thenReturn(handler);
when(dispatcher.listTagsForArn(headers, arn)).thenReturn(expected);
Response actual = controller.listTags(headers, arn);
Response actual = controller.listTags(headers, uriInfo, arn);
assertEquals(expected, actual);
verify(dispatcher).resolveHandler(arn, uriInfo);
verify(dispatcher).listTagsForArn(headers, arn);
}
@Test
void aRequestOnNoRouteOfTheArnsServiceIsRefusedBeforeItIsDispatched() {
HttpHeaders headers = mock(HttpHeaders.class);
UriInfo uriInfo = mock(UriInfo.class);
String arn = "arn:aws:scheduler:us-east-1:000000000000:schedule-group/reports";
AwsException refused = new AwsException("BadRequestException", "Invalid resource ARN: " + arn, 400);
when(dispatcher.resolveHandler(arn, uriInfo)).thenThrow(refused);
assertSame(refused, assertThrows(AwsException.class, () -> controller.listTags(headers, uriInfo, arn)));
verify(dispatcher, never()).listTagsForArn(any(), any());
}
@Test
void tagResourcePostDispatchesWithHandlerSuccessStatus() {
HttpHeaders headers = mock(HttpHeaders.class);
String arn = "arn:aws:kafka:us-east-1:000000000000:cluster/test/id";
String body = "{\"tags\":{\"env\":\"test\"}}";
when(dispatcher.resolveHandler(arn)).thenReturn(handler);
UriInfo uriInfo = mock(UriInfo.class);
when(dispatcher.resolveHandler(arn, uriInfo)).thenReturn(handler);
when(handler.tagResourceSuccessStatus()).thenReturn(204);
Response expected = Response.noContent().build();
when(dispatcher.tagResourcePost(eq(headers), eq(arn), eq(body), any(Response.class))).thenReturn(expected);
Response actual = controller.tagResourcePost(headers, arn, body);
Response actual = controller.tagResourcePost(headers, uriInfo, arn, body);
assertEquals(expected, actual);
verify(dispatcher).tagResourcePost(eq(headers), eq(arn), eq(body), any(Response.class));
@@ -67,12 +86,13 @@ class AbstractTagsControllerTest {
HttpHeaders headers = mock(HttpHeaders.class);
String arn = "arn:aws:apigateway:us-east-1::/restapis/123";
String body = "{\"tags\":{\"env\":\"test\"}}";
when(dispatcher.resolveHandler(arn)).thenReturn(handler);
UriInfo uriInfo = mock(UriInfo.class);
when(dispatcher.resolveHandler(arn, uriInfo)).thenReturn(handler);
when(handler.tagResourceSuccessStatus()).thenReturn(200);
Response expected = Response.ok().build();
when(dispatcher.tagResourcePut(eq(headers), eq(arn), eq(body), any(Response.class))).thenReturn(expected);
Response actual = controller.tagResourcePut(headers, arn, body);
Response actual = controller.tagResourcePut(headers, uriInfo, arn, body);
assertEquals(expected, actual);
verify(dispatcher).tagResourcePut(eq(headers), eq(arn), eq(body), any(Response.class));
@@ -83,7 +103,7 @@ class AbstractTagsControllerTest {
HttpHeaders headers = mock(HttpHeaders.class);
UriInfo uriInfo = mock(UriInfo.class);
String arn = "arn:aws:apigateway:us-east-1::/restapis/123";
when(dispatcher.resolveHandler(arn)).thenReturn(handler);
when(dispatcher.resolveHandler(arn, uriInfo)).thenReturn(handler);
when(handler.untagResourceSuccessStatus()).thenReturn(204);
Response expected = Response.noContent().build();
when(dispatcher.untagResourceForArn(eq(headers), eq(uriInfo), eq(arn), any(Response.class), eq(handler)))
@@ -451,8 +451,9 @@ class IamEnforcementFilterTest {
}
@Test
void schedulerResourcesAreBuiltInTheRequestsPartition() {
// A Region no partition publishes takes the deployment's partition, which Scheduler mints its ARNs in.
void schedulerResourcesAreReadFromTheTableInTheRequestsPartition() {
// A Region no partition publishes takes the deployment's partition, which Scheduler mints its ARNs in, on the
// operation the request is dispatched as, which the table of request resources reads.
ContainerRequestContext containerRequest = mock(ContainerRequestContext.class);
String auth = "AWS4-HMAC-SHA256 Credential=AKIAUSER/20260924/xx-local-1/scheduler/aws4_request, "
+ "SignedHeaders=host, Signature=abc";
@@ -467,12 +468,13 @@ class IamEnforcementFilterTest {
.thenReturn(Optional.of(descriptor("scheduler", ServiceProtocol.JSON,
Set.of("scheduler"), SchedulerController.class)));
when(actionRegistry.resolveRoute("scheduler", containerRequest)).thenReturn("scheduler:GetSchedule");
when(arnBuilder.buildResources(any(), any(), any(), any(), any())).thenReturn(List.of("*"));
when(arnBuilder.buildResources(any(), any(), any(), any(), any(), any())).thenReturn(List.of("*"));
when(iamService.resolveCallerContext(eq("AKIAUSER"), any())).thenReturn(CallerContext.of(List.of()));
newFilter(resourceInfo(SchedulerController.class)).filter(containerRequest);
verify(arnBuilder).buildResources("scheduler", containerRequest, "xx-local-1", "000000000000", "aws-cn");
verify(arnBuilder).buildResources("scheduler", "scheduler:GetSchedule", containerRequest, "xx-local-1",
"000000000000", "aws-cn");
}
@Test
@@ -0,0 +1,65 @@
package io.floci.aws.core.common;
import com.fasterxml.jackson.databind.ObjectMapper;
import jakarta.ws.rs.core.MultivaluedHashMap;
import jakarta.ws.rs.core.UriInfo;
import org.junit.jupiter.api.Test;
import java.net.URI;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
class TagDispatcherTest {
private static final String GROUP = "arn:aws:scheduler:us-east-1:000000000000:schedule-group/reports";
private static final String PIPE = "arn:aws:pipes:us-east-1:000000000000:pipe/orders";
private final TagHandler scheduler = handler("scheduler");
private final TagHandler pipes = handler("pipes");
private final TagDispatcher dispatcher = new TagDispatcher(List.of(scheduler, pipes),
new RegionResolver("us-east-1", "000000000000"), new ObjectMapper());
/**
* Scheduler, which the generated table reads whole, tags on its modeled /tags/{ResourceArn} alone, the ARN sent
* as one encoded segment: the bare /tags, or an ARN whose slash is not encoded, is no route of its model and is
* refused as an ARN that path does not serve.
*/
@Test
void aServiceTheTableReadsIsServedOnlyOnTheRoutesItsModelGives() {
String encoded = "/tags/arn%3Aaws%3Ascheduler%3Aus-east-1%3A000000000000%3Aschedule-group%2Freports";
assertSame(scheduler, dispatcher.resolveHandler(GROUP, sent(encoded)));
for (String refused : List.of("/tags", "/tags/" + GROUP)) {
AwsException error = assertThrows(AwsException.class,
() -> dispatcher.resolveHandler(GROUP, sent(refused)));
assertEquals(400, error.getHttpStatus());
assertEquals("Invalid resource ARN: " + GROUP, error.getMessage());
}
}
/** Pipes is still built by hand, its tagged ARN read wherever the controller reads it, so every route serves it. */
@Test
void aServiceBuiltByHandIsServedOnEveryRoute() {
assertSame(pipes, dispatcher.resolveHandler(PIPE, sent("/tags")));
assertSame(pipes, dispatcher.resolveHandler(PIPE, sent("/tags/" + PIPE)));
}
private static TagHandler handler(String serviceKey) {
TagHandler handler = mock(TagHandler.class);
when(handler.serviceKey()).thenReturn(serviceKey);
return handler;
}
/** The URI of a request sent to the path, as {@link UriInfo} gives it. */
private static UriInfo sent(String path) {
UriInfo uriInfo = mock(UriInfo.class);
when(uriInfo.getRequestUri()).thenReturn(URI.create("http://localhost:4566" + path));
when(uriInfo.getBaseUri()).thenReturn(URI.create("http://localhost:4566/"));
when(uriInfo.getQueryParameters()).thenReturn(new MultivaluedHashMap<>());
return uriInfo;
}
}
@@ -6,6 +6,8 @@ import io.quarkus.test.junit.QuarkusTest;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Map;
@@ -93,9 +95,9 @@ class CloudFormationListIntrinsicsIntegrationTest {
.when().post("/")
.then().statusCode(200).body("Tags", equalTo(expected));
given()
.queryParam("resourceArn", "arn:aws:scheduler:us-east-1:000000000000:schedule-group/" + name)
.when().get("/tags")
given().urlEncodingEnabled(false)
.when().get("/tags/" + URLEncoder.encode(
"arn:aws:scheduler:us-east-1:000000000000:schedule-group/" + name, StandardCharsets.UTF_8))
.then().statusCode(200).body("Tags", equalTo(expected));
}
} finally {
@@ -6,6 +6,8 @@ import io.restassured.response.Response;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.List;
import static io.restassured.RestAssured.given;
@@ -260,36 +262,36 @@ class GuardDutyControllerIntegrationTest {
String detectorId = createDetector(authorization, "{\"enable\":true,\"tags\":{\"env\":\"test\"}}");
String arn = "arn:aws:guardduty:" + EAST + ":000000000208:detector/" + detectorId;
given()
given().urlEncodingEnabled(false)
.contentType("application/json")
.header("Authorization", authorization)
.body("{\"tags\":{\"team\":\"security\"}}")
.when()
.post("/tags/" + arn)
.post(tagsPath(arn))
.then()
.statusCode(204);
given()
given().urlEncodingEnabled(false)
.header("Authorization", authorization)
.when()
.get("/tags/" + arn)
.get(tagsPath(arn))
.then()
.statusCode(200)
.body("tags.env", equalTo("test"))
.body("tags.team", equalTo("security"));
given()
given().urlEncodingEnabled(false)
.header("Authorization", authorization)
.queryParam("tagKeys", "env")
.when()
.delete("/tags/" + arn)
.delete(tagsPath(arn))
.then()
.statusCode(204);
given()
given().urlEncodingEnabled(false)
.header("Authorization", authorization)
.when()
.get("/tags/" + arn)
.get(tagsPath(arn))
.then()
.statusCode(200)
.body("tags.team", equalTo("security"));
@@ -311,4 +313,9 @@ class GuardDutyControllerIntegrationTest {
.body("detectorId", notNullValue())
.extract().path("detectorId");
}
/** The modeled {@code /tags/{ResourceArn}}, the ARN encoded as one path segment as an SDK sends it. */
private static String tagsPath(String arn) {
return "/tags/" + URLEncoder.encode(arn, StandardCharsets.UTF_8);
}
}
@@ -7,6 +7,8 @@ import io.restassured.specification.RequestSpecification;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.time.Instant;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
@@ -127,16 +129,16 @@ class GuardDutyMalwareProtectionPlanIntegrationTest {
""".formatted(ROLE));
String arn = "arn:aws:guardduty:eu-north-1:000000000205:malware-protection-plan/" + planId;
given().contentType("application/json").header("Authorization", auth)
given().urlEncodingEnabled(false).contentType("application/json").header("Authorization", auth)
.body("{\"tags\":{\"b\":\"2\"}}")
.when().post("/tags/" + arn)
.when().post(tagsPath(arn))
.then().statusCode(204);
given().header("Authorization", auth)
.when().delete("/tags/" + arn + "?tagKeys=a")
given().urlEncodingEnabled(false).header("Authorization", auth)
.when().delete(tagsPath(arn) + "?tagKeys=a")
.then().statusCode(204);
given().header("Authorization", auth)
.when().get("/tags/" + arn)
given().urlEncodingEnabled(false).header("Authorization", auth)
.when().get(tagsPath(arn))
.then().statusCode(200)
.body("tags.b", equalTo("2"))
.body("tags.a", nullValue());
@@ -225,4 +227,9 @@ class GuardDutyMalwareProtectionPlanIntegrationTest {
.body("malwareProtectionPlanId", not(startsWith("arn:")))
.extract().path("malwareProtectionPlanId");
}
/** The modeled {@code /tags/{ResourceArn}}, the ARN encoded as one path segment as an SDK sends it. */
private static String tagsPath(String arn) {
return "/tags/" + URLEncoder.encode(arn, StandardCharsets.UTF_8);
}
}
@@ -184,6 +184,25 @@ class IamActionRegistryTest {
assertEquals(action, registry.resolveRoute("es", mockCtx(method, path, new MultivaluedHashMap<>(), null, "")));
}
@Test
void aRequestIsOnAPathOfAServicesModelOnlyAsTheModelGivesIt() {
MultivaluedMap<String, String> none = new MultivaluedHashMap<>();
String encoded = "/tags/arn%3Aaws%3Ascheduler%3Aus-east-1%3A000000000000%3Aschedule-group%2Freports";
// Scheduler's /tags/{ResourceArn} takes the ARN as one segment, encoded as an SDK sends it, whatever method
// a request sends there.
assertTrue(IamActionRegistry.modelRoutes("scheduler", mockCtx("POST", encoded, none, null, "").getUriInfo()));
assertTrue(IamActionRegistry.modelRoutes("scheduler", mockCtx("PUT", encoded, none, null, "").getUriInfo()));
assertFalse(IamActionRegistry.modelRoutes("scheduler",
mockCtx("POST", "/tags/arn:aws:scheduler:us-east-1:000000000000:schedule-group/reports", none, null, "")
.getUriInfo()));
assertFalse(IamActionRegistry.modelRoutes("scheduler", mockCtx("POST", "/tags", none, null, "").getUriInfo()));
// Control Tower's generated routes give the bare path the shared tags controller also serves it on.
assertTrue(IamActionRegistry.modelRoutes("controltower",
mockCtx("POST", "/tags", none, null, "").getUriInfo()));
// A scope whose routes are not vendored is not one the model can answer for.
assertTrue(IamActionRegistry.modelRoutes("sqs", mockCtx("POST", "/tags", none, null, "").getUriInfo()));
}
@Test
void theLabelsOfTheVendoredRouteARequestMatchesAreItsPathsValuesDecoded() {
MultivaluedMap<String, String> none = new MultivaluedHashMap<>();
@@ -144,28 +144,39 @@ class IamRestRouteEnforcementIntegrationTest {
}
@Test
void schedulerTaggingIsCheckedOnTheBareTagsRouteToo() {
// The shared tagging routes also take the ARN in the body of POST /tags.
void schedulerTaggingIsCheckedOnTheGroupItsModeledRouteNamesAndServedOnNoOtherRoute() {
// Scheduler tags the group whose ARN its modeled /tags/{ResourceArn} carries, which the generated request
// resources read, so a Deny on that group holds against an Allow on every resource. The shared controller's
// bare POST /tags is no route of Scheduler's model, as AWS gives it none: let through, it is refused as an
// ARN that path does not serve, and tags nothing.
String user = user("route-scheduler-tags");
String group = scheduleGroup("route-group-" + suffix());
String tagsPath = "/tags/" + encoded(group);
String tags = "{\"Tags\":[{\"Key\":\"team\",\"Value\":\"a\"}]}";
policy(user, allow("scheduler:ListTagsForResource", "*"));
refused(as(user, "scheduler").body(tagBody(group)).post("/tags").then(), "scheduler:TagResource");
refused(as(user, "scheduler").urlEncodingEnabled(false).body(tags).post(tagsPath).then(),
"scheduler:TagResource");
policy(user, allow("scheduler:TagResource", group));
// Allowed on that group, the request reaches Scheduler, which has no such group.
as(user, "scheduler").body(tagBody(group)).post("/tags").then().statusCode(not(403));
as(user, "scheduler").urlEncodingEnabled(false).body(tags).post(tagsPath).then().statusCode(not(403));
policy(user, allow("scheduler:TagResource", "*") + "," + deny("scheduler:TagResource", group));
refused(as(user, "scheduler").urlEncodingEnabled(false).body(tags).post(tagsPath).then(),
"scheduler:TagResource");
as(user, "scheduler").body(tagBody(group)).post("/tags").then().statusCode(400)
.body(containsString("Invalid resource ARN"));
}
@Test
void postTagsIsCheckedAgainstTheArnItsBodyNames() {
// POST /tags tags the ARN its body names: one named in the query does not move the check.
String user = user("route-tags-body");
String allowed = scheduleGroup("route-allowed-" + suffix());
String other = scheduleGroup("route-other-" + suffix());
String allowed = "arn:aws:pipes:us-east-1:" + ACCOUNT + ":pipe/route-allowed-" + suffix();
String other = "arn:aws:pipes:us-east-1:" + ACCOUNT + ":pipe/route-other-" + suffix();
policy(user, allow("scheduler:TagResource", allowed));
refused(as(user, "scheduler").queryParam("resourceArn", allowed).body(tagBody(other)).post("/tags").then(),
"scheduler:TagResource");
policy(user, allow("pipes:TagResource", allowed));
refused(as(user, "pipes").queryParam("resourceArn", allowed).body(tagBody(other)).post("/tags").then(),
"pipes:TagResource");
}
@Test
@@ -2414,65 +2414,101 @@ class ResourceArnBuilderTest {
builder.buildResources("apigateway", ctx, "us-gov-west-1", ACCOUNT, "aws-us-gov"));
}
/**
* Scheduler as IAM asks it: the {@code default} schedule group, in the partition given, the one a request naming
* no group acts on.
*/
private static StoredResourceArns schedulerIn(String partition) {
return new StoredResourceArns() {
@Override
public String namespace() {
return "scheduler";
}
@Override
public Optional<String> find(String type, List<String> names, String region) {
return Optional.empty();
}
@Override
public Optional<String> findDefault(String type, String region) {
return "schedule-group".equals(type)
? Optional.of("arn:" + partition + ":scheduler:" + region + ":" + ACCOUNT
+ ":schedule-group/default")
: Optional.empty();
}
};
}
private List<String> schedulerResources(ResourceArnBuilder builder, String method, String sent, String operation) {
when(ctx.getMethod()).thenReturn(method);
request(sent);
return builder.buildResources("scheduler", "scheduler:" + operation, ctx, "us-east-1", ACCOUNT, "aws");
}
/**
* A schedule is in the group its request names, the body's {@code GroupName} on a create or an update and the
* {@code groupName} query parameter otherwise, and in the {@code default} group when it names none, as botocore
* documents ("If you omit this, the default schedule group is used"); a group is the one its path names; a tag
* route's resource the ARN in its path; and the list operations act on no resource type.
*/
@Test
void schedulerRoutesResolveTheScheduleInItsGroupTheGroupOrTheTaggedArn() {
when(uriInfo.getPath()).thenReturn("/schedules/nightly");
assertEquals("arn:aws:scheduler:us-east-1:000000000000:schedule/default/nightly",
builder.build("scheduler", ctx, "us-east-1", "000000000000"));
void aScheduleIsInTheGroupItsRequestNamesOrTheDefaultOneAndAGroupIsTheOneItsPathNames() {
ResourceArnBuilder backed = reading(schedulerIn("aws"));
String schedule = "arn:aws:scheduler:us-east-1:000000000000:schedule/";
assertEquals(List.of(schedule + "default/nightly"),
schedulerResources(backed, "GET", "/schedules/nightly", "GetSchedule"));
assertEquals(List.of(schedule + "default/nightly"),
schedulerResources(backed, "DELETE", "/schedules/nightly", "DeleteSchedule"));
queryParams.putSingle("groupName", "reports");
assertEquals("arn:aws:scheduler:us-east-1:000000000000:schedule/reports/nightly",
builder.build("scheduler", ctx, "us-east-1", "000000000000"));
// A create or update names its group in the body, which Scheduler reads, not in the query, which
// it ignores for them: a groupName there does not move the check to another group.
when(ctx.getMethod()).thenReturn("POST");
setJsonBody("{\"GroupName\":\"billing\",\"ScheduleExpression\":\"rate(1 hour)\"}");
assertEquals("arn:aws:scheduler:us-east-1:000000000000:schedule/billing/nightly",
builder.build("scheduler", ctx, "us-east-1", "000000000000"));
queryParams.putSingle("groupName", "reports");
setJsonBody("{\"GroupName\":\"billing\",\"ScheduleExpression\":\"rate(1 hour)\"}");
assertEquals("arn:aws:scheduler:us-east-1:000000000000:schedule/billing/nightly",
builder.build("scheduler", ctx, "us-east-1", "000000000000"));
assertEquals(List.of(schedule + "reports/nightly"),
schedulerResources(backed, "GET", "/schedules/nightly?groupName=reports", "GetSchedule"));
// A create or update names its group in the body, which Scheduler reads, not in the query, which it
// ignores for them: a groupName there does not move the check to another group. A target's ARN is no
// schedule's.
setJsonBody("{\"GroupName\":\"billing\",\"ScheduleExpression\":\"rate(1 hour)\",\"Target\":{\"Arn\":"
+ "\"arn:aws:lambda:us-east-1:000000000000:function:f\","
+ "\"RoleArn\":\"arn:aws:iam::000000000000:role/r\"}}");
assertEquals(List.of(schedule + "billing/nightly"),
schedulerResources(backed, "POST", "/schedules/nightly?groupName=reports", "CreateSchedule"));
queryParams.clear();
when(ctx.getMethod()).thenReturn("PUT");
setJsonBody("{\"ScheduleExpression\":\"rate(1 hour)\"}");
assertEquals("arn:aws:scheduler:us-east-1:000000000000:schedule/default/nightly",
builder.build("scheduler", ctx, "us-east-1", "000000000000"));
when(ctx.getMethod()).thenReturn("GET");
queryParams.clear();
when(uriInfo.getPath()).thenReturn("/schedule-groups/reports");
assertEquals("arn:aws:scheduler:us-east-1:000000000000:schedule-group/reports",
builder.build("scheduler", ctx, "us-east-1", "000000000000"));
assertEquals(List.of(schedule + "default/nightly"),
schedulerResources(backed, "PUT", "/schedules/nightly", "UpdateSchedule"));
String group = "arn:aws:scheduler:us-east-1:000000000000:schedule-group/reports";
when(uriInfo.getPath()).thenReturn("/tags/" + group);
assertEquals(group, builder.build("scheduler", ctx, "us-east-1", "000000000000"));
// The same tagging is served at /tags, the ARN in the resourceArn query parameter or body field.
when(uriInfo.getPath()).thenReturn("/tags");
queryParams.putSingle("resourceArn", group);
assertEquals(group, builder.build("scheduler", ctx, "us-east-1", "000000000000"));
assertEquals(List.of(group), schedulerResources(backed, "GET", "/schedule-groups/reports", "GetScheduleGroup"));
assertEquals(List.of(group),
schedulerResources(backed, "POST", "/schedule-groups/reports", "CreateScheduleGroup"));
assertEquals(List.of(group),
schedulerResources(backed, "DELETE", "/schedule-groups/reports", "DeleteScheduleGroup"));
// An SDK sends the ARN in the path encoded, as one segment of the modeled /tags/{ResourceArn}.
String encoded = "/tags/arn%3Aaws%3Ascheduler%3Aus-east-1%3A000000000000%3Aschedule-group%2Freports";
assertEquals(List.of(group), schedulerResources(backed, "GET", encoded, "ListTagsForResource"));
assertEquals(List.of(group), schedulerResources(backed, "POST", encoded, "TagResource"));
queryParams.putSingle("TagKeys", "team");
assertEquals(List.of(group), schedulerResources(backed, "DELETE", encoded + "?TagKeys=team", "UntagResource"));
queryParams.clear();
when(ctx.getMethod()).thenReturn("POST");
setJsonBody("{\"resourceArn\":\"" + group + "\",\"tags\":[]}");
assertEquals(group, builder.build("scheduler", ctx, "us-east-1", "000000000000"));
// POST /tags tags the body's ARN, so a resourceArn in the query does not move the check.
queryParams.putSingle("resourceArn", "arn:aws:scheduler:us-east-1:000000000000:schedule-group/other");
setJsonBody("{\"resourceArn\":\"" + group + "\",\"tags\":[]}");
assertEquals(group, builder.build("scheduler", ctx, "us-east-1", "000000000000"));
queryParams.clear();
when(uriInfo.getPath()).thenReturn("/schedules");
assertEquals("*", builder.build("scheduler", ctx, "us-east-1", "000000000000"));
assertEquals(List.of("*"), schedulerResources(backed, "GET", "/schedules", "ListSchedules"));
assertEquals(List.of("*"), schedulerResources(backed, "GET", "/schedule-groups", "ListScheduleGroups"));
}
@Test
void schedulerAndPipesArnsAreMintedInTheRequestsPartition() {
// A Region no partition publishes takes the deployment's partition, as Scheduler and Pipes mint
// their ARNs, rather than aws.
when(uriInfo.getPath()).thenReturn("/schedules/nightly");
ResourceArnBuilder backed = reading(schedulerIn("aws-cn"));
when(ctx.getMethod()).thenReturn("GET");
request("/schedules/nightly");
assertEquals(List.of("arn:aws-cn:scheduler:xx-local-1:000000000000:schedule/default/nightly"),
builder.buildResources("scheduler", ctx, "xx-local-1", "000000000000", "aws-cn"));
when(uriInfo.getPath()).thenReturn("/schedule-groups/reports");
backed.buildResources("scheduler", "scheduler:GetSchedule", ctx, "xx-local-1", "000000000000",
"aws-cn"));
request("/schedule-groups/reports");
assertEquals(List.of("arn:aws-cn:scheduler:xx-local-1:000000000000:schedule-group/reports"),
builder.buildResources("scheduler", ctx, "xx-local-1", "000000000000", "aws-cn"));
when(uriInfo.getPath()).thenReturn("/v1/pipes/orders");
backed.buildResources("scheduler", "scheduler:GetScheduleGroup", ctx, "xx-local-1", "000000000000",
"aws-cn"));
request("/v1/pipes/orders");
assertEquals(List.of("arn:aws-cn:pipes:xx-local-1:000000000000:pipe/orders"),
builder.buildResources("pipes", ctx, "xx-local-1", "000000000000", "aws-cn"));
}
@@ -8,6 +8,8 @@ import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.List;
import static io.restassured.RestAssured.given;
@@ -221,13 +223,21 @@ class SchedulerIntegrationTest {
private static final String TAGGED_GROUP_ARN =
"arn:aws:scheduler:us-east-1:000000000000:schedule-group/tagged-group";
/**
* The modeled {@code /tags/{ResourceArn}} for an ARN, encoded as one path segment as an SDK sends it. Send it with
* {@code urlEncodingEnabled(false)}, or it is encoded twice.
*/
private static String tagsPath(String arn) {
return "/tags/" + URLEncoder.encode(arn, StandardCharsets.UTF_8);
}
@Test
@Order(13)
void listTagsReturnsTagsFromCreate() {
// tagged-group was created at @Order(2) with env=test and team=platform.
given()
given().urlEncodingEnabled(false)
.when()
.get("/tags/" + TAGGED_GROUP_ARN)
.get(tagsPath(TAGGED_GROUP_ARN))
.then()
.statusCode(200)
.body("Tags.find { it.Key == 'env' }.Value", equalTo("test"))
@@ -243,7 +253,7 @@ class SchedulerIntegrationTest {
// a system whose clock granularity collides with the test class's startup speed.
Thread.sleep(2);
given()
given().urlEncodingEnabled(false)
.contentType("application/json")
.body("""
{
@@ -254,13 +264,13 @@ class SchedulerIntegrationTest {
}
""")
.when()
.post("/tags/" + TAGGED_GROUP_ARN)
.post(tagsPath(TAGGED_GROUP_ARN))
.then()
.statusCode(204);
given()
given().urlEncodingEnabled(false)
.when()
.get("/tags/" + TAGGED_GROUP_ARN)
.get(tagsPath(TAGGED_GROUP_ARN))
.then()
.statusCode(200)
.body("Tags.find { it.Key == 'owner' }.Value", equalTo("Alice"))
@@ -291,17 +301,17 @@ class SchedulerIntegrationTest {
@Test
@Order(15)
void untagResourceRemovesKeys() {
given()
given().urlEncodingEnabled(false)
.queryParam("TagKeys", "owner")
.queryParam("TagKeys", "env")
.when()
.delete("/tags/" + TAGGED_GROUP_ARN)
.delete(tagsPath(TAGGED_GROUP_ARN))
.then()
.statusCode(204);
given()
given().urlEncodingEnabled(false)
.when()
.get("/tags/" + TAGGED_GROUP_ARN)
.get(tagsPath(TAGGED_GROUP_ARN))
.then()
.statusCode(200)
.body("Tags.find { it.Key == 'owner' }", nullValue())
@@ -309,17 +319,53 @@ class SchedulerIntegrationTest {
.body("Tags.find { it.Key == 'team' }.Value", equalTo("platform"));
}
@Test
@Order(16)
void taggingOnARouteSchedulerDoesNotHaveIsRefusedAndTagsNothing() {
// AWS serves Scheduler's tagging on /tags/{ResourceArn} alone: the bare /tags the shared controller serves
// other services on, and a path whose ARN's slash is not encoded, are no route of Scheduler's.
given()
.contentType("application/json")
.body("{\"resourceArn\":\"" + TAGGED_GROUP_ARN + "\",\"tags\":[{\"key\":\"refused\",\"value\":\"x\"}]}")
.when()
.post("/tags")
.then()
.statusCode(400)
.body(containsString("Invalid resource ARN"));
given()
.contentType("application/json")
.body("{\"Tags\":[{\"Key\":\"refused\",\"Value\":\"x\"}]}")
.when()
.post("/tags/" + TAGGED_GROUP_ARN)
.then()
.statusCode(400)
.body(containsString("Invalid resource ARN"));
given()
.queryParam("resourceArn", TAGGED_GROUP_ARN)
.when()
.get("/tags")
.then()
.statusCode(400);
given().urlEncodingEnabled(false)
.when()
.get(tagsPath(TAGGED_GROUP_ARN))
.then()
.statusCode(200)
.body("Tags.find { it.Key == 'refused' }", nullValue());
}
@Test
@Order(16)
void tagResourceOnMissingGroupReturns404() {
String arn = "arn:aws:scheduler:us-east-1:000000000000:schedule-group/no-such-group";
given()
given().urlEncodingEnabled(false)
.contentType("application/json")
.body("""
{"Tags": [{"Key": "k", "Value": "v"}]}
""")
.when()
.post("/tags/" + arn)
.post(tagsPath(arn))
.then()
.statusCode(404);
}
@@ -329,10 +375,10 @@ class SchedulerIntegrationTest {
void tagResourceWithEmptyBodyReturns400() {
// Null/blank request body must surface as the structured AWS validation error
// ("Value null at 'Tags' ...") rather than leaking a Jackson parser message.
given()
given().urlEncodingEnabled(false)
.contentType("application/json")
.when()
.post("/tags/" + TAGGED_GROUP_ARN)
.post(tagsPath(TAGGED_GROUP_ARN))
.then()
.statusCode(400);
}
@@ -342,11 +388,11 @@ class SchedulerIntegrationTest {
void tagResourceWithNonObjectBodyReturns400() {
// A syntactically valid JSON array at the root must be rejected as a wire-shape
// error, not silently treated as "missing 'Tags'".
given()
given().urlEncodingEnabled(false)
.contentType("application/json")
.body("[1,2,3]")
.when()
.post("/tags/" + TAGGED_GROUP_ARN)
.post(tagsPath(TAGGED_GROUP_ARN))
.then()
.statusCode(400);
}
@@ -356,13 +402,13 @@ class SchedulerIntegrationTest {
void tagResourceOnScheduleArnReturns400() {
// AWS only allows tagging schedule groups, not individual schedules.
String arn = "arn:aws:scheduler:us-east-1:000000000000:schedule/default/some-schedule";
given()
given().urlEncodingEnabled(false)
.contentType("application/json")
.body("""
{"Tags": [{"Key": "k", "Value": "v"}]}
""")
.when()
.post("/tags/" + arn)
.post(tagsPath(arn))
.then()
.statusCode(400);
}
@@ -372,11 +418,11 @@ class SchedulerIntegrationTest {
void tagResourceWithoutTagsReturns400() {
// AWS spec: Tags is required on TagResource. Empty body must surface as
// ValidationException rather than silently succeed.
given()
given().urlEncodingEnabled(false)
.contentType("application/json")
.body("{}")
.when()
.post("/tags/" + TAGGED_GROUP_ARN)
.post(tagsPath(TAGGED_GROUP_ARN))
.then()
.statusCode(400);
}
@@ -385,9 +431,9 @@ class SchedulerIntegrationTest {
@Order(19)
void untagResourceWithoutTagKeysReturns400() {
// AWS spec: TagKeys is required on UntagResource.
given()
given().urlEncodingEnabled(false)
.when()
.delete("/tags/" + TAGGED_GROUP_ARN)
.delete(tagsPath(TAGGED_GROUP_ARN))
.then()
.statusCode(400);
}
@@ -1028,13 +1074,13 @@ class SchedulerIntegrationTest {
void tagResourceEntryMissingKeyOrValueReturns400() {
// AWS Tag shape requires both Key and Value; entries with either missing
// must surface as ValidationException, not be silently dropped.
given()
given().urlEncodingEnabled(false)
.contentType("application/json")
.body("""
{"Tags": [{"Key": "k"}]}
""")
.when()
.post("/tags/" + TAGGED_GROUP_ARN)
.post(tagsPath(TAGGED_GROUP_ARN))
.then()
.statusCode(400);
}
@@ -1044,13 +1090,13 @@ class SchedulerIntegrationTest {
void tagResourceTagsWrongTypeReturns400() {
// Tags must be a list. An object or string in its place is a wire-format
// error, not a missing value, so the message should differ from "Value null".
given()
given().urlEncodingEnabled(false)
.contentType("application/json")
.body("""
{"Tags": "not-a-list"}
""")
.when()
.post("/tags/" + TAGGED_GROUP_ARN)
.post(tagsPath(TAGGED_GROUP_ARN))
.then()
.statusCode(400);
}
@@ -1060,13 +1106,13 @@ class SchedulerIntegrationTest {
void tagResourceWithPutMethodReturns405() {
// AWS Scheduler only defines POST for TagResource. PUT is not in the spec
// and must be rejected so floci does not expose a non-AWS mutation route.
given()
given().urlEncodingEnabled(false)
.contentType("application/json")
.body("""
{"Tags": [{"Key": "k", "Value": "v"}]}
""")
.when()
.put("/tags/" + TAGGED_GROUP_ARN)
.put(tagsPath(TAGGED_GROUP_ARN))
.then()
.statusCode(405);
}
+17 -8
View File
@@ -260,11 +260,11 @@ NAMESPACES = ("access-analyzer", "account", "acm", "application-autoscaling", "a
"payment-cryptography", "quicksight", "ram", "redshift", "redshift-data", "redshift-serverless",
"rekognition", "resource-explorer-2", "route53", "servicediscovery", "servicequotas", "ssm", "sso",
"states", "textract", "timestream-influxdb", "translate", "signer", "xray", "securityhub", "guardduty",
"secretsmanager")
"secretsmanager", "scheduler")
# The namespaces whose resources ResourceArnBuilder builds itself.
HAND_BUILT = ("apigateway", "bedrock", "dsql", "dynamodb", "eks", "iam", "kinesis", "kms", "lambda", "logs", "pipes",
"resource-groups", "s3", "scheduler", "sns", "sqs", "sts")
"resource-groups", "s3", "sns", "sqs", "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 "
@@ -2506,15 +2506,21 @@ def named_by_variable(variable: str, formats: dict[str, str]) -> str | None:
# Documentation saying what a service uses for a member a request leaves out: "If you do not specify a cluster, the
# default cluster is assumed", "If you don't specify a cluster, default is used".
# default cluster is assumed", "If you don't specify a cluster, default is used", or, naming the type after
# `default`, "If you omit this, the default schedule group is used", "If you omit this, EventBridge Scheduler assumes
# that the schedule is associated with the default group".
DOC_DEFAULT_RE = re.compile(r"\bif you do(?: not|n't) specify an? ([a-z][a-z -]*?), (?:the )?default(?: [a-z -]+?)? is "
r"(?:assumed|used)\b")
r"(?:assumed|used)\b"
r"|\bif you omit this(?: value)?, (?:the default ([a-z][a-z -]*?) is (?:assumed|used)\b"
r"|[a-z0-9 -]+? assumes (?:that )?the [a-z -]+? is associated (?:with|to) the default "
r"([a-z][a-z -]*?)(?:[.,;]|$))")
def defaulted_members(models: dict[str, dict], operation: str) -> dict[str, str]:
"""The optional top-level members of the operation's request, strings or lists of them, whose documentation says
its service uses its default of a type for a request leaving them out, by their path, each with the word it
names that type by: ECS's `cluster`, "If you do not specify a cluster, the default cluster is assumed"."""
names that type by: ECS's `cluster`, "If you do not specify a cluster, the default cluster is assumed";
EventBridge Scheduler's `GroupName`, "If you omit this, the default schedule group is used"."""
found: dict[str, str] = {}
for model in models.values():
spec = model["operations"].get(operation)
@@ -2525,7 +2531,7 @@ def defaulted_members(models: dict[str, dict], operation: str) -> dict[str, str]
strings = _strings(model, model["shapes"][member["shape"]])
said = DOC_DEFAULT_RE.search(_lead_text(member.get("documentation")))
if name not in shape.get("required", []) and strings is not None and said:
found.setdefault(name + strings, said.group(1).replace(" ", "-"))
found.setdefault(name + strings, next(word for word in said.groups() if word).replace(" ", "-"))
return found
@@ -2534,7 +2540,9 @@ def with_documented_defaults(resources: list[dict], formats: dict[str, str], def
service uses its default for a request leaving it out marked so (`defaults`), when the variable is the one of a
type whose format is that variable alone named by the word the documentation uses: a service's
`service/${ClusterName}/${ServiceName}` is on the default cluster, `cluster/${ClusterName}`, for a request with
no `cluster`. The reader asks the type's service for that default."""
no `cluster`. The reader asks the type's service for that default. A resource of a pair that already applies by
whether the member names the default (`whenDefault`, `unlessDefault`: a rule on the default event bus or on
another) is left as it is, the pair's other resource being the one a request leaving it out names."""
found = []
for resource in resources:
defaults = {}
@@ -2543,7 +2551,8 @@ def with_documented_defaults(resources: list[dict], formats: dict[str, str], def
if path in defaulted and kind is not None and related(stem(defaulted[path]), stem(kind)):
defaults[path] = kind
found.append(dict(resource, defaults=dict(sorted(defaults.items()))) if defaults and "type" in resource
and not {"when", "unless", "find", "default"} & set(resource) else resource)
and not {"when", "unless", "find", "default", "whenDefault", "unlessDefault"} & set(resource)
else resource)
return found
@@ -1860,6 +1860,44 @@ def test_a_member_whose_service_uses_its_default_when_left_out_names_that_defaul
assert r.with_optional_qualifier([service], {"cluster"}) == [dict(service, unless={"cluster": [None]})]
GROUPS = {"schedule": "arn:${Partition}:scheduler:${Region}:${Account}:schedule/${GroupName}/${ScheduleName}",
"schedule-group": "arn:${Partition}:scheduler:${Region}:${Account}:schedule-group/${GroupName}"}
def test_a_member_whose_service_assumes_its_default_when_omitted_names_that_default():
# EventBridge Scheduler names the type after "default", in each of the three ways botocore puts it.
for doc in ("<p>The name of the schedule group to associate with this schedule. If you omit this, the default "
"schedule group is used.</p>",
"<p>The name of the schedule group associated with this schedule. If you omit this, EventBridge "
"Scheduler assumes that the schedule is associated with the default group.</p>",
"<p>The name of the schedule group with which the schedule is associated. You must provide this value "
"in order for EventBridge Scheduler to find the schedule you want to update. If you omit this value, "
"EventBridge Scheduler assumes the group is associated to the default group.</p>"):
defaulted = r.defaulted_members(cluster_model("GetSchedule", {"GroupName": doc}), "GetSchedule")
assert set(defaulted) == {"GroupName"}
schedule = {"type": "schedule", "fill": {"GroupName": "GroupName", "ScheduleName": "Name"}}
assert r.with_documented_defaults([schedule], GROUPS, defaulted) == [
dict(schedule, defaults={"GroupName": "schedule-group"})]
# A filter naming no default names none.
listing = cluster_model("ListSchedules", {"GroupName": "<p>If specified, only lists the schedules whose associated "
"schedule group matches the given filter.</p>"})
assert r.defaulted_members(listing, "ListSchedules") == {}
def test_a_resource_of_a_default_pair_takes_no_default_of_its_own():
# EventBridge documents EventBusName "If you omit this, the default event bus is used", and a rule on the
# default bus is the pair's other resource, which applies when the request leaves the bus out.
formats = {"event-bus": "arn:${Partition}:events:${Region}:${Account}:event-bus/${EventBusName}",
"rule-on-custom-event-bus": "arn:${Partition}:events:${Region}:${Account}:rule/${EventBusName}/"
"${RuleName}"}
custom = {"type": "rule-on-custom-event-bus", "fill": {"EventBusName": "EventBusName", "RuleName": "Name"},
"unlessDefault": {"EventBusName": "event-bus"}}
assert r.with_documented_defaults([custom], formats, {"EventBusName": "event-bus"}) == [custom]
unpaired = {key: value for key, value in custom.items() if key != "unlessDefault"}
assert r.with_documented_defaults([unpaired], formats, {"EventBusName": "event-bus"}) == [
dict(unpaired, defaults={"EventBusName": "event-bus"})]
def test_a_member_documented_as_a_name_or_an_arn_of_another_type_may_give_that_types_arn():
for doc in (CLUSTER_DOC, "<p>The short name or full ARN of the cluster that hosts the task.</p>",
# AWS's own typo, the "of" left out.