mirror of
https://github.com/floci-io/floci.git
synced 2026-11-22 21:50:46 -05:00
fix(iam): check Application Auto Scaling requests on the scalable target they name (#7193)
Under IAM enforcement, Application Auto Scaling requests were checked on
`*`, so a grant scoped to a scalable target was refused and a deny
scoped to one never applied.
A scalable target's ARN ends in a unique id the service assigns,
`scalable-target/<id>` ("The unique ID ... is a value assigned by
Application Auto Scaling to the scalable target"), which the Service
Reference names ${ResourceId}, while requests name the target by
ServiceNamespace, ResourceId and ScalableDimension. Read as the table
reads other services, ResourceId (`service/<cluster>/<service>`) would
have filled that id, so the namespace was left out until the table could
look the ARN up.
The generator's new FOUND_BY gives a type whose ARN is all an id its
service mints, with the members a request names it by. An operation
whose request has them all names the type by them (`find`), generated
rather than corrected, and the reader asks the service for the ARN they
find through StoredResourceArns, the lookup EventBridge's connections
already use, or else checks the ARN with its id open, as for a create.
StoredResourceArns.find now takes the values a request names the
resource by, in the table's order: one name for EventBridge, the three
members for Application Auto Scaling, whose service now implements it
from the store its handlers read. A member left out or given a JSON
null names none, as the handler reads it.
Application Auto Scaling joins the table (14 operations, 1036 over 25
namespaces): RegisterScalableTarget, DeregisterScalableTarget,
PutScalingPolicy, DeleteScalingPolicy, PutScheduledAction and
DeleteScheduledAction are checked on the target's stored ARN, and a
RegisterScalableTarget registering a new one, its tags included, on
`scalable-target/*`; TagResource, UntagResource and
ListTagsForResource on the ARN their ResourceARN gives; the Describe
operations and GetPredictiveScalingForecast on `*`, as AWS checks them.
This commit is contained in:
1 parent
d39f06e733
commit
beef71e8eb
15 files changed
+372
-44
No files matched your search
@@ -61,6 +61,9 @@ PolicyARN arn:aws:autoscaling:<region>:<account>:scalingPolicy:<uuid>:r
|
||||
`DescribeScalableTargets` into the resource's `arn` attribute and then passes it to
|
||||
`ListTagsForResource` on every read, so it is always populated.
|
||||
|
||||
Under IAM enforcement, a request naming a target by its triple is checked on that ARN, and a
|
||||
`RegisterScalableTarget` registering a new one on `scalable-target/*`, as its id is not assigned yet.
|
||||
|
||||
## CloudWatch alarms
|
||||
|
||||
A `TargetTrackingScaling` policy creates a real pair of CloudWatch alarms, exactly as AWS
|
||||
|
||||
@@ -1602,7 +1602,7 @@ SQS, SNS, DynamoDB, Kinesis, SSM, KMS, IAM, Resource Groups, EventBridge Schedul
|
||||
Pipes, Aurora DSQL, EKS, API Gateway, CloudWatch Logs, Secrets Manager and STS. For Elastic Load Balancing, ECR,
|
||||
Step Functions, EventBridge, 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),
|
||||
AWS Budgets, Cost and Usage Reports, Service Quotas, Amazon Textract, Amazon Translate, Amazon Athena,
|
||||
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 and Amazon
|
||||
Timestream for InfluxDB they come from a table generated from AWS's Service Reference and botocore, `src/main/resources/aws/iam-request-resources.json`, which gives each
|
||||
operation's action, the resource types that action acts on with their ARN formats, and the request
|
||||
@@ -1666,7 +1666,11 @@ so one entry for a bus the caller may not publish to refuses the whole request,
|
||||
User Guide gives it for every entry. A connection or an API destination, whose ARN
|
||||
EventBridge follows with an id it mints after the name, `connection/<name>/<id>`, is checked on
|
||||
the ARN it is stored under when the request names it, and on `connection/<name>/*` when there is
|
||||
none yet, as for its create. EventBridge V2's API, which Floci does not serve, is not read. A
|
||||
none yet, as for its create. An Application Auto Scaling scalable target, whose ARN ends in the id
|
||||
Application Auto Scaling assigns it, `scalable-target/<id>`, while its requests name it by
|
||||
`ServiceNamespace`, `ResourceId` and `ScalableDimension`, is checked on the ARN it is stored under, and
|
||||
on `scalable-target/*` when there is none yet, as for a `RegisterScalableTarget` registering a new one;
|
||||
its tag operations name it by its ARN. EventBridge V2's API, which Floci does not serve, is not read. A
|
||||
state machine's version or alias
|
||||
(`stateMachine:<name>:<qualifier>`) is checked on the state machine's ARN, as Step Functions
|
||||
authorizes it, so a grant or a deny on `stateMachine:<name>` covers its versions and aliases, and
|
||||
|
||||
@@ -47,6 +47,8 @@ final class RequestResourceMembers {
|
||||
private static final Pattern ONE_VARIABLE = Pattern.compile("[^$]*\\$\\{\\w+}");
|
||||
/** The one id a child type's format appends to its parent's. */
|
||||
private static final Pattern APPENDED_ID = Pattern.compile("[/:]\\$\\{\\w+}");
|
||||
/** The keys a resource found by members does not take: it is read no other way, in the caller's account. */
|
||||
private static final List<String> FOUND_ONLY = List.of("absent", "arnOf", "account", "fixed", "before");
|
||||
|
||||
/**
|
||||
* A top-level request member that holds a string, or a list of them when {@code list}, or, with a
|
||||
@@ -124,11 +126,20 @@ final class RequestResourceMembers {
|
||||
* {@code before}, when there is one: Step Functions Local's handler drops a test case after {@code #}, and a
|
||||
* CodeBuild build id is {@code <project>:<id>}, a build being checked on its project. A create naming other
|
||||
* resources beside the one it makes marks that one {@code made}, where its tags go (a webhook, not the pipeline
|
||||
* it connects to).
|
||||
* it connects to). A type whose ARN is all an id its service mints is named instead by the members its service
|
||||
* finds it by, {@code find}, each one value, in the order its service reads them, filling none of its variables
|
||||
* and read no other way, in the caller's account (a scalable target by its service namespace, resource id and
|
||||
* scalable dimension).
|
||||
*/
|
||||
record Resource(List<String> types, Member arn, Map<String, Member> fill, Map<String, List<String>> when,
|
||||
Map<String, List<String>> unless, Map<String, String> absent, Map<String, String> arnOf,
|
||||
Member account, String before, Map<String, String> fixed, boolean made) {
|
||||
Member account, String before, Map<String, String> fixed, boolean made, List<Member> find) {
|
||||
|
||||
Resource(List<String> types, Member arn, Map<String, Member> fill, Map<String, List<String>> when,
|
||||
Map<String, List<String>> unless, Map<String, String> absent, Map<String, String> arnOf,
|
||||
Member account, String before, Map<String, String> fixed, boolean made) {
|
||||
this(types, arn, fill, when, unless, absent, arnOf, account, before, fixed, made, List.of());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -247,6 +258,10 @@ final class RequestResourceMembers {
|
||||
throw new IllegalStateException(RESOURCE_NAME + " reads an ARN for " + operation
|
||||
+ " of types with no format: " + types);
|
||||
}
|
||||
if (resource.has("find")) {
|
||||
throw new IllegalStateException(RESOURCE_NAME + " reads an ARN for " + operation
|
||||
+ " and finds its resource by " + resource.path("find") + " too");
|
||||
}
|
||||
return new Resource(types, arnMember(operation, resource.path("arn").asText("")), Map.of(), Map.of(),
|
||||
Map.of(), Map.of(), Map.of(), null, before, Map.of(), made);
|
||||
}
|
||||
@@ -274,6 +289,15 @@ final class RequestResourceMembers {
|
||||
}
|
||||
fixed.put(variable.getKey(), variable.getValue().asText());
|
||||
});
|
||||
List<Member> find = new ArrayList<>();
|
||||
for (JsonNode member : resource.path("find")) {
|
||||
find.add(member(operation, member.asText("")));
|
||||
}
|
||||
if (resource.has("find") && (!resource.path("find").isArray() || find.isEmpty() || !fill.isEmpty()
|
||||
|| find.stream().anyMatch(Member::list) || FOUND_ONLY.stream().anyMatch(resource::has))) {
|
||||
throw new IllegalStateException(RESOURCE_NAME + " finds a " + type + " for " + operation + " by "
|
||||
+ resource.path("find") + ", no members of one value each, or beside members reading it otherwise");
|
||||
}
|
||||
if (fill.values().stream().filter(Member::list).count() > 1) {
|
||||
throw new IllegalStateException(RESOURCE_NAME + " fills " + type + " for " + operation
|
||||
+ " from more than one list");
|
||||
@@ -306,7 +330,7 @@ final class RequestResourceMembers {
|
||||
+ " from " + account.name() + ", no member of one account or a type of none");
|
||||
}
|
||||
return new Resource(List.of(type), null, Map.copyOf(fill), when, unless, Map.copyOf(absent), Map.copyOf(arnOf),
|
||||
account, before, Map.copyOf(fixed), made);
|
||||
account, before, Map.copyOf(fixed), made, List.copyOf(find));
|
||||
}
|
||||
|
||||
/** The values each member named in {@code when} or {@code unless} may have, an empty one for the member absent. */
|
||||
|
||||
@@ -23,7 +23,9 @@ import java.util.regex.Pattern;
|
||||
* resource type the action acts on, or by members filling the variables of a type's format, the others open as
|
||||
* {@code *} (a resource a request creates has the id its service mints). A type whose service follows the name a
|
||||
* request gives with an id it mints ({@code connection/<name>/<id>}) is the resource its service stores under that
|
||||
* name, or else has that id open. An ARN with a qualifier its service drops
|
||||
* name, or else has that id open, and so is a type whose ARN is all an id its service mints, which a request names
|
||||
* by members its ARN does not hold (a scalable target, {@code scalable-target/<id>}, by its service namespace,
|
||||
* resource id and scalable dimension), under those members' values. An ARN with a qualifier its service drops
|
||||
* to check it is checked without one (a state machine's version or alias, on the state machine). An ARN naming
|
||||
* another account or Region than the request's is checked as given and as each resource of that name a handler may
|
||||
* act on instead, in the ARN's account or the caller's and in the ARN's Region or the request's, and the request is
|
||||
@@ -61,8 +63,8 @@ public final class RequestResources {
|
||||
|
||||
/**
|
||||
* As {@link #of(String, ContainerRequestContext, String, String, String)}, a resource of a type whose service
|
||||
* mints an id after its name being the one {@code stored} finds for the caller under the name the request gives,
|
||||
* or else its ARN with that id open, as it is with no {@code stored}.
|
||||
* mints an id after its name, or as all of its ARN, being the one {@code stored} finds for the caller under the
|
||||
* name or the members the request gives, or else its ARN with that id open, as it is with no {@code stored}.
|
||||
*/
|
||||
public static List<String> of(String operation, ContainerRequestContext ctx, String partition, String region,
|
||||
String accountId, StoredResourceArns stored) {
|
||||
@@ -93,6 +95,8 @@ public final class RequestResources {
|
||||
.findFirst().ifPresent(format -> addNamed(arns, format.checked(named), partition, region,
|
||||
accountId));
|
||||
}
|
||||
} else if (!resource.find().isEmpty()) {
|
||||
found(arns, resource, formats, form, body, partition, region, accountId, stored);
|
||||
} else {
|
||||
fill(arns, resource, formats, form, body, partition, region, accountId, stored);
|
||||
}
|
||||
@@ -323,6 +327,29 @@ public final class RequestResources {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The resource of a type whose ARN is all an id its service mints, named by the members the table gives it
|
||||
* ({@code find}), when the request gives each one value: the caller's resource {@code stored} finds under those
|
||||
* values in the Region, or else its ARN with that id open, as for a create; none when it leaves one out or gives
|
||||
* it a JSON null, which its handler reads as none.
|
||||
*/
|
||||
private static void found(Set<String> arns, RequestResourceMembers.Resource resource,
|
||||
Map<String, RequestResourceMembers.ArnFormat> formats, Map<String, String> form,
|
||||
JsonNode body, String partition, String region, String accountId,
|
||||
StoredResourceArns stored) {
|
||||
List<String> names = new ArrayList<>();
|
||||
for (RequestResourceMembers.Member member : resource.find()) {
|
||||
List<String> values = values(form, body, member);
|
||||
if (isNull(body, member) || values.size() != 1) {
|
||||
return;
|
||||
}
|
||||
names.add(values.getFirst());
|
||||
}
|
||||
String type = resource.types().getFirst();
|
||||
Optional<String> found = stored == null ? Optional.empty() : stored.find(type, names, region);
|
||||
arns.add(found.orElseGet(() -> render(formats.get(type).format(), Map.of(), partition, region, accountId)));
|
||||
}
|
||||
|
||||
/** Whether a member that may give an ARN of a type instead of its name gives one. */
|
||||
private static boolean isArnOf(RequestResourceMembers.ArnFormat named, String value) {
|
||||
return named != null && named.pattern().matcher(value).matches();
|
||||
@@ -339,7 +366,7 @@ public final class RequestResources {
|
||||
return arn;
|
||||
}
|
||||
if (stored != null && filling.size() == 1) {
|
||||
Optional<String> found = stored.find(type, filling.values().iterator().next(), region);
|
||||
Optional<String> found = stored.find(type, List.of(filling.values().iterator().next()), region);
|
||||
if (found.isPresent()) {
|
||||
return found.get();
|
||||
}
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
package io.github.hectorvent.floci.core.common;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Finds the ARN a service stores a resource under, for a type of the request-resources table whose service follows
|
||||
* the name a request gives with an id it mints ({@code connection/<name>/<id>}), which only the service knows.
|
||||
* Finds the ARN a service stores a resource under, for a type of the request-resources table whose ARN carries an id
|
||||
* the service mints, which only the service knows: after the name a request gives ({@code connection/<name>/<id>}),
|
||||
* or as all of it, a request naming the resource by members its ARN does not hold
|
||||
* ({@code scalable-target/<id>}, named by its service namespace, resource id and scalable dimension).
|
||||
*
|
||||
* <p>Implemented by the service that owns such resources (EventBridge, for its connections and API destinations);
|
||||
* looked up lazily by {@code ResourceArnBuilder} through {@code Instance<StoredResourceArns>} for the namespace a
|
||||
* request is of, so IAM never depends on that service directly.</p>
|
||||
* <p>Implemented by the service that owns such resources (EventBridge, for its connections and API destinations;
|
||||
* Application Auto Scaling, for its scalable targets); looked up lazily by {@code ResourceArnBuilder} through
|
||||
* {@code Instance<StoredResourceArns>} for the namespace a request is of, so IAM never depends on that service
|
||||
* directly.</p>
|
||||
*/
|
||||
public interface StoredResourceArns {
|
||||
|
||||
@@ -16,8 +20,9 @@ public interface StoredResourceArns {
|
||||
String namespace();
|
||||
|
||||
/**
|
||||
* The ARN the caller's resource of the type, named {@code name} in the Region, is stored under; empty when there
|
||||
* is none, or the type is not one it mints an id for.
|
||||
* The ARN the caller's resource of the type in the Region is stored under, named by {@code names}, the values the
|
||||
* request names it by in the order the table reads them: a connection's name, or a scalable target's service
|
||||
* namespace, resource id and scalable dimension; empty when there is none, or the type is not one it finds.
|
||||
*/
|
||||
Optional<String> find(String type, String name, String region);
|
||||
Optional<String> find(String type, List<String> names, String region);
|
||||
}
|
||||
+19
-1
@@ -7,6 +7,7 @@ import io.github.hectorvent.floci.core.common.Pagination;
|
||||
import io.github.hectorvent.floci.core.common.RegionResolver;
|
||||
import io.github.hectorvent.floci.core.common.ServicePrincipals;
|
||||
import io.github.hectorvent.floci.core.common.SignedMarkers;
|
||||
import io.github.hectorvent.floci.core.common.StoredResourceArns;
|
||||
import io.github.hectorvent.floci.core.storage.StorageBackend;
|
||||
import io.github.hectorvent.floci.core.storage.StorageFactory;
|
||||
import io.github.hectorvent.floci.services.applicationautoscaling.model.Alarm;
|
||||
@@ -46,7 +47,7 @@ import java.util.UUID;
|
||||
* @see <a href="https://docs.aws.amazon.com/autoscaling/application/APIReference/Welcome.html">Application Auto Scaling API Reference</a>
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class ApplicationAutoScalingService {
|
||||
public class ApplicationAutoScalingService implements StoredResourceArns {
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(ApplicationAutoScalingService.class);
|
||||
private static final int MAX_TARGET_PAGE_SIZE = 50;
|
||||
@@ -704,6 +705,23 @@ public class ApplicationAutoScalingService {
|
||||
return targets.get(targetKey(region, serviceNamespace, resourceId, scalableDimension));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String namespace() {
|
||||
return "application-autoscaling";
|
||||
}
|
||||
|
||||
/**
|
||||
* The ARN of the caller's scalable target in the Region named by its service namespace, resource id and scalable
|
||||
* dimension, in that order, which ends in the id it was registered with, as its handlers look it up.
|
||||
*/
|
||||
@Override
|
||||
public Optional<String> find(String type, List<String> names, String region) {
|
||||
if (!"ScalableTarget".equals(type) || names.size() != 3) {
|
||||
return Optional.empty();
|
||||
}
|
||||
return findTarget(region, names.get(0), names.get(1), names.get(2)).map(ScalableTarget::getScalableTargetArn);
|
||||
}
|
||||
|
||||
/**
|
||||
* Looked up by {@link ScalingPolicyAlarmActionHandler} when an alarm's AlarmActions references
|
||||
* a scaling-policy ARN, and by the CloudFormation provisioner, whose physical id for a policy
|
||||
|
||||
+7
-3
@@ -1625,11 +1625,15 @@ public class EventBridgeService implements ResourceProvider, StoredResourceArns
|
||||
}
|
||||
|
||||
/**
|
||||
* The ARN of the caller's connection or API destination of the name in the Region, which follows the name with
|
||||
* the id it was minted with, as its handlers look it up.
|
||||
* The ARN of the caller's connection or API destination of the one name in the Region, which follows the name
|
||||
* with the id it was minted with, as its handlers look it up.
|
||||
*/
|
||||
@Override
|
||||
public Optional<String> find(String type, String name, String region) {
|
||||
public Optional<String> find(String type, List<String> names, String region) {
|
||||
if (names.size() != 1) {
|
||||
return Optional.empty();
|
||||
}
|
||||
String name = names.getFirst();
|
||||
return switch (type) {
|
||||
case "connection" -> connectionStore.get(connectionKey(region, name)).map(Connection::getConnectionArn);
|
||||
case "api-destination" -> apiDestinationStore.get(apiDestinationKey(region, name)).map(ApiDestination::getArn);
|
||||
|
||||
@@ -101,7 +101,7 @@ public class ResourceArnBuilder {
|
||||
private final Instance<KmsService> kmsService;
|
||||
/**
|
||||
* Looked up lazily for the same reason, to read the ARN a resource the request-resources table names by a name
|
||||
* its service follows with a minted id is stored under.
|
||||
* its service follows with a minted id, or by members its minted ARN does not hold, is stored under.
|
||||
*/
|
||||
private final Instance<StoredResourceArns> storedResourceArns;
|
||||
|
||||
@@ -219,8 +219,8 @@ public class ResourceArnBuilder {
|
||||
/**
|
||||
* The resources a request of a namespace this builder has no branch for names, from the vendored table of
|
||||
* request resources (see {@link RequestResources}); {@code *} when it names none, or the operation is not one
|
||||
* of the namespace. A resource whose service mints an id after its name is the one the namespace's
|
||||
* {@link StoredResourceArns} finds under that name.
|
||||
* of the namespace. A resource whose service mints an id after its name, or as all of its ARN, is the one the
|
||||
* namespace's {@link StoredResourceArns} finds under that name or the members naming it.
|
||||
*/
|
||||
private List<String> namedResources(String credentialScope, String operation, ContainerRequestContext ctx,
|
||||
String region, String accountId, String partition) {
|
||||
|
||||
@@ -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.113 (installed package)", "retrieved": "2026-10-31", "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": {"acm": ["acm"], "athena": ["athena"], "bcm-data-exports": ["bcm-data-exports"], "bcm-pricing-calculator": ["bcm-pricing-calculator"], "budgets": ["budgets"], "ce": ["ce"], "cloudtrail": ["cloudtrail"], "codebuild": ["codebuild"], "codepipeline": ["codepipeline"], "cognito-identity": ["cognito-identity"], "cognito-idp": ["cognito-idp"], "cur": ["cur"], "ecr": ["ecr"], "elasticloadbalancing": ["elb", "elbv2"], "events": ["events"], "firehose": ["firehose"], "globalaccelerator": ["globalaccelerator"], "kinesisanalytics": ["kinesisanalyticsv2"], "servicediscovery": ["servicediscovery"], "servicequotas": ["service-quotas"], "states": ["stepfunctions"], "textract": ["textract"], "timestream-influxdb": ["timestream-influxdb"], "translate": ["translate"]},
|
||||
"_source": {"generator": "tools/aws/regen_iam_request_resources.py", "reference": "https://servicereference.us-east-1.amazonaws.com/", "botocore": "botocore 1.43.113 (installed package)", "retrieved": "2026-11-01", "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": {"acm": ["acm"], "application-autoscaling": ["application-autoscaling"], "athena": ["athena"], "bcm-data-exports": ["bcm-data-exports"], "bcm-pricing-calculator": ["bcm-pricing-calculator"], "budgets": ["budgets"], "ce": ["ce"], "cloudtrail": ["cloudtrail"], "codebuild": ["codebuild"], "codepipeline": ["codepipeline"], "cognito-identity": ["cognito-identity"], "cognito-idp": ["cognito-idp"], "cur": ["cur"], "ecr": ["ecr"], "elasticloadbalancing": ["elb", "elbv2"], "events": ["events"], "firehose": ["firehose"], "globalaccelerator": ["globalaccelerator"], "kinesisanalytics": ["kinesisanalyticsv2"], "servicediscovery": ["servicediscovery"], "servicequotas": ["service-quotas"], "states": ["stepfunctions"], "textract": ["textract"], "timestream-influxdb": ["timestream-influxdb"], "translate": ["translate"]},
|
||||
"clientsNotRead": {"eventbridgev2": "EventBridge V2, the AWSEventsV2 target over Smithy RPC v2 CBOR on the eventsv2 endpoint, which Floci does not serve; its operations share EventBridge's names and name their resources by other members", "kinesisanalytics": "Kinesis Data Analytics v1, SQL applications on the KinesisAnalytics_20150814 target, which Floci does not serve (it serves v2, kinesisanalyticsv2); its operations share v2's names and name their resources by other members"},
|
||||
"handBuilt": ["apigateway", "bedrock", "dsql", "dynamodb", "eks", "iam", "kinesis", "kms", "lambda", "logs", "pipes", "resource-groups", "s3", "scheduler", "secretsmanager", "sns", "sqs", "ssm", "sts"],
|
||||
"notCovered": {"access-analyzer": "REST: its requests name their resources in the path, which RequestResources does not read yet", "account": "REST: its requests name their resources in the path, which RequestResources does not read yet", "airflow": "REST: its requests name their resources in the path, which RequestResources does not read yet", "app-integrations": "REST: its requests name their resources in the path, which RequestResources does not read yet", "appconfig": "REST: its requests name their resources in the path, which RequestResources does not read yet", "application-autoscaling": "not read yet: a scalable target's ARN ends in an id the service mints, `scalable-target/<id>`, while its requests name the target by ServiceNamespace, ResourceId and ScalableDimension, so its resource is the stored ARN those three find, which RequestResources has no lookup for yet; read as a member, ResourceId would fill that id", "appsync": "REST: its requests name their resources in the path, which RequestResources does not read yet", "aps": "REST: its requests name their resources in the path, which RequestResources does not read 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 does not read yet", "batch": "REST: its requests name their resources in the path, which RequestResources does not read yet", "bedrock-agentcore": "REST: its requests name their resources in the path, which RequestResources does not read yet", "cloudformation": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "cloudfront": "REST: its requests name their resources in the path, which RequestResources does not read yet", "cloudhsm": "not read yet: its ARN formats end in ${CloudHsmClusterInstanceName} and ${CloudHsmBackupInstanceName}, names, while its requests give ClusterId and BackupId, ids, which the rule does not fill a name from, so nearly every operation needs a correction", "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 does not read 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 does not read 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 does not read yet", "controlcatalog": "REST: its requests name their resources in the path, which RequestResources does not read yet", "controltower": "REST: its requests name their resources in the path, which RequestResources does not read yet", "datasync": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "detective": "REST: its requests name their resources in the path, which RequestResources does not read yet", "dlm": "REST: its requests name their resources in the path, which RequestResources does not read yet", "dms": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "ec2": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "ecs": "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: a later batch, with the tests that show its ARNs are the ones its handlers mint", "elasticfilesystem": "REST: its requests name their resources in the path, which RequestResources does not read yet", "elasticmapreduce": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "emr-serverless": "REST: its requests name their resources in the path, which RequestResources does not read yet", "es": "REST: its requests name their resources in the path, which RequestResources does not read yet", "execute-api": "REST: its requests nameLine truncated
|
||||
"notCovered": {"access-analyzer": "REST: its requests name their resources in the path, which RequestResources does not read yet", "account": "REST: its requests name their resources in the path, which RequestResources does not read yet", "airflow": "REST: its requests name their resources in the path, which RequestResources does not read yet", "app-integrations": "REST: its requests name their resources in the path, which RequestResources does not read yet", "appconfig": "REST: its requests name their resources in the path, which RequestResources does not read yet", "appsync": "REST: its requests name their resources in the path, which RequestResources does not read yet", "aps": "REST: its requests name their resources in the path, which RequestResources does not read 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 does not read yet", "batch": "REST: its requests name their resources in the path, which RequestResources does not read yet", "bedrock-agentcore": "REST: its requests name their resources in the path, which RequestResources does not read yet", "cloudformation": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "cloudfront": "REST: its requests name their resources in the path, which RequestResources does not read yet", "cloudhsm": "not read yet: its ARN formats end in ${CloudHsmClusterInstanceName} and ${CloudHsmBackupInstanceName}, names, while its requests give ClusterId and BackupId, ids, which the rule does not fill a name from, so nearly every operation needs a correction", "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 does not read 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 does not read 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 does not read yet", "controlcatalog": "REST: its requests name their resources in the path, which RequestResources does not read yet", "controltower": "REST: its requests name their resources in the path, which RequestResources does not read yet", "datasync": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "detective": "REST: its requests name their resources in the path, which RequestResources does not read yet", "dlm": "REST: its requests name their resources in the path, which RequestResources does not read yet", "dms": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "ec2": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "ecs": "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: a later batch, with the tests that show its ARNs are the ones its handlers mint", "elasticfilesystem": "REST: its requests name their resources in the path, which RequestResources does not read yet", "elasticmapreduce": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "emr-serverless": "REST: its requests name their resources in the path, which RequestResources does not read yet", "es": "REST: its requests name their resources in the path, which RequestResources does not read yet", "execute-api": "REST: its requests name their resources in the path, which RequestResources does not read yet", "fis": "REST: its requests name their resources in the path, which RequestResources does not read yet", "glue": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "guardduty": "REST: its requests name their resources in the path, which RequesLine 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", "cloudfront-keyvaluestore", "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", "ec2-instance-connect", "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", "payment-cryptography", "payments", "pca-connector-ad", "pca-connector-scep", "pcs", "personalize", "pi", "polly", "private-networks", "profile", "proton", "purchase-orders", "q", "qapps", "qbusiness", "qdeveloper", "qldb", "quicksight", "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", "signer", "simspaceweaver", "sms-voice", "snow-device-management", "social-messaging", "sqlworkbench", "ssm-contacts", "ssm-incidents", "ssm-quicksetup", "ssm-sap", "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", "xray"],
|
||||
"arnFormats": {"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}"}, "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}", "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}"}, "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:${Region}:${Account}:trail/${TrailName}"}, "codebuild": {"build": "arn:${Partition}:codebuild:${Region}:${Account}:build/${BuildId}", "build-batch": "arn:${Partition}:codebuild:${Region}:${Account}:build-batch/${BuildBatchId}", "fleet": "arn:${Partition}:codebuild:${Region}:${Account}:fleet/${FleetName}:${FleetId}", "project": "arn:${Partition}:codebuild:${Region}:${Account}:project/${ProjectName}", "report": "arn:${Partition}:codebuild:${Region}:${Account}:report/${ReportGroupName}:${ReportId}", "report-group": "arn:${Partition}:codebuild:${Region}:${Account}:report-group/${ReportGroupName}", "sandbox": "arn:${Partition}:codebuild:${Region}:${Account}:sandbox/${SandboxId}"}, "codepipeline": {"action": "arn:${Partition}:codepipeline:${Region}:${Account}:${PipelineName}/${StageName}/${ActionName}", "actiontype": "arn:${Partition}:codepipeline:${Region}:${Account}:actiontype:${Owner}/${Category}/${Provider}/${Version}", "pipeline": "arn:${Partition}:codepipeline:${Region}:${Account}:${PipelineName}", "stage": "arn:${Partition}:codepipeline:${Region}:${Account}:${PipelineName}/${StageName}", "webhook": "arn:${Partition}:codepipeline:${Region}:${Account}:webhook:${WebhookName}"}, "cognito-identity": {"identitypool": "arn:${Partition}:cognito-identity:${Region}:${Account}:identitypool/${IdentityPoolId}"}, "cognito-idp": {"userpool": "arn:${Partition}:cognito-idp:${Region}:${Account}:userpool/${UserPoolId}", "webacl": "arn:${Partition}:wafv2:${Region}:${Account}:${Scope}/webacl/${Name}/${Id}"}, "cur": {"cur": "arn:${Partition}:cur:${Region}:${Account}:definition/${ReportName}"}, "ecr": {"repository": "arn:${Partition}:ecr:${Region}:${Account}:repository/${RepositoryName}"}, "elasticloadbalancing": {"listener-rule/app": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:listener-rule/app/${LoadBalancerName}/${LoadBalancerId}/${ListenerId}/${ListenerRuleId}", "listener-rule/net": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:listener-rule/net/${LoadBalancerName}/${LoadBalancerId}/${ListenerId}/${ListenerRuleId}", "listener/app": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:listener/app/${LoadBalancerName}/${LoadBalancerId}/${ListenerId}", "listener/gwy": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:listener/gwy/${LoadBalancerName}/${LoadBalancerId}/${ListenerId}", "listener/net": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:listener/net/${LoadBalancerName}/${LoadBalancerId}/${ListenerId}", "loadbalancer": "arn:${Partition}:elasticloadbalancing:${Region}:${AccLine truncated
|
||||
"arnFormats": {"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}", "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}"}, "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:${Region}:${Account}:trail/${TrailName}"}, "codebuild": {"build": "arn:${Partition}:codebuild:${Region}:${Account}:build/${BuildId}", "build-batch": "arn:${Partition}:codebuild:${Region}:${Account}:build-batch/${BuildBatchId}", "fleet": "arn:${Partition}:codebuild:${Region}:${Account}:fleet/${FleetName}:${FleetId}", "project": "arn:${Partition}:codebuild:${Region}:${Account}:project/${ProjectName}", "report": "arn:${Partition}:codebuild:${Region}:${Account}:report/${ReportGroupName}:${ReportId}", "report-group": "arn:${Partition}:codebuild:${Region}:${Account}:report-group/${ReportGroupName}", "sandbox": "arn:${Partition}:codebuild:${Region}:${Account}:sandbox/${SandboxId}"}, "codepipeline": {"action": "arn:${Partition}:codepipeline:${Region}:${Account}:${PipelineName}/${StageName}/${ActionName}", "actiontype": "arn:${Partition}:codepipeline:${Region}:${Account}:actiontype:${Owner}/${Category}/${Provider}/${Version}", "pipeline": "arn:${Partition}:codepipeline:${Region}:${Account}:${PipelineName}", "stage": "arn:${Partition}:codepipeline:${Region}:${Account}:${PipelineName}/${StageName}", "webhook": "arn:${Partition}:codepipeline:${Region}:${Account}:webhook:${WebhookName}"}, "cognito-identity": {"identitypool": "arn:${Partition}:cognito-identity:${Region}:${Account}:identitypool/${IdentityPoolId}"}, "cognito-idp": {"userpool": "arn:${Partition}:cognito-idp:${Region}:${Account}:userpool/${UserPoolId}", "webacl": "arn:${Partition}:wafv2:${Region}:${Account}:${Scope}/webacl/${Name}/${Id}"}, "cur": {"cur": "arn:${Partition}:cur:${Region}:${Account}:definition/${ReportName}"}, "ecr": {"repository": "arn:${Partition}:ecr:${Region}:${Account}:repository/${RepositoryName}"}, "elasticloadbalancing": {"listener-rule/app": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:listener-rule/app/${LoadBalancerName}/${LoadBalancerId}/${ListenerId}/${ListenerRuleId}", "listener-rule/net": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:listener-rule/net/${LoadBalancerName}/${LoadBalancerId}/${ListenerId}/${ListenerRuleId}", "listener/app": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:listener/app/${LoadBalancerName}/${LoadBalancerId}/${ListenerId}", "listener/gwy": "arn:${Partition}:elasticloadbalancing:${Region}:${Account}:listener/gwy/${LoadBalancerName}/${LoadBalancerId}/${ListenerId}", "listener/net": "arn:${Partition}:elasticloadbalancing:${Region}:${AccoLine truncated
|
||||
"unqualified": {"states": ["statemachine"]},
|
||||
"mintedIds": {"events": ["api-destination", "connection"]},
|
||||
"operations": {
|
||||
@@ -49,6 +49,20 @@
|
||||
"acm:UpdateAcmeDomainValidation": {"action": "acm:UpdateAcmeDomainValidation", "types": ["acme-domain-validation"], "resources": [{"types": ["acme-domain-validation"], "arn": "AcmeDomainValidationArn"}]},
|
||||
"acm:UpdateAcmeEndpoint": {"action": "acm:UpdateAcmeEndpoint", "types": ["acme-endpoint"], "resources": [{"types": ["acme-endpoint"], "arn": "AcmeEndpointArn"}]},
|
||||
"acm:UpdateCertificateOptions": {"action": "acm:UpdateCertificateOptions", "types": ["certificate"], "resources": [{"types": ["certificate"], "arn": "CertificateArn"}]},
|
||||
"application-autoscaling:DeleteScalingPolicy": {"action": "application-autoscaling:DeleteScalingPolicy", "types": ["ScalableTarget"], "resources": [{"type": "ScalableTarget", "fill": {}, "find": ["ServiceNamespace", "ResourceId", "ScalableDimension"]}]},
|
||||
"application-autoscaling:DeleteScheduledAction": {"action": "application-autoscaling:DeleteScheduledAction", "types": ["ScalableTarget"], "resources": [{"type": "ScalableTarget", "fill": {}, "find": ["ServiceNamespace", "ResourceId", "ScalableDimension"]}]},
|
||||
"application-autoscaling:DeregisterScalableTarget": {"action": "application-autoscaling:DeregisterScalableTarget", "types": ["ScalableTarget"], "resources": [{"type": "ScalableTarget", "fill": {}, "find": ["ServiceNamespace", "ResourceId", "ScalableDimension"]}]},
|
||||
"application-autoscaling:DescribeScalableTargets": {"action": "application-autoscaling:DescribeScalableTargets", "types": [], "resources": []},
|
||||
"application-autoscaling:DescribeScalingActivities": {"action": "application-autoscaling:DescribeScalingActivities", "types": [], "resources": []},
|
||||
"application-autoscaling:DescribeScalingPolicies": {"action": "application-autoscaling:DescribeScalingPolicies", "types": [], "resources": []},
|
||||
"application-autoscaling:DescribeScheduledActions": {"action": "application-autoscaling:DescribeScheduledActions", "types": [], "resources": []},
|
||||
"application-autoscaling:GetPredictiveScalingForecast": {"action": "application-autoscaling:GetPredictiveScalingForecast", "types": [], "resources": []},
|
||||
"application-autoscaling:ListTagsForResource": {"action": "application-autoscaling:ListTagsForResource", "types": ["ScalableTarget"], "resources": [{"types": ["ScalableTarget"], "arn": "ResourceARN"}]},
|
||||
"application-autoscaling:PutScalingPolicy": {"action": "application-autoscaling:PutScalingPolicy", "types": ["ScalableTarget"], "resources": [{"type": "ScalableTarget", "fill": {}, "find": ["ServiceNamespace", "ResourceId", "ScalableDimension"]}]},
|
||||
"application-autoscaling:PutScheduledAction": {"action": "application-autoscaling:PutScheduledAction", "types": ["ScalableTarget"], "resources": [{"type": "ScalableTarget", "fill": {}, "find": ["ServiceNamespace", "ResourceId", "ScalableDimension"]}]},
|
||||
"application-autoscaling:RegisterScalableTarget": {"action": "application-autoscaling:RegisterScalableTarget", "types": ["ScalableTarget"], "resources": [{"types": ["ScalableTarget"], "arn": "RoleARN"}, {"type": "ScalableTarget", "fill": {}, "find": ["ServiceNamespace", "ResourceId", "ScalableDimension"]}]},
|
||||
"application-autoscaling:TagResource": {"action": "application-autoscaling:TagResource", "types": ["ScalableTarget"], "resources": [{"types": ["ScalableTarget"], "arn": "ResourceARN"}]},
|
||||
"application-autoscaling:UntagResource": {"action": "application-autoscaling:UntagResource", "types": ["ScalableTarget"], "resources": [{"types": ["ScalableTarget"], "arn": "ResourceARN"}]},
|
||||
"athena:BatchGetNamedQuery": {"action": "athena:BatchGetNamedQuery", "types": ["workgroup"], "resources": []},
|
||||
"athena:BatchGetPreparedStatement": {"action": "athena:BatchGetPreparedStatement", "types": ["workgroup"], "resources": [{"type": "workgroup", "fill": {"WorkGroupName": "WorkGroup"}}]},
|
||||
"athena:BatchGetQueryExecution": {"action": "athena:BatchGetQueryExecution", "types": ["workgroup"], "resources": []},
|
||||
|
||||
+33
-3
@@ -79,6 +79,35 @@ class RequestResourceMembersTest {
|
||||
assertFalse(events.get("event-bus").minted());
|
||||
}
|
||||
|
||||
@Test
|
||||
void aScalableTargetIsFoundByTheMembersItsServiceReadsNotFilledByItsResourceId() {
|
||||
List<Member> triple = List.of(new Member("ServiceNamespace", false), new Member("ResourceId", false),
|
||||
new Member("ScalableDimension", false));
|
||||
for (String operation : List.of("RegisterScalableTarget", "DeregisterScalableTarget", "PutScalingPolicy",
|
||||
"DeleteScalingPolicy", "PutScheduledAction", "DeleteScheduledAction")) {
|
||||
Resource target = RequestResourceMembers.table().operations().get("application-autoscaling:" + operation)
|
||||
.stream().filter(resource -> resource.arn() == null).findFirst().orElseThrow();
|
||||
assertEquals(triple, target.find(), operation);
|
||||
assertTrue(target.fill().isEmpty(), operation);
|
||||
}
|
||||
String formats = "\"arnFormats\":{\"a\":{\"target\":\"arn:${Partition}:a:${Region}:${Account}:target/${Id}\"}}";
|
||||
assertEquals(List.of(new Member("Namespace", false), new Member("Dimension", false)), parseUnchecked(document(
|
||||
formats, "{\"type\":\"target\",\"fill\":{},\"find\":[\"Namespace\",\"Dimension\"]}"))
|
||||
.operations().get("a:Op").getFirst().find());
|
||||
// No members, a list, members beside one filling it, no list of them, or beside members reading it otherwise.
|
||||
for (String bad : List.of("\"fill\":{},\"find\":[]", "\"fill\":{},\"find\":[\"Ids[]\"]",
|
||||
"\"fill\":{\"Id\":\"Id\"},\"find\":[\"Namespace\"]", "\"fill\":{},\"find\":\"Namespace\"",
|
||||
"\"fill\":{},\"find\":{\"a\":\"Namespace\"}",
|
||||
"\"fill\":{},\"find\":[\"Namespace\"],\"account\":\"registryId\"",
|
||||
"\"fill\":{},\"find\":[\"Namespace\"],\"absent\":{\"Namespace\":\"ecs\"}")) {
|
||||
assertThrows(IllegalStateException.class,
|
||||
() -> parse(document(formats, "{\"type\":\"target\"," + bad + "}")), bad);
|
||||
}
|
||||
// Nor beside an ARN member, which names the resource itself.
|
||||
assertThrows(IllegalStateException.class, () -> parse(document(formats,
|
||||
"{\"types\":[\"target\"],\"arn\":\"TargetArn\",\"find\":[\"Namespace\"]}")));
|
||||
}
|
||||
|
||||
@Test
|
||||
void aMalformedTableFailsToLoad() {
|
||||
assertThrows(IllegalStateException.class, () -> parse("{\"operations\":{}}"));
|
||||
@@ -218,7 +247,8 @@ class RequestResourceMembersTest {
|
||||
ObjectNode body = MAPPER.createObjectNode();
|
||||
StringBuilder form = new StringBuilder("Action=" + name);
|
||||
Map<Member, String> values = resource.arn() != null ? Map.of(resource.arn(), arn)
|
||||
: resource.fill().values().stream().distinct().collect(Collectors.toMap(m -> m, m -> "x"));
|
||||
: Stream.concat(resource.fill().values().stream(), resource.find().stream()).distinct()
|
||||
.collect(Collectors.toMap(m -> m, m -> "x"));
|
||||
Map<Member, String> given = new LinkedHashMap<>(values);
|
||||
if (resource.account() != null) {
|
||||
given.put(resource.account(), account);
|
||||
@@ -273,8 +303,8 @@ class RequestResourceMembersTest {
|
||||
|
||||
/** Whether every request of its operation names the resource: no member names it and no member's value selects it. */
|
||||
private static boolean named(Resource resource) {
|
||||
return resource.arn() == null && resource.fill().isEmpty() && resource.when().isEmpty()
|
||||
&& resource.unless().isEmpty();
|
||||
return resource.arn() == null && resource.fill().isEmpty() && resource.find().isEmpty()
|
||||
&& resource.when().isEmpty() && resource.unless().isEmpty();
|
||||
}
|
||||
|
||||
/** The value at the member's path in a body: in its list's first element, and in its field's structure. */
|
||||
|
||||
@@ -338,9 +338,9 @@ class RequestResourcesTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<String> find(String type, String name, String region) {
|
||||
return "web".equals(name) && "us-east-1".equals(region) ? Optional.of(events + type + "/web/1234")
|
||||
: Optional.empty();
|
||||
public Optional<String> find(String type, List<String> names, String region) {
|
||||
return List.of("web").equals(names) && "us-east-1".equals(region)
|
||||
? Optional.of(events + type + "/web/1234") : Optional.empty();
|
||||
}
|
||||
};
|
||||
assertEquals(List.of(events + "connection/web/1234"), RequestResources.of("events:DescribeConnection",
|
||||
@@ -356,6 +356,44 @@ class RequestResourcesTest {
|
||||
+ "connection/web/1234\"}"), "aws", "us-east-1", "000000000000", stored));
|
||||
}
|
||||
|
||||
/**
|
||||
* A scalable target's ARN is all the id Application Auto Scaling mints, while its requests name it by its service
|
||||
* namespace, resource id and scalable dimension: it is the one stored under those, or else has its id open, as a
|
||||
* new one has; a request leaving one out names none, and one naming it by its ARN names it as given.
|
||||
*/
|
||||
@Test
|
||||
void aResourceWhoseArnIsAllAMintedIdIsTheOneStoredUnderTheMembersNamingIt() {
|
||||
String targets = "arn:aws:application-autoscaling:us-east-1:000000000000:scalable-target/";
|
||||
StoredResourceArns stored = new StoredResourceArns() {
|
||||
@Override
|
||||
public String namespace() {
|
||||
return "application-autoscaling";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<String> find(String type, List<String> names, String region) {
|
||||
return "ScalableTarget".equals(type) && "us-east-1".equals(region)
|
||||
&& List.of("ecs", "service/default/web", "ecs:service:DesiredCount").equals(names)
|
||||
? Optional.of(targets + "0123abcd") : Optional.empty();
|
||||
}
|
||||
};
|
||||
String web = "\"ServiceNamespace\":\"ecs\",\"ResourceId\":\"service/default/web\","
|
||||
+ "\"ScalableDimension\":\"ecs:service:DesiredCount\"";
|
||||
assertEquals(List.of(targets + "0123abcd"), RequestResources.of("application-autoscaling:PutScalingPolicy",
|
||||
json("{\"PolicyName\":\"p\"," + web + "}"), "aws", "us-east-1", "000000000000", stored));
|
||||
assertEquals(List.of(targets + "*"), RequestResources.of("application-autoscaling:RegisterScalableTarget",
|
||||
json("{" + web.replace("/web", "/api") + "}"), "aws", "us-east-1", "000000000000", stored));
|
||||
assertEquals(List.of(targets + "*"), of("application-autoscaling:DeregisterScalableTarget", json("{" + web + "}")));
|
||||
assertEquals(List.of(), RequestResources.of("application-autoscaling:DeregisterScalableTarget",
|
||||
json("{\"ServiceNamespace\":\"ecs\",\"ResourceId\":\"service/default/web\"}"), "aws", "us-east-1",
|
||||
"000000000000", stored));
|
||||
assertEquals(List.of(), RequestResources.of("application-autoscaling:DeregisterScalableTarget",
|
||||
json("{" + web.replace("\"ecs\",", "null,") + "}"), "aws", "us-east-1", "000000000000", stored));
|
||||
assertEquals(List.of(targets + "0123abcd"), RequestResources.of("application-autoscaling:TagResource",
|
||||
json("{\"ResourceARN\":\"" + targets + "0123abcd\",\"Tags\":{}}"), "aws", "us-east-1", "000000000000",
|
||||
stored));
|
||||
}
|
||||
|
||||
/** A request value is a name, so a {@code ${...}} in it is kept, not read as a variable of the format. */
|
||||
@Test
|
||||
void aValueIsTakenLiterally() {
|
||||
|
||||
+15
@@ -21,6 +21,7 @@ import java.util.Base64;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
@@ -619,6 +620,20 @@ class ApplicationAutoScalingServiceTest {
|
||||
assertEquals(0, service.describeScalableTargets(NAMESPACE, null, null, "eu-west-1").size());
|
||||
}
|
||||
|
||||
/** IAM finds a target's ARN, which ends in the id it was registered with, by the three members naming it. */
|
||||
@Test
|
||||
void aTargetIsFoundByItsNamespaceResourceAndDimension() {
|
||||
String arn = register().getScalableTargetArn();
|
||||
assertEquals("application-autoscaling", service.namespace());
|
||||
assertEquals(Optional.of(arn), service.find("ScalableTarget", List.of(NAMESPACE, RESOURCE_ID, DIMENSION), REGION));
|
||||
assertEquals(Optional.empty(), service.find("ScalableTarget",
|
||||
List.of(NAMESPACE, RESOURCE_ID, "ecs:service:Other"), REGION));
|
||||
assertEquals(Optional.empty(), service.find("ScalableTarget", List.of(NAMESPACE, RESOURCE_ID, DIMENSION),
|
||||
"eu-west-1"));
|
||||
assertEquals(Optional.empty(), service.find("ScalableTarget", List.of(RESOURCE_ID), REGION));
|
||||
assertEquals(Optional.empty(), service.find("other", List.of(NAMESPACE, RESOURCE_ID, DIMENSION), REGION));
|
||||
}
|
||||
|
||||
private TargetTrackingConfiguration withCooldowns(TargetTrackingConfiguration config) {
|
||||
config.setScaleInCooldown(240);
|
||||
config.setScaleOutCooldown(60);
|
||||
|
||||
+67
@@ -47,6 +47,7 @@ class IamRequestResourceEnforcementIntegrationTest {
|
||||
private static final String REGION = "us-east-1";
|
||||
private static final String ELB = "arn:aws:elasticloadbalancing:" + REGION + ":" + ACCOUNT + ":";
|
||||
private static final String EVENTS = "arn:aws:events:" + REGION + ":" + ACCOUNT + ":";
|
||||
private static final String TARGETS = "arn:aws:application-autoscaling:" + REGION + ":" + ACCOUNT + ":scalable-target/";
|
||||
/** The AWS Load Balancer Controller's create, tag-on-create and listener statements (its policy v2.14.0). */
|
||||
private static final String CONTROLLER_CREATE = "{\"Effect\":\"Allow\",\"Action\":[\"elasticloadbalancing:CreateLoadBalancer\","
|
||||
+ "\"elasticloadbalancing:CreateTargetGroup\"],\"Resource\":\"*\","
|
||||
@@ -1128,6 +1129,72 @@ class IamRequestResourceEnforcementIntegrationTest {
|
||||
+ "-other\"]}"), "translate:TranslateDocument");
|
||||
}
|
||||
|
||||
/**
|
||||
* A scalable target, named by its service namespace, resource id and scalable dimension, is checked on the ARN
|
||||
* Application Auto Scaling registered it under, which ends in the id it assigned, so a grant on that ARN allows
|
||||
* it, one on another target's does not, and a deny on it holds; registering a new one is checked with its id
|
||||
* open, and its tags by its ARN. Before, these were checked on {@code *}.
|
||||
*/
|
||||
@Test
|
||||
void aScalableTargetIsCheckedOnTheArnItWasRegisteredUnder() {
|
||||
String target = scalableTarget("service/res-" + suffix() + "/web");
|
||||
String arn = registerScalableTarget(target);
|
||||
assertTrue(arn.startsWith(TARGETS), arn);
|
||||
|
||||
User user = user("res-target");
|
||||
user.policy(allowOn("application-autoscaling:RegisterScalableTarget", arn));
|
||||
scaling(user, "RegisterScalableTarget", target + ",\"MaxCapacity\":3}").statusCode(200);
|
||||
user.policy(allowOn("application-autoscaling:RegisterScalableTarget", TARGETS + "other"));
|
||||
refusedJson(scaling(user, "RegisterScalableTarget", target + ",\"MaxCapacity\":3}"),
|
||||
"application-autoscaling:RegisterScalableTarget");
|
||||
// Its tags on an update are checked on the target too.
|
||||
user.policy(allowOn("application-autoscaling:RegisterScalableTarget", arn) + ","
|
||||
+ allowOn("application-autoscaling:TagResource", TARGETS + "other"));
|
||||
refusedJson(scaling(user, "RegisterScalableTarget", target + ",\"Tags\":{\"team\":\"a\"}}"),
|
||||
"application-autoscaling:TagResource");
|
||||
user.policy(allowOn("application-autoscaling:RegisterScalableTarget", arn) + ","
|
||||
+ allowOn("application-autoscaling:TagResource", arn));
|
||||
scaling(user, "RegisterScalableTarget", target + ",\"Tags\":{\"team\":\"a\"}}").statusCode(200);
|
||||
// A new target has no id yet, so it is checked on scalable-target/*, which a grant on another does not cover.
|
||||
String other = scalableTarget("service/res-" + suffix() + "/api");
|
||||
refusedJson(scaling(user, "RegisterScalableTarget", other + ",\"MinCapacity\":1,\"MaxCapacity\":2}"),
|
||||
"application-autoscaling:RegisterScalableTarget");
|
||||
user.policy(allowOn("application-autoscaling:RegisterScalableTarget", TARGETS + "*"));
|
||||
cleanup.register(() -> adminJson("application-autoscaling", "AnyScaleFrontendService.DeregisterScalableTarget")
|
||||
.body(other + "}").post("/"));
|
||||
scaling(user, "RegisterScalableTarget", other + ",\"MinCapacity\":1,\"MaxCapacity\":2}").statusCode(200);
|
||||
// A deny on the target holds, on a policy put on it and on its tags read by its ARN, and on no other target.
|
||||
user.policy(allowOn("application-autoscaling:*", "*") + ",{\"Effect\":\"Deny\",\"Action\":["
|
||||
+ "\"application-autoscaling:PutScalingPolicy\",\"application-autoscaling:ListTagsForResource\"],"
|
||||
+ "\"Resource\":\"" + arn + "\"}");
|
||||
refusedJson(scaling(user, "PutScalingPolicy", target.replace("{", "{\"PolicyName\":\"p\","
|
||||
+ "\"PolicyType\":\"StepScaling\",") + "}"), "application-autoscaling:PutScalingPolicy");
|
||||
refusedJson(scaling(user, "ListTagsForResource", "{\"ResourceARN\":\"" + arn + "\"}"),
|
||||
"application-autoscaling:ListTagsForResource");
|
||||
scaling(user, "DeregisterScalableTarget", other + "}").statusCode(200);
|
||||
}
|
||||
|
||||
/** The members naming an ECS service's desired count as a scalable target, an open JSON object. */
|
||||
private static String scalableTarget(String resourceId) {
|
||||
return "{\"ServiceNamespace\":\"ecs\",\"ResourceId\":\"" + resourceId + "\","
|
||||
+ "\"ScalableDimension\":\"ecs:service:DesiredCount\"";
|
||||
}
|
||||
|
||||
/** Registers the scalable target as the admin and gives its ARN. */
|
||||
private String registerScalableTarget(String target) {
|
||||
String arn = adminJson("application-autoscaling", "AnyScaleFrontendService.RegisterScalableTarget")
|
||||
.body(target + ",\"MinCapacity\":1,\"MaxCapacity\":2}").post("/").then().statusCode(200)
|
||||
.extract().path("ScalableTargetARN");
|
||||
cleanup.register(() -> adminJson("application-autoscaling", "AnyScaleFrontendService.DeregisterScalableTarget")
|
||||
.body(target + "}").post("/"));
|
||||
return arn;
|
||||
}
|
||||
|
||||
private static ValidatableResponse scaling(User user, String operation, String body) {
|
||||
return user.json("application-autoscaling", "AnyScaleFrontendService." + operation, "1.1").body(body).post("/")
|
||||
.then();
|
||||
}
|
||||
|
||||
/** A monthly cost budget of the name, with a billing view ARN when one is given. */
|
||||
private static String budget(String name, String billingViewArn) {
|
||||
return "{\"BudgetName\":\"" + name + "\",\"BudgetType\":\"COST\",\"TimeUnit\":\"MONTHLY\",\"BudgetLimit\":"
|
||||
|
||||
@@ -82,7 +82,12 @@ past its format, and whose service checks it without one: Step Functions checks
|
||||
on its state machine's ARN. `MINTED_IDS` are the resource types whose service follows the name their
|
||||
format ends in with an id it mints, `/<id>`, which the format leaves out and a request naming one by
|
||||
its name does not give: EventBridge's connections and API destinations, whose stored ARN the reader
|
||||
asks the service for, or else checks with that id open.
|
||||
asks the service for, or else checks with that id open. `FOUND_BY` are the resource types whose ARN is
|
||||
all an id their service mints, which a request names by members the ARN does not hold, with those
|
||||
members: each operation whose request has them all names the type by them (`find`), and the reader
|
||||
asks the service for the ARN they find, or else checks the ARN with its id open, as for a create; an
|
||||
Application Auto Scaling scalable target, `scalable-target/<id>`, is named by its service namespace,
|
||||
resource id and scalable dimension.
|
||||
|
||||
The Service Reference is live rather than a pinned dependency, so a fresh generation is not
|
||||
byte-identical. The two gates split along the sources:
|
||||
@@ -119,7 +124,7 @@ OUTPUT = REPO_ROOT / "src/main/resources/aws/iam-request-resources.json"
|
||||
|
||||
# The namespaces read, in batches: each moves here from NOT_COVERED with the tests that show its ARNs
|
||||
# are the ones its handlers mint.
|
||||
NAMESPACES = ("acm", "athena", "bcm-data-exports", "bcm-pricing-calculator", "budgets", "ce", "cloudtrail",
|
||||
NAMESPACES = ("acm", "application-autoscaling", "athena", "bcm-data-exports", "bcm-pricing-calculator", "budgets", "ce", "cloudtrail",
|
||||
"codebuild", "codepipeline", "cognito-identity", "cognito-idp", "cur", "ecr", "elasticloadbalancing",
|
||||
"events", "firehose", "globalaccelerator", "kinesisanalytics", "servicediscovery", "servicequotas",
|
||||
"states", "textract", "timestream-influxdb", "translate")
|
||||
@@ -149,11 +154,6 @@ NOT_COVERED: dict[str, str] = {
|
||||
"airflow": _REST,
|
||||
"app-integrations": _REST,
|
||||
"appconfig": _REST,
|
||||
"application-autoscaling": "not read yet: a scalable target's ARN ends in an id the service mints, "
|
||||
"`scalable-target/<id>`, while its requests name the target by ServiceNamespace, "
|
||||
"ResourceId and ScalableDimension, so its resource is the stored ARN those three "
|
||||
"find, which RequestResources has no lookup for yet; read as a member, ResourceId "
|
||||
"would fill that id",
|
||||
"appsync": _REST,
|
||||
"aps": _REST,
|
||||
"autoscaling": "not read yet: AWS's group and launch configuration ARNs carry an id the service mints, "
|
||||
@@ -214,7 +214,7 @@ NOT_COVERED: dict[str, str] = {
|
||||
"redshift": _LATER,
|
||||
"redshift-data": "not read yet: a serverless workgroup's ARN ends in an id the service mints, `workgroup/<id>`, "
|
||||
"while its requests name the workgroup by WorkgroupName, a name or an ARN, so its resource is the "
|
||||
"stored ARN that name finds, which RequestResources has no lookup for yet",
|
||||
"stored ARN that name finds, a FOUND_BY type its service does not look up yet",
|
||||
"redshift-serverless": _LATER,
|
||||
"rekognition": _LATER,
|
||||
"resource-explorer-2": _REST,
|
||||
@@ -411,6 +411,19 @@ MINTED_IDS: dict[str, str] = {
|
||||
"as it does a connection's",
|
||||
}
|
||||
|
||||
# Resource types whose ARN is all an id their service mints, which a request names by members the ARN does not
|
||||
# hold, the members in the order the service reads them, and why: an operation whose request has them all names the
|
||||
# type by them, and the reader asks the service for the ARN they find.
|
||||
FOUND_BY: dict[str, tuple[list[str], str]] = {
|
||||
"application-autoscaling:ScalableTarget": (
|
||||
["ServiceNamespace", "ResourceId", "ScalableDimension"],
|
||||
"a scalable target's ARN ends in its unique id, scalable-target/<id> ('The unique ID "
|
||||
"(1234abcd56ab78cd901ef1234567890ab123) is a value assigned by Application Auto Scaling to the scalable "
|
||||
"target', Application Auto Scaling User Guide), which the reference names ${ResourceId}, while its requests "
|
||||
"name the target by ServiceNamespace, ResourceId and ScalableDimension; ResourceId is the target's "
|
||||
"resource (service/<cluster>/<service>), not that id"),
|
||||
}
|
||||
|
||||
# The variables of an ARN format the account, partition and Region fill.
|
||||
KNOWN_VARIABLES = {"Partition", "Region", "Account"}
|
||||
VARIABLE_RE = re.compile(r"\$\{(\w+)}")
|
||||
@@ -761,7 +774,7 @@ def entry_for(operation: str, upstream: dict, formats: dict[str, str], models: d
|
||||
if operation in CORRECTIONS:
|
||||
resources = CORRECTIONS[operation][0]
|
||||
else:
|
||||
resources = resources_for(operation, types, formats, members)
|
||||
resources = with_found(resources_for(operation, types, formats, members), namespace_of(operation), members)
|
||||
resources = with_account(resources, formats, account_members(models, operation.split(":", 1)[1]))
|
||||
resources = with_arn_of(resources, formats, name_or_arn_members(models, operation.split(":", 1)[1]))
|
||||
resources = with_made(resources, operation, formats)
|
||||
@@ -772,6 +785,19 @@ def entry_for(operation: str, upstream: dict, formats: dict[str, str], models: d
|
||||
return entry
|
||||
|
||||
|
||||
def with_found(resources: list[dict], namespace: str, members: dict[str, str]) -> list[dict]:
|
||||
"""The resources, each a `FOUND_BY` type fills named by the members its service finds it by instead, when the
|
||||
request has them all, and left out when it does not: its variables are an id the request does not give."""
|
||||
found = []
|
||||
for resource in resources:
|
||||
key = f"{namespace}:{resource.get('type')}"
|
||||
if "fill" not in resource or key not in FOUND_BY:
|
||||
found.append(resource)
|
||||
elif all(members.get(member) == member for member in FOUND_BY[key][0]):
|
||||
found.append({"type": resource["type"], "fill": {}, "find": list(FOUND_BY[key][0])})
|
||||
return found
|
||||
|
||||
|
||||
def build(documents: list[dict], provenance: str, data: Path, botocore: str) -> dict:
|
||||
upstream = checked_actions(documents)
|
||||
covered = {operation: value for operation, value in upstream.items() if namespace_of(operation) in NAMESPACES}
|
||||
@@ -789,6 +815,8 @@ def build(documents: list[dict], provenance: str, data: Path, botocore: str) ->
|
||||
missing += [f"MINTED_IDS names {namespace}:{kind}, whose ARN format does not end in its one variable"
|
||||
for namespace, kinds in minted.items() for kind in kinds
|
||||
if kind in formats.get(namespace, {}) and not ONE_VARIABLE_RE.match(_resource(formats[namespace][kind]))]
|
||||
missing += [f"FOUND_BY names {key}, no resource type with an ARN format of a namespace the file reads"
|
||||
for key in sorted(FOUND_BY) if key.split(":", 1)[1] not in formats.get(key.split(":", 1)[0], {})]
|
||||
if missing:
|
||||
raise ValueError("; ".join(missing))
|
||||
operations = {}
|
||||
@@ -885,6 +913,8 @@ FILL_PATH_RE = re.compile(r"^[A-Za-z][A-Za-z0-9_]*(\[]|\[]\.[A-Za-z][A-Za-z0-9_]
|
||||
ARN_PATH_RE = re.compile(r"^[A-Za-z][A-Za-z0-9_]*(\[])?(\.[A-Za-z][A-Za-z0-9_]*(\[])?)?$")
|
||||
# A format's resource that is a literal and one variable, at its end.
|
||||
ONE_VARIABLE_RE = re.compile(r"^[^$]*\$\{\w+}$")
|
||||
# The keys a resource found by members does not take: it is read no other way, in the caller's account.
|
||||
FOUND_ONLY = {"absent", "arnOf", "account", "fixed", "before"}
|
||||
|
||||
|
||||
def validate(document: dict) -> list[str]:
|
||||
@@ -948,7 +978,7 @@ def validate(document: dict) -> list[str]:
|
||||
def _resource_problems(operation: str, resource: object, types: set[str], formats: dict[str, str]) -> list[str]:
|
||||
if not isinstance(resource, dict) or not ({"types", "arn"} <= set(resource) <= {"types", "arn", "before", "made"}
|
||||
or {"type", "fill"} <= set(resource) <= {"type", "fill", "when", "unless", "absent", "arnOf", "account",
|
||||
"fixed", "made", "before"}):
|
||||
"fixed", "made", "before", "find"}):
|
||||
return [f"{operation} names {resource!r}, which is neither an ARN member nor a type's variables"]
|
||||
if resource.get("made", True) is not True:
|
||||
return [f"{operation} marks {resource!r} made by {resource['made']!r}, which is not true"]
|
||||
@@ -963,6 +993,11 @@ def _resource_problems(operation: str, resource: object, types: set[str], format
|
||||
return [f"{operation} reads an ARN at {resource['arn']!r}, which is no member"]
|
||||
return []
|
||||
fill = resource["fill"]
|
||||
find = resource.get("find", [])
|
||||
if not isinstance(find, list) or ("find" in resource and (not find or fill or set(resource) & FOUND_ONLY)) \
|
||||
or not all(isinstance(path, str) and PATH_RE.match(path) and not path.endswith("[]") for path in find):
|
||||
return [f"{operation} finds {kinds[0]} by {find!r}, which are no members of one value each, or beside a fill "
|
||||
f"or members reading it otherwise"]
|
||||
variables = set(VARIABLE_RE.findall(formats[kinds[0]])) - KNOWN_VARIABLES
|
||||
if not isinstance(fill, dict) or set(fill) - variables or not all(
|
||||
isinstance(path, str) and FILL_PATH_RE.match(path) for path in fill.values()):
|
||||
|
||||
@@ -179,6 +179,7 @@ def corrections(monkeypatch):
|
||||
monkeypatch.setattr(r, "CORRECTIONS", {})
|
||||
monkeypatch.setattr(r, "UNQUALIFIED", {})
|
||||
monkeypatch.setattr(r, "MINTED_IDS", {})
|
||||
monkeypatch.setattr(r, "FOUND_BY", {})
|
||||
monkeypatch.setattr(r, "CLIENTS_NOT_READ", {})
|
||||
return monkeypatch
|
||||
|
||||
@@ -259,6 +260,31 @@ def test_a_type_whose_service_mints_an_id_after_its_name_is_recorded_and_must_be
|
||||
r.build(DOCUMENTS, "test", tmp_path, "botocore test")
|
||||
|
||||
|
||||
def test_a_type_whose_arn_is_all_an_id_its_service_mints_is_found_by_the_members_naming_it(corrections, tmp_path):
|
||||
documents = [reference("svc", {"PutTarget": ["target"], "TagTarget": ["target"], "GetByResource": ["target"]},
|
||||
{"target": "arn:${Partition}:svc:${Region}:${Account}:target/${ResourceId}"})]
|
||||
write_models(tmp_path, {"svc": model({"PutTarget": {"Namespace": "String", "ResourceId": "String",
|
||||
"Dimension": "String"},
|
||||
"TagTarget": {"ResourceArn": "String"},
|
||||
"GetByResource": {"ResourceId": "String"}})})
|
||||
corrections.setattr(r, "FOUND_BY", {"svc:target": (["Namespace", "ResourceId", "Dimension"], "its service mints the id")})
|
||||
document = r.build(documents, "test", tmp_path, "botocore test")
|
||||
assert r.validate(document) == [] and r.derive(document, tmp_path) == []
|
||||
operations = document["operations"]
|
||||
# Found by the three, in order, rather than filled by ResourceId, which is not the id the ARN ends in.
|
||||
assert operations["svc:PutTarget"]["resources"] == [
|
||||
{"type": "target", "fill": {}, "find": ["Namespace", "ResourceId", "Dimension"]}]
|
||||
# Its ARN names it as given, and a request lacking a member names none.
|
||||
assert operations["svc:TagTarget"]["resources"] == [{"types": ["target"], "arn": "ResourceArn"}]
|
||||
assert operations["svc:GetByResource"]["resources"] == []
|
||||
# A hand edit no longer matches, and a type the file has no format for fails the build.
|
||||
operations["svc:PutTarget"]["resources"] = [{"type": "target", "fill": {"ResourceId": "ResourceId"}}]
|
||||
assert r.validate(document) == [] and len(r.derive(document, tmp_path)) == 1
|
||||
corrections.setattr(r, "FOUND_BY", {"svc:gone": (["Namespace"], "no longer there")})
|
||||
with pytest.raises(ValueError, match="svc:gone"):
|
||||
r.build(documents, "test", tmp_path, "botocore test")
|
||||
|
||||
|
||||
def test_a_client_not_read_gives_no_members_and_aws_listing_it_is_no_untrue_claim(corrections, tmp_path):
|
||||
corrections.setattr(r, "CLIENTS_NOT_READ", {"svcv2": "a second API Floci does not serve"})
|
||||
write_models(tmp_path, {"svc": model({"GetThing": {"ThingName": "String"}, "ListThings": {}}),
|
||||
@@ -348,6 +374,10 @@ def test_a_well_formed_document_validates():
|
||||
fill={"GroupName": "Group.Name"}, absent={"Group.Name": "default"}, fixed={"GroupId": "g-1"}, made=True)
|
||||
document["operations"]["svc:A"]["resources"][0]["made"] = True
|
||||
assert r.validate(document) == []
|
||||
# A type whose ARN is all an id its service mints, found by the members naming it.
|
||||
document = good_document()
|
||||
document["operations"]["svc:B"]["resources"][0].update(fill={}, find=["Namespace", "Id"])
|
||||
assert r.validate(document) == []
|
||||
|
||||
|
||||
def with_a_create() -> dict:
|
||||
@@ -410,6 +440,15 @@ def with_a_create() -> dict:
|
||||
(lambda d: d.update(mintedIds={"other": ["thing"]}), "mintedIds"),
|
||||
(lambda d: d.update(mintedIds={"svc": []}), "mintedIds"),
|
||||
(lambda d: d.pop("mintedIds"), "mintedIds"),
|
||||
(lambda d: d["operations"]["svc:B"]["resources"][0].update(find=["Namespace"]), "beside a fill"),
|
||||
(lambda d: d["operations"]["svc:B"]["resources"][0].update(fill={}, find=[]), "beside a fill"),
|
||||
(lambda d: d["operations"]["svc:B"]["resources"][0].update(fill={}, find=["Ids[]"]), "beside a fill"),
|
||||
(lambda d: d["operations"]["svc:B"]["resources"][0].update(fill={}, find="Namespace"), "beside a fill"),
|
||||
(lambda d: d["operations"]["svc:B"]["resources"][0].update(fill={}, find=["Namespace"], account="registryId"),
|
||||
"beside a fill"),
|
||||
(lambda d: d["operations"]["svc:B"]["resources"][0].update(fill={}, find=["Namespace"], absent={"Namespace": "ecs"}),
|
||||
"beside a fill"),
|
||||
(lambda d: d["operations"]["svc:A"]["resources"][0].update(find=["Namespace"]), "neither an ARN member"),
|
||||
])
|
||||
def test_a_malformed_document_is_rejected(change, problem):
|
||||
document = good_document()
|
||||
@@ -503,6 +542,11 @@ def test_the_vendored_file_is_well_formed():
|
||||
assert operations["elasticloadbalancing:CreateRule"]["creates"] == [
|
||||
{"type": f"listener-rule/{kind}", "parent": f"listener/{kind}", "arn": "ListenerArn"} for kind in ("app", "net")]
|
||||
assert set(document["handBuilt"]) >= {"lambda", "s3", "sqs"}
|
||||
# A scalable target is found by the three members naming it, its ARN ending in the id the service mints.
|
||||
assert operations["application-autoscaling:DeregisterScalableTarget"]["resources"] == [
|
||||
{"type": "ScalableTarget", "fill": {}, "find": ["ServiceNamespace", "ResourceId", "ScalableDimension"]}]
|
||||
assert operations["application-autoscaling:TagResource"]["resources"] == [
|
||||
{"types": ["ScalableTarget"], "arn": "ResourceARN"}]
|
||||
# The v2 API's Type picks the load balancer it creates, application when it gives none.
|
||||
assert operations["elasticloadbalancing:CreateLoadBalancer"]["resources"][1] == {
|
||||
"type": "loadbalancer/app/", "fill": {"LoadBalancerName": "Name"}, "when": {"Type": ["application", None]}}
|
||||
Reference in new issue
Block a user