mirror of
https://github.com/floci-io/floci.git
synced 2026-11-22 21:50:46 -05:00
feat(iam): read a REST request's resources from its path and query (#7499)
The table of request resources read only a request's body or Query
form, so no REST namespace was read: a REST request names its
resources in its path and its query. An OpenSearch Service request
naming its domain, DescribeDomain on
/2021-01-01/opensearch/domain/{DomainName}, was left unchecked by the
routes the previous change reads, as Floci could not check it on the
domain AWS checks it on.
- The generator reads a rest-json request's members in its path and
its query as members, under their botocore names, and records where
each one a resource reads is (`located`): a path label, `{Label}`, or
a query parameter, `?name`. RequestResources lays them over the body,
a label's value from the route the request matched in the vendored
routes (IamActionRegistry.pathLabels, IamRestRoutes now capturing
each label), a query parameter's from the query, so every kind of
resource reads them as it reads the body's. A located member is read
from where it is alone, as its handler reads it: one the body also
gives is dropped.
- A namespace read this way also takes the operations of each botocore
model Floci reads routes for under it (regen_rest_routes.MODELS) that
the reference lists for none of its clients, each the action of its
own name with that action's resource types, when the reference has
that action: the reference lists OpenSearch Service's `es` client
alone, while the `opensearch` client's operations are named after
`es` actions. --verify checks such an operation's action and types
against the reference's Actions, and reports one whose action AWS no
longer has.
- `es` moves from NOT_COVERED to NAMESPACES: 120 operations, both API
versions', 1505 over 34 namespaces. Every domain route Floci serves
reads its domain, from the path, the body or `?arn`, on
`domain/<DomainName>`, the ARN Floci mints. Those whose resource the
table does not find (outbound connections, applications, insights)
are routes Floci does not serve.
- Reading rest-json would also have read the Payment Cryptography data
plane's key from its path; Floci serves only the control plane, so
`payment-cryptography-data` joins CLIENTS_NOT_READ with its reason
and its operations stay as they were. No other entry changes.
With the domain operations in the table, the routes check them by the
resources-read half of the join rule. IamActionRegistryTest checks the
domain routes and the labels a request's path gives;
RequestResourcesTest reads a path label, a query parameter and a body
together; IamRestRouteEnforcementIntegrationTest checks DescribeDomain,
DescribeElasticsearchDomain and ListTags on the domain they name; the
generator tests cover the located members, a member two clients locate
apart, the REST models' operations and a round trip through --check and
--verify. iam.md says so.
This commit is contained in:
1 parent
8f69e81893
commit
9062572948
14 files changed
+637
-53
No files matched your search
+18
-5
@@ -1676,7 +1676,7 @@ Map, ACM, CodePipeline, CodeBuild, Amazon Managed Service for Apache Flink (Kine
|
||||
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
|
||||
Timestream for InfluxDB, the Amazon Redshift Data API, AWS Payment Cryptography, AWS DataSync, Amazon EMR,
|
||||
Amazon Rekognition and IAM Identity Center they come from a table generated from AWS's Service Reference and botocore, `src/main/resources/aws/iam-request-resources.json`, which gives each
|
||||
Amazon Rekognition, IAM Identity Center and Amazon OpenSearch Service they come from a table generated from AWS's Service Reference and botocore, `src/main/resources/aws/iam-request-resources.json`, which gives each
|
||||
operation's action, the resource types that action acts on with their ARN formats, and the request
|
||||
members that name them: a member holding a resource's ARN, which counts when it matches the format
|
||||
of a type the action acts on, or members filling the variables of a type's format. A member holding
|
||||
@@ -1853,6 +1853,18 @@ 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.
|
||||
|
||||
A REST request names its resources in its path and its query as well as its body. For OpenSearch
|
||||
Service, the one REST service the table reads, a member its path carries, the `DomainName` of
|
||||
`/2021-01-01/opensearch/domain/{DomainName}`, is read from the route the request matches in the
|
||||
vendored routes below, and one its query carries, the `arn` of `ListTags`, from the query, as members of
|
||||
the body are: `DescribeDomain` is checked on `domain/<DomainName>` and `ListTags` on the ARN it gives.
|
||||
A member its path or query carries is read from there alone, as OpenSearch reads it: a
|
||||
`GetCompatibleVersions` naming a domain in its body and none in its query names no domain.
|
||||
The table reads both API versions' operations, `2015-01-01` and `2021-01-01`, the Service Reference
|
||||
listing the first's alone, each the action of its own name. A request of an operation whose resource
|
||||
the table does not find, an outbound connection's or an OpenSearch application's, is checked on `*`;
|
||||
Floci serves neither.
|
||||
|
||||
A route no rule maps is the operation whose route it matches in botocore's model of its service,
|
||||
vendored in `src/main/resources/aws/rest-routes.json` (`make aws-data-sync` regenerates it): of the
|
||||
routes it matches, the most specific, segment by segment from the left a literal before a label and a
|
||||
@@ -1863,10 +1875,11 @@ when the Service Reference gives the action no resource type, as AWS authorizes
|
||||
The actions of no resource type are vendored in `src/main/resources/aws/iam-authorized-actions.json`
|
||||
for each scope whose routes are read (`make iam-authorized-actions-sync` regenerates them). So
|
||||
OpenSearch Service's `ListDomainNames`, `ListVersions` and VPC endpoint operations, in both API
|
||||
versions, and Access Analyzer's `ListAnalyzers` and `ValidatePolicy` are checked by their routes. A
|
||||
route whose action AWS checks on a resource Floci neither builds nor reads, OpenSearch's domain
|
||||
operations and Access Analyzer's analyzer operations among them, is not checked: checked on `*`, a
|
||||
grant scoped to the domain or analyzer would be refused. The routes of
|
||||
versions, and Access Analyzer's `ListAnalyzers` and `ValidatePolicy` are checked by their routes, and
|
||||
so are OpenSearch Service's domain operations, the table of request resources reading the domain they
|
||||
name. A route whose action AWS checks on a resource Floci neither builds nor reads, Access Analyzer's
|
||||
analyzer operations among them, is not checked: checked on `*`, a grant scoped to the analyzer would
|
||||
be refused. The routes of
|
||||
Lambda, EKS, EventBridge Scheduler, EventBridge Pipes and Aurora DSQL are all mapped by their rules,
|
||||
so none is checked differently. S3 and API Gateway are routed by their rules alone: S3 tells apart the
|
||||
operations of one route by their query and headers, and API Gateway is checked by HTTP method. A route
|
||||
|
||||
@@ -1138,7 +1138,7 @@ public class IamEnforcementFilter implements ContainerRequestFilter {
|
||||
String region, String accountId, String akid) {
|
||||
// A create tags the resource it makes, not the parent it makes it in (see RequestResources.created).
|
||||
List<String> created = RequestResources.created(operation, ctx, AwsRegions.partitionFor(region), region,
|
||||
accountId);
|
||||
accountId, IamActionRegistry.pathLabels(credentialScope, ctx));
|
||||
List<String> made = created.isEmpty() ? resources : created;
|
||||
for (TagOnCreate.TagSet set : tagging.checked()) {
|
||||
Map<String, List<String>> context = TagOnCreate.conditionContext(tagging, set, operation);
|
||||
|
||||
@@ -45,6 +45,9 @@ final class RequestResourceMembers {
|
||||
"^arn:\\$\\{Partition}:[^:]*:[^:]*:[^:]*:([A-Za-z][A-Za-z0-9-]*)(.*)$");
|
||||
/** A format's resource that is a literal and one variable. */
|
||||
private static final Pattern ONE_VARIABLE = Pattern.compile("[^$]*\\$\\{\\w+}");
|
||||
/** A member a REST request carries outside its body, by its name, and where: a path label or a query parameter. */
|
||||
private static final Pattern LOCATED_MEMBER = Pattern.compile("[A-Za-z][A-Za-z0-9_]*");
|
||||
private static final Pattern LOCATION = Pattern.compile("\\{[A-Za-z0-9_]+}|\\?[A-Za-z0-9_.-]+");
|
||||
/** 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. */
|
||||
@@ -169,12 +172,14 @@ final class RequestResourceMembers {
|
||||
|
||||
/**
|
||||
* The file: each operation's resources and the resources it creates under a parent, as
|
||||
* {@code <namespace>:<Operation>}, each namespace's ARN formats, and the namespaces it reads, those built by
|
||||
* hand, those not read yet, and the others with resource types.
|
||||
* {@code <namespace>:<Operation>}, the members a REST operation's request carries outside its body, each
|
||||
* namespace's ARN formats, and the namespaces it reads, those built by hand, those not read yet, and the others
|
||||
* with resource types. A located member is a label of the request's path, {@code {Label}}, or a parameter of its
|
||||
* query, {@code ?name}, by the member's name.
|
||||
*/
|
||||
record Table(Map<String, List<Resource>> operations, Map<String, List<Created>> creates,
|
||||
Map<String, Map<String, ArnFormat>> formats, Set<String> namespaces, Set<String> handBuilt,
|
||||
Set<String> notCovered, Set<String> otherNamespaces) {
|
||||
Map<String, Map<String, String>> located, Map<String, Map<String, ArnFormat>> formats,
|
||||
Set<String> namespaces, Set<String> handBuilt, Set<String> notCovered, Set<String> otherNamespaces) {
|
||||
}
|
||||
|
||||
private static final class Holder {
|
||||
@@ -229,6 +234,7 @@ final class RequestResourceMembers {
|
||||
});
|
||||
Map<String, List<Resource>> entries = new LinkedHashMap<>();
|
||||
Map<String, List<Created>> creates = new LinkedHashMap<>();
|
||||
Map<String, Map<String, String>> located = new LinkedHashMap<>();
|
||||
operations.properties().forEach(operation -> {
|
||||
String namespace = operation.getKey().substring(0, Math.max(0, operation.getKey().indexOf(':')));
|
||||
if (!namespaces.contains(namespace)) {
|
||||
@@ -247,8 +253,20 @@ final class RequestResourceMembers {
|
||||
if (!made.isEmpty()) {
|
||||
creates.put(operation.getKey(), List.copyOf(made));
|
||||
}
|
||||
Map<String, String> where = new LinkedHashMap<>();
|
||||
operation.getValue().path("located").properties().forEach(member -> {
|
||||
if (!LOCATED_MEMBER.matcher(member.getKey()).matches()
|
||||
|| !LOCATION.matcher(member.getValue().asText("")).matches()) {
|
||||
throw new IllegalStateException(RESOURCE_NAME + " locates " + operation.getKey() + "'s "
|
||||
+ member.getKey() + " at " + member.getValue() + ", no label of a path or query parameter");
|
||||
}
|
||||
where.put(member.getKey(), member.getValue().asText());
|
||||
});
|
||||
if (!where.isEmpty()) {
|
||||
located.put(operation.getKey(), Map.copyOf(where));
|
||||
}
|
||||
});
|
||||
return new Table(Map.copyOf(entries), Map.copyOf(creates), Map.copyOf(formats), namespaces,
|
||||
return new Table(Map.copyOf(entries), Map.copyOf(creates), Map.copyOf(located), Map.copyOf(formats), namespaces,
|
||||
names(document.path("handBuilt")),
|
||||
Set.copyOf(document.path("notCovered").propertyStream().map(Map.Entry::getKey).toList()),
|
||||
names(document.path("otherNamespaces")));
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package io.github.hectorvent.floci.core.common;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import jakarta.ws.rs.container.ContainerRequestContext;
|
||||
import jakarta.ws.rs.core.MultivaluedMap;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -79,6 +82,16 @@ public final class RequestResources {
|
||||
*/
|
||||
public static List<String> of(String operation, ContainerRequestContext ctx, String partition, String region,
|
||||
String accountId, StoredResourceArns stored) {
|
||||
return of(operation, ctx, partition, region, accountId, stored, Map.of());
|
||||
}
|
||||
|
||||
/**
|
||||
* As {@link #of(String, ContainerRequestContext, String, String, String, StoredResourceArns)}, a member the table
|
||||
* locates in a REST request's path read from {@code labels}, the value the request's path gives each label of the
|
||||
* route it was routed by, and one it locates in its query from the request's query parameters.
|
||||
*/
|
||||
public static List<String> of(String operation, ContainerRequestContext ctx, String partition, String region,
|
||||
String accountId, StoredResourceArns stored, Map<String, String> labels) {
|
||||
RequestResourceMembers.Table table = RequestResourceMembers.table();
|
||||
List<RequestResourceMembers.Resource> resources = operation == null ? null
|
||||
: served(table.operations().get(operation), ctx);
|
||||
@@ -86,7 +99,7 @@ public final class RequestResources {
|
||||
return List.of();
|
||||
}
|
||||
Map<String, String> form = IamConditionContextResolver.formParameters(ctx);
|
||||
JsonNode body = form.isEmpty() ? PassedRoles.jsonBody(ctx) : null;
|
||||
JsonNode body = form.isEmpty() ? located(table, operation, PassedRoles.jsonBody(ctx), ctx, labels) : null;
|
||||
return named(resources, formats(table, operation), form, body, partition, region, accountId, stored);
|
||||
}
|
||||
|
||||
@@ -128,6 +141,15 @@ public final class RequestResources {
|
||||
*/
|
||||
public static List<String> created(String operation, ContainerRequestContext ctx, String partition, String region,
|
||||
String accountId) {
|
||||
return created(operation, ctx, partition, region, accountId, Map.of());
|
||||
}
|
||||
|
||||
/**
|
||||
* As {@link #created(String, ContainerRequestContext, String, String, String)}, with the path's labels as for
|
||||
* {@link #of(String, ContainerRequestContext, String, String, String, StoredResourceArns, Map)}.
|
||||
*/
|
||||
public static List<String> created(String operation, ContainerRequestContext ctx, String partition, String region,
|
||||
String accountId, Map<String, String> labels) {
|
||||
RequestResourceMembers.Table table = RequestResourceMembers.table();
|
||||
List<RequestResourceMembers.Created> creates = operation == null ? null : table.creates().get(operation);
|
||||
List<RequestResourceMembers.Resource> made = operation == null || creates != null ? List.of()
|
||||
@@ -137,7 +159,7 @@ public final class RequestResources {
|
||||
return List.of();
|
||||
}
|
||||
Map<String, String> form = IamConditionContextResolver.formParameters(ctx);
|
||||
JsonNode body = form.isEmpty() ? PassedRoles.jsonBody(ctx) : null;
|
||||
JsonNode body = form.isEmpty() ? located(table, operation, PassedRoles.jsonBody(ctx), ctx, labels) : null;
|
||||
Map<String, RequestResourceMembers.ArnFormat> formats = formats(table, operation);
|
||||
if (creates == null) {
|
||||
return named(made, formats, form, body, partition, region, accountId, null);
|
||||
@@ -163,6 +185,32 @@ public final class RequestResources {
|
||||
return List.copyOf(arns);
|
||||
}
|
||||
|
||||
/**
|
||||
* The request's body with each member the table locates in a REST request's path or query laid over it under the
|
||||
* member's name, so a resource reads it as it reads a member of the body: a path label's value from {@code labels},
|
||||
* a query parameter's first value; the body itself when the operation locates none. A located member is read from
|
||||
* where it is alone, as its handler reads it: one the body also gives is dropped, so a body naming a domain the
|
||||
* query does not name names nothing.
|
||||
*/
|
||||
private static JsonNode located(RequestResourceMembers.Table table, String operation, JsonNode body,
|
||||
ContainerRequestContext ctx, Map<String, String> labels) {
|
||||
Map<String, String> located = table.located().getOrDefault(operation, Map.of());
|
||||
if (located.isEmpty()) {
|
||||
return body;
|
||||
}
|
||||
ObjectNode overlaid = body instanceof ObjectNode object ? object.deepCopy() : JsonNodeFactory.instance.objectNode();
|
||||
MultivaluedMap<String, String> query = ctx.getUriInfo() == null ? null : ctx.getUriInfo().getQueryParameters();
|
||||
located.forEach((member, where) -> {
|
||||
overlaid.remove(member);
|
||||
String value = where.startsWith("{") ? labels.get(where.substring(1, where.length() - 1))
|
||||
: query == null ? null : query.getFirst(where.substring(1));
|
||||
if (value != null) {
|
||||
overlaid.put(member, value);
|
||||
}
|
||||
});
|
||||
return overlaid;
|
||||
}
|
||||
|
||||
/**
|
||||
* The resources that apply to a request of the service serving it: one with an {@code endpoint} applies only to
|
||||
* a request the service of that endpoint prefix serves, read from the claim of the service whose handler runs it
|
||||
|
||||
@@ -743,6 +743,21 @@ public class IamActionRegistry {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* The value a REST request's path gives each label of the vendored route it matches, decoded, by the label's
|
||||
* name; empty when it matches none. {@link RequestResources} reads a member the table of request resources
|
||||
* locates in the path from them, as {@link #resolveRoute} matches the route.
|
||||
*/
|
||||
public static Map<String, String> pathLabels(String credentialScope, ContainerRequestContext ctx) {
|
||||
IamRestRoutes routes = IamRestRoutes.vendored();
|
||||
if (credentialScope == null || !routes.routes(credentialScope)) {
|
||||
return Map.of();
|
||||
}
|
||||
return routes.match(credentialScope, ctx.getMethod().toUpperCase(), routedPath(ctx),
|
||||
ctx.getUriInfo() == null ? null : ctx.getUriInfo().getQueryParameters())
|
||||
.map(IamRestRoutes.Match::labels).orElse(Map.of());
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether a request of the operation is checked on the resources AWS checks its action on: those its request
|
||||
* names, which the vendored request resources read for the operation ({@link RequestResources#reads}) or
|
||||
|
||||
@@ -7,6 +7,8 @@ import jakarta.ws.rs.core.MultivaluedMap;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URLDecoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
@@ -52,8 +54,15 @@ final class IamRestRoutes {
|
||||
private static final int ONE_SEGMENT = 1;
|
||||
private static final int REST_OF_PATH = 0;
|
||||
|
||||
/** A route: its operation, its path as a pattern, each segment's rank, and the query it names. */
|
||||
private record Route(String operation, Pattern path, int[] ranks, Map<String, String> query) {
|
||||
/** A route a request matched: its operation, and the value its path gives each of the route's labels, decoded. */
|
||||
record Match(String operation, Map<String, String> labels) {
|
||||
}
|
||||
|
||||
/**
|
||||
* A route: its operation, its path as a pattern capturing each label in turn, the labels' names, each segment's
|
||||
* rank, and the query it names.
|
||||
*/
|
||||
private record Route(String operation, Pattern path, List<String> labels, int[] ranks, Map<String, String> query) {
|
||||
|
||||
boolean matches(String requestPath, MultivaluedMap<String, String> parameters) {
|
||||
if (!path.matcher(requestPath).matches()) {
|
||||
@@ -68,6 +77,20 @@ final class IamRestRoutes {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** The value the path gives each label, decoded as the router decodes a path parameter. */
|
||||
Map<String, String> labelValues(String requestPath) {
|
||||
Matcher matcher = path.matcher(requestPath);
|
||||
if (!matcher.matches()) {
|
||||
return Map.of();
|
||||
}
|
||||
Map<String, String> values = new LinkedHashMap<>();
|
||||
for (int i = 0; i < labels.size(); i++) {
|
||||
values.put(labels.get(i), URLDecoder.decode(matcher.group(i + 1).replace("+", "%2B"),
|
||||
StandardCharsets.UTF_8));
|
||||
}
|
||||
return Map.copyOf(values);
|
||||
}
|
||||
|
||||
/** Whether this route is more specific than the other, as {@link IamRestRoutes} orders them. */
|
||||
boolean outranks(Route other) {
|
||||
int compared = Arrays.compare(ranks, other.ranks);
|
||||
@@ -97,6 +120,11 @@ final class IamRestRoutes {
|
||||
* matches several; empty when it matches none, or its scope is one the file does not route.
|
||||
*/
|
||||
Optional<String> operation(String scope, String method, String path, MultivaluedMap<String, String> query) {
|
||||
return match(scope, method, path, query).map(Match::operation);
|
||||
}
|
||||
|
||||
/** As {@link #operation}, with the values the request's path gives the route's labels. */
|
||||
Optional<Match> match(String scope, String method, String path, MultivaluedMap<String, String> query) {
|
||||
String requestPath = IamActionRegistry.withoutTrailingSlash(path);
|
||||
Route best = null;
|
||||
for (Route route : routes.getOrDefault(scope, Map.of()).getOrDefault(method, List.of())) {
|
||||
@@ -104,7 +132,12 @@ final class IamRestRoutes {
|
||||
best = route;
|
||||
}
|
||||
}
|
||||
return best == null ? Optional.empty() : Optional.of(best.operation());
|
||||
return best == null ? Optional.empty() : Optional.of(new Match(best.operation(), best.labelValues(requestPath)));
|
||||
}
|
||||
|
||||
/** Whether the file routes any request of the credential scope. */
|
||||
boolean routes(String scope) {
|
||||
return routes.containsKey(scope);
|
||||
}
|
||||
|
||||
static IamRestRoutes parse(InputStream in) throws IOException {
|
||||
@@ -153,12 +186,14 @@ final class IamRestRoutes {
|
||||
String path = IamActionRegistry.withoutTrailingSlash(question < 0 ? requestUri : requestUri.substring(0, question));
|
||||
List<String> segments = path.equals("/") ? List.of() : List.of(path.substring(1).split("/", -1));
|
||||
StringBuilder pattern = new StringBuilder();
|
||||
List<String> labels = new ArrayList<>();
|
||||
int[] ranks = new int[segments.size()];
|
||||
for (int i = 0; i < segments.size(); i++) {
|
||||
String segment = segments.get(i);
|
||||
pattern.append('/');
|
||||
if (GREEDY.matcher(segment).matches()) {
|
||||
pattern.append(".+");
|
||||
pattern.append("(.+)");
|
||||
labels.add(segment.substring(1, segment.length() - 2));
|
||||
ranks[i] = REST_OF_PATH;
|
||||
continue;
|
||||
}
|
||||
@@ -166,7 +201,8 @@ final class IamRestRoutes {
|
||||
int literalFrom = 0;
|
||||
boolean labelled = false;
|
||||
while (label.find()) {
|
||||
pattern.append(Pattern.quote(segment.substring(literalFrom, label.start()))).append("[^/]+");
|
||||
pattern.append(Pattern.quote(segment.substring(literalFrom, label.start()))).append("([^/]+)");
|
||||
labels.add(segment.substring(label.start() + 1, label.end() - 1));
|
||||
literalFrom = label.end();
|
||||
labelled = true;
|
||||
}
|
||||
@@ -181,7 +217,7 @@ final class IamRestRoutes {
|
||||
equals < 0 ? "" : parameter.substring(equals + 1));
|
||||
}
|
||||
}
|
||||
return new Route(operation, Pattern.compile(pattern.isEmpty() ? "/" : pattern.toString()), ranks,
|
||||
Map.copyOf(query));
|
||||
return new Route(operation, Pattern.compile(pattern.isEmpty() ? "/" : pattern.toString()), List.copyOf(labels),
|
||||
ranks, Map.copyOf(query));
|
||||
}
|
||||
}
|
||||
@@ -229,7 +229,8 @@ public class ResourceArnBuilder {
|
||||
private List<String> namedResources(String credentialScope, String operation, ContainerRequestContext ctx,
|
||||
String region, String accountId, String partition) {
|
||||
List<String> named = operation == null || !operation.startsWith(credentialScope + ":") ? List.of()
|
||||
: RequestResources.of(operation, ctx, partition, region, accountId, storedResourceArns(credentialScope));
|
||||
: RequestResources.of(operation, ctx, partition, region, accountId, storedResourceArns(credentialScope),
|
||||
IamActionRegistry.pathLabels(credentialScope, ctx));
|
||||
return named.isEmpty() ? List.of("*") : named;
|
||||
}
|
||||
|
||||
|
||||
@@ -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-03", "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"], "datasync": ["datasync"], "dynamodb": ["dynamodb"], "ecr": ["ecr"], "elasticloadbalancing": ["elb", "elbv2"], "elasticmapreduce": ["emr"], "events": ["eventbridgev2", "events"], "firehose": ["firehose"], "globalaccelerator": ["globalaccelerator"], "kinesisanalytics": ["kinesisanalyticsv2"], "logs": ["logs"], "payment-cryptography": ["payment-cryptography", "payment-cryptography-data"], "redshift-data": ["redshift-data"], "rekognition": ["rekognition"], "servicediscovery": ["servicediscovery"], "servicequotas": ["service-quotas"], "sso": ["sso", "sso-admin"], "states": ["stepfunctions"], "textract": ["textract"], "timestream-influxdb": ["timestream-influxdb"], "translate": ["translate"]},
|
||||
"clientsNotRead": {"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"},
|
||||
"_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-04", "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"], "datasync": ["datasync"], "dynamodb": ["dynamodb"], "ecr": ["ecr"], "elasticloadbalancing": ["elb", "elbv2"], "elasticmapreduce": ["emr"], "es": ["es", "opensearch"], "events": ["eventbridgev2", "events"], "firehose": ["firehose"], "globalaccelerator": ["globalaccelerator"], "kinesisanalytics": ["kinesisanalyticsv2"], "logs": ["logs"], "payment-cryptography": ["payment-cryptography"], "redshift-data": ["redshift-data"], "rekognition": ["rekognition"], "servicediscovery": ["servicediscovery"], "servicequotas": ["service-quotas"], "sso": ["sso", "sso-admin"], "states": ["stepfunctions"], "textract": ["textract"], "timestream-influxdb": ["timestream-influxdb"], "translate": ["translate"]},
|
||||
"clientsNotRead": {"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", "payment-cryptography-data": "the Payment Cryptography data plane, REST routes such as /keys/{KeyIdentifier}/encrypt, which Floci does not serve (it serves the control plane's JSON operations); its KeyIdentifier may be an alias, read on the control plane by the handler, not by its path"},
|
||||
"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", "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", "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: an environment's ARN carries its application's name, `environment/<application>/<name>`, while most of its requests name it by EnvironmentName or EnvironmentId alone, so reading it needs the stored environment those find", "elasticfilesystem": "REST: its requests name their resources in the path, which RequestResources does not read yet", "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 RequestResources does not read yet", "identitystore": "not read yet: a later batch, with thLine 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", "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: an environment's ARN carries its application's name, `environment/<application>/<name>`, while most of its requests name it by EnvironmentName or EnvironmentId alone, so reading it needs the stored environment those find", "elasticfilesystem": "REST: its requests name their resources in the path, which RequestResources does not read yet", "emr-serverless": "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 RequestResources does not read yet", "identitystore": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "inspector2": "REST: its requests name theiLine 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", "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}"}, "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}"}, "datasync": {"agent": "arn:${Partition}:datasync:${Region}:${Account}:agent/${AgentId}", "discoveryjob": "arn:${Partition}:datasync:${Region}:${Account}:system/${StorageSystemId}/job/${DiscoveryJobId}", "location": "arn:${Partition}:datasync:${Region}:${Account}:location/${LocationId}", "storagesystem": "arn:${Partition}:datasync:${Region}:${Account}:system/${StorageSystemId}", "task": "arn:${Partition}:datasync:${Region}:${Account}:task/${TaskId}", "taskexecution": "arn:${Partition}:datasync:${Region}:${Account}:task/${TaskId}/execution/${ExecutionId}"}, "dynamodb": {"backup": "arn:${Partition}:dynamodb:${Region}:${Account}:table/${TableName}/backup/${BackupName}", "export": "arn:${Partition}:dynamodb:${Region}:${Account}:table/${TableName}/export/${ExportName}", "global-table": "arn:${Partition}:dynamodb::${Line 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}"}, "datasync": {"agent": "arn:${Partition}:datasync:${Region}:${Account}:agent/${AgentId}", "discoveryjob": "arn:${Partition}:datasync:${Region}:${Account}:system/${StorageSystemId}/job/${DiscoveryJobId}", "location": "arn:${Partition}:datasync:${Region}:${Account}:location/${LocationId}", "storagesystem": "arn:${Partition}:datasync:${Region}:${Account}:system/${StorageSystemId}", "task": "arn:${Partition}:datasync:${Region}:${Account}:task/${TaskId}", "taskexecution": "arn:${Partition}:datasync:${Region}:${Account}:task/${TaskId}/execution/${ExecutionId}"}, "dynamodb": {"backup": "arn:${Partition}:dynamodb:${Region}:${Account}:table/${TableName}/backup/${BackupName}", "export": "arn:${Partition}:dynamodb:${Region}:${Account}:table/${TableName}/export/${ExportName}", "global-table": "arn:${Partition}:dynamodb::${Line truncated
|
||||
"unqualified": {"states": ["statemachine"]},
|
||||
"mintedIds": {"events": ["api-destination", "connection"]},
|
||||
"operations": {
|
||||
@@ -831,6 +831,126 @@
|
||||
"elasticmapreduce:TerminateSession": {"action": "elasticmapreduce:TerminateSession", "types": ["session"], "resources": [{"type": "session", "fill": {"ClusterId": "ClusterId", "SessionId": "SessionId"}}]},
|
||||
"elasticmapreduce:UpdateStudio": {"action": "elasticmapreduce:UpdateStudio", "types": ["studio"], "resources": [{"types": ["studio"], "arn": "EncryptionKeyArn"}, {"type": "studio", "fill": {"StudioId": "StudioId"}}]},
|
||||
"elasticmapreduce:UpdateStudioSessionMapping": {"action": "elasticmapreduce:UpdateStudioSessionMapping", "types": ["studio"], "resources": [{"types": ["studio"], "arn": "SessionPolicyArn"}, {"type": "studio", "fill": {"StudioId": "StudioId"}}]},
|
||||
"es:AcceptInboundConnection": {"action": "es:AcceptInboundConnection", "types": [], "resources": []},
|
||||
"es:AcceptInboundCrossClusterSearchConnection": {"action": "es:AcceptInboundCrossClusterSearchConnection", "types": [], "resources": []},
|
||||
"es:AddDataSource": {"action": "es:AddDataSource", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}], "located": {"DomainName": "{DomainName}"}},
|
||||
"es:AddDirectQueryDataSource": {"action": "es:AddDirectQueryDataSource", "types": ["datasource"], "resources": [{"types": ["datasource"], "arn": "OpenSearchArns[]"}, {"type": "datasource", "fill": {"DataSourceName": "DataSourceName"}}]},
|
||||
"es:AddTags": {"action": "es:AddTags", "types": ["application", "datasource", "domain"], "resources": [{"types": ["application", "datasource", "domain"], "arn": "ARN"}]},
|
||||
"es:AssociatePackage": {"action": "es:AssociatePackage", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}], "located": {"DomainName": "{DomainName}"}},
|
||||
"es:AssociatePackages": {"action": "es:AssociatePackages", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}]},
|
||||
"es:AttachDataSource": {"action": "es:AttachDataSource", "types": ["application"], "resources": [{"types": ["application"], "arn": "dataSourceArn"}]},
|
||||
"es:AuthorizeVpcEndpointAccess": {"action": "es:AuthorizeVpcEndpointAccess", "types": [], "resources": []},
|
||||
"es:CancelDomainConfigChange": {"action": "es:CancelDomainConfigChange", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}], "located": {"DomainName": "{DomainName}"}},
|
||||
"es:CancelElasticsearchServiceSoftwareUpdate": {"action": "es:CancelElasticsearchServiceSoftwareUpdate", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}]},
|
||||
"es:CancelServiceSoftwareUpdate": {"action": "es:CancelServiceSoftwareUpdate", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}]},
|
||||
"es:CreateApplication": {"action": "es:CreateApplication", "types": [], "resources": []},
|
||||
"es:CreateDomain": {"action": "es:CreateDomain", "types": ["domain"], "resources": [{"types": ["domain"], "arn": "CognitoOptions.RoleArn"}, {"types": ["domain"], "arn": "DomainEndpointOptions.CustomEndpointCertificateArn"}, {"types": ["domain"], "arn": "IdentityCenterOptions.IdentityCenterInstanceARN"}, {"type": "domain", "fill": {"DomainName": "DomainName"}}]},
|
||||
"es:CreateElasticsearchDomain": {"action": "es:CreateElasticsearchDomain", "types": ["domain"], "resources": [{"types": ["domain"], "arn": "CognitoOptions.RoleArn"}, {"types": ["domain"], "arn": "DomainEndpointOptions.CustomEndpointCertificateArn"}, {"type": "domain", "fill": {"DomainName": "DomainName"}}]},
|
||||
"es:CreateIndex": {"action": "es:CreateIndex", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}], "located": {"DomainName": "{DomainName}"}},
|
||||
"es:CreateOutboundConnection": {"action": "es:CreateOutboundConnection", "types": ["domain"], "resources": []},
|
||||
"es:CreateOutboundCrossClusterSearchConnection": {"action": "es:CreateOutboundCrossClusterSearchConnection", "types": ["domain"], "resources": []},
|
||||
"es:CreatePackage": {"action": "es:CreatePackage", "types": [], "resources": []},
|
||||
"es:CreateVpcEndpoint": {"action": "es:CreateVpcEndpoint", "types": [], "resources": []},
|
||||
"es:DeleteApplication": {"action": "es:DeleteApplication", "types": ["application"], "resources": [{"type": "application", "fill": {"AppId": "id"}}], "located": {"id": "{id}"}},
|
||||
"es:DeleteDataSource": {"action": "es:DeleteDataSource", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}], "located": {"DomainName": "{DomainName}"}},
|
||||
"es:DeleteDirectQueryDataSource": {"action": "es:DeleteDirectQueryDataSource", "types": ["datasource"], "resources": [{"type": "datasource", "fill": {"DataSourceName": "DataSourceName"}}], "located": {"DataSourceName": "{DataSourceName}"}},
|
||||
"es:DeleteDomain": {"action": "es:DeleteDomain", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}], "located": {"DomainName": "{DomainName}"}},
|
||||
"es:DeleteElasticsearchDomain": {"action": "es:DeleteElasticsearchDomain", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}], "located": {"DomainName": "{DomainName}"}},
|
||||
"es:DeleteElasticsearchServiceRole": {"action": "es:DeleteElasticsearchServiceRole", "types": [], "resources": []},
|
||||
"es:DeleteInboundConnection": {"action": "es:DeleteInboundConnection", "types": [], "resources": []},
|
||||
"es:DeleteInboundCrossClusterSearchConnection": {"action": "es:DeleteInboundCrossClusterSearchConnection", "types": [], "resources": []},
|
||||
"es:DeleteIndex": {"action": "es:DeleteIndex", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}], "located": {"DomainName": "{DomainName}"}},
|
||||
"es:DeleteOutboundConnection": {"action": "es:DeleteOutboundConnection", "types": [], "resources": []},
|
||||
"es:DeleteOutboundCrossClusterSearchConnection": {"action": "es:DeleteOutboundCrossClusterSearchConnection", "types": [], "resources": []},
|
||||
"es:DeletePackage": {"action": "es:DeletePackage", "types": [], "resources": []},
|
||||
"es:DeleteVpcEndpoint": {"action": "es:DeleteVpcEndpoint", "types": [], "resources": []},
|
||||
"es:DeregisterCapability": {"action": "es:DeregisterCapability", "types": ["application"], "resources": [{"type": "application", "fill": {"AppId": "applicationId"}}], "located": {"applicationId": "{ApplicationId}"}},
|
||||
"es:DescribeDataSourceAttachment": {"action": "es:DescribeDataSourceAttachment", "types": ["application"], "resources": [{"types": ["application"], "arn": "dataSourceArn"}]},
|
||||
"es:DescribeDomain": {"action": "es:DescribeDomain", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}], "located": {"DomainName": "{DomainName}"}},
|
||||
"es:DescribeDomainAutoTunes": {"action": "es:DescribeDomainAutoTunes", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}], "located": {"DomainName": "{DomainName}"}},
|
||||
"es:DescribeDomainChangeProgress": {"action": "es:DescribeDomainChangeProgress", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}], "located": {"DomainName": "{DomainName}"}},
|
||||
"es:DescribeDomainConfig": {"action": "es:DescribeDomainConfig", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}], "located": {"DomainName": "{DomainName}"}},
|
||||
"es:DescribeDomainHealth": {"action": "es:DescribeDomainHealth", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}], "located": {"DomainName": "{DomainName}"}},
|
||||
"es:DescribeDomainNodes": {"action": "es:DescribeDomainNodes", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}], "located": {"DomainName": "{DomainName}"}},
|
||||
"es:DescribeDomains": {"action": "es:DescribeDomains", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainNames[]"}}]},
|
||||
"es:DescribeDryRunProgress": {"action": "es:DescribeDryRunProgress", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}], "located": {"DomainName": "{DomainName}"}},
|
||||
"es:DescribeElasticsearchDomain": {"action": "es:DescribeElasticsearchDomain", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}], "located": {"DomainName": "{DomainName}"}},
|
||||
"es:DescribeElasticsearchDomainConfig": {"action": "es:DescribeElasticsearchDomainConfig", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}], "located": {"DomainName": "{DomainName}"}},
|
||||
"es:DescribeElasticsearchDomains": {"action": "es:DescribeElasticsearchDomains", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainNames[]"}}]},
|
||||
"es:DescribeElasticsearchInstanceTypeLimits": {"action": "es:DescribeElasticsearchInstanceTypeLimits", "types": [], "resources": []},
|
||||
"es:DescribeInboundConnections": {"action": "es:DescribeInboundConnections", "types": [], "resources": []},
|
||||
"es:DescribeInboundCrossClusterSearchConnections": {"action": "es:DescribeInboundCrossClusterSearchConnections", "types": [], "resources": []},
|
||||
"es:DescribeInsightDetails": {"action": "es:DescribeInsightDetails", "types": ["domain"], "resources": []},
|
||||
"es:DescribeInstanceTypeLimits": {"action": "es:DescribeInstanceTypeLimits", "types": [], "resources": []},
|
||||
"es:DescribeOutboundConnections": {"action": "es:DescribeOutboundConnections", "types": [], "resources": []},
|
||||
"es:DescribeOutboundCrossClusterSearchConnections": {"action": "es:DescribeOutboundCrossClusterSearchConnections", "types": [], "resources": []},
|
||||
"es:DescribePackages": {"action": "es:DescribePackages", "types": [], "resources": []},
|
||||
"es:DescribeReservedElasticsearchInstanceOfferings": {"action": "es:DescribeReservedElasticsearchInstanceOfferings", "types": [], "resources": []},
|
||||
"es:DescribeReservedElasticsearchInstances": {"action": "es:DescribeReservedElasticsearchInstances", "types": [], "resources": []},
|
||||
"es:DescribeReservedInstanceOfferings": {"action": "es:DescribeReservedInstanceOfferings", "types": [], "resources": []},
|
||||
"es:DescribeReservedInstances": {"action": "es:DescribeReservedInstances", "types": [], "resources": []},
|
||||
"es:DescribeVpcEndpoints": {"action": "es:DescribeVpcEndpoints", "types": [], "resources": []},
|
||||
"es:DetachDataSource": {"action": "es:DetachDataSource", "types": ["application"], "resources": [{"types": ["application"], "arn": "dataSourceArn"}]},
|
||||
"es:DissociatePackage": {"action": "es:DissociatePackage", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}], "located": {"DomainName": "{DomainName}"}},
|
||||
"es:DissociatePackages": {"action": "es:DissociatePackages", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}]},
|
||||
"es:GetApplication": {"action": "es:GetApplication", "types": ["application"], "resources": [{"type": "application", "fill": {"AppId": "id"}}], "located": {"id": "{id}"}},
|
||||
"es:GetCapability": {"action": "es:GetCapability", "types": ["application"], "resources": [{"type": "application", "fill": {"AppId": "applicationId"}}], "located": {"applicationId": "{ApplicationId}"}},
|
||||
"es:GetCompatibleElasticsearchVersions": {"action": "es:GetCompatibleElasticsearchVersions", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}], "located": {"DomainName": "?domainName"}},
|
||||
"es:GetCompatibleVersions": {"action": "es:GetCompatibleVersions", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}], "located": {"DomainName": "?domainName"}},
|
||||
"es:GetDataSource": {"action": "es:GetDataSource", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}], "located": {"DomainName": "{DomainName}"}},
|
||||
"es:GetDefaultApplicationSetting": {"action": "es:GetDefaultApplicationSetting", "types": ["application"], "resources": []},
|
||||
"es:GetDirectQueryDataSource": {"action": "es:GetDirectQueryDataSource", "types": ["datasource"], "resources": [{"type": "datasource", "fill": {"DataSourceName": "DataSourceName"}}], "located": {"DataSourceName": "{DataSourceName}"}},
|
||||
"es:GetDomainMaintenanceStatus": {"action": "es:GetDomainMaintenanceStatus", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}], "located": {"DomainName": "{DomainName}"}},
|
||||
"es:GetIndex": {"action": "es:GetIndex", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}], "located": {"DomainName": "{DomainName}"}},
|
||||
"es:GetMigration": {"action": "es:GetMigration", "types": ["application"], "resources": []},
|
||||
"es:GetPackageVersionHistory": {"action": "es:GetPackageVersionHistory", "types": [], "resources": []},
|
||||
"es:GetUpgradeHistory": {"action": "es:GetUpgradeHistory", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}], "located": {"DomainName": "{DomainName}"}},
|
||||
"es:GetUpgradeStatus": {"action": "es:GetUpgradeStatus", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}], "located": {"DomainName": "{DomainName}"}},
|
||||
"es:InsightFeedback": {"action": "es:InsightFeedback", "types": ["domain"], "resources": []},
|
||||
"es:ListApplications": {"action": "es:ListApplications", "types": ["application"], "resources": []},
|
||||
"es:ListDataSourceAttachments": {"action": "es:ListDataSourceAttachments", "types": ["application"], "resources": []},
|
||||
"es:ListDataSources": {"action": "es:ListDataSources", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}], "located": {"DomainName": "{DomainName}"}},
|
||||
"es:ListDirectQueryDataSources": {"action": "es:ListDirectQueryDataSources", "types": ["datasource"], "resources": []},
|
||||
"es:ListDomainMaintenances": {"action": "es:ListDomainMaintenances", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}], "located": {"DomainName": "{DomainName}"}},
|
||||
"es:ListDomainNames": {"action": "es:ListDomainNames", "types": [], "resources": []},
|
||||
"es:ListDomainsForPackage": {"action": "es:ListDomainsForPackage", "types": [], "resources": []},
|
||||
"es:ListElasticsearchInstanceTypes": {"action": "es:ListElasticsearchInstanceTypes", "types": [], "resources": []},
|
||||
"es:ListElasticsearchVersions": {"action": "es:ListElasticsearchVersions", "types": [], "resources": []},
|
||||
"es:ListInsights": {"action": "es:ListInsights", "types": ["domain"], "resources": []},
|
||||
"es:ListInstanceTypeDetails": {"action": "es:ListInstanceTypeDetails", "types": [], "resources": []},
|
||||
"es:ListMigrations": {"action": "es:ListMigrations", "types": ["application"], "resources": [{"type": "application", "fill": {"AppId": "applicationId"}}], "located": {"applicationId": "?applicationId"}},
|
||||
"es:ListPackagesForDomain": {"action": "es:ListPackagesForDomain", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}], "located": {"DomainName": "{DomainName}"}},
|
||||
"es:ListScheduledActions": {"action": "es:ListScheduledActions", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}], "located": {"DomainName": "{DomainName}"}},
|
||||
"es:ListTags": {"action": "es:ListTags", "types": ["application", "datasource", "domain"], "resources": [{"types": ["application", "datasource", "domain"], "arn": "ARN"}], "located": {"ARN": "?arn"}},
|
||||
"es:ListVersions": {"action": "es:ListVersions", "types": [], "resources": []},
|
||||
"es:ListVpcEndpointAccess": {"action": "es:ListVpcEndpointAccess", "types": [], "resources": []},
|
||||
"es:ListVpcEndpoints": {"action": "es:ListVpcEndpoints", "types": [], "resources": []},
|
||||
"es:ListVpcEndpointsForDomain": {"action": "es:ListVpcEndpointsForDomain", "types": [], "resources": []},
|
||||
"es:PurchaseReservedElasticsearchInstanceOffering": {"action": "es:PurchaseReservedElasticsearchInstanceOffering", "types": [], "resources": []},
|
||||
"es:PurchaseReservedInstanceOffering": {"action": "es:PurchaseReservedInstanceOffering", "types": [], "resources": []},
|
||||
"es:PutDefaultApplicationSetting": {"action": "es:PutDefaultApplicationSetting", "types": ["application"], "resources": [{"types": ["application"], "arn": "applicationArn"}]},
|
||||
"es:RegisterCapability": {"action": "es:RegisterCapability", "types": ["application"], "resources": [{"type": "application", "fill": {"AppId": "applicationId"}}], "located": {"applicationId": "{ApplicationId}"}},
|
||||
"es:RejectInboundConnection": {"action": "es:RejectInboundConnection", "types": [], "resources": []},
|
||||
"es:RejectInboundCrossClusterSearchConnection": {"action": "es:RejectInboundCrossClusterSearchConnection", "types": [], "resources": []},
|
||||
"es:RemoveTags": {"action": "es:RemoveTags", "types": ["application", "datasource", "domain"], "resources": [{"types": ["application", "datasource", "domain"], "arn": "ARN"}]},
|
||||
"es:RevokeVpcEndpointAccess": {"action": "es:RevokeVpcEndpointAccess", "types": [], "resources": []},
|
||||
"es:RollbackServiceSoftwareUpdate": {"action": "es:RollbackServiceSoftwareUpdate", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}]},
|
||||
"es:StartDomainMaintenance": {"action": "es:StartDomainMaintenance", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}], "located": {"DomainName": "{DomainName}"}},
|
||||
"es:StartElasticsearchServiceSoftwareUpdate": {"action": "es:StartElasticsearchServiceSoftwareUpdate", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}]},
|
||||
"es:StartMigration": {"action": "es:StartMigration", "types": ["application"], "resources": [{"type": "application", "fill": {"AppId": "applicationId"}}]},
|
||||
"es:StartServiceSoftwareUpdate": {"action": "es:StartServiceSoftwareUpdate", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}]},
|
||||
"es:UpdateApplication": {"action": "es:UpdateApplication", "types": ["application"], "resources": [{"types": ["application"], "arn": "dataSources[].dataSourceArn"}, {"types": ["application"], "arn": "dataSources[].iamRoleForDataSourceArn"}, {"types": ["application"], "arn": "iamIdentityCenterOptions.iamIdentityCenterInstanceArn"}, {"types": ["application"], "arn": "iamIdentityCenterOptions.iamRoleForIdentityCenterApplicationArn"}, {"type": "application", "fill": {"AppId": "id"}}], "located": {"id": "{id}"}},
|
||||
"es:UpdateDataSource": {"action": "es:UpdateDataSource", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}], "located": {"DomainName": "{DomainName}"}},
|
||||
"es:UpdateDirectQueryDataSource": {"action": "es:UpdateDirectQueryDataSource", "types": ["datasource"], "resources": [{"types": ["datasource"], "arn": "OpenSearchArns[]"}, {"type": "datasource", "fill": {"DataSourceName": "DataSourceName"}}], "located": {"DataSourceName": "{DataSourceName}"}},
|
||||
"es:UpdateDomainConfig": {"action": "es:UpdateDomainConfig", "types": ["domain"], "resources": [{"types": ["domain"], "arn": "CognitoOptions.RoleArn"}, {"types": ["domain"], "arn": "DomainEndpointOptions.CustomEndpointCertificateArn"}, {"types": ["domain"], "arn": "IdentityCenterOptions.IdentityCenterInstanceARN"}, {"type": "domain", "fill": {"DomainName": "DomainName"}}], "located": {"DomainName": "{DomainName}"}},
|
||||
"es:UpdateElasticsearchDomainConfig": {"action": "es:UpdateElasticsearchDomainConfig", "types": ["domain"], "resources": [{"types": ["domain"], "arn": "CognitoOptions.RoleArn"}, {"types": ["domain"], "arn": "DomainEndpointOptions.CustomEndpointCertificateArn"}, {"type": "domain", "fill": {"DomainName": "DomainName"}}], "located": {"DomainName": "{DomainName}"}},
|
||||
"es:UpdateIndex": {"action": "es:UpdateIndex", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}], "located": {"DomainName": "{DomainName}"}},
|
||||
"es:UpdatePackage": {"action": "es:UpdatePackage", "types": [], "resources": []},
|
||||
"es:UpdatePackageScope": {"action": "es:UpdatePackageScope", "types": [], "resources": []},
|
||||
"es:UpdateScheduledAction": {"action": "es:UpdateScheduledAction", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}], "located": {"DomainName": "{DomainName}"}},
|
||||
"es:UpdateVpcEndpoint": {"action": "es:UpdateVpcEndpoint", "types": [], "resources": []},
|
||||
"es:UpgradeDomain": {"action": "es:UpgradeDomain", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}]},
|
||||
"es:UpgradeElasticsearchDomain": {"action": "es:UpgradeElasticsearchDomain", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}]},
|
||||
"events:ActivateEventSource": {"action": "events:ActivateEventSource", "types": ["event-source"], "resources": [{"type": "event-source", "fill": {"EventSourceName": "Name"}}]},
|
||||
"events:CancelReplay": {"action": "events:CancelReplay", "types": ["replay"], "resources": [{"type": "replay", "fill": {"ReplayName": "ReplayName"}}]},
|
||||
"events:CreateApiDestination": {"action": "events:CreateApiDestination", "types": ["api-destination", "connection"], "resources": [{"types": ["api-destination", "connection"], "arn": "ConnectionArn"}, {"type": "api-destination", "fill": {"ApiDestinationName": "Name"}, "made": true}]},
|
||||
|
||||
+29
-8
@@ -7,6 +7,9 @@ import io.github.hectorvent.floci.core.common.RequestResourceMembers.Member;
|
||||
import io.github.hectorvent.floci.core.common.RequestResourceMembers.Resource;
|
||||
import jakarta.ws.rs.container.ContainerRequestContext;
|
||||
import jakarta.ws.rs.core.MediaType;
|
||||
import jakarta.ws.rs.core.MultivaluedHashMap;
|
||||
import jakarta.ws.rs.core.MultivaluedMap;
|
||||
import jakarta.ws.rs.core.UriInfo;
|
||||
import org.junit.jupiter.api.DynamicTest;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.TestFactory;
|
||||
@@ -279,7 +282,8 @@ class RequestResourceMembersTest {
|
||||
* account member names when it has one, with those sharing its explicit member selector, those the operation
|
||||
* always names, such as a create's new resource (Cloud Map's {@code CreateService}), and those filled from the ARN
|
||||
* it is read from (a permission set made in an instance); one named through another resource of its service's
|
||||
* own, the ARN its service gives for that.
|
||||
* own, the ARN its service gives for that. A member the table locates in a REST request's path or query is given
|
||||
* there, a body giving it naming nothing, and such a request is not checked as a form.
|
||||
*/
|
||||
@TestFactory
|
||||
Stream<DynamicTest> everyResourceOfTheTableIsReadFromAJsonBodyAndAForm() {
|
||||
@@ -308,8 +312,20 @@ class RequestResourceMembersTest {
|
||||
given.put(new Member(member, false), allowed.getFirst());
|
||||
}
|
||||
});
|
||||
// A member the table locates in a REST request's path or query goes there, where the reader takes it
|
||||
// from; a REST request has no form, so the form is checked for an operation locating none.
|
||||
Map<String, String> located = table.located().getOrDefault(operation.getKey(), Map.of());
|
||||
Map<String, String> labels = new LinkedHashMap<>();
|
||||
MultivaluedMap<String, String> query = new MultivaluedHashMap<>();
|
||||
given.forEach((member, value) -> {
|
||||
put(body, member, value);
|
||||
String where = member.field() == null && !member.list() ? located.get(member.name()) : null;
|
||||
if (where == null) {
|
||||
put(body, member, value);
|
||||
} else if (where.startsWith("{")) {
|
||||
labels.put(where.substring(1, where.length() - 1), value);
|
||||
} else {
|
||||
query.add(where.substring(1), value);
|
||||
}
|
||||
form.append('&').append(parameter(member)).append('=').append(encoded(value));
|
||||
});
|
||||
List<String> named = operation.getValue().stream()
|
||||
@@ -323,12 +339,17 @@ class RequestResourceMembersTest {
|
||||
"000000000000"))
|
||||
.distinct().toList();
|
||||
StoredResourceArns stored = runningOn(namespace, arn);
|
||||
assertEquals(named, RequestResources.of(operation.getKey(),
|
||||
servedBy(json(body.toString()), resource.endpoint()), "aws", "us-east-1", "000000000000",
|
||||
stored), body.toString());
|
||||
assertEquals(named, RequestResources.of(operation.getKey(),
|
||||
servedBy(form(form.toString()), resource.endpoint()), "aws", "us-east-1", "000000000000",
|
||||
stored), form.toString());
|
||||
ContainerRequestContext request = servedBy(json(body.toString()), resource.endpoint());
|
||||
UriInfo uriInfo = mock(UriInfo.class);
|
||||
when(uriInfo.getQueryParameters()).thenReturn(query);
|
||||
when(request.getUriInfo()).thenReturn(uriInfo);
|
||||
assertEquals(named, RequestResources.of(operation.getKey(), request, "aws", "us-east-1",
|
||||
"000000000000", stored, labels), body + " " + labels + " " + query);
|
||||
if (given.keySet().stream().noneMatch(member -> located.containsKey(member.name()))) {
|
||||
assertEquals(named, RequestResources.of(operation.getKey(),
|
||||
servedBy(form(form.toString()), resource.endpoint()), "aws", "us-east-1",
|
||||
"000000000000", stored), form.toString());
|
||||
}
|
||||
})));
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,9 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.dataformat.cbor.CBORFactory;
|
||||
import jakarta.ws.rs.container.ContainerRequestContext;
|
||||
import jakarta.ws.rs.core.MediaType;
|
||||
import jakarta.ws.rs.core.MultivaluedHashMap;
|
||||
import jakarta.ws.rs.core.MultivaluedMap;
|
||||
import jakarta.ws.rs.core.UriInfo;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
@@ -826,6 +829,49 @@ class RequestResourcesTest {
|
||||
return request("application/x-amz-json-1.1", body);
|
||||
}
|
||||
|
||||
/**
|
||||
* A REST request's member the table locates in its path is read from the labels of the route it was routed by,
|
||||
* one it locates in its query from the query, and one in its body from the body beside them: OpenSearch's
|
||||
* {@code DescribeDomain} names its domain in the path, {@code ListTags} its ARN in {@code ?arn}, and
|
||||
* {@code UpdateDomainConfig} its domain in the path under a JSON body. With no label given, the path member names
|
||||
* nothing, so the request is checked on {@code *}; and a located member is read from where it is alone, a body
|
||||
* giving it under its name naming nothing: {@code GetCompatibleVersions} with a domain in its body and none in its
|
||||
* query, which its handler answers with every domain's versions, names no domain.
|
||||
*/
|
||||
@Test
|
||||
void aRestRequestsPathAndQueryMembersAreReadWhereTheTableLocatesThem() {
|
||||
String domain = "arn:aws:es:us-east-1:111111111111:domain/logs";
|
||||
assertEquals(List.of(domain), RequestResources.of("es:DescribeDomain", rest("GET", null, Map.of()), "aws",
|
||||
"us-east-1", "111111111111", null, Map.of("DomainName", "logs")));
|
||||
assertEquals(List.of(), RequestResources.of("es:DescribeDomain", rest("GET", null, Map.of()), "aws",
|
||||
"us-east-1", "111111111111", null, Map.of()));
|
||||
assertEquals(List.of(domain), RequestResources.of("es:ListTags", rest("GET", null, Map.of("arn", domain)), "aws",
|
||||
"us-east-1", "111111111111", null, Map.of()));
|
||||
assertEquals(List.of(domain), RequestResources.of("es:UpdateDomainConfig",
|
||||
rest("POST", "{\"EngineVersion\":\"OpenSearch_2.11\"}", Map.of()), "aws", "us-east-1", "111111111111",
|
||||
null, Map.of("DomainName", "logs")));
|
||||
assertEquals(List.of(), RequestResources.of("es:GetCompatibleVersions",
|
||||
rest("GET", "{\"DomainName\":\"logs\"}", Map.of()), "aws", "us-east-1", "111111111111", null, Map.of()));
|
||||
assertEquals(List.of(domain), RequestResources.of("es:GetCompatibleVersions",
|
||||
rest("GET", "{\"DomainName\":\"other\"}", Map.of("domainName", "logs")), "aws", "us-east-1",
|
||||
"111111111111", null, Map.of()));
|
||||
assertEquals(List.of(domain), RequestResources.of("es:DescribeDomain",
|
||||
rest("GET", "{\"DomainName\":\"other\"}", Map.of()), "aws", "us-east-1", "111111111111", null,
|
||||
Map.of("DomainName", "logs")));
|
||||
}
|
||||
|
||||
private static ContainerRequestContext rest(String method, String body, Map<String, String> query) {
|
||||
ContainerRequestContext request = body == null ? mock(ContainerRequestContext.class)
|
||||
: request("application/json", body);
|
||||
when(request.getMethod()).thenReturn(method);
|
||||
UriInfo uriInfo = mock(UriInfo.class);
|
||||
MultivaluedMap<String, String> parameters = new MultivaluedHashMap<>();
|
||||
query.forEach(parameters::add);
|
||||
when(uriInfo.getQueryParameters()).thenReturn(parameters);
|
||||
when(request.getUriInfo()).thenReturn(uriInfo);
|
||||
return request;
|
||||
}
|
||||
|
||||
private static ContainerRequestContext form(String body) {
|
||||
return request("application/x-www-form-urlencoded", body);
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.net.URI;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
@@ -47,10 +48,10 @@ class IamActionRegistryTest {
|
||||
/**
|
||||
* A REST request no rule maps is checked as the operation whose vendored route it matches, as that operation's
|
||||
* action, when Floci checks it on the resources AWS does: built by hand for its namespace ({@code Invoke} as
|
||||
* {@code lambda:InvokeFunction}), read by the vendored request resources ({@code DescribeRepositories}), or
|
||||
* none, AWS authorizing its action on no resource type ({@code ListDomainNames}). One AWS checks on a resource
|
||||
* Floci does not read stays unmapped ({@code DescribeDomain}), as does a request matching no route, and a rule
|
||||
* still decides a route it maps.
|
||||
* {@code lambda:InvokeFunction}), read by the vendored request resources ({@code DescribeRepositories}, and
|
||||
* {@code DescribeDomain} from its path), or none, AWS authorizing its action on no resource type
|
||||
* ({@code ListDomainNames}). One AWS checks on a resource Floci does not read stays unmapped ({@code GetAnalyzer}),
|
||||
* as does a request matching no route, and a rule still decides a route it maps.
|
||||
*/
|
||||
@Test
|
||||
void aRouteNoRuleMapsIsCheckedAsItsOperationWhenFlociChecksItAsAwsDoes() throws IOException {
|
||||
@@ -61,6 +62,9 @@ class IamActionRegistryTest {
|
||||
"ListDomainNames": {"method": "GET", "requestUri": "/unmapped/domain"},
|
||||
"DescribeDomain": {"method": "GET", "requestUri": "/unmapped/domain/{DomainName}"}
|
||||
}},
|
||||
"accessanalyzer": {"credentialScope": "access-analyzer", "operations": {
|
||||
"GetAnalyzer": {"method": "GET", "requestUri": "/unmapped/analyzer/{analyzerName}"}
|
||||
}},
|
||||
"ecr": {"credentialScope": "ecr", "operations": {
|
||||
"DescribeRepositories": {"method": "GET", "requestUri": "/unmapped/repositories"}
|
||||
}},
|
||||
@@ -72,7 +76,8 @@ class IamActionRegistryTest {
|
||||
IamActionRegistry routed = new IamActionRegistry(routes);
|
||||
MultivaluedMap<String, String> none = new MultivaluedHashMap<>();
|
||||
assertEquals("es:ListDomainNames", routed.resolveRoute("es", mockCtx("GET", "/unmapped/domain", none, null, "")));
|
||||
assertNull(routed.resolveRoute("es", mockCtx("GET", "/unmapped/domain/logs", none, null, "")));
|
||||
assertEquals("es:DescribeDomain", routed.resolveRoute("es", mockCtx("GET", "/unmapped/domain/logs", none, null, "")));
|
||||
assertNull(routed.resolveRoute("access-analyzer", mockCtx("GET", "/unmapped/analyzer/a", none, null, "")));
|
||||
assertNull(routed.resolveRoute("es", mockCtx("GET", "/other/domain", none, null, "")));
|
||||
assertNull(routed.resolveRoute("other", mockCtx("GET", "/unmapped/domain", none, null, "")));
|
||||
assertEquals("lambda:InvokeFunction", routed.resolveRoute("lambda",
|
||||
@@ -86,7 +91,7 @@ class IamActionRegistryTest {
|
||||
/**
|
||||
* With the vendored routes, OpenSearch's and Access Analyzer's requests whose actions act on no resource type
|
||||
* are checked as their operations, the OpenSearch VPC endpoint operations among them, in both API versions;
|
||||
* those AWS checks on a domain or an analyzer stay unmapped, so a grant scoped to one is not refused.
|
||||
* those AWS checks on an analyzer stay unmapped, so a grant scoped to one is not refused.
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@CsvSource({"es,GET,/2021-01-01/domain,es:ListDomainNames",
|
||||
@@ -107,13 +112,39 @@ class IamActionRegistryTest {
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@CsvSource({"es,GET,/2021-01-01/opensearch/domain/logs", "es,POST,/2021-01-01/opensearch/domain",
|
||||
"es,GET,/2015-01-01/es/domain/logs", "access-analyzer,PUT,/analyzer",
|
||||
"access-analyzer,GET,/analyzer/default", "access-analyzer,DELETE,/analyzer/default"})
|
||||
@CsvSource({"access-analyzer,PUT,/analyzer", "access-analyzer,GET,/analyzer/default",
|
||||
"access-analyzer,DELETE,/analyzer/default"})
|
||||
void aVendoredRouteAwsChecksOnAResourceStaysUnmapped(String scope, String method, String path) {
|
||||
assertNull(registry.resolveRoute(scope, mockCtx(method, path, new MultivaluedHashMap<>(), null, "")));
|
||||
}
|
||||
|
||||
/**
|
||||
* OpenSearch's domain routes, in both API versions, are checked as their operations, the vendored request
|
||||
* resources reading the domain from the path, the body or the query, and the labels the routed path gives the
|
||||
* route are the ones the request resources read.
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@CsvSource({"GET,/2021-01-01/opensearch/domain/logs,es:DescribeDomain",
|
||||
"POST,/2021-01-01/opensearch/domain,es:CreateDomain",
|
||||
"DELETE,/2021-01-01/opensearch/domain/logs,es:DeleteDomain",
|
||||
"GET,/2021-01-01/opensearch/domain/logs/config,es:DescribeDomainConfig",
|
||||
"GET,/2015-01-01/es/domain/logs,es:DescribeElasticsearchDomain",
|
||||
"POST,/2015-01-01/es/domain/logs/config,es:UpdateElasticsearchDomainConfig"})
|
||||
void anOpenSearchDomainRouteIsCheckedAsItsOperation(String method, String path, String action) {
|
||||
assertEquals(action, registry.resolveRoute("es", mockCtx(method, path, new MultivaluedHashMap<>(), null, "")));
|
||||
}
|
||||
|
||||
@Test
|
||||
void theLabelsOfTheVendoredRouteARequestMatchesAreItsPathsValuesDecoded() {
|
||||
MultivaluedMap<String, String> none = new MultivaluedHashMap<>();
|
||||
assertEquals(Map.of("DomainName", "logs"),
|
||||
IamActionRegistry.pathLabels("es", mockCtx("GET", "/2021-01-01/opensearch/domain/logs", none, null, "")));
|
||||
assertEquals(Map.of("DomainName", "logs", "IndexName", "a b"), IamActionRegistry.pathLabels("es",
|
||||
mockCtx("GET", "/2021-01-01/opensearch/domain/logs/index/a%20b", none, null, "")));
|
||||
assertEquals(Map.of(), IamActionRegistry.pathLabels("es", mockCtx("GET", "/nothing", none, null, "")));
|
||||
assertEquals(Map.of(), IamActionRegistry.pathLabels("sqs", mockCtx("GET", "/queue", none, null, "")));
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@CsvSource({"/policy/validation", "/%70olicy/validation", "/policy/%76alidation",
|
||||
"/policy;ignored=yes/validation", "/policy/validation;ignored=yes",
|
||||
|
||||
+33
-3
@@ -494,8 +494,8 @@ class IamRestRouteEnforcementIntegrationTest {
|
||||
|
||||
/**
|
||||
* A route no rule maps is checked as the operation of its vendored route when AWS authorizes that operation's
|
||||
* action on no resource type, in both OpenSearch API versions and for Access Analyzer; one AWS checks on a domain
|
||||
* stays unchecked, so a grant scoped to the domain is not refused for want of reading it.
|
||||
* action on no resource type, in both OpenSearch API versions and for Access Analyzer; one AWS checks on an
|
||||
* analyzer stays unchecked, so a grant scoped to the analyzer is not refused for want of reading it.
|
||||
*/
|
||||
@Test
|
||||
void aVendoredRouteIsCheckedWhenAwsAuthorizesItsActionOnNoResourceType() {
|
||||
@@ -506,7 +506,7 @@ class IamRestRouteEnforcementIntegrationTest {
|
||||
refused(as(user, "es").get("/2015-01-01/domain").then(), "es:ListDomainNames");
|
||||
refused(as(user, "es").get("/2021-01-01/opensearch/versions").then(), "es:ListVersions");
|
||||
refused(as(user, "access-analyzer").get("/analyzer").then(), "access-analyzer:ListAnalyzers");
|
||||
as(user, "es").get("/2021-01-01/opensearch/domain/route-missing-" + suffix()).then().statusCode(409)
|
||||
as(user, "access-analyzer").get("/analyzer/route-missing-" + suffix()).then().statusCode(404)
|
||||
.body(containsString("ResourceNotFoundException"));
|
||||
|
||||
policy(user, allow("es:ListDomainNames", "*"));
|
||||
@@ -514,6 +514,36 @@ class IamRestRouteEnforcementIntegrationTest {
|
||||
as(user, "es").get("/2015-01-01/domain").then().statusCode(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* An OpenSearch request naming its domain in its path, or its ARN in its query, is checked on that domain, in
|
||||
* both API versions: a grant scoped to the domain lets the request reach OpenSearch, which has no such domain, a
|
||||
* request naming another domain is refused, and a deny on the domain holds under an allow on everything. A domain
|
||||
* a request's body gives where OpenSearch reads it from the query names nothing: {@code GetCompatibleVersions}
|
||||
* with the domain in its body alone, which OpenSearch answers with every version, is checked on {@code *}.
|
||||
*/
|
||||
@Test
|
||||
void anOpenSearchRequestIsCheckedOnTheDomainItsPathOrQueryNames() {
|
||||
String user = user("route-domain");
|
||||
String domain = "route-domain-" + suffix();
|
||||
String arn = "arn:aws:es:us-east-1:" + ACCOUNT + ":domain/" + domain;
|
||||
policy(user, allow("es:DescribeDomain", arn) + "," + allow("es:DescribeElasticsearchDomain", arn) + ","
|
||||
+ allow("es:ListTags", arn) + "," + allow("es:GetCompatibleVersions", arn));
|
||||
as(user, "es").queryParam("domainName", domain).get("/2021-01-01/opensearch/compatibleVersions").then()
|
||||
.statusCode(409);
|
||||
refused(as(user, "es").body("{\"DomainName\":\"" + domain + "\"}").get("/2021-01-01/opensearch/compatibleVersions")
|
||||
.then(), "es:GetCompatibleVersions");
|
||||
as(user, "es").get("/2021-01-01/opensearch/domain/" + domain).then().statusCode(409);
|
||||
as(user, "es").get("/2015-01-01/es/domain/" + domain).then().statusCode(409);
|
||||
as(user, "es").queryParam("arn", arn).get("/2021-01-01/tags/").then().statusCode(not(403));
|
||||
refused(as(user, "es").get("/2021-01-01/opensearch/domain/other-" + domain).then(), "es:DescribeDomain");
|
||||
refused(as(user, "es").get("/2015-01-01/es/domain/other-" + domain).then(), "es:DescribeElasticsearchDomain");
|
||||
refused(as(user, "es").queryParam("arn", arn + "-other").get("/2021-01-01/tags/").then(), "es:ListTags");
|
||||
|
||||
policy(user, allow("es:*", "*") + "," + deny("es:DescribeDomain", arn));
|
||||
refused(as(user, "es").get("/2021-01-01/opensearch/domain/" + domain).then(), "es:DescribeDomain");
|
||||
as(user, "es").get("/2021-01-01/opensearch/domain/other-" + domain).then().statusCode(409);
|
||||
}
|
||||
|
||||
/**
|
||||
* A segment ending in a matrix parameter, which the router ignores, is checked as the route it reaches, on the
|
||||
* resource its path names: the routed path carries no matrix parameter, so the rule matches and the ARN is the
|
||||
|
||||
@@ -60,6 +60,15 @@ A type nothing names is not checked: an action lists the optional resources its
|
||||
that covers what it does name. An operation whose action acts on no resource type, or whose request
|
||||
names none, is checked on `*`, as AWS checks it.
|
||||
|
||||
A REST request (`rest-json`) carries members in its path and its query as well as its body: a label of its path,
|
||||
`{DomainName}`, and a parameter of its query, `?arn`, are members as its body's are, under their botocore names, and
|
||||
the file records where each is (`located`), which the reader lays over the body from the path the request was routed
|
||||
by and its query. A namespace read this way also takes the operations of each botocore model Floci reads REST routes
|
||||
for under it (`regen_rest_routes.MODELS`) that the reference lists for none of its clients, each checked as the action
|
||||
of its own name with that action's resource types when the reference has that action, and left out when it does not:
|
||||
the reference lists one client's operations per namespace, and
|
||||
OpenSearch Service's are the `es` client's alone, while the `opensearch` client's are named after `es` actions.
|
||||
|
||||
Every operation in `NAMESPACES` is read, whether Floci serves it or not. Explicit `CORRECTIONS`
|
||||
in `HAND_BUILT` are also read, overriding only those operations while the remaining operations
|
||||
keep their existing resource builders, and so are the operations `READ_IN_HAND_BUILT` lists, which
|
||||
@@ -141,6 +150,7 @@ from regen_iam_passed_roles import (
|
||||
namespace_of,
|
||||
)
|
||||
from regen_partitions import resolve_botocore_data
|
||||
from regen_rest_routes import MODELS as REST_MODELS
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[2]
|
||||
OUTPUT = REPO_ROOT / "src/main/resources/aws/iam-request-resources.json"
|
||||
@@ -149,7 +159,7 @@ OUTPUT = REPO_ROOT / "src/main/resources/aws/iam-request-resources.json"
|
||||
# are the ones its handlers mint.
|
||||
NAMESPACES = ("acm", "application-autoscaling", "athena", "bcm-data-exports", "bcm-pricing-calculator", "budgets", "ce",
|
||||
"cloudtrail", "codebuild", "codepipeline", "cognito-identity", "cognito-idp", "cur", "datasync", "ecr",
|
||||
"elasticloadbalancing", "elasticmapreduce", "events", "firehose", "globalaccelerator", "kinesisanalytics",
|
||||
"elasticloadbalancing", "elasticmapreduce", "es", "events", "firehose", "globalaccelerator", "kinesisanalytics",
|
||||
"payment-cryptography", "redshift-data", "rekognition", "servicediscovery", "servicequotas", "sso",
|
||||
"states", "textract", "timestream-influxdb", "translate")
|
||||
|
||||
@@ -159,6 +169,10 @@ CLIENTS_NOT_READ: dict[str, str] = {
|
||||
"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",
|
||||
"payment-cryptography-data": "the Payment Cryptography data plane, REST routes such as "
|
||||
"/keys/{KeyIdentifier}/encrypt, which Floci does not serve (it serves the control "
|
||||
"plane's JSON operations); its KeyIdentifier may be an alias, read on the control "
|
||||
"plane by the handler, not by its path",
|
||||
}
|
||||
|
||||
# The namespaces whose resources ResourceArnBuilder builds itself.
|
||||
@@ -224,7 +238,6 @@ NOT_COVERED: dict[str, str] = {
|
||||
"or EnvironmentId alone, so reading it needs the stored environment those find",
|
||||
"elasticfilesystem": _REST,
|
||||
"emr-serverless": _REST,
|
||||
"es": _REST,
|
||||
"execute-api": _REST,
|
||||
"fis": _REST,
|
||||
"glue": _LATER,
|
||||
@@ -588,8 +601,11 @@ CREATING_RE = re.compile(r"^(Create|Run|Allocate|Register|Put|Import|Copy|Reques
|
||||
# An operation's verb: what follows is what it acts on.
|
||||
SUBJECT_RE = re.compile(r"^[A-Z][a-z]+")
|
||||
# The protocols whose requests RequestResources reads: form parameters or a JSON or CBOR body.
|
||||
READ_PROTOCOLS = {"json", "query", "ec2", "smithy-rpc-v2-cbor"}
|
||||
READ_PROTOCOLS = {"json", "query", "ec2", "smithy-rpc-v2-cbor", "rest-json"}
|
||||
BODY_LOCATIONS = (None, "")
|
||||
# Where a REST request carries a member outside its body, as the file writes it: a label of its path, `{Name}`, or a
|
||||
# parameter of its query, `?name`.
|
||||
LOCATED_RE = re.compile(r"^(\{[A-Za-z0-9_]+\}|\?[A-Za-z0-9_.-]+)$")
|
||||
|
||||
|
||||
def stem(name: str) -> str:
|
||||
@@ -662,7 +678,7 @@ def request_members(models: dict[str, dict], operation: str) -> dict[str, str]:
|
||||
continue
|
||||
root = model["shapes"][spec["input"]["shape"]]
|
||||
for name, member in root.get("members", {}).items():
|
||||
if member.get("location") not in BODY_LOCATIONS:
|
||||
if member.get("location") not in BODY_LOCATIONS and _located(member) is None:
|
||||
continue
|
||||
shape = model["shapes"][member["shape"]]
|
||||
if _strings(model, shape) is not None:
|
||||
@@ -672,6 +688,34 @@ def request_members(models: dict[str, dict], operation: str) -> dict[str, str]:
|
||||
return found
|
||||
|
||||
|
||||
def located_members(models: dict[str, dict], operation: str) -> dict[str, str]:
|
||||
"""The members of a REST request that its path or its query carries, holding a string, by name, with where:
|
||||
`{Label}` for a label of its path, `?name` for a parameter of its query. The reader lays them over the request's
|
||||
body under their names, so a resource reads them as it reads a member of the body."""
|
||||
found: dict[str, str] = {}
|
||||
for client, model in sorted(models.items()):
|
||||
spec = model["operations"].get(operation)
|
||||
if spec is None or "input" not in spec or "rest-json" not in _protocols(model):
|
||||
continue
|
||||
for name, member in model["shapes"][spec["input"]["shape"]].get("members", {}).items():
|
||||
where = _located(member)
|
||||
if where is None or _strings(model, model["shapes"][member["shape"]]) != "":
|
||||
continue
|
||||
if found.setdefault(name, where) != where:
|
||||
raise ValueError(f"{operation}'s {name} is {found[name]} in one client and {where} in {client}")
|
||||
return dict(sorted(found.items()))
|
||||
|
||||
|
||||
def _located(member: dict) -> str | None:
|
||||
"""Where a REST request carries a member outside its body, as `located_members` writes it; None for its body or a
|
||||
header."""
|
||||
if member.get("location") == "uri":
|
||||
return "{" + member.get("locationName", "") + "}"
|
||||
if member.get("location") == "querystring":
|
||||
return "?" + member.get("locationName", "")
|
||||
return None
|
||||
|
||||
|
||||
def _strings(model: dict, shape: dict) -> str | None:
|
||||
"""How a path reads a shape that holds a string (``) or a list of strings (`[]`); None for another."""
|
||||
if shape["type"] == "string":
|
||||
@@ -980,9 +1024,24 @@ def entry_for(operation: str, upstream: dict, formats: dict[str, str], models: d
|
||||
creates = creates_for(operation, types, formats, members)
|
||||
if creates:
|
||||
entry["creates"] = creates
|
||||
named = _named(resources) | _named(creates)
|
||||
located = {member: where for member, where in located_members(models, operation.split(":", 1)[1]).items()
|
||||
if member in named}
|
||||
if located:
|
||||
entry["located"] = located
|
||||
return entry
|
||||
|
||||
|
||||
def _named(value: object) -> set[str]:
|
||||
"""The member names an operation's resources read: every key and string they hold, each up to its first `[` or
|
||||
`.`, a superset that keeps `located` to the members something reads."""
|
||||
if isinstance(value, dict):
|
||||
return set().union(*(_named(key) | _named(item) for key, item in value.items())) if value else set()
|
||||
if isinstance(value, list):
|
||||
return set().union(*(_named(item) for item in value)) if value else set()
|
||||
return {re.split(r"[\[.]", value, maxsplit=1)[0]} if isinstance(value, str) else set()
|
||||
|
||||
|
||||
def with_found(resources: list[dict], namespace: str, types: list[str], members: dict[str, str]) -> list[dict]:
|
||||
"""The resources, a `FOUND_BY` type the action acts on named by the members its service finds it by, when the
|
||||
request has them all, rather than by any it fills: its variables are an id the request does not give."""
|
||||
@@ -1006,8 +1065,48 @@ def with_through(resources: list[dict], namespace: str, types: list[str], member
|
||||
return resources + through
|
||||
|
||||
|
||||
def rest_operations(data: Path) -> dict[str, set[str]]:
|
||||
"""The operation names of each botocore model whose REST routes Floci reads under a namespace the file reads."""
|
||||
return {client: set(model["operations"])
|
||||
for client, model in load_models(data, {client for client, namespace in REST_MODELS.items()
|
||||
if namespace in NAMESPACES}).items()}
|
||||
|
||||
|
||||
def with_rest_operations(upstream: dict[str, dict], documents: list[dict],
|
||||
given: dict[str, set[str]]) -> dict[str, dict]:
|
||||
"""`upstream` with the operations of the models Floci reads REST routes for (`regen_rest_routes.MODELS`), each
|
||||
given as its operation names: an operation the reference lists gets the model among its clients, and one it lists
|
||||
for none of them is checked as the action of its own name, or the one the reference maps it to, with that
|
||||
action's resource types, when the reference has that action; one it does not have is left out, so `--verify`
|
||||
reports a vendored one as no longer listed. The reference lists the operations of one client of a namespace:
|
||||
OpenSearch Service's are the `es` client's alone, while the `opensearch` client's are named after `es` actions all
|
||||
the same."""
|
||||
mapped = authorized_actions_from(documents)
|
||||
actions = {document["Name"]: {action["Name"].lower(): action for action in document.get("Actions", [])}
|
||||
for document in documents}
|
||||
found = dict(upstream)
|
||||
for client, names in sorted(given.items()):
|
||||
namespace = REST_MODELS[client]
|
||||
for name in sorted(names):
|
||||
operation = f"{namespace}:{name}"
|
||||
if operation in found:
|
||||
if client not in found[operation]["clients"]:
|
||||
found[operation] = {**found[operation], "clients": sorted(found[operation]["clients"] + [client])}
|
||||
continue
|
||||
action_name = mapped.get(namespace, {}).get(name, operation).split(":", 1)[1]
|
||||
action = actions.get(namespace, {}).get(action_name.lower())
|
||||
if action is None:
|
||||
continue
|
||||
found[operation] = {
|
||||
"action": f"{namespace}:{action['Name']}",
|
||||
"types": [resource["Name"] for resource in action.get("Resources") or []],
|
||||
"clients": [client],
|
||||
}
|
||||
return found
|
||||
|
||||
|
||||
def build(documents: list[dict], provenance: str, data: Path, botocore: str) -> dict:
|
||||
upstream = checked_actions(documents)
|
||||
upstream = with_rest_operations(checked_actions(documents), documents, rest_operations(data))
|
||||
covered = {operation: value for operation, value in upstream.items() if reads(operation)}
|
||||
_check_overrides(covered)
|
||||
read_namespaces = set(NAMESPACES) | {namespace_of(operation) for operation in covered}
|
||||
@@ -1182,7 +1281,7 @@ def validate(document: dict) -> list[str]:
|
||||
if not OPERATION_RE.match(operation) or namespace not in namespaces:
|
||||
problems.append(f"{operation!r} is not an operation of a namespace the file reads")
|
||||
continue
|
||||
if not isinstance(entry, dict) or not {"action", "types", "resources"} <= set(entry) <= {"action", "types", "resources", "creates"}:
|
||||
if not isinstance(entry, dict) or not {"action", "types", "resources"} <= set(entry) <= {"action", "types", "resources", "creates", "located"}:
|
||||
problems.append(f"{operation} is not an action, its types and its resources")
|
||||
continue
|
||||
if not isinstance(entry["action"], str) or not OPERATION_RE.match(entry["action"]) \
|
||||
@@ -1196,6 +1295,12 @@ def validate(document: dict) -> list[str]:
|
||||
problems += _resource_problems(operation, resource, set(types), formats.get(namespace, {}))
|
||||
for created in entry.get("creates", []) if isinstance(entry.get("creates", []), list) else [None]:
|
||||
problems += _created_problems(operation, created, set(types), formats.get(namespace, {}))
|
||||
located = entry.get("located", {})
|
||||
if not isinstance(located, dict) or not located and "located" in entry or not all(
|
||||
isinstance(member, str) and PATH_RE.match(member) and isinstance(where, str) and LOCATED_RE.match(where)
|
||||
for member, where in located.items()):
|
||||
problems.append(f"{operation} does not give each member it locates a label of its path or a parameter of "
|
||||
f"its query")
|
||||
return problems
|
||||
|
||||
|
||||
@@ -1375,7 +1480,11 @@ def main(argv: list[str] | None = None) -> int:
|
||||
return 0
|
||||
try:
|
||||
documents, provenance = fetch_references(args.source_dir)
|
||||
upstream = checked_actions(documents)
|
||||
listed = checked_actions(documents)
|
||||
upstream = with_rest_operations(listed, documents, {
|
||||
client: {operation.split(":", 1)[1] for operation in document["operations"]
|
||||
if namespace_of(operation) == namespace and operation not in listed}
|
||||
for client, namespace in REST_MODELS.items() if client in document["namespaces"].get(namespace, [])})
|
||||
formats = arn_formats(documents, set(document["namespaces"]))
|
||||
except (OSError, ValueError) as e:
|
||||
print(f"error: could not read the Service Reference ({e})", file=sys.stderr)
|
||||
|
||||
@@ -761,3 +761,99 @@ def test_measured_callback_correction_retains_action_metadata_and_rejects_unlist
|
||||
assert r._resource_problems("states:SendTaskSuccess", {**resource, "find": ["otherToken"]}, [], formats)
|
||||
assert r._resource_problems("states:OtherOperation", resource, [], formats)
|
||||
assert r._resource_problems("states:SendTaskSuccess", resource, [], {})
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------- #
|
||||
# REST requests: members in the path and the query, and the REST models' operations
|
||||
# --------------------------------------------------------------------------- #
|
||||
def rest_model(operations: dict[str, dict[str, str]], located: dict[str, dict[str, str]]) -> dict:
|
||||
"""A rest-json model whose operations take the members given, `located` giving a member's `location` and
|
||||
`locationName` as `uri:Name` or `querystring:name`."""
|
||||
built = model(operations, protocol="rest-json")
|
||||
for operation, members in located.items():
|
||||
for member, where in members.items():
|
||||
location, name = where.split(":", 1)
|
||||
built["shapes"][operation + "In"]["members"][member].update(location=location, locationName=name)
|
||||
return built
|
||||
|
||||
|
||||
def test_a_rest_request_reads_its_path_and_query_members_and_records_where_the_ones_it_reads_are(corrections, tmp_path):
|
||||
svc = rest_model({"GetThing": {"ThingName": "String", "Marker": "String"}, "ListThings": {"Marker": "String"}},
|
||||
{"GetThing": {"ThingName": "uri:Name", "Marker": "querystring:marker"},
|
||||
"ListThings": {"Marker": "querystring:marker"}})
|
||||
write_models(tmp_path, {"svc": svc})
|
||||
document = r.build(DOCUMENTS, "test", tmp_path, "botocore test")
|
||||
assert document["operations"]["svc:GetThing"] == {
|
||||
"action": "svc:GetThing", "types": ["thing"], "resources": [{"type": "thing", "fill": {"ThingName": "ThingName"}}],
|
||||
"located": {"ThingName": "{Name}"}}
|
||||
assert "located" not in document["operations"]["svc:ListThings"]
|
||||
assert r.validate(document) == []
|
||||
assert r.derive(document, tmp_path) == []
|
||||
|
||||
|
||||
def test_a_member_two_clients_locate_apart_is_an_error():
|
||||
one = rest_model({"GetThing": {"ThingName": "String"}}, {"GetThing": {"ThingName": "uri:ThingName"}})
|
||||
two = rest_model({"GetThing": {"ThingName": "String"}}, {"GetThing": {"ThingName": "querystring:thing"}})
|
||||
with pytest.raises(ValueError, match="GetThing's ThingName is"):
|
||||
r.located_members({"one": one, "two": two}, "GetThing")
|
||||
|
||||
|
||||
def test_a_located_member_must_be_a_path_label_or_a_query_parameter(corrections, tmp_path):
|
||||
write_models(tmp_path, {"svc": rest_model({"GetThing": {"ThingName": "String"}, "ListThings": {}},
|
||||
{"GetThing": {"ThingName": "uri:ThingName"}})})
|
||||
document = r.build(DOCUMENTS, "test", tmp_path, "botocore test")
|
||||
document["operations"]["svc:GetThing"]["located"] = {"ThingName": "header:x"}
|
||||
assert any("does not give each member it locates" in problem for problem in r.validate(document))
|
||||
|
||||
|
||||
SPLIT = [reference("svc", {"GetThing": ["thing"], "ListThings": []}, {"thing": FORMATS["thing"]}),
|
||||
reference("other", {"Op": ["x"]}, {"x": "arn:${Partition}:other:::x"}),
|
||||
reference("later", {"Op": ["y"]}, {"y": "arn:${Partition}:later:::y"})]
|
||||
# The reference lists svc's operations for its first client alone: DescribeThing is an action with no operation.
|
||||
SPLIT[0]["Actions"].append({"Name": "DescribeThing", "Resources": [{"Name": "thing"}]})
|
||||
|
||||
|
||||
def test_a_rest_models_operations_the_reference_lists_for_no_client_take_their_own_actions(corrections):
|
||||
corrections.setattr(r, "REST_MODELS", {"svc-v2": "svc"})
|
||||
found = r.with_rest_operations(r.checked_actions(SPLIT), SPLIT, {"svc-v2": {"GetThing", "DescribeThing", "Gone"}})
|
||||
assert found["svc:GetThing"]["clients"] == ["svc", "svc-v2"]
|
||||
assert found["svc:DescribeThing"] == {"action": "svc:DescribeThing", "types": ["thing"], "clients": ["svc-v2"]}
|
||||
# An operation whose action the reference does not have is left out, not given no types.
|
||||
assert "svc:Gone" not in found
|
||||
|
||||
|
||||
def test_a_namespace_reads_the_operations_of_the_rest_models_floci_routes_under_it(corrections, tmp_path):
|
||||
corrections.setattr(r, "REST_MODELS", {"svc-v2": "svc"})
|
||||
write_models(tmp_path, {"svc": model({"GetThing": {"ThingName": "String"}, "ListThings": {}}),
|
||||
"svc-v2": rest_model({"DescribeThing": {"ThingName": "String"}},
|
||||
{"DescribeThing": {"ThingName": "uri:ThingName"}})})
|
||||
sources = tmp_path / "reference"
|
||||
sources.mkdir()
|
||||
for document in SPLIT:
|
||||
(sources / f"{document['Name']}.json").write_text(json.dumps(document), encoding="utf-8")
|
||||
output = tmp_path / "table.json"
|
||||
assert r.main(["--source-dir", str(sources), "--botocore-data", str(tmp_path), "--output", str(output)]) == 0
|
||||
document = json.loads(output.read_text())
|
||||
assert document["namespaces"]["svc"] == ["svc", "svc-v2"]
|
||||
assert document["operations"]["svc:DescribeThing"] == {
|
||||
"action": "svc:DescribeThing", "types": ["thing"],
|
||||
"resources": [{"type": "thing", "fill": {"ThingName": "ThingName"}}], "located": {"ThingName": "{ThingName}"}}
|
||||
assert r.main(["--check", "--botocore-data", str(tmp_path), "--output", str(output)]) == 0
|
||||
assert r.main(["--verify", "--source-dir", str(sources), "--output", str(output)]) == 0
|
||||
|
||||
|
||||
def test_verify_reports_a_rest_models_operation_whose_action_aws_no_longer_has(corrections, tmp_path):
|
||||
corrections.setattr(r, "REST_MODELS", {"svc-v2": "svc"})
|
||||
write_models(tmp_path, {"svc": model({"GetThing": {"ThingName": "String"}, "ListThings": {}}),
|
||||
"svc-v2": rest_model({"DescribeThing": {"ThingName": "String"}},
|
||||
{"DescribeThing": {"ThingName": "uri:ThingName"}})})
|
||||
sources = tmp_path / "reference"
|
||||
sources.mkdir()
|
||||
for document in SPLIT:
|
||||
(sources / f"{document['Name']}.json").write_text(json.dumps(document), encoding="utf-8")
|
||||
output = tmp_path / "table.json"
|
||||
assert r.main(["--source-dir", str(sources), "--botocore-data", str(tmp_path), "--output", str(output)]) == 0
|
||||
gone = json.loads(json.dumps(SPLIT[0]))
|
||||
gone["Actions"] = [action for action in gone["Actions"] if action["Name"] != "DescribeThing"]
|
||||
(sources / "svc.json").write_text(json.dumps(gone), encoding="utf-8")
|
||||
assert r.main(["--verify", "--source-dir", str(sources), "--output", str(output)]) == 1
|
||||
Reference in new issue
Block a user