mirror of
https://github.com/floci-io/floci.git
synced 2026-11-22 21:50:46 -05:00
feat(ssm): generate the IAM request resources for SSM (#8203)
* feat(ssm): generate the IAM request resources for SSM * test(ssm): enforce IAM on parameter reads, deletes and tagging * refactor(ssm): derive the SSM request resources without corrections * fix(iam): read a Parameter Store name as its parameter's ARN holds it * fix(ssm): refuse tagging a resource type other than a parameter * test(ssm): read an unslashed parameter by its ARN under a grant on it * test(iam): expect ssm parameter in the vendored unqualified types * fix(ssm): keep tagging documents and associations * refactor(iam): drop the SSM operations read in the hand-built namespaces * chore(iam): resync Route 53 record set protection resource types
This commit is contained in:
1 parent
68a5f2a7f0
commit
39c29de635
14 files changed
+1021
-93
No files matched your search
@@ -44,6 +44,7 @@ public final class RequestResources {
|
||||
|
||||
private static final Pattern VARIABLE = Pattern.compile("\\$\\{(\\w+)}");
|
||||
private static final Pattern ACCOUNT_ID = Pattern.compile("\\d{12}");
|
||||
private static final String WITHOUT_LEADING_SLASH = "WithoutLeadingSlash";
|
||||
|
||||
/** Values for a type's variables, and the ARN whose account and Region the resource they name is in, if any. */
|
||||
private record Filling(Map<String, String> variables, AwsArnUtils.Arn from) {
|
||||
@@ -490,7 +491,9 @@ public final class RequestResources {
|
||||
* structure gives, the request's for a name (a {@code PutEvents} entry, on the bus it names). Each value is read
|
||||
* up to the resource's {@code before} character, when it has one (a CodeBuild build id's project), and without the
|
||||
* type's own path when it begins with one, as Route 53 returns its ids ({@code /hostedzone/Z1} names hosted zone
|
||||
* {@code Z1}). A type
|
||||
* {@code Z1}). A value filling a {@code ...WithoutLeadingSlash} variable is a Parameter Store name instead, read
|
||||
* as {@link #asVariable} reads it. A value rendered past a type's format, when its service checks the
|
||||
* type without a qualifier, is cut where the format ends, as an ARN given is. A type
|
||||
* whose service mints an id after its name is the caller's resource {@code stored} finds under that name, or
|
||||
* else has that id open.
|
||||
*/
|
||||
@@ -508,8 +511,10 @@ public final class RequestResources {
|
||||
boolean given = false;
|
||||
for (Map.Entry<String, RequestResourceMembers.Member> variable : resource.fill().entrySet()) {
|
||||
List<String> values = read(resource, form, body, variable.getValue()).stream()
|
||||
.map(value -> withoutTypePath(before(value, resource.before()), resource.types().getFirst()))
|
||||
.map(value -> asVariable(variable.getKey(), value))
|
||||
.map(value -> before(value, resource.before()))
|
||||
.map(value -> variable.getKey().endsWith(WITHOUT_LEADING_SLASH)
|
||||
? asVariable(variable.getKey(), value)
|
||||
: withoutTypePath(value, resource.types().getFirst()))
|
||||
.toList();
|
||||
if (values.isEmpty()) {
|
||||
continue;
|
||||
@@ -543,13 +548,14 @@ public final class RequestResources {
|
||||
for (Filling filling : fillings) {
|
||||
AwsArnUtils.Arn from = filling.from();
|
||||
if (from == null) {
|
||||
arns.add(withId(render(format.format(), filling.variables(), partition, region, account), format,
|
||||
arns.add(withId(format.checked(render(format.format(), filling.variables(), partition, region,
|
||||
account)), format,
|
||||
resource.types().getFirst(), filling.variables(), account.equals(accountId) ? stored : null,
|
||||
region));
|
||||
} else {
|
||||
addNamed(arns, withId(render(format.format(), filling.variables(), from.partition(),
|
||||
addNamed(arns, withId(format.checked(render(format.format(), filling.variables(), from.partition(),
|
||||
from.region().isEmpty() ? region : from.region(),
|
||||
from.accountId().isEmpty() ? accountId : from.accountId()), format,
|
||||
from.accountId().isEmpty() ? accountId : from.accountId())), format,
|
||||
resource.types().getFirst(), filling.variables(), null, region), format.awsOwned(), partition,
|
||||
region, accountId, null);
|
||||
}
|
||||
@@ -557,11 +563,17 @@ public final class RequestResources {
|
||||
}
|
||||
|
||||
/**
|
||||
* The value as the variable takes it: without the leading {@code /} a variable named for leaving it out drops,
|
||||
* as an SSM parameter's ARN names {@code /team/x} as {@code parameter/team/x}.
|
||||
* The value as the variable takes it: a variable named for leaving out the leading {@code /} takes a Parameter
|
||||
* Store name without the whitespace around it, which a put drops, and without one leading {@code /}, as an SSM
|
||||
* parameter's ARN names {@code /team/x} as {@code parameter/team/x}. A name of two leading slashes keeps the
|
||||
* second, and a name beginning {@code /parameter/} keeps that, being no type path.
|
||||
*/
|
||||
static String asVariable(String variable, String value) {
|
||||
return variable.endsWith("WithoutLeadingSlash") && value.startsWith("/") ? value.substring(1) : value;
|
||||
if (!variable.endsWith(WITHOUT_LEADING_SLASH)) {
|
||||
return value;
|
||||
}
|
||||
String name = value.strip();
|
||||
return name.startsWith("/") ? name.substring(1) : name;
|
||||
}
|
||||
|
||||
/** The value without a leading {@code /<type>/}, the path a service may return an id of that type under. */
|
||||
|
||||
@@ -89,10 +89,6 @@ public class ResourceArnBuilder {
|
||||
/** The route of Bedrock's resource-policy actions, which the ARN of the resource they act on may follow. */
|
||||
private static final String BEDROCK_RESOURCE_POLICY_ROUTE = "/resource-policy";
|
||||
|
||||
/** The SSM actions whose {@code ResourceArn} names the parameter they act on, in place of {@code Name}. */
|
||||
private static final Set<String> SSM_RESOURCE_POLICY_ACTIONS =
|
||||
Set.of("PutResourcePolicy", "GetResourcePolicies", "DeleteResourcePolicy");
|
||||
|
||||
private final ObjectMapper objectMapper;
|
||||
/**
|
||||
* Looked up lazily through a provider: this builder is constructed by the enforcement filter,
|
||||
@@ -232,7 +228,6 @@ public class ResourceArnBuilder {
|
||||
case "sns" -> List.of(buildSnsArn(ctx, region, accountId));
|
||||
case "dynamodb" -> buildDynamoDbArns(ctx, region, accountId);
|
||||
case "kinesis" -> List.of(buildKinesisArn(ctx, region, accountId));
|
||||
case "ssm" -> List.of(buildSsmArn(ctx, region, accountId));
|
||||
case "iam" -> buildIamArns(ctx, region, accountId);
|
||||
case "resource-groups" -> List.of(buildResourceGroupArn(ctx, region, accountId));
|
||||
case "scheduler" -> List.of(buildSchedulerArn(path, ctx, region, accountId, partition));
|
||||
@@ -1890,32 +1885,6 @@ public class ResourceArnBuilder {
|
||||
return new AwsArnUtils.Arn(partition, "secretsmanager", region, accountId, "secret:" + name).toString();
|
||||
}
|
||||
|
||||
// ── SSM ──────────────────────────────────────────────────────────────────────
|
||||
private String buildSsmArn(ContainerRequestContext ctx, String region, String accountId) {
|
||||
JsonNode json = readJsonBody(ctx);
|
||||
if (json != null && json.isObject()) {
|
||||
String operation = IamActionRegistry.targetOperation(ctx);
|
||||
if (operation != null && SSM_RESOURCE_POLICY_ACTIONS.contains(operation)
|
||||
&& json.hasNonNull("ResourceArn")) {
|
||||
String resourceArn = json.get("ResourceArn").asText().trim();
|
||||
if (AwsArnUtils.isArnFor(resourceArn, "ssm")) {
|
||||
return resourceArn;
|
||||
}
|
||||
}
|
||||
if (json.hasNonNull("Name")) {
|
||||
String name = json.get("Name").asText().trim();
|
||||
if (!name.isEmpty()) {
|
||||
if (AwsArnUtils.isArnFor(name, "ssm")) {
|
||||
return name;
|
||||
}
|
||||
String paramResource = name.startsWith("/") ? "parameter" + name : "parameter/" + name;
|
||||
return AwsArnUtils.Arn.of("ssm", region, accountId, paramResource).toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
return AwsArnUtils.Arn.of("ssm", region, accountId, "parameter/*").toString();
|
||||
}
|
||||
|
||||
// ── KMS ──────────────────────────────────────────────────────────────────────
|
||||
|
||||
/**
|
||||
|
||||
@@ -236,6 +236,9 @@ public class SsmJsonHandler {
|
||||
}
|
||||
|
||||
private Response handleGetParametersByPath(JsonNode request, String region) {
|
||||
if (!request.path("Path").isTextual()) {
|
||||
throw SmithyValidationErrors.validationException(SmithyValidationErrors.notNull("path"));
|
||||
}
|
||||
PageRequest pageRequest = pageRequest(request, GET_PARAMETERS_BY_PATH_MAX_RESULTS);
|
||||
String path = request.path("Path").asText();
|
||||
boolean recursive = request.path("Recursive").asBoolean(false);
|
||||
@@ -1202,12 +1205,14 @@ public class SsmJsonHandler {
|
||||
}
|
||||
|
||||
private Response handleAddTagsToResource(JsonNode request, String region) {
|
||||
requireTaggedResourceType(request);
|
||||
ssmService.addTagsToResource(request.path("ResourceType").asText(), request.path("ResourceId").asText(),
|
||||
requestTags(request), region);
|
||||
return Response.ok(objectMapper.createObjectNode()).build();
|
||||
}
|
||||
|
||||
private Response handleListTagsForResource(JsonNode request, String region) {
|
||||
requireTaggedResourceType(request);
|
||||
Map<String, String> tags = ssmService.listTagsForResource(request.path("ResourceType").asText(),
|
||||
request.path("ResourceId").asText(), region);
|
||||
ObjectNode response = objectMapper.createObjectNode();
|
||||
@@ -1216,6 +1221,7 @@ public class SsmJsonHandler {
|
||||
}
|
||||
|
||||
private Response handleRemoveTagsFromResource(JsonNode request, String region) {
|
||||
requireTaggedResourceType(request);
|
||||
List<String> tagKeys = new ArrayList<>();
|
||||
request.path("TagKeys").forEach(k -> tagKeys.add(k.asText()));
|
||||
ssmService.removeTagsFromResource(request.path("ResourceType").asText(), request.path("ResourceId").asText(),
|
||||
@@ -1236,6 +1242,29 @@ public class SsmJsonHandler {
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Refuses a tagging request whose {@code ResourceType} is missing, outside the model's enum, or a type whose tags
|
||||
* this service does not keep, so the request acts on the type IAM checked.
|
||||
*/
|
||||
private static void requireTaggedResourceType(JsonNode request) {
|
||||
JsonNode resourceType = request.path("ResourceType");
|
||||
if (!resourceType.isTextual()) {
|
||||
throw SmithyValidationErrors.validationException(SmithyValidationErrors.notNull("resourceType"));
|
||||
}
|
||||
if (!RESOURCE_TYPES_FOR_TAGGING.contains(resourceType.asText())) {
|
||||
throw SmithyValidationErrors.validationException(SmithyValidationErrors.notInEnum(resourceType.asText(),
|
||||
"resourceType", RESOURCE_TYPES_FOR_TAGGING));
|
||||
}
|
||||
if (!TAGGED_RESOURCE_TYPES.contains(resourceType.asText())) {
|
||||
throw new AwsException("InvalidResourceType", "The resource type isn't valid.", 400);
|
||||
}
|
||||
}
|
||||
|
||||
private static final List<String> RESOURCE_TYPES_FOR_TAGGING = List.of("Document", "ManagedInstance",
|
||||
"MaintenanceWindow", "Parameter", "PatchBaseline", "OpsItem", "OpsMetadata", "Automation", "Association",
|
||||
"CloudConnector");
|
||||
private static final Set<String> TAGGED_RESOURCE_TYPES = Set.of("Parameter", "Document", "Association");
|
||||
|
||||
private static final int GET_RESOURCE_POLICIES_MAX_RESULTS = 50;
|
||||
private static final String GET_RESOURCE_POLICIES_TOKEN = "GetResourcePolicies:";
|
||||
private static final String POLICY_PATTERN = "^(?!\\s*$).+";
|
||||
|
||||
@@ -15,6 +15,7 @@ import io.floci.aws.core.common.DeadlineCharSequence;
|
||||
import io.floci.aws.core.common.Digests;
|
||||
import io.floci.aws.core.common.RegionResolver;
|
||||
import io.floci.aws.core.common.SmithyValidationErrors;
|
||||
import io.floci.aws.core.common.StoredResourceArns;
|
||||
import io.floci.aws.core.resource.ExplorerResource;
|
||||
import io.floci.aws.core.resource.ResourceProvider;
|
||||
import io.floci.aws.core.resource.SupportedResourceType;
|
||||
@@ -51,7 +52,7 @@ import java.util.regex.Pattern;
|
||||
import java.util.regex.PatternSyntaxException;
|
||||
|
||||
@ApplicationScoped
|
||||
public class SsmService implements ResourceProvider {
|
||||
public class SsmService implements ResourceProvider, StoredResourceArns {
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(SsmService.class);
|
||||
|
||||
@@ -1123,7 +1124,7 @@ public class SsmService implements ResourceProvider {
|
||||
|
||||
/**
|
||||
* {@code AddTagsToResource} on the resource of {@code resourceType}: a document by its name, an
|
||||
* association by its ID, and a parameter, or any type Floci does not tag yet, as before.
|
||||
* association by its ID, and a parameter by its name or ARN.
|
||||
*/
|
||||
public synchronized void addTagsToResource(String resourceType, String resourceId, Map<String, String> tags,
|
||||
String region) {
|
||||
@@ -2023,4 +2024,25 @@ public class SsmService implements ResourceProvider {
|
||||
public Set<SupportedResourceType> getSupportedResourceTypes() {
|
||||
return Set.of(new SupportedResourceType("ssm:parameter", "ssm", true));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String namespace() {
|
||||
return "ssm";
|
||||
}
|
||||
|
||||
/**
|
||||
* The {@code parameter/<name>} ARN a legacy {@code parameter<name>} ARN of the caller's partition, Region and
|
||||
* account names, which the tagging operations act on as {@link #parameterTagName} reads it; empty for any other
|
||||
* value, whose ARN is the one its name renders.
|
||||
*/
|
||||
@Override
|
||||
public Optional<String> find(String type, List<String> names, String region) {
|
||||
if (!"parameter".equals(type) || names.size() != 1) {
|
||||
return Optional.empty();
|
||||
}
|
||||
String name = names.getFirst();
|
||||
String arn = withLegacyParameterSlash(name, regionResolver.partitionForRegion(region), region,
|
||||
regionResolver.getAccountId());
|
||||
return arn == null || arn.equals(name) ? Optional.empty() : Optional.of(arn);
|
||||
}
|
||||
}
|
||||
@@ -2,12 +2,12 @@
|
||||
"_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-13", "note": "make iam-request-resources-check re-derives every operation's resources from botocore; make iam-request-resources-verify checks every action, type and format against AWS."},
|
||||
"namespaces": {"access-analyzer": ["accessanalyzer"], "account": ["account"], "acm": ["acm"], "application-autoscaling": ["application-autoscaling"], "athena": ["athena"], "bcm-data-exports": ["bcm-data-exports"], "bcm-pricing-calculator": ["bcm-pricing-calculator"], "budgets": ["budgets"], "ce": ["ce"], "cloudfront": ["cloudfront"], "cloudfront-keyvaluestore": ["cloudfront-keyvaluestore"], "cloudtrail": ["cloudtrail"], "codebuild": ["codebuild"], "codepipeline": ["codepipeline"], "cognito-identity": ["cognito-identity"], "cognito-idp": ["cognito-idp"], "controlcatalog": ["controlcatalog"], "controltower": ["controltower"], "cur": ["cur"], "datasync": ["datasync"], "dynamodb": ["dynamodb"], "ec2": ["ec2"], "ecr": ["ecr"], "elasticloadbalancing": ["elb", "elbv2"], "elasticmapreduce": ["emr"], "emr-serverless": ["emr-serverless"], "es": ["es", "opensearch"], "events": ["eventbridgev2", "events"], "firehose": ["firehose"], "fis": ["fis"], "globalaccelerator": ["globalaccelerator"], "guardduty": ["guardduty"], "inspector2": ["inspector2"], "kinesisanalytics": ["kinesisanalyticsv2"], "logs": ["logs"], "macie2": ["macie2"], "oam": ["oam"], "payment-cryptography": ["payment-cryptography", "payment-cryptography-data"], "quicksight": ["quicksight"], "ram": ["ram"], "redshift": ["redshift"], "redshift-data": ["redshift-data"], "redshift-serverless": ["redshift-serverless"], "rekognition": ["rekognition"], "resource-explorer-2": ["resource-explorer-2"], "route53": ["route53"], "securityhub": ["securityhub"], "servicediscovery": ["servicediscovery"], "servicequotas": ["service-quotas"], "signer": ["signer", "signer-data"], "ssm": ["ssm"], "sso": ["sso", "sso-admin"], "states": ["stepfunctions"], "textract": ["textract"], "timestream-influxdb": ["timestream-influxdb"], "translate": ["translate"], "xray": ["xray"]},
|
||||
"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"},
|
||||
"handBuilt": ["apigateway", "bedrock", "dsql", "dynamodb", "eks", "iam", "kinesis", "kms", "lambda", "logs", "pipes", "resource-groups", "s3", "scheduler", "secretsmanager", "sns", "sqs", "ssm", "sts"],
|
||||
"handBuilt": ["apigateway", "bedrock", "dsql", "dynamodb", "eks", "iam", "kinesis", "kms", "lambda", "logs", "pipes", "resource-groups", "s3", "scheduler", "secretsmanager", "sns", "sqs", "sts"],
|
||||
"notCovered": {"airflow": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "app-integrations": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "appconfig": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "appsync": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "aps": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "autoscaling": "not read yet: AWS's group and launch configuration ARNs carry an id the service mints, `autoScalingGroup:<id>:autoScalingGroupName/<name>`, while Floci mints `autoScalingGroup:<name>`, which other services (ECS capacity providers) read back; the mint is fixed first", "aws-marketplace": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "backup": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "batch": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "bedrock-agentcore": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "cloudformation": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "cloudhsm": "not read yet: its ARN formats end in ${CloudHsmClusterInstanceName} and ${CloudHsmBackupInstanceName}, names, while its requests give ClusterId and BackupId, ids, which the 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 reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "codedeploy": "not read yet: the Service Reference gives an on-premises instance's ARN as `instance:${InstanceName}`, while the CodeDeploy permissions reference gives arn:aws:codedeploy:region:account-id:instance/instance-ID and AWS's GetOnPremisesInstance example answers instance/<name>_<id>, an id the service mints after the name; reading it needs that format corrected", "codeguru-reviewer": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "comprehend": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "config": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "connect": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "detective": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "dlm": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "dms": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "ec2-instance-connect": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "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 reaLine truncated
|
||||
"otherNamespaces": ["a4b", "account-access", "acm-pca", "aco-automation", "agent-registry", "aidevops", "aiops", "airflow-serverless", "amplify", "amplifybackend", "amplifyuibuilder", "aoss", "appfabric", "appflow", "application-signals", "application-signals-mcp", "appmesh", "appmesh-preview", "apprunner", "appstream", "apptest", "arc-region-switch", "arc-zonal-shift", "artifact", "assurance", "auditmanager", "aws-external-anthropic", "b2bi", "backup-gateway", "backup-search", "bedrock-mantle", "bedrock-websearch", "billing", "billingconductor", "braket", "bugbust", "cases", "cassandra", "chatbot", "chime", "cleanrooms", "cleanrooms-ml", "cloud9", "clouddirectory", "cloudsearch", "cloudshell", "cloudtrail-data", "codecatalyst", "codecommit", "codeconnections", "codeguru-profiler", "codeguru-security", "codestar-connections", "codestar-notifications", "codewhisperer", "cognito-sync", "connect-campaigns", "consoleapp", "continuum", "databrew", "dataexchange", "datapipeline", "datazone", "dax", "deadline", "devicefarm", "devops-guru", "directconnect", "docdb-elastic", "drs", "ds", "ds-data", "ebs", "ecr-public", "eks-auth", "elastictranscoder", "elemental-appliances-software", "elemental-inference", "elemental-support-cases", "emr-containers", "end-user-messaging", "entityresolution", "evs", "finspace", "finspace-api", "fms", "forecast", "frauddetector", "freertos", "fsx", "gamelift", "gameliftstreams", "geo", "geo-maps", "geo-places", "geo-routes", "glacier", "grafana", "greengrass", "groundstation", "health", "health-agent", "healthlake", "honeycode", "identity-sync", "imagebuilder", "interconnect", "internetmonitor", "invoicing", "iotanalytics", "iotdeviceadvisor", "iotfleethub", "iotfleetwise", "iotjobsdata", "iotmanagedintegrations", "iotsitewise", "iottwinmaker", "iotwireless", "iq", "iq-permission", "ivs", "ivschat", "kafka-cluster", "kafkaconnect", "kendra", "kendra-ranking", "kinesisvideo", "launchwizard", "lex", "license-manager", "license-manager-linux-subscriptions", "license-manager-user-subscriptions", "lookoutequipment", "lookoutmetrics", "lookoutvision", "m2", "machinelearning", "managedblockchain", "mapcredits", "mediaconnect", "mediaconvert", "medialive", "mediapackage", "mediapackage-vod", "mediapackagev2", "mediastore", "mediatailor", "medical-imaging", "mgh", "mgn", "migrationhub-orchestrator", "mobiletargeting", "monitron", "mpa", "neptune-db", "neptune-graph", "network-security-manager", "networkflowmonitor", "networkmanager", "networkmonitor", "nimble", "notifications", "notifications-contacts", "nova-act", "observabilityadmin", "odb", "omics", "one", "opensearch", "opsworks", "osis", "outposts", "panorama", "partnercentral", "payments", "pca-connector-ad", "pca-connector-scep", "pcs", "personalize", "pi", "polly", "private-networks", "profile", "proton", "purchase-orders", "q", "qapps", "qbusiness", "qdeveloper", "qldb", "rbin", "rds-db", "refactor-spaces", "repostspace", "resiliencehub", "robomaker", "rolesanywhere", "route53-recovery-cluster", "route53-recovery-control-config", "route53-recovery-readiness", "route53globalresolver", "route53profiles", "rtbfabric", "s3-object-lambda", "s3-outposts", "s3express", "s3files", "sagemaker-geospatial", "sagemaker-mlflow", "savingsplans", "schemas", "scn", "sdb", "security-ir", "securityagent", "securitylake", "serverlessrepo", "shield", "simspaceweaver", "sms-voice", "snow-device-management", "social-messaging", "sqlworkbench", "ssm-contacts", "ssm-incidents", "ssm-quicksetup", "ssm-sap", "ssmmessages", "storagegateway", "supportauthz", "synthetics", "thinclient", "timestream", "tnb", "transform", "transform-custom", "trustedadvisor", "ts", "vendor-insights", "voiceid", "vpc-lattice", "vpc-lattice-svcs", "vpce", "waf", "waf-regional", "wellarchitected", "wickr", "wisdom", "workdocs", "worklink", "workmail", "workmailmessageflow", "workspaces", "workspaces-instances", "workspaces-web"],
|
||||
"arnFormats": {"access-analyzer": {"Analyzer": "arn:${Partition}:access-analyzer:${Region}:${Account}:analyzer/${AnalyzerName}", "ArchiveRule": "arn:${Partition}:access-analyzer:${Region}:${Account}:analyzer/${AnalyzerName}/archive-rule/${RuleName}"}, "account": {"account": "arn:${Partition}:account::${Account}:account", "accountInOrganization": "arn:${Partition}:account::${ManagementAccountId}:account/o-${OrganizationId}/${MemberAccountId}"}, "acm": {"acme-domain-validation": "arn:${Partition}:acm:${Region}:${Account}:acme-endpoint/${AcmeEndpointId}/acme-domain-validation/${AcmeDomainValidationId}", "acme-endpoint": "arn:${Partition}:acm:${Region}:${Account}:acme-endpoint/${AcmeEndpointId}", "acme-external-account-binding": "arn:${Partition}:acm:${Region}:${Account}:acme-endpoint/${AcmeEndpointId}/acme-external-account-binding/${ExternalAccountBindingId}", "certificate": "arn:${Partition}:acm:${Region}:${Account}:certificate/${CertificateId}"}, "application-autoscaling": {"ScalableTarget": "arn:${Partition}:application-autoscaling:${Region}:${Account}:scalable-target/${ResourceId}"}, "athena": {"capacity-reservation": "arn:${Partition}:athena:${Region}:${Account}:capacity-reservation/${CapacityReservationName}", "datacatalog": "arn:${Partition}:athena:${Region}:${Account}:datacatalog/${DataCatalogName}", "session": "arn:${Partition}:athena:${Region}:${Account}:workgroup/${WorkGroupName}/session/${SessionId}", "system-table": "arn:${Partition}:athena:${Region}:${Account}:system-table/${TableName}", "workgroup": "arn:${Partition}:athena:${Region}:${Account}:workgroup/${WorkGroupName}"}, "bcm-data-exports": {"billingview": "arn:${Partition}:billing::${Account}:billingview/${ResourceId}", "export": "arn:${Partition}:bcm-data-exports:${Region}:${Account}:export/${Identifier}", "table": "arn:${Partition}:bcm-data-exports:${Region}:${Account}:table/${Identifier}"}, "bcm-pricing-calculator": {"bill-estimate": "arn:${Partition}:bcm-pricing-calculator::${Account}:bill-estimate/${BillEstimateId}", "bill-scenario": "arn:${Partition}:bcm-pricing-calculator::${Account}:bill-scenario/${BillScenarioId}", "workload-estimate": "arn:${Partition}:bcm-pricing-calculator::${Account}:workload-estimate/${WorkloadEstimateId}"}, "budgets": {"budget": "arn:${Partition}:budgets::${Account}:budget/${BudgetName}", "budgetAction": "arn:${Partition}:budgets::${Account}:budget/${BudgetName}/action/${ActionId}"}, "ce": {"anomalymonitor": "arn:${Partition}:ce::${Account}:anomalymonitor/${Identifier}", "anomalysubscription": "arn:${Partition}:ce::${Account}:anomalysubscription/${Identifier}", "billingview": "arn:${Partition}:billing::${Account}:billingview/${ResourceId}", "costcategory": "arn:${Partition}:ce::${Account}:costcategory/${Identifier}"}, "cloudfront": {"anycast-ip-list": "arn:${Partition}:cloudfront::${Account}:anycast-ip-list/${Id}", "cache-policy": "arn:${Partition}:cloudfront::${Account}:cache-policy/${Id}", "connection-function": "arn:${Partition}:cloudfront::${Account}:connection-function/${Id}", "connection-group": "arn:${Partition}:cloudfront::${Account}:connection-group/${Id}", "continuous-deployment-policy": "arn:${Partition}:cloudfront::${Account}:continuous-deployment-policy/${Id}", "distribution": "arn:${Partition}:cloudfront::${Account}:distribution/${DistributionId}", "distribution-tenant": "arn:${Partition}:cloudfront::${Account}:distribution-tenant/${Id}", "field-level-encryption-config": "arn:${Partition}:cloudfront::${Account}:field-level-encryption-config/${Id}", "field-level-encryption-profile": "arn:${Partition}:cloudfront::${Account}:field-level-encryption-profile/${Id}", "function": "arn:${Partition}:cloudfront::${Account}:function/${Name}", "key-value-store": "arn:${Partition}:cloudfront::${Account}:key-value-store/${Name}", "origin-access-control": "arn:${Partition}:cloudfront::${Account}:origin-access-control/${Id}", "origin-access-identity": "arn:${Partition}:cloudfront::${Account}:origin-access-identity/${Id}", "origin-request-policy": "arn:${Partition}:cloudfront::${Account}:origin-request-policy/${Id}", "realtime-log-config": "arn:${Partition}:cloudfront::${Account}:realtime-log-config/${Name}", "response-headers-policy": "arn:${Partition}:cloudfront::${Account}:response-headers-policy/${Id}", "streaming-distribution": "arn:${Partition}:cloudfront::${Account}:streaming-distribution/${DistributionId}", "trust-store": "arn:${Partition}:cloudfront::${Account}:trust-store/${Id}", "vpcorigin": "arn:${Partition}:cloudfront::${Account}:vpcorigin/${Id}"}, "cloudfront-keyvaluestore": {"key-value-store": "arn:${Partition}:cloudfront::${Account}:key-value-store/${ResourceId}"}, "cloudtrail": {"channel": "arn:${Partition}:cloudtrail:${Region}:${Account}:channel/${ChannelId}", "dashboard": "arn:${Partition}:cloudtrail:${Region}:${Account}:dashboard/${DashboardName}", "eventdatastore": "arn:${Partition}:cloudtrail:${Region}:${Account}:eventdatastore/${EventDataStoreId}", "trail": "arn:${Partition}:cloudtrail:${Line truncated
|
||||
"resourceTagKeys": {"ec2": {"instance": ["aws:ResourceTag/", "ec2:ResourceTag/"]}},
|
||||
"unqualified": {"states": ["statemachine"]},
|
||||
"unqualified": {"ssm": ["parameter"], "states": ["statemachine"]},
|
||||
"mintedIds": {"events": ["api-destination", "connection"]},
|
||||
"operations": {
|
||||
"access-analyzer:ApplyArchiveRule": {"action": "access-analyzer:ApplyArchiveRule", "types": ["Analyzer"], "resources": [{"types": ["Analyzer"], "arn": "analyzerArn"}]},
|
||||
@@ -3294,7 +3294,7 @@
|
||||
"route53:CreateHostedZone": {"action": "route53:CreateHostedZone", "types": [], "resources": [], "makes": [{"type": "hostedzone", "fill": {}}]},
|
||||
"route53:CreateKeySigningKey": {"action": "route53:CreateKeySigningKey", "types": ["hostedzone"], "resources": []},
|
||||
"route53:CreateQueryLoggingConfig": {"action": "route53:CreateQueryLoggingConfig", "types": ["hostedzone"], "resources": []},
|
||||
"route53:CreateResourceRecordSetProtections": {"action": "route53:CreateResourceRecordSetProtections", "types": [], "resources": []},
|
||||
"route53:CreateResourceRecordSetProtections": {"action": "route53:CreateResourceRecordSetProtections", "types": ["hostedzone"], "resources": []},
|
||||
"route53:CreateReusableDelegationSet": {"action": "route53:CreateReusableDelegationSet", "types": [], "resources": [], "makes": [{"type": "delegationset", "fill": {}}]},
|
||||
"route53:CreateTrafficPolicy": {"action": "route53:CreateTrafficPolicy", "types": [], "resources": [], "makes": [{"type": "trafficpolicy", "fill": {}}]},
|
||||
"route53:CreateTrafficPolicyInstance": {"action": "route53:CreateTrafficPolicyInstance", "types": ["hostedzone", "trafficpolicy"], "resources": []},
|
||||
@@ -3306,7 +3306,7 @@
|
||||
"route53:DeleteHostedZone": {"action": "route53:DeleteHostedZone", "types": ["hostedzone"], "resources": [{"type": "hostedzone", "fill": {"Id": "Id"}}], "located": {"Id": "{Id}"}},
|
||||
"route53:DeleteKeySigningKey": {"action": "route53:DeleteKeySigningKey", "types": ["hostedzone"], "resources": [{"type": "hostedzone", "fill": {"Id": "HostedZoneId"}}], "located": {"HostedZoneId": "{HostedZoneId}"}},
|
||||
"route53:DeleteQueryLoggingConfig": {"action": "route53:DeleteQueryLoggingConfig", "types": ["queryloggingconfig"], "resources": [{"type": "queryloggingconfig", "fill": {"Id": "Id"}}], "located": {"Id": "{Id}"}},
|
||||
"route53:DeleteResourceRecordSetProtections": {"action": "route53:DeleteResourceRecordSetProtections", "types": [], "resources": []},
|
||||
"route53:DeleteResourceRecordSetProtections": {"action": "route53:DeleteResourceRecordSetProtections", "types": ["hostedzone"], "resources": []},
|
||||
"route53:DeleteReusableDelegationSet": {"action": "route53:DeleteReusableDelegationSet", "types": ["delegationset"], "resources": [{"type": "delegationset", "fill": {"Id": "Id"}}], "located": {"Id": "{Id}"}},
|
||||
"route53:DeleteTrafficPolicy": {"action": "route53:DeleteTrafficPolicy", "types": ["trafficpolicy"], "resources": [{"type": "trafficpolicy", "fill": {"Id": "Id"}}], "located": {"Id": "{Id}"}},
|
||||
"route53:DeleteTrafficPolicyInstance": {"action": "route53:DeleteTrafficPolicyInstance", "types": ["trafficpolicyinstance"], "resources": [{"type": "trafficpolicyinstance", "fill": {"Id": "Id"}}], "located": {"Id": "{Id}"}},
|
||||
@@ -3341,7 +3341,7 @@
|
||||
"route53:ListHostedZonesByName": {"action": "route53:ListHostedZonesByName", "types": [], "resources": []},
|
||||
"route53:ListHostedZonesByVPC": {"action": "route53:ListHostedZonesByVPC", "types": [], "resources": []},
|
||||
"route53:ListQueryLoggingConfigs": {"action": "route53:ListQueryLoggingConfigs", "types": ["hostedzone"], "resources": [{"type": "hostedzone", "fill": {"Id": "HostedZoneId"}}], "located": {"HostedZoneId": "?hostedzoneid"}},
|
||||
"route53:ListResourceRecordSetProtections": {"action": "route53:ListResourceRecordSetProtections", "types": [], "resources": []},
|
||||
"route53:ListResourceRecordSetProtections": {"action": "route53:ListResourceRecordSetProtections", "types": ["hostedzone"], "resources": []},
|
||||
"route53:ListResourceRecordSets": {"action": "route53:ListResourceRecordSets", "types": ["hostedzone"], "resources": [{"type": "hostedzone", "fill": {"Id": "HostedZoneId"}}], "located": {"HostedZoneId": "{Id}"}},
|
||||
"route53:ListReusableDelegationSets": {"action": "route53:ListReusableDelegationSets", "types": [], "resources": []},
|
||||
"route53:ListTagsForResource": {"action": "route53:ListTagsForResource", "types": ["healthcheck", "hostedzone"], "resources": [{"type": "healthcheck", "fill": {"Id": "ResourceId"}, "when": {"ResourceType": ["healthcheck"]}}, {"type": "hostedzone", "fill": {"Id": "ResourceId"}, "when": {"ResourceType": ["hostedzone"]}}], "located": {"ResourceId": "{ResourceId}", "ResourceType": "{ResourceType}"}},
|
||||
@@ -3560,10 +3560,159 @@
|
||||
"signer:TagResource": {"action": "signer:TagResource", "types": ["signing-profile"], "resources": [{"types": ["signing-profile"], "arn": "resourceArn"}], "located": {"resourceArn": "{resourceArn}"}},
|
||||
"signer:UntagResource": {"action": "signer:UntagResource", "types": ["signing-profile"], "resources": [{"types": ["signing-profile"], "arn": "resourceArn"}], "located": {"resourceArn": "{resourceArn}"}},
|
||||
"ssm:AddTagsToResource": {"action": "ssm:AddTagsToResource", "types": ["association", "automation-execution", "cloud-connector", "document", "instance", "maintenancewindow", "managed-instance", "opsitem", "opsmetadata", "parameter", "patchbaseline", "task"], "resources": [{"type": "association", "fill": {"AssociationId": "ResourceId"}, "when": {"ResourceType": ["Association"]}}, {"type": "cloud-connector", "fill": {"CloudConnectorId": "ResourceId"}, "when": {"ResourceType": ["CloudConnector"]}}, {"type": "document", "fill": {"DocumentName": "ResourceId"}, "when": {"ResourceType": ["Document"]}}, {"type": "maintenancewindow", "fill": {"ResourceId": "ResourceId"}, "when": {"ResourceType": ["MaintenanceWindow"]}}, {"type": "managed-instance", "fill": {"InstanceId": "ResourceId"}, "when": {"ResourceType": ["ManagedInstance"]}}, {"type": "opsitem", "fill": {"ResourceId": "ResourceId"}, "when": {"ResourceType": ["OpsItem"]}}, {"type": "opsmetadata", "fill": {"ResourceId": "ResourceId"}, "when": {"ResourceType": ["OpsMetadata"]}}, {"type": "parameter", "fill": {"ParameterNameWithoutLeadingSlash": "ResourceId"}, "when": {"ResourceType": ["Parameter"]}}, {"type": "patchbaseline", "fill": {"PatchBaselineIdResourceId": "ResourceId"}, "when": {"ResourceType": ["PatchBaseline"]}}]},
|
||||
"ssm:CreateAssociation": {"action": "ssm:CreateAssociation", "types": ["association", "document", "instance", "managed-instance"], "resources": [{"type": "association", "fill": {}}]},
|
||||
"ssm:AssociateOpsItemRelatedItem": {"action": "ssm:AssociateOpsItemRelatedItem", "types": ["opsitem"], "resources": [{"type": "opsitem", "fill": {"ResourceId": "OpsItemId"}}]},
|
||||
"ssm:CancelCommand": {"action": "ssm:CancelCommand", "types": [], "resources": []},
|
||||
"ssm:CancelMaintenanceWindowExecution": {"action": "ssm:CancelMaintenanceWindowExecution", "types": ["maintenancewindow"], "resources": []},
|
||||
"ssm:CreateActivation": {"action": "ssm:CreateActivation", "types": [], "resources": []},
|
||||
"ssm:CreateAssociation": {"action": "ssm:CreateAssociation", "types": ["association", "document", "instance", "managed-instance"], "resources": [{"type": "association", "fill": {}, "made": true}, {"type": "document", "fill": {"DocumentName": "Name"}}]},
|
||||
"ssm:CreateAssociationBatch": {"action": "ssm:CreateAssociationBatch", "types": ["document", "instance", "managed-instance"], "resources": []},
|
||||
"ssm:CreateCloudConnector": {"action": "ssm:CreateCloudConnector", "types": ["cloud-connector"], "resources": [{"types": ["cloud-connector"], "arn": "ConfigConnectorArn"}, {"types": ["cloud-connector"], "arn": "RoleArn"}, {"type": "cloud-connector", "fill": {}}]},
|
||||
"ssm:CreateDocument": {"action": "ssm:CreateDocument", "types": ["document"], "resources": [{"type": "document", "fill": {"DocumentName": "Name"}}]},
|
||||
"ssm:CreateMaintenanceWindow": {"action": "ssm:CreateMaintenanceWindow", "types": [], "resources": [], "makes": [{"type": "maintenancewindow", "fill": {}}]},
|
||||
"ssm:CreateOpsItem": {"action": "ssm:CreateOpsItem", "types": [], "resources": [], "makes": [{"type": "opsitem", "fill": {"ResourceId": "Source"}}]},
|
||||
"ssm:CreateOpsMetadata": {"action": "ssm:CreateOpsMetadata", "types": [], "resources": [], "makes": [{"type": "opsmetadata", "fill": {"ResourceId": "ResourceId"}}]},
|
||||
"ssm:CreatePatchBaseline": {"action": "ssm:CreatePatchBaseline", "types": [], "resources": [], "makes": [{"type": "patchbaseline", "fill": {}}]},
|
||||
"ssm:CreateResourceDataSync": {"action": "ssm:CreateResourceDataSync", "types": ["resourcedatasync"], "resources": [{"types": ["resourcedatasync"], "arn": "S3Destination.AWSKMSKeyARN"}, {"type": "resourcedatasync", "fill": {"SyncName": "SyncName"}}]},
|
||||
"ssm:DeleteActivation": {"action": "ssm:DeleteActivation", "types": [], "resources": []},
|
||||
"ssm:DeleteAssociation": {"action": "ssm:DeleteAssociation", "types": ["association"], "resources": [{"type": "association", "fill": {"AssociationId": "AssociationId"}}]},
|
||||
"ssm:DeleteCloudConnector": {"action": "ssm:DeleteCloudConnector", "types": ["cloud-connector"], "resources": [{"type": "cloud-connector", "fill": {"CloudConnectorId": "CloudConnectorId"}}]},
|
||||
"ssm:DeleteDocument": {"action": "ssm:DeleteDocument", "types": ["document"], "resources": [{"type": "document", "fill": {"DocumentName": "Name"}}]},
|
||||
"ssm:DeleteInventory": {"action": "ssm:DeleteInventory", "types": [], "resources": []},
|
||||
"ssm:DeleteMaintenanceWindow": {"action": "ssm:DeleteMaintenanceWindow", "types": ["maintenancewindow"], "resources": [{"type": "maintenancewindow", "fill": {"ResourceId": "WindowId"}}]},
|
||||
"ssm:DeleteOpsItem": {"action": "ssm:DeleteOpsItem", "types": ["opsitem"], "resources": [{"type": "opsitem", "fill": {"ResourceId": "OpsItemId"}}]},
|
||||
"ssm:DeleteOpsMetadata": {"action": "ssm:DeleteOpsMetadata", "types": ["opsmetadata"], "resources": [{"types": ["opsmetadata"], "arn": "OpsMetadataArn"}]},
|
||||
"ssm:DeleteParameter": {"action": "ssm:DeleteParameter", "types": ["parameter"], "resources": [{"type": "parameter", "fill": {"ParameterNameWithoutLeadingSlash": "Name"}}]},
|
||||
"ssm:DeleteParameters": {"action": "ssm:DeleteParameters", "types": ["parameter"], "resources": [{"type": "parameter", "fill": {"ParameterNameWithoutLeadingSlash": "Names[]"}}]},
|
||||
"ssm:DeletePatchBaseline": {"action": "ssm:DeletePatchBaseline", "types": ["patchbaseline"], "resources": [{"type": "patchbaseline", "fill": {"PatchBaselineIdResourceId": "BaselineId"}}]},
|
||||
"ssm:DeleteResourceDataSync": {"action": "ssm:DeleteResourceDataSync", "types": ["resourcedatasync"], "resources": [{"type": "resourcedatasync", "fill": {"SyncName": "SyncName"}}]},
|
||||
"ssm:DeleteResourcePolicy": {"action": "ssm:DeleteResourcePolicy", "types": ["document", "opsitemgroup", "parameter"], "resources": [{"types": ["document", "opsitemgroup", "parameter"], "arn": "ResourceArn"}]},
|
||||
"ssm:DeregisterDefaultHostManagementConfiguration": {"action": "ssm:DeregisterDefaultHostManagementConfiguration", "types": [], "resources": []},
|
||||
"ssm:DeregisterManagedInstance": {"action": "ssm:DeregisterManagedInstance", "types": ["managed-instance"], "resources": [{"type": "managed-instance", "fill": {"InstanceId": "InstanceId"}}]},
|
||||
"ssm:DeregisterPatchBaselineForPatchGroup": {"action": "ssm:DeregisterPatchBaselineForPatchGroup", "types": ["patchbaseline"], "resources": [{"type": "patchbaseline", "fill": {"PatchBaselineIdResourceId": "BaselineId"}}]},
|
||||
"ssm:DeregisterTargetFromMaintenanceWindow": {"action": "ssm:DeregisterTargetFromMaintenanceWindow", "types": ["maintenancewindow", "windowtarget"], "resources": [{"type": "maintenancewindow", "fill": {"ResourceId": "WindowId"}}, {"type": "windowtarget", "fill": {"WindowTargetId": "WindowTargetId"}}]},
|
||||
"ssm:DeregisterTaskFromMaintenanceWindow": {"action": "ssm:DeregisterTaskFromMaintenanceWindow", "types": ["maintenancewindow", "windowtask"], "resources": [{"type": "maintenancewindow", "fill": {"ResourceId": "WindowId"}}, {"type": "windowtask", "fill": {"WindowTaskId": "WindowTaskId"}}]},
|
||||
"ssm:DescribeActivations": {"action": "ssm:DescribeActivations", "types": [], "resources": []},
|
||||
"ssm:DescribeAssociation": {"action": "ssm:DescribeAssociation", "types": ["association"], "resources": [{"type": "association", "fill": {"AssociationId": "AssociationId"}}]},
|
||||
"ssm:DescribeAssociationExecutionTargets": {"action": "ssm:DescribeAssociationExecutionTargets", "types": ["association"], "resources": [{"type": "association", "fill": {"AssociationId": "AssociationId"}}]},
|
||||
"ssm:DescribeAssociationExecutions": {"action": "ssm:DescribeAssociationExecutions", "types": ["association"], "resources": [{"type": "association", "fill": {"AssociationId": "AssociationId"}}]},
|
||||
"ssm:DescribeAutomationExecutions": {"action": "ssm:DescribeAutomationExecutions", "types": [], "resources": []},
|
||||
"ssm:DescribeAutomationStepExecutions": {"action": "ssm:DescribeAutomationStepExecutions", "types": ["automation-execution"], "resources": [{"type": "automation-execution", "fill": {"AutomationExecutionId": "AutomationExecutionId"}}]},
|
||||
"ssm:DescribeAvailablePatches": {"action": "ssm:DescribeAvailablePatches", "types": [], "resources": []},
|
||||
"ssm:DescribeDocument": {"action": "ssm:DescribeDocument", "types": ["document"], "resources": [{"type": "document", "fill": {"DocumentName": "Name"}}]},
|
||||
"ssm:DescribeDocumentPermission": {"action": "ssm:DescribeDocumentPermission", "types": ["document"], "resources": [{"type": "document", "fill": {"DocumentName": "Name"}}]},
|
||||
"ssm:DescribeEffectiveInstanceAssociations": {"action": "ssm:DescribeEffectiveInstanceAssociations", "types": ["instance", "managed-instance"], "resources": []},
|
||||
"ssm:DescribeEffectivePatchesForPatchBaseline": {"action": "ssm:DescribeEffectivePatchesForPatchBaseline", "types": ["patchbaseline"], "resources": [{"type": "patchbaseline", "fill": {"PatchBaselineIdResourceId": "BaselineId"}}]},
|
||||
"ssm:DescribeInstanceAssociationsStatus": {"action": "ssm:DescribeInstanceAssociationsStatus", "types": ["instance", "managed-instance"], "resources": []},
|
||||
"ssm:DescribeInstanceInformation": {"action": "ssm:DescribeInstanceInformation", "types": [], "resources": []},
|
||||
"ssm:DescribeInstancePatchStates": {"action": "ssm:DescribeInstancePatchStates", "types": ["instance", "managed-instance"], "resources": []},
|
||||
"ssm:DescribeInstancePatchStatesForPatchGroup": {"action": "ssm:DescribeInstancePatchStatesForPatchGroup", "types": [], "resources": []},
|
||||
"ssm:DescribeInstancePatches": {"action": "ssm:DescribeInstancePatches", "types": ["instance", "managed-instance"], "resources": []},
|
||||
"ssm:DescribeInstanceProperties": {"action": "ssm:DescribeInstanceProperties", "types": [], "resources": []},
|
||||
"ssm:DescribeInventoryDeletions": {"action": "ssm:DescribeInventoryDeletions", "types": [], "resources": []},
|
||||
"ssm:DescribeMaintenanceWindowExecutionTaskInvocations": {"action": "ssm:DescribeMaintenanceWindowExecutionTaskInvocations", "types": [], "resources": []},
|
||||
"ssm:DescribeMaintenanceWindowExecutionTasks": {"action": "ssm:DescribeMaintenanceWindowExecutionTasks", "types": [], "resources": []},
|
||||
"ssm:DescribeMaintenanceWindowExecutions": {"action": "ssm:DescribeMaintenanceWindowExecutions", "types": ["maintenancewindow"], "resources": [{"type": "maintenancewindow", "fill": {"ResourceId": "WindowId"}}]},
|
||||
"ssm:DescribeMaintenanceWindowSchedule": {"action": "ssm:DescribeMaintenanceWindowSchedule", "types": [], "resources": []},
|
||||
"ssm:DescribeMaintenanceWindowTargets": {"action": "ssm:DescribeMaintenanceWindowTargets", "types": ["maintenancewindow"], "resources": [{"type": "maintenancewindow", "fill": {"ResourceId": "WindowId"}}]},
|
||||
"ssm:DescribeMaintenanceWindowTasks": {"action": "ssm:DescribeMaintenanceWindowTasks", "types": ["maintenancewindow"], "resources": [{"type": "maintenancewindow", "fill": {"ResourceId": "WindowId"}}]},
|
||||
"ssm:DescribeMaintenanceWindows": {"action": "ssm:DescribeMaintenanceWindows", "types": [], "resources": []},
|
||||
"ssm:DescribeMaintenanceWindowsForTarget": {"action": "ssm:DescribeMaintenanceWindowsForTarget", "types": [], "resources": []},
|
||||
"ssm:DescribeOpsItems": {"action": "ssm:DescribeOpsItems", "types": [], "resources": []},
|
||||
"ssm:DescribeParameters": {"action": "ssm:DescribeParameters", "types": [], "resources": []},
|
||||
"ssm:DescribePatchBaselines": {"action": "ssm:DescribePatchBaselines", "types": [], "resources": []},
|
||||
"ssm:DescribePatchGroupState": {"action": "ssm:DescribePatchGroupState", "types": [], "resources": []},
|
||||
"ssm:DescribePatchGroups": {"action": "ssm:DescribePatchGroups", "types": [], "resources": []},
|
||||
"ssm:DescribePatchProperties": {"action": "ssm:DescribePatchProperties", "types": [], "resources": []},
|
||||
"ssm:DescribeSessions": {"action": "ssm:DescribeSessions", "types": [], "resources": []},
|
||||
"ssm:DisassociateOpsItemRelatedItem": {"action": "ssm:DisassociateOpsItemRelatedItem", "types": ["opsitem"], "resources": [{"type": "opsitem", "fill": {"ResourceId": "OpsItemId"}}]},
|
||||
"ssm:GetAccessToken": {"action": "ssm:GetAccessToken", "types": ["opsitem"], "resources": []},
|
||||
"ssm:GetAutomationExecution": {"action": "ssm:GetAutomationExecution", "types": ["automation-execution"], "resources": [{"type": "automation-execution", "fill": {"AutomationExecutionId": "AutomationExecutionId"}}]},
|
||||
"ssm:GetCalendarState": {"action": "ssm:GetCalendarState", "types": ["document"], "resources": []},
|
||||
"ssm:GetCloudConnector": {"action": "ssm:GetCloudConnector", "types": ["cloud-connector"], "resources": [{"type": "cloud-connector", "fill": {"CloudConnectorId": "CloudConnectorId"}}]},
|
||||
"ssm:GetCommandInvocation": {"action": "ssm:GetCommandInvocation", "types": [], "resources": []},
|
||||
"ssm:GetConnectionStatus": {"action": "ssm:GetConnectionStatus", "types": ["instance", "managed-instance", "task"], "resources": []},
|
||||
"ssm:GetDefaultPatchBaseline": {"action": "ssm:GetDefaultPatchBaseline", "types": ["patchbaseline"], "resources": []},
|
||||
"ssm:GetDeployablePatchSnapshotForInstance": {"action": "ssm:GetDeployablePatchSnapshotForInstance", "types": [], "resources": []},
|
||||
"ssm:GetDocument": {"action": "ssm:GetDocument", "types": ["document"], "resources": [{"type": "document", "fill": {"DocumentName": "Name"}}]},
|
||||
"ssm:GetExecutionPreview": {"action": "ssm:GetExecutionPreview", "types": [], "resources": []},
|
||||
"ssm:GetInventory": {"action": "ssm:GetInventory", "types": [], "resources": []},
|
||||
"ssm:GetInventorySchema": {"action": "ssm:GetInventorySchema", "types": [], "resources": []},
|
||||
"ssm:GetMaintenanceWindow": {"action": "ssm:GetMaintenanceWindow", "types": ["maintenancewindow"], "resources": [{"type": "maintenancewindow", "fill": {"ResourceId": "WindowId"}}]},
|
||||
"ssm:GetMaintenanceWindowExecution": {"action": "ssm:GetMaintenanceWindowExecution", "types": [], "resources": []},
|
||||
"ssm:GetMaintenanceWindowExecutionTask": {"action": "ssm:GetMaintenanceWindowExecutionTask", "types": [], "resources": []},
|
||||
"ssm:GetMaintenanceWindowExecutionTaskInvocation": {"action": "ssm:GetMaintenanceWindowExecutionTaskInvocation", "types": [], "resources": []},
|
||||
"ssm:GetMaintenanceWindowTask": {"action": "ssm:GetMaintenanceWindowTask", "types": ["maintenancewindow"], "resources": [{"type": "maintenancewindow", "fill": {"ResourceId": "WindowId"}}]},
|
||||
"ssm:GetOpsItem": {"action": "ssm:GetOpsItem", "types": ["opsitem"], "resources": [{"types": ["opsitem"], "arn": "OpsItemArn"}, {"type": "opsitem", "fill": {"ResourceId": "OpsItemId"}}]},
|
||||
"ssm:GetOpsMetadata": {"action": "ssm:GetOpsMetadata", "types": ["opsmetadata"], "resources": [{"types": ["opsmetadata"], "arn": "OpsMetadataArn"}]},
|
||||
"ssm:GetOpsSummary": {"action": "ssm:GetOpsSummary", "types": ["resourcedatasync"], "resources": [{"type": "resourcedatasync", "fill": {"SyncName": "SyncName"}}]},
|
||||
"ssm:GetParameter": {"action": "ssm:GetParameter", "types": ["parameter"], "resources": [{"type": "parameter", "fill": {"ParameterNameWithoutLeadingSlash": "Name"}}]},
|
||||
"ssm:GetParameterHistory": {"action": "ssm:GetParameterHistory", "types": ["parameter"], "resources": [{"type": "parameter", "fill": {"ParameterNameWithoutLeadingSlash": "Name"}}]},
|
||||
"ssm:GetParameters": {"action": "ssm:GetParameters", "types": ["parameter"], "resources": [{"type": "parameter", "fill": {"ParameterNameWithoutLeadingSlash": "Names[]"}}]},
|
||||
"ssm:GetParametersByPath": {"action": "ssm:GetParametersByPath", "types": ["parameter"], "resources": [{"type": "parameter", "fill": {"ParameterNameWithoutLeadingSlash": "Path"}}]},
|
||||
"ssm:GetPatchBaseline": {"action": "ssm:GetPatchBaseline", "types": ["patchbaseline"], "resources": [{"type": "patchbaseline", "fill": {"PatchBaselineIdResourceId": "BaselineId"}}]},
|
||||
"ssm:GetPatchBaselineForPatchGroup": {"action": "ssm:GetPatchBaselineForPatchGroup", "types": [], "resources": []},
|
||||
"ssm:GetResourcePolicies": {"action": "ssm:GetResourcePolicies", "types": ["document", "opsitemgroup", "parameter"], "resources": [{"types": ["document", "opsitemgroup", "parameter"], "arn": "ResourceArn"}]},
|
||||
"ssm:GetServiceSetting": {"action": "ssm:GetServiceSetting", "types": ["servicesetting"], "resources": [{"type": "servicesetting", "fill": {"ResourceId": "SettingId"}}]},
|
||||
"ssm:LabelParameterVersion": {"action": "ssm:LabelParameterVersion", "types": ["parameter"], "resources": [{"type": "parameter", "fill": {"ParameterNameWithoutLeadingSlash": "Name"}}]},
|
||||
"ssm:ListAssociationVersions": {"action": "ssm:ListAssociationVersions", "types": ["association"], "resources": [{"type": "association", "fill": {"AssociationId": "AssociationId"}}]},
|
||||
"ssm:ListAssociations": {"action": "ssm:ListAssociations", "types": [], "resources": []},
|
||||
"ssm:ListCloudConnectors": {"action": "ssm:ListCloudConnectors", "types": [], "resources": []},
|
||||
"ssm:ListCommandInvocations": {"action": "ssm:ListCommandInvocations", "types": [], "resources": []},
|
||||
"ssm:ListCommands": {"action": "ssm:ListCommands", "types": [], "resources": []},
|
||||
"ssm:ListComplianceItems": {"action": "ssm:ListComplianceItems", "types": [], "resources": []},
|
||||
"ssm:ListComplianceSummaries": {"action": "ssm:ListComplianceSummaries", "types": [], "resources": []},
|
||||
"ssm:ListDocumentMetadataHistory": {"action": "ssm:ListDocumentMetadataHistory", "types": ["document"], "resources": [{"type": "document", "fill": {"DocumentName": "Name"}}]},
|
||||
"ssm:ListDocumentVersions": {"action": "ssm:ListDocumentVersions", "types": ["document"], "resources": [{"type": "document", "fill": {"DocumentName": "Name"}}]},
|
||||
"ssm:ListDocuments": {"action": "ssm:ListDocuments", "types": [], "resources": []},
|
||||
"ssm:ListInventoryEntries": {"action": "ssm:ListInventoryEntries", "types": [], "resources": []},
|
||||
"ssm:ListNodes": {"action": "ssm:ListNodes", "types": ["resourcedatasync"], "resources": [{"type": "resourcedatasync", "fill": {"SyncName": "SyncName"}}]},
|
||||
"ssm:ListNodesSummary": {"action": "ssm:ListNodesSummary", "types": ["resourcedatasync"], "resources": [{"type": "resourcedatasync", "fill": {"SyncName": "SyncName"}}]},
|
||||
"ssm:ListOpsItemEvents": {"action": "ssm:ListOpsItemEvents", "types": [], "resources": []},
|
||||
"ssm:ListOpsItemRelatedItems": {"action": "ssm:ListOpsItemRelatedItems", "types": [], "resources": []},
|
||||
"ssm:ListOpsMetadata": {"action": "ssm:ListOpsMetadata", "types": [], "resources": []},
|
||||
"ssm:ListResourceComplianceSummaries": {"action": "ssm:ListResourceComplianceSummaries", "types": [], "resources": []},
|
||||
"ssm:ListResourceDataSync": {"action": "ssm:ListResourceDataSync", "types": [], "resources": []},
|
||||
"ssm:ListTagsForResource": {"action": "ssm:ListTagsForResource", "types": ["association", "automation-execution", "cloud-connector", "document", "maintenancewindow", "managed-instance", "opsitem", "opsmetadata", "parameter", "patchbaseline"], "resources": [{"type": "association", "fill": {"AssociationId": "ResourceId"}, "when": {"ResourceType": ["Association"]}}, {"type": "cloud-connector", "fill": {"CloudConnectorId": "ResourceId"}, "when": {"ResourceType": ["CloudConnector"]}}, {"type": "document", "fill": {"DocumentName": "ResourceId"}, "when": {"ResourceType": ["Document"]}}, {"type": "maintenancewindow", "fill": {"ResourceId": "ResourceId"}, "when": {"ResourceType": ["MaintenanceWindow"]}}, {"type": "managed-instance", "fill": {"InstanceId": "ResourceId"}, "when": {"ResourceType": ["ManagedInstance"]}}, {"type": "opsitem", "fill": {"ResourceId": "ResourceId"}, "when": {"ResourceType": ["OpsItem"]}}, {"type": "opsmetadata", "fill": {"ResourceId": "ResourceId"}, "when": {"ResourceType": ["OpsMetadata"]}}, {"type": "parameter", "fill": {"ParameterNameWithoutLeadingSlash": "ResourceId"}, "when": {"ResourceType": ["Parameter"]}}, {"type": "patchbaseline", "fill": {"PatchBaselineIdResourceId": "ResourceId"}, "when": {"ResourceType": ["PatchBaseline"]}}]},
|
||||
"ssm:ModifyDocumentPermission": {"action": "ssm:ModifyDocumentPermission", "types": ["document"], "resources": [{"type": "document", "fill": {"DocumentName": "Name"}}]},
|
||||
"ssm:PutComplianceItems": {"action": "ssm:PutComplianceItems", "types": ["instance", "managed-instance"], "resources": []},
|
||||
"ssm:PutInventory": {"action": "ssm:PutInventory", "types": [], "resources": [], "makes": [{"type": "managed-instance-inventory", "fill": {"InstanceId": "InstanceId"}}]},
|
||||
"ssm:PutParameter": {"action": "ssm:PutParameter", "types": ["parameter"], "resources": [{"type": "parameter", "fill": {"ParameterNameWithoutLeadingSlash": "Name"}}]},
|
||||
"ssm:PutResourcePolicy": {"action": "ssm:PutResourcePolicy", "types": ["document", "opsitemgroup", "parameter"], "resources": [{"types": ["document", "opsitemgroup", "parameter"], "arn": "ResourceArn"}]},
|
||||
"ssm:RegisterDefaultHostManagementConfiguration": {"action": "ssm:RegisterDefaultHostManagementConfiguration", "types": [], "resources": []},
|
||||
"ssm:RegisterDefaultPatchBaseline": {"action": "ssm:RegisterDefaultPatchBaseline", "types": ["patchbaseline"], "resources": [{"type": "patchbaseline", "fill": {"PatchBaselineIdResourceId": "BaselineId"}}]},
|
||||
"ssm:RegisterPatchBaselineForPatchGroup": {"action": "ssm:RegisterPatchBaselineForPatchGroup", "types": ["patchbaseline"], "resources": [{"type": "patchbaseline", "fill": {"PatchBaselineIdResourceId": "BaselineId"}}]},
|
||||
"ssm:RegisterTargetWithMaintenanceWindow": {"action": "ssm:RegisterTargetWithMaintenanceWindow", "types": ["maintenancewindow"], "resources": [{"type": "maintenancewindow", "fill": {"ResourceId": "WindowId"}}]},
|
||||
"ssm:RegisterTaskWithMaintenanceWindow": {"action": "ssm:RegisterTaskWithMaintenanceWindow", "types": ["maintenancewindow"], "resources": [{"types": ["maintenancewindow"], "arn": "ServiceRoleArn"}, {"types": ["maintenancewindow"], "arn": "TaskArn"}, {"type": "maintenancewindow", "fill": {"ResourceId": "WindowId"}}]},
|
||||
"ssm:RemoveTagsFromResource": {"action": "ssm:RemoveTagsFromResource", "types": ["association", "automation-execution", "cloud-connector", "document", "instance", "maintenancewindow", "managed-instance", "opsitem", "opsmetadata", "parameter", "patchbaseline", "task"], "resources": [{"type": "association", "fill": {"AssociationId": "ResourceId"}, "when": {"ResourceType": ["Association"]}}, {"type": "cloud-connector", "fill": {"CloudConnectorId": "ResourceId"}, "when": {"ResourceType": ["CloudConnector"]}}, {"type": "document", "fill": {"DocumentName": "ResourceId"}, "when": {"ResourceType": ["Document"]}}, {"type": "maintenancewindow", "fill": {"ResourceId": "ResourceId"}, "when": {"ResourceType": ["MaintenanceWindow"]}}, {"type": "managed-instance", "fill": {"InstanceId": "ResourceId"}, "when": {"ResourceType": ["ManagedInstance"]}}, {"type": "opsitem", "fill": {"ResourceId": "ResourceId"}, "when": {"ResourceType": ["OpsItem"]}}, {"type": "opsmetadata", "fill": {"ResourceId": "ResourceId"}, "when": {"ResourceType": ["OpsMetadata"]}}, {"type": "parameter", "fill": {"ParameterNameWithoutLeadingSlash": "ResourceId"}, "when": {"ResourceType": ["Parameter"]}}, {"type": "patchbaseline", "fill": {"PatchBaselineIdResourceId": "ResourceId"}, "when": {"ResourceType": ["PatchBaseline"]}}]},
|
||||
"ssm:ResetServiceSetting": {"action": "ssm:ResetServiceSetting", "types": ["servicesetting"], "resources": [{"type": "servicesetting", "fill": {"ResourceId": "SettingId"}}]},
|
||||
"ssm:ResumeSession": {"action": "ssm:ResumeSession", "types": ["session"], "resources": [{"type": "session", "fill": {"SessionId": "SessionId"}}]},
|
||||
"ssm:SendAutomationSignal": {"action": "ssm:SendAutomationSignal", "types": ["automation-execution"], "resources": [{"type": "automation-execution", "fill": {"AutomationExecutionId": "AutomationExecutionId"}}]},
|
||||
"ssm:SendCommand": {"action": "ssm:SendCommand", "types": ["bucket", "document", "instance", "managed-instance"], "resources": [{"types": ["bucket", "document", "instance", "managed-instance"], "arn": "NotificationConfig.NotificationArn"}, {"types": ["bucket", "document", "instance", "managed-instance"], "arn": "ServiceRoleArn"}, {"type": "bucket", "fill": {"BucketName": "OutputS3BucketName"}}, {"type": "document", "fill": {"DocumentName": "DocumentName"}}]},
|
||||
"ssm:StartAccessRequest": {"action": "ssm:StartAccessRequest", "types": ["instance", "managed-instance"], "resources": []},
|
||||
"ssm:StartAssociationsOnce": {"action": "ssm:StartAssociationsOnce", "types": ["association"], "resources": [{"type": "association", "fill": {"AssociationId": "AssociationIds[]"}}]},
|
||||
"ssm:StartAutomationExecution": {"action": "ssm:StartAutomationExecution", "types": ["automation-definition", "automation-execution", "document"], "resources": [{"type": "automation-definition", "fill": {"VersionId": "DocumentVersion"}}, {"type": "automation-execution", "fill": {}, "made": true}, {"type": "document", "fill": {"DocumentName": "DocumentName"}}]},
|
||||
"ssm:StartChangeRequestExecution": {"action": "ssm:StartChangeRequestExecution", "types": ["automation-definition", "automation-execution", "document"], "resources": [{"type": "automation-definition", "fill": {"VersionId": "DocumentVersion"}}, {"type": "document", "fill": {"DocumentName": "DocumentName"}}]},
|
||||
"ssm:StartExecutionPreview": {"action": "ssm:StartExecutionPreview", "types": [], "resources": []},
|
||||
"ssm:StartSession": {"action": "ssm:StartSession", "types": ["document", "instance", "managed-instance", "task"], "resources": [{"type": "document", "fill": {"DocumentName": "DocumentName"}}]},
|
||||
"ssm:StopAutomationExecution": {"action": "ssm:StopAutomationExecution", "types": ["automation-execution"], "resources": [{"type": "automation-execution", "fill": {"AutomationExecutionId": "AutomationExecutionId"}}]},
|
||||
"ssm:TerminateSession": {"action": "ssm:TerminateSession", "types": ["session"], "resources": [{"type": "session", "fill": {"SessionId": "SessionId"}}]},
|
||||
"ssm:UnlabelParameterVersion": {"action": "ssm:UnlabelParameterVersion", "types": ["parameter"], "resources": [{"type": "parameter", "fill": {"ParameterNameWithoutLeadingSlash": "Name"}}]},
|
||||
"ssm:UpdateAssociation": {"action": "ssm:UpdateAssociation", "types": ["association", "document", "instance", "managed-instance"], "resources": [{"type": "association", "fill": {"AssociationId": "AssociationId"}}, {"type": "document", "fill": {"DocumentName": "Name"}}]},
|
||||
"ssm:UpdateAssociationStatus": {"action": "ssm:UpdateAssociationStatus", "types": ["document", "instance", "managed-instance"], "resources": [{"type": "document", "fill": {"DocumentName": "Name"}}]},
|
||||
"ssm:UpdateCloudConnector": {"action": "ssm:UpdateCloudConnector", "types": ["cloud-connector"], "resources": [{"type": "cloud-connector", "fill": {"CloudConnectorId": "CloudConnectorId"}}]},
|
||||
"ssm:UpdateDocument": {"action": "ssm:UpdateDocument", "types": ["document"], "resources": [{"type": "document", "fill": {"DocumentName": "Name"}}]},
|
||||
"ssm:UpdateDocumentDefaultVersion": {"action": "ssm:UpdateDocumentDefaultVersion", "types": ["document"], "resources": [{"type": "document", "fill": {"DocumentName": "Name"}}]},
|
||||
"ssm:UpdateDocumentMetadata": {"action": "ssm:UpdateDocumentMetadata", "types": ["document"], "resources": [{"type": "document", "fill": {"DocumentName": "Name"}}]},
|
||||
"ssm:UpdateMaintenanceWindow": {"action": "ssm:UpdateMaintenanceWindow", "types": ["maintenancewindow"], "resources": [{"type": "maintenancewindow", "fill": {"ResourceId": "WindowId"}}]},
|
||||
"ssm:UpdateMaintenanceWindowTarget": {"action": "ssm:UpdateMaintenanceWindowTarget", "types": ["maintenancewindow", "windowtarget"], "resources": [{"type": "maintenancewindow", "fill": {"ResourceId": "WindowId"}}, {"type": "windowtarget", "fill": {"WindowTargetId": "WindowTargetId"}}]},
|
||||
"ssm:UpdateMaintenanceWindowTask": {"action": "ssm:UpdateMaintenanceWindowTask", "types": ["maintenancewindow", "windowtask"], "resources": [{"types": ["maintenancewindow", "windowtask"], "arn": "ServiceRoleArn"}, {"types": ["maintenancewindow", "windowtask"], "arn": "TaskArn"}, {"type": "maintenancewindow", "fill": {"ResourceId": "WindowId"}}, {"type": "windowtask", "fill": {"WindowTaskId": "WindowTaskId"}}]},
|
||||
"ssm:UpdateManagedInstanceRole": {"action": "ssm:UpdateManagedInstanceRole", "types": ["iam-role", "managed-instance"], "resources": [{"type": "iam-role", "fill": {"RoleName": "IamRole"}}, {"type": "managed-instance", "fill": {"InstanceId": "InstanceId"}}]},
|
||||
"ssm:UpdateOpsItem": {"action": "ssm:UpdateOpsItem", "types": ["opsitem"], "resources": [{"types": ["opsitem"], "arn": "Notifications[].Arn"}, {"types": ["opsitem"], "arn": "OpsItemArn"}, {"type": "opsitem", "fill": {"ResourceId": "OpsItemId"}}]},
|
||||
"ssm:UpdateOpsMetadata": {"action": "ssm:UpdateOpsMetadata", "types": ["opsmetadata"], "resources": [{"types": ["opsmetadata"], "arn": "OpsMetadataArn"}]},
|
||||
"ssm:UpdatePatchBaseline": {"action": "ssm:UpdatePatchBaseline", "types": ["patchbaseline"], "resources": [{"type": "patchbaseline", "fill": {"PatchBaselineIdResourceId": "BaselineId"}}]},
|
||||
"ssm:UpdateResourceDataSync": {"action": "ssm:UpdateResourceDataSync", "types": ["resourcedatasync"], "resources": [{"type": "resourcedatasync", "fill": {"SyncName": "SyncName"}}]},
|
||||
"ssm:UpdateServiceSetting": {"action": "ssm:UpdateServiceSetting", "types": ["servicesetting"], "resources": [{"type": "servicesetting", "fill": {"ResourceId": "SettingId"}}]},
|
||||
"ssm:ValidateCloudConnector": {"action": "ssm:ValidateCloudConnector", "types": ["cloud-connector"], "resources": [{"type": "cloud-connector", "fill": {"CloudConnectorId": "CloudConnectorId"}}]},
|
||||
"sso:AddRegion": {"action": "sso:AddRegion", "types": ["Instance"], "resources": [{"types": ["Instance"], "arn": "InstanceArn"}]},
|
||||
"sso:AttachCustomerManagedPolicyReferenceToPermissionSet": {"action": "sso:AttachCustomerManagedPolicyReferenceToPermissionSet", "types": ["Instance", "PermissionSet"], "resources": [{"types": ["Instance", "PermissionSet"], "arn": "InstanceArn"}, {"types": ["Instance", "PermissionSet"], "arn": "PermissionSetArn"}]},
|
||||
"sso:AttachManagedPolicyToPermissionSet": {"action": "sso:AttachManagedPolicyToPermissionSet", "types": ["Instance", "PermissionSet"], "resources": [{"types": ["Instance", "PermissionSet"], "arn": "InstanceArn"}, {"types": ["Instance", "PermissionSet"], "arn": "ManagedPolicyArn"}, {"types": ["Instance", "PermissionSet"], "arn": "PermissionSetArn"}]},
|
||||
|
||||
@@ -91,7 +91,7 @@ class RequestResourceMembersTest {
|
||||
RequestResourceMembers.Table table = RequestResourceMembers.table();
|
||||
assertTrue(table.namespaces().containsAll(List.of("cognito-idp", "ecr", "elasticloadbalancing", "states")));
|
||||
assertTrue(table.handBuilt().contains("lambda"));
|
||||
assertEquals(Set.of("dynamodb", "logs", "ssm"), table.namespaces().stream().filter(table.handBuilt()::contains)
|
||||
assertEquals(Set.of("dynamodb", "logs"), table.namespaces().stream().filter(table.handBuilt()::contains)
|
||||
.collect(Collectors.toSet()));
|
||||
Set<String> logsDelivery = Stream.of("PutDeliverySource", "GetDeliverySource", "DeleteDeliverySource",
|
||||
"DescribeDeliverySources", "PutDeliveryDestination", "GetDeliveryDestination",
|
||||
@@ -101,8 +101,6 @@ class RequestResourceMembersTest {
|
||||
Set<String> expected = new HashSet<>(logsDelivery);
|
||||
expected.add("dynamodb:ListTables");
|
||||
expected.add("logs:PutDestination");
|
||||
Stream.of("AddTagsToResource", "ListTagsForResource", "RemoveTagsFromResource", "CreateDocument",
|
||||
"CreateAssociation").forEach(operation -> expected.add("ssm:" + operation));
|
||||
assertEquals(expected, table.operations().keySet().stream()
|
||||
.filter(operation -> table.handBuilt().contains(operation.substring(0, operation.indexOf(':'))))
|
||||
.collect(Collectors.toSet()),
|
||||
|
||||
@@ -1065,6 +1065,64 @@ class RequestResourcesTest {
|
||||
assertEquals(List.of(project + "a"), of("codebuild:RetryBuild", form("Action=RetryBuild&id=a:1")));
|
||||
}
|
||||
|
||||
/**
|
||||
* A Parameter Store parameter is {@code parameter/<name>} whether its name starts with a slash or not, without the
|
||||
* whitespace around it, a name of two leading slashes keeping the second and one beginning {@code /parameter/}
|
||||
* keeping that; a version or a label after its name, or after its ARN, is checked on the parameter; a path is
|
||||
* checked as given; and the tagging operations act on the resource of the type their {@code ResourceType} picks,
|
||||
* a parameter by its name or its ARN, a legacy {@code parameter<name>} ARN being the one the service finds for it,
|
||||
* and on none without one.
|
||||
*/
|
||||
@Test
|
||||
void aParameterIsNamedWithOrWithoutItsLeadingSlash() {
|
||||
String parameter = "arn:aws:ssm:us-east-1:000000000000:parameter/";
|
||||
for (String name : List.of("/a", "a")) {
|
||||
assertEquals(List.of(parameter + "a"), of("ssm:GetParameter", json("{\"Name\":\"" + name + "\"}")), name);
|
||||
assertEquals(List.of(parameter + "a"), of("ssm:GetParameterHistory", json("{\"Name\":\"" + name + "\"}")));
|
||||
assertEquals(List.of(parameter + "a"), of("ssm:LabelParameterVersion",
|
||||
json("{\"Name\":\"" + name + "\",\"Labels\":[\"l\"]}")));
|
||||
}
|
||||
assertEquals(List.of(parameter + "/x"), of("ssm:GetParameter", json("{\"Name\":\"//x\"}")));
|
||||
assertEquals(List.of(parameter + "parameter/x"), of("ssm:GetParameter",
|
||||
json("{\"Name\":\"/parameter/x\"}")));
|
||||
assertEquals(List.of(parameter + "x"), of("ssm:GetParameter", json("{\"Name\":\"x:1\"}")));
|
||||
assertEquals(List.of(parameter + "x"), of("ssm:GetParameter", json("{\"Name\":\"/x:prod\"}")));
|
||||
assertEquals(List.of(parameter + "x"), of("ssm:GetParameter", json("{\"Name\":\"" + parameter + "x:1\"}")));
|
||||
assertEquals(List.of(parameter + "a", parameter + "b"), of("ssm:GetParameters",
|
||||
json("{\"Names\":[\"/a\",\"b:2\"]}")));
|
||||
assertEquals(List.of(parameter + "a/"), of("ssm:GetParametersByPath", json("{\"Path\":\"/a/\"}")));
|
||||
assertEquals(List.of(parameter + "a"), of("ssm:GetParametersByPath", json("{\"Path\":\"/a\"}")));
|
||||
assertEquals(List.of(parameter), of("ssm:GetParametersByPath", json("{\"Path\":\"/\"}")));
|
||||
assertEquals(List.of(), of("ssm:GetParametersByPath", json("{}")));
|
||||
assertEquals(List.of(parameter + "x"), of("ssm:PutParameter", json("{\"Name\":\" x \",\"Value\":\"v\"}")));
|
||||
assertEquals(List.of(parameter + "x"), of("ssm:UnlabelParameterVersion",
|
||||
json("{\"Name\":\" /x \",\"Labels\":[\"l\"]}")));
|
||||
assertEquals(List.of(parameter + "x"), of("ssm:GetParameter", json("{\"Name\":\" x \"}")));
|
||||
assertEquals(List.of(parameter + "x"), of("ssm:AddTagsToResource",
|
||||
json("{\"ResourceType\":\"Parameter\",\"ResourceId\":\"/x\",\"Tags\":[]}")));
|
||||
assertEquals(List.of(parameter + "x"), of("ssm:ListTagsForResource",
|
||||
json("{\"ResourceType\":\"Parameter\",\"ResourceId\":\"" + parameter + "x\"}")));
|
||||
assertEquals(List.of("arn:aws:ssm:us-east-1:000000000000:document/x"), of("ssm:ListTagsForResource",
|
||||
json("{\"ResourceType\":\"Document\",\"ResourceId\":\"x\"}")));
|
||||
assertEquals(List.of(), of("ssm:ListTagsForResource", json("{\"ResourceId\":\"x\"}")));
|
||||
|
||||
String legacy = "arn:aws:ssm:us-east-1:000000000000:parameterx";
|
||||
StoredResourceArns stored = new StoredResourceArns() {
|
||||
@Override
|
||||
public String namespace() {
|
||||
return "ssm";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<String> find(String type, List<String> names, String region) {
|
||||
return List.of(legacy).equals(names) ? Optional.of(parameter + "x") : Optional.empty();
|
||||
}
|
||||
};
|
||||
assertEquals(List.of(parameter + "x"), RequestResources.of("ssm:RemoveTagsFromResource",
|
||||
json("{\"ResourceType\":\"Parameter\",\"ResourceId\":\"" + legacy + "\",\"TagKeys\":[\"k\"]}"), "aws",
|
||||
"us-east-1", "000000000000", stored));
|
||||
}
|
||||
|
||||
/** A list taking a name or an ARN for each value names each value's resource, whichever it gives. */
|
||||
@Test
|
||||
void aListMixingNamesAndArnsNamesEachValuesResource() {
|
||||
|
||||
@@ -1711,34 +1711,23 @@ class ResourceArnBuilderTest {
|
||||
// ── SSM ──────────────────────────────────────────────────────────────────────
|
||||
|
||||
@Test
|
||||
void ssmBuildsArnFromNameWithLeadingSlash() {
|
||||
setJsonBody("{\"Name\":\"/config/env\"}");
|
||||
String arn = builder.build("ssm", ctx, "us-east-1", "000000000000");
|
||||
assertEquals("arn:aws:ssm:us-east-1:000000000000:parameter/config/env", arn);
|
||||
}
|
||||
|
||||
@Test
|
||||
void ssmBuildsArnFromNameWithoutLeadingSlash() {
|
||||
setJsonBody("{\"Name\":\"config-key\"}");
|
||||
String arn = builder.build("ssm", ctx, "us-east-1", "000000000000");
|
||||
assertEquals("arn:aws:ssm:us-east-1:000000000000:parameter/config-key", arn);
|
||||
void ssmNamesTheParameterItsNameNamesWithOrWithoutALeadingSlash() {
|
||||
for (String name : List.of("/config/env", "config/env")) {
|
||||
setJsonBody("{\"Name\":\"" + name + "\"}");
|
||||
assertEquals(List.of("arn:aws:ssm:us-east-1:000000000000:parameter/config/env"),
|
||||
builder.buildResources("ssm", "ssm:GetParameter", ctx, "us-east-1", ACCOUNT, "aws"), name);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void ssmResourcePolicyActionsActOnTheParameterTheirResourceArnNames() {
|
||||
when(ctx.getHeaderString("X-Amz-Target")).thenReturn("AmazonSSM.PutResourcePolicy");
|
||||
setJsonBody("{\"ResourceArn\":\"arn:aws:ssm:us-east-1:000000000000:parameter/prod/db\",\"Policy\":\"{}\"}");
|
||||
assertEquals("arn:aws:ssm:us-east-1:000000000000:parameter/prod/db",
|
||||
builder.build("ssm", ctx, "us-east-1", "000000000000"));
|
||||
assertEquals(List.of("arn:aws:ssm:us-east-1:000000000000:parameter/prod/db"),
|
||||
builder.buildResources("ssm", "ssm:PutResourcePolicy", ctx, "us-east-1", ACCOUNT, "aws"));
|
||||
|
||||
// Any other action acts on the parameter its handler reads, its Name, whatever else the body carries.
|
||||
when(ctx.getHeaderString("X-Amz-Target")).thenReturn("AmazonSSM.GetParameter");
|
||||
setJsonBody("{\"Name\":\"/prod/db\",\"ResourceArn\":\"arn:aws:ssm:us-east-1:000000000000:parameter/dev/db\"}");
|
||||
assertEquals("arn:aws:ssm:us-east-1:000000000000:parameter/prod/db",
|
||||
builder.build("ssm", ctx, "us-east-1", "000000000000"));
|
||||
when(ctx.getHeaderString("X-Amz-Target")).thenReturn(null);
|
||||
assertEquals("arn:aws:ssm:us-east-1:000000000000:parameter/prod/db",
|
||||
builder.build("ssm", ctx, "us-east-1", "000000000000"));
|
||||
assertEquals(List.of("arn:aws:ssm:us-east-1:000000000000:parameter/prod/db"),
|
||||
builder.buildResources("ssm", "ssm:GetParameter", ctx, "us-east-1", ACCOUNT, "aws"));
|
||||
}
|
||||
|
||||
// ── SQS ─────────────────────────────────────────────────────────────────────
|
||||
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
package io.floci.aws.services.ssm;
|
||||
|
||||
import io.floci.aws.testing.AwsTestClients;
|
||||
import io.floci.aws.testing.EnforcementFixtures;
|
||||
import io.floci.aws.testing.IamEnforcementProfile;
|
||||
import io.floci.aws.testing.PartitionCleanup;
|
||||
import io.floci.aws.testing.RestAssuredJsonUtils;
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
import io.quarkus.test.junit.TestProfile;
|
||||
import io.restassured.RestAssured;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.RegisterExtension;
|
||||
import software.amazon.awssdk.regions.Region;
|
||||
import software.amazon.awssdk.services.ssm.SsmClient;
|
||||
import software.amazon.awssdk.services.ssm.model.DeleteParametersResponse;
|
||||
import software.amazon.awssdk.services.ssm.model.ParameterType;
|
||||
import software.amazon.awssdk.services.ssm.model.SsmException;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import static io.floci.aws.testing.EnforcementFixtures.auth;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
/**
|
||||
* {@code DeleteParameters} is checked against each parameter its {@code Names} give, before any of them is
|
||||
* deleted.
|
||||
*/
|
||||
@QuarkusTest
|
||||
@TestProfile(IamEnforcementProfile.class)
|
||||
class SsmDeleteParametersIamEnforcementIntegrationTest {
|
||||
|
||||
private static final String ACCOUNT = "000000000000";
|
||||
|
||||
@RegisterExtension
|
||||
final PartitionCleanup cleanup = new PartitionCleanup();
|
||||
|
||||
@BeforeAll
|
||||
static void configureRestAssured() {
|
||||
RestAssuredJsonUtils.configureAwsContentTypes();
|
||||
}
|
||||
|
||||
@Test
|
||||
void grantsOnEveryNamedParameterAllowTheBatchDeletion() {
|
||||
String prefix = "/iam-names-delete-" + UUID.randomUUID();
|
||||
String first = prefix + "/a";
|
||||
String second = prefix + "/b";
|
||||
try (SsmClient root = AwsTestClients.create(SsmClient.builder(), ACCOUNT, Region.US_EAST_1)) {
|
||||
try {
|
||||
root.putParameter(r -> r.name(first).type(ParameterType.STRING).value("v"));
|
||||
root.putParameter(r -> r.name(second).type(ParameterType.STRING).value("v"));
|
||||
EnforcementFixtures.UserCredentials credentials = user("""
|
||||
{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":"ssm:DeleteParameters",
|
||||
"Resource":["arn:aws:ssm:us-east-1:000000000000:parameter%s",
|
||||
"arn:aws:ssm:us-east-1:000000000000:parameter%s"]}]}"""
|
||||
.formatted(first, second));
|
||||
try (SsmClient user = AwsTestClients.create(SsmClient.builder(), credentials.accessKeyId(),
|
||||
Region.US_EAST_1)) {
|
||||
DeleteParametersResponse deleted = user.deleteParameters(r -> r.names(first, second));
|
||||
assertEquals(List.of(first, second), deleted.deletedParameters());
|
||||
}
|
||||
assertEquals(List.of(first, second),
|
||||
root.getParameters(r -> r.names(first, second)).invalidParameters());
|
||||
} finally {
|
||||
root.deleteParameters(r -> r.names(first, second));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void aDenyOnOneNamedParameterRefusesTheBatchAndDeletesNeither() {
|
||||
String prefix = "/iam-names-delete-" + UUID.randomUUID();
|
||||
String allowed = prefix + "/allowed";
|
||||
String denied = prefix + "/denied";
|
||||
try (SsmClient root = AwsTestClients.create(SsmClient.builder(), ACCOUNT, Region.US_EAST_1)) {
|
||||
try {
|
||||
root.putParameter(r -> r.name(allowed).type(ParameterType.STRING).value("v"));
|
||||
root.putParameter(r -> r.name(denied).type(ParameterType.STRING).value("v"));
|
||||
EnforcementFixtures.UserCredentials credentials = user("""
|
||||
{"Version":"2012-10-17","Statement":[
|
||||
{"Effect":"Allow","Action":"ssm:DeleteParameters",
|
||||
"Resource":"arn:aws:ssm:us-east-1:000000000000:parameter/*"},
|
||||
{"Effect":"Deny","Action":"ssm:DeleteParameters",
|
||||
"Resource":"arn:aws:ssm:us-east-1:000000000000:parameter%s"}]}""".formatted(denied));
|
||||
try (SsmClient user = AwsTestClients.create(SsmClient.builder(), credentials.accessKeyId(),
|
||||
Region.US_EAST_1)) {
|
||||
SsmException refused = assertThrows(SsmException.class,
|
||||
() -> user.deleteParameters(r -> r.names(allowed, denied)));
|
||||
assertEquals("AccessDeniedException", refused.awsErrorDetails().errorCode());
|
||||
}
|
||||
assertEquals(2, root.getParameters(r -> r.names(allowed, denied)).parameters().size());
|
||||
} finally {
|
||||
root.deleteParameters(r -> r.names(allowed, denied));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private EnforcementFixtures.UserCredentials user(String policy) {
|
||||
String userName = "ssm-delete-" + UUID.randomUUID();
|
||||
EnforcementFixtures.UserCredentials credentials = EnforcementFixtures.createUser(
|
||||
cleanup, RestAssured.port, auth(ACCOUNT, "iam"), userName);
|
||||
EnforcementFixtures.putUserPolicy(RestAssured.port, auth(ACCOUNT, "iam"), userName, "p", policy);
|
||||
return credentials;
|
||||
}
|
||||
}
|
||||
@@ -1771,6 +1771,73 @@ class SsmIntegrationTest {
|
||||
.body("DeletedParameters", hasSize(2));
|
||||
}
|
||||
|
||||
@Test
|
||||
void taggingRefusesAResourceTypeWhoseTagsAreNotKept() {
|
||||
String name = "tag-type-" + System.nanoTime();
|
||||
putFilterFixture(name, "String", "");
|
||||
|
||||
given()
|
||||
.header("X-Amz-Target", "AmazonSSM.AddTagsToResource")
|
||||
.contentType(SSM_CONTENT_TYPE)
|
||||
.body("""
|
||||
{ "ResourceType": "MaintenanceWindow", "ResourceId": "%s", "Tags": [{"Key": "env", "Value": "dev"}] }
|
||||
""".formatted(name))
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(400)
|
||||
.body("__type", equalTo("InvalidResourceType"));
|
||||
|
||||
given()
|
||||
.header("X-Amz-Target", "AmazonSSM.ListTagsForResource")
|
||||
.contentType(SSM_CONTENT_TYPE)
|
||||
.body("""
|
||||
{ "ResourceType": "Bucket", "ResourceId": "%s" }
|
||||
""".formatted(name))
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(400)
|
||||
.body("__type", equalTo("ValidationException"))
|
||||
.body("message", containsString("'resourceType'"));
|
||||
|
||||
given()
|
||||
.header("X-Amz-Target", "AmazonSSM.RemoveTagsFromResource")
|
||||
.contentType(SSM_CONTENT_TYPE)
|
||||
.body("""
|
||||
{ "ResourceId": "%s", "TagKeys": ["env"] }
|
||||
""".formatted(name))
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(400)
|
||||
.body("__type", equalTo("ValidationException"))
|
||||
.body("message", containsString("'resourceType'"));
|
||||
|
||||
given()
|
||||
.header("X-Amz-Target", "AmazonSSM.DeleteParameter")
|
||||
.contentType(SSM_CONTENT_TYPE)
|
||||
.body("{ \"Name\": \"" + name + "\" }")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200);
|
||||
}
|
||||
|
||||
@Test
|
||||
void getParametersByPathRefusesARequestWithoutAPath() {
|
||||
given()
|
||||
.header("X-Amz-Target", "AmazonSSM.GetParametersByPath")
|
||||
.contentType(SSM_CONTENT_TYPE)
|
||||
.body("{ \"Recursive\": true }")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(400)
|
||||
.body("__type", equalTo("ValidationException"))
|
||||
.body("message", containsString("'path'"));
|
||||
}
|
||||
|
||||
private String parameterArn(String name, String expectedArnSuffix) {
|
||||
return given()
|
||||
.header("X-Amz-Target", "AmazonSSM.GetParameter")
|
||||
|
||||
+301
@@ -0,0 +1,301 @@
|
||||
package io.floci.aws.services.ssm;
|
||||
|
||||
import io.floci.aws.testing.AwsTestClients;
|
||||
import io.floci.aws.testing.EnforcementFixtures;
|
||||
import io.floci.aws.testing.IamEnforcementProfile;
|
||||
import io.floci.aws.testing.PartitionCleanup;
|
||||
import io.floci.aws.testing.RestAssuredJsonUtils;
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
import io.quarkus.test.junit.TestProfile;
|
||||
import io.restassured.RestAssured;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.RegisterExtension;
|
||||
import software.amazon.awssdk.regions.Region;
|
||||
import software.amazon.awssdk.services.ssm.SsmClient;
|
||||
import software.amazon.awssdk.services.ssm.model.GetParametersByPathResponse;
|
||||
import software.amazon.awssdk.services.ssm.model.GetParametersResponse;
|
||||
import software.amazon.awssdk.services.ssm.model.ParameterType;
|
||||
import software.amazon.awssdk.services.ssm.model.SsmException;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import static io.floci.aws.testing.EnforcementFixtures.auth;
|
||||
import static io.restassured.RestAssured.given;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
/**
|
||||
* {@code GetParametersByPath} is checked against the parameter its {@code Path} names, and {@code GetParameters}
|
||||
* against each parameter its {@code Names} give, without the version or label selector a name may carry.
|
||||
*/
|
||||
@QuarkusTest
|
||||
@TestProfile(IamEnforcementProfile.class)
|
||||
class SsmParameterReadIamEnforcementIntegrationTest {
|
||||
|
||||
private static final String ACCOUNT = "000000000000";
|
||||
|
||||
@RegisterExtension
|
||||
final PartitionCleanup cleanup = new PartitionCleanup();
|
||||
|
||||
@BeforeAll
|
||||
static void configureRestAssured() {
|
||||
RestAssuredJsonUtils.configureAwsContentTypes();
|
||||
}
|
||||
|
||||
@Test
|
||||
void aGrantOnAPathAllowsGetParametersByPathOnItAndNoOtherPath() {
|
||||
String prefix = "/iam-path-read-" + UUID.randomUUID();
|
||||
String allowed = prefix + "/config";
|
||||
String other = prefix + "/secrets";
|
||||
try (SsmClient root = AwsTestClients.create(SsmClient.builder(), ACCOUNT, Region.US_EAST_1)) {
|
||||
try {
|
||||
root.putParameter(r -> r.name(allowed + "/key").type(ParameterType.STRING).value("v"));
|
||||
root.putParameter(r -> r.name(other + "/key").type(ParameterType.STRING).value("v"));
|
||||
EnforcementFixtures.UserCredentials credentials = user("""
|
||||
{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":"ssm:GetParametersByPath",
|
||||
"Resource":"arn:aws:ssm:us-east-1:000000000000:parameter%s"}]}""".formatted(allowed));
|
||||
try (SsmClient user = AwsTestClients.create(SsmClient.builder(), credentials.accessKeyId(),
|
||||
Region.US_EAST_1)) {
|
||||
GetParametersByPathResponse listed = user.getParametersByPath(r -> r.path(allowed));
|
||||
assertEquals(1, listed.parameters().size());
|
||||
assertEquals(allowed + "/key", listed.parameters().getFirst().name());
|
||||
|
||||
SsmException denied = assertThrows(SsmException.class,
|
||||
() -> user.getParametersByPath(r -> r.path(other)));
|
||||
assertEquals("AccessDeniedException", denied.awsErrorDetails().errorCode());
|
||||
}
|
||||
} finally {
|
||||
root.deleteParameter(r -> r.name(allowed + "/key"));
|
||||
root.deleteParameter(r -> r.name(other + "/key"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void getParametersNeedsAGrantOnEveryParameterItNames() {
|
||||
String prefix = "/iam-names-read-" + UUID.randomUUID();
|
||||
String allowed = prefix + "/a";
|
||||
String other = prefix + "/b";
|
||||
try (SsmClient root = AwsTestClients.create(SsmClient.builder(), ACCOUNT, Region.US_EAST_1)) {
|
||||
try {
|
||||
root.putParameter(r -> r.name(allowed).type(ParameterType.STRING).value("v"));
|
||||
root.putParameter(r -> r.name(other).type(ParameterType.STRING).value("v"));
|
||||
EnforcementFixtures.UserCredentials credentials = user("""
|
||||
{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":"ssm:GetParameters",
|
||||
"Resource":"arn:aws:ssm:us-east-1:000000000000:parameter%s"}]}""".formatted(allowed));
|
||||
try (SsmClient user = AwsTestClients.create(SsmClient.builder(), credentials.accessKeyId(),
|
||||
Region.US_EAST_1)) {
|
||||
GetParametersResponse read = user.getParameters(r -> r.names(allowed));
|
||||
assertEquals(1, read.parameters().size());
|
||||
|
||||
SsmException denied = assertThrows(SsmException.class,
|
||||
() -> user.getParameters(r -> r.names(allowed, other)));
|
||||
assertEquals("AccessDeniedException", denied.awsErrorDetails().errorCode());
|
||||
}
|
||||
} finally {
|
||||
root.deleteParameter(r -> r.name(allowed));
|
||||
root.deleteParameter(r -> r.name(other));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void aDenyOnAPathRefusesGetParametersByPathOnItWhateverNamesTheBodyCarries() {
|
||||
String prefix = "/iam-path-names-" + UUID.randomUUID();
|
||||
String allowed = prefix + "/allowed";
|
||||
String other = prefix + "/secrets";
|
||||
try (SsmClient root = AwsTestClients.create(SsmClient.builder(), ACCOUNT, Region.US_EAST_1)) {
|
||||
try {
|
||||
root.putParameter(r -> r.name(allowed).type(ParameterType.STRING).value("v"));
|
||||
root.putParameter(r -> r.name(other + "/key").type(ParameterType.STRING).value("v"));
|
||||
EnforcementFixtures.UserCredentials credentials = user("""
|
||||
{"Version":"2012-10-17","Statement":[
|
||||
{"Effect":"Allow","Action":"ssm:GetParametersByPath",
|
||||
"Resource":"arn:aws:ssm:us-east-1:000000000000:parameter/*"},
|
||||
{"Effect":"Deny","Action":"ssm:GetParametersByPath",
|
||||
"Resource":"arn:aws:ssm:us-east-1:000000000000:parameter%s"}]}""".formatted(other));
|
||||
|
||||
given()
|
||||
.header("Authorization", auth(credentials.accessKeyId(), "ssm"))
|
||||
.header("X-Amz-Target", "AmazonSSM.GetParametersByPath")
|
||||
.contentType("application/x-amz-json-1.1")
|
||||
.body("{\"Path\":\"" + other + "\",\"Names\":[\"" + allowed + "\"]}")
|
||||
.when().post("/")
|
||||
.then().statusCode(400).body(containsString("AccessDeniedException"));
|
||||
} finally {
|
||||
root.deleteParameter(r -> r.name(allowed));
|
||||
root.deleteParameter(r -> r.name(other + "/key"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void aGrantOnAParameterAllowsReadingItsVersionsAndLabels() {
|
||||
String name = "/iam-selector-read-" + UUID.randomUUID() + "/db";
|
||||
try (SsmClient root = AwsTestClients.create(SsmClient.builder(), ACCOUNT, Region.US_EAST_1)) {
|
||||
try {
|
||||
root.putParameter(r -> r.name(name).type(ParameterType.STRING).value("v1"));
|
||||
root.putParameter(r -> r.name(name).type(ParameterType.STRING).value("v2").overwrite(true));
|
||||
root.labelParameterVersion(r -> r.name(name).parameterVersion(1L).labels("stable"));
|
||||
String arn = root.getParameter(r -> r.name(name)).parameter().arn();
|
||||
EnforcementFixtures.UserCredentials credentials = user("""
|
||||
{"Version":"2012-10-17","Statement":[{"Effect":"Allow",
|
||||
"Action":["ssm:GetParameter","ssm:GetParameters"],
|
||||
"Resource":"arn:aws:ssm:us-east-1:000000000000:parameter%s"}]}""".formatted(name));
|
||||
try (SsmClient user = AwsTestClients.create(SsmClient.builder(), credentials.accessKeyId(),
|
||||
Region.US_EAST_1)) {
|
||||
assertEquals("v1", user.getParameter(r -> r.name(name + ":1")).parameter().value());
|
||||
assertEquals("v1", user.getParameter(r -> r.name(arn + ":stable")).parameter().value());
|
||||
GetParametersResponse read = user.getParameters(r -> r.names(name + ":2", name + ":stable"));
|
||||
assertEquals(2, read.parameters().size());
|
||||
}
|
||||
} finally {
|
||||
root.deleteParameter(r -> r.name(name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void aDenyOnAParameterRefusesReadingItsVersionsAndLabels() {
|
||||
String name = "/iam-selector-deny-" + UUID.randomUUID() + "/db";
|
||||
try (SsmClient root = AwsTestClients.create(SsmClient.builder(), ACCOUNT, Region.US_EAST_1)) {
|
||||
try {
|
||||
root.putParameter(r -> r.name(name).type(ParameterType.STRING).value("v1"));
|
||||
root.labelParameterVersion(r -> r.name(name).parameterVersion(1L).labels("stable"));
|
||||
String arn = root.getParameter(r -> r.name(name)).parameter().arn();
|
||||
EnforcementFixtures.UserCredentials credentials = user("""
|
||||
{"Version":"2012-10-17","Statement":[
|
||||
{"Effect":"Allow","Action":["ssm:GetParameter","ssm:GetParameters"],
|
||||
"Resource":"arn:aws:ssm:us-east-1:000000000000:parameter/*"},
|
||||
{"Effect":"Deny","Action":["ssm:GetParameter","ssm:GetParameters"],
|
||||
"Resource":"arn:aws:ssm:us-east-1:000000000000:parameter%s"}]}""".formatted(name));
|
||||
try (SsmClient user = AwsTestClients.create(SsmClient.builder(), credentials.accessKeyId(),
|
||||
Region.US_EAST_1)) {
|
||||
for (String selected : new String[] {name + ":1", name + ":stable", arn + ":stable"}) {
|
||||
SsmException denied = assertThrows(SsmException.class,
|
||||
() -> user.getParameter(r -> r.name(selected)));
|
||||
assertEquals("AccessDeniedException", denied.awsErrorDetails().errorCode());
|
||||
SsmException batchDenied = assertThrows(SsmException.class,
|
||||
() -> user.getParameters(r -> r.names(selected)));
|
||||
assertEquals("AccessDeniedException", batchDenied.awsErrorDetails().errorCode());
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
root.deleteParameter(r -> r.name(name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void aDoubleSlashArnDoesNotReadTheParameterADenyCovers() {
|
||||
String name = "/iam-double-slash-" + UUID.randomUUID();
|
||||
String doubleSlashArn = "arn:aws:ssm:us-east-1:000000000000:parameter/" + name;
|
||||
try (SsmClient root = AwsTestClients.create(SsmClient.builder(), ACCOUNT, Region.US_EAST_1)) {
|
||||
try {
|
||||
root.putParameter(r -> r.name(name).type(ParameterType.STRING).value("v1"));
|
||||
root.labelParameterVersion(r -> r.name(name).parameterVersion(1L).labels("stable"));
|
||||
EnforcementFixtures.UserCredentials credentials = user("""
|
||||
{"Version":"2012-10-17","Statement":[
|
||||
{"Effect":"Allow","Action":["ssm:GetParameter","ssm:GetParameters"],
|
||||
"Resource":"arn:aws:ssm:us-east-1:000000000000:parameter/*"},
|
||||
{"Effect":"Deny","Action":["ssm:GetParameter","ssm:GetParameters"],
|
||||
"Resource":"arn:aws:ssm:us-east-1:000000000000:parameter%s"}]}""".formatted(name));
|
||||
try (SsmClient user = AwsTestClients.create(SsmClient.builder(), credentials.accessKeyId(),
|
||||
Region.US_EAST_1)) {
|
||||
for (String selected : new String[] {doubleSlashArn, doubleSlashArn + ":stable"}) {
|
||||
SsmException refused = assertThrows(SsmException.class,
|
||||
() -> user.getParameter(r -> r.name(selected)));
|
||||
assertEquals("ParameterNotFound", refused.awsErrorDetails().errorCode());
|
||||
GetParametersResponse read = user.getParameters(r -> r.names(selected));
|
||||
assertEquals(0, read.parameters().size());
|
||||
assertEquals(List.of(selected), read.invalidParameters());
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
root.deleteParameter(r -> r.name(name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void aGrantOnAParameterWithoutALeadingSlashAllowsReadingItsVersion() {
|
||||
String name = "iam-unslashed-read-" + UUID.randomUUID();
|
||||
try (SsmClient root = AwsTestClients.create(SsmClient.builder(), ACCOUNT, Region.US_EAST_1)) {
|
||||
try {
|
||||
root.putParameter(r -> r.name(name).type(ParameterType.STRING).value("v1"));
|
||||
EnforcementFixtures.UserCredentials credentials = user("""
|
||||
{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":"ssm:GetParameter",
|
||||
"Resource":"arn:aws:ssm:us-east-1:000000000000:parameter/%s"}]}""".formatted(name));
|
||||
try (SsmClient user = AwsTestClients.create(SsmClient.builder(), credentials.accessKeyId(),
|
||||
Region.US_EAST_1)) {
|
||||
assertEquals("v1", user.getParameter(r -> r.name(name + ":1")).parameter().value());
|
||||
assertEquals("v1", user.getParameter(
|
||||
r -> r.name("arn:aws:ssm:us-east-1:000000000000:parameter/" + name)).parameter().value());
|
||||
}
|
||||
} finally {
|
||||
root.deleteParameter(r -> r.name(name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void aGrantOnADoubleSlashArnAllowsOnlyThatArnThrough() {
|
||||
String name = "/iam-double-slash-grant-" + UUID.randomUUID();
|
||||
String doubleSlashArn = "arn:aws:ssm:us-east-1:000000000000:parameter/" + name;
|
||||
try (SsmClient root = AwsTestClients.create(SsmClient.builder(), ACCOUNT, Region.US_EAST_1)) {
|
||||
try {
|
||||
root.putParameter(r -> r.name(name).type(ParameterType.STRING).value("v1"));
|
||||
EnforcementFixtures.UserCredentials credentials = user("""
|
||||
{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":"ssm:GetParameter",
|
||||
"Resource":"%s"}]}""".formatted(doubleSlashArn));
|
||||
try (SsmClient user = AwsTestClients.create(SsmClient.builder(), credentials.accessKeyId(),
|
||||
Region.US_EAST_1)) {
|
||||
SsmException missing = assertThrows(SsmException.class,
|
||||
() -> user.getParameter(r -> r.name(doubleSlashArn)));
|
||||
assertEquals("ParameterNotFound", missing.awsErrorDetails().errorCode());
|
||||
|
||||
SsmException denied = assertThrows(SsmException.class,
|
||||
() -> user.getParameter(r -> r.name(name)));
|
||||
assertEquals("AccessDeniedException", denied.awsErrorDetails().errorCode());
|
||||
}
|
||||
} finally {
|
||||
root.deleteParameter(r -> r.name(name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void aDenyOnTheRootPathRefusesGetParametersByPathOnItAndWithoutAPath() {
|
||||
EnforcementFixtures.UserCredentials credentials = user("""
|
||||
{"Version":"2012-10-17","Statement":[
|
||||
{"Effect":"Allow","Action":"ssm:GetParametersByPath",
|
||||
"Resource":"arn:aws:ssm:us-east-1:000000000000:parameter/*"},
|
||||
{"Effect":"Deny","Action":"ssm:GetParametersByPath",
|
||||
"Resource":"arn:aws:ssm:us-east-1:000000000000:parameter/"}]}""");
|
||||
try (SsmClient user = AwsTestClients.create(SsmClient.builder(), credentials.accessKeyId(),
|
||||
Region.US_EAST_1)) {
|
||||
SsmException denied = assertThrows(SsmException.class,
|
||||
() -> user.getParametersByPath(r -> r.path("/").recursive(true)));
|
||||
assertEquals("AccessDeniedException", denied.awsErrorDetails().errorCode());
|
||||
}
|
||||
|
||||
given()
|
||||
.header("Authorization", auth(credentials.accessKeyId(), "ssm"))
|
||||
.header("X-Amz-Target", "AmazonSSM.GetParametersByPath")
|
||||
.contentType("application/x-amz-json-1.1")
|
||||
.body("{\"Recursive\":true}")
|
||||
.when().post("/")
|
||||
.then().statusCode(400).body(containsString("AccessDeniedException"));
|
||||
}
|
||||
|
||||
private EnforcementFixtures.UserCredentials user(String policy) {
|
||||
String userName = "ssm-read-" + UUID.randomUUID();
|
||||
EnforcementFixtures.UserCredentials credentials = EnforcementFixtures.createUser(
|
||||
cleanup, RestAssured.port, auth(ACCOUNT, "iam"), userName);
|
||||
EnforcementFixtures.putUserPolicy(RestAssured.port, auth(ACCOUNT, "iam"), userName, "p", policy);
|
||||
return credentials;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,191 @@
|
||||
package io.floci.aws.services.ssm;
|
||||
|
||||
import io.floci.aws.testing.AwsTestClients;
|
||||
import io.floci.aws.testing.EnforcementFixtures;
|
||||
import io.floci.aws.testing.IamEnforcementProfile;
|
||||
import io.floci.aws.testing.PartitionCleanup;
|
||||
import io.floci.aws.testing.RestAssuredJsonUtils;
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
import io.quarkus.test.junit.TestProfile;
|
||||
import io.restassured.RestAssured;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.RegisterExtension;
|
||||
import software.amazon.awssdk.regions.Region;
|
||||
import software.amazon.awssdk.services.ssm.SsmClient;
|
||||
import software.amazon.awssdk.services.ssm.model.ParameterType;
|
||||
import software.amazon.awssdk.services.ssm.model.ResourceTypeForTagging;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import static io.floci.aws.testing.EnforcementFixtures.auth;
|
||||
import static io.restassured.RestAssured.given;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
/** The tagging actions are checked against the parameter their {@code ResourceId} names. */
|
||||
@QuarkusTest
|
||||
@TestProfile(IamEnforcementProfile.class)
|
||||
class SsmTaggingIamEnforcementIntegrationTest {
|
||||
|
||||
private static final String ACCOUNT = "000000000000";
|
||||
|
||||
@RegisterExtension
|
||||
final PartitionCleanup cleanup = new PartitionCleanup();
|
||||
|
||||
@BeforeAll
|
||||
static void configureRestAssured() {
|
||||
RestAssuredJsonUtils.configureAwsContentTypes();
|
||||
}
|
||||
|
||||
@Test
|
||||
void aDenyOnAParameterRefusesTaggingItWhateverNameTheBodyCarries() {
|
||||
String prefix = "/iam-tagging-" + UUID.randomUUID();
|
||||
String allowed = prefix + "/allowed";
|
||||
String denied = prefix + "/denied";
|
||||
try (SsmClient root = AwsTestClients.create(SsmClient.builder(), ACCOUNT, Region.US_EAST_1)) {
|
||||
try {
|
||||
root.putParameter(r -> r.name(allowed).type(ParameterType.STRING).value("v"));
|
||||
root.putParameter(r -> r.name(denied).type(ParameterType.STRING).value("v"));
|
||||
String userName = "ssm-tagging-" + UUID.randomUUID();
|
||||
EnforcementFixtures.UserCredentials credentials = EnforcementFixtures.createUser(
|
||||
cleanup, RestAssured.port, auth(ACCOUNT, "iam"), userName);
|
||||
EnforcementFixtures.putUserPolicy(RestAssured.port, auth(ACCOUNT, "iam"), userName, "p", """
|
||||
{"Version":"2012-10-17","Statement":[
|
||||
{"Effect":"Allow","Action":["ssm:AddTagsToResource","ssm:ListTagsForResource",
|
||||
"ssm:RemoveTagsFromResource"],"Resource":"*"},
|
||||
{"Effect":"Deny","Action":["ssm:AddTagsToResource","ssm:ListTagsForResource",
|
||||
"ssm:RemoveTagsFromResource"],
|
||||
"Resource":"arn:aws:ssm:us-east-1:000000000000:parameter%s"}]}""".formatted(denied));
|
||||
|
||||
for (String operation : new String[] {"AddTagsToResource", "ListTagsForResource",
|
||||
"RemoveTagsFromResource"}) {
|
||||
given()
|
||||
.header("Authorization", auth(credentials.accessKeyId(), "ssm"))
|
||||
.header("X-Amz-Target", "AmazonSSM." + operation)
|
||||
.contentType("application/x-amz-json-1.1")
|
||||
.body("{\"ResourceType\":\"Parameter\",\"ResourceId\":\"" + denied + "\",\"Name\":\""
|
||||
+ allowed + "\",\"Tags\":[{\"Key\":\"team\",\"Value\":\"x\"}],"
|
||||
+ "\"TagKeys\":[\"team\"]}")
|
||||
.when().post("/")
|
||||
.then().statusCode(400).body(containsString("AccessDeniedException"));
|
||||
}
|
||||
|
||||
given()
|
||||
.header("Authorization", auth(credentials.accessKeyId(), "ssm"))
|
||||
.header("X-Amz-Target", "AmazonSSM.AddTagsToResource")
|
||||
.contentType("application/x-amz-json-1.1")
|
||||
.body("{\"ResourceType\":\"Parameter\",\"ResourceId\":\"" + allowed + "\",\"Name\":\""
|
||||
+ denied + "\",\"Tags\":[{\"Key\":\"team\",\"Value\":\"x\"}]}")
|
||||
.when().post("/")
|
||||
.then().statusCode(200);
|
||||
|
||||
assertTrue(root.listTagsForResource(r -> r.resourceType(ResourceTypeForTagging.PARAMETER)
|
||||
.resourceId(denied)).tagList().isEmpty());
|
||||
} finally {
|
||||
root.deleteParameter(r -> r.name(denied));
|
||||
root.deleteParameter(r -> r.name(allowed));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void aDenyOnAParameterRefusesTaggingItByItsArnInAnotherRegion() {
|
||||
String denied = "/iam-tagging-" + UUID.randomUUID() + "/denied";
|
||||
try (SsmClient root = AwsTestClients.create(SsmClient.builder(), ACCOUNT, Region.US_EAST_1)) {
|
||||
try {
|
||||
root.putParameter(r -> r.name(denied).type(ParameterType.STRING).value("v"));
|
||||
String userName = "ssm-tagging-" + UUID.randomUUID();
|
||||
EnforcementFixtures.UserCredentials credentials = EnforcementFixtures.createUser(
|
||||
cleanup, RestAssured.port, auth(ACCOUNT, "iam"), userName);
|
||||
EnforcementFixtures.putUserPolicy(RestAssured.port, auth(ACCOUNT, "iam"), userName, "p", """
|
||||
{"Version":"2012-10-17","Statement":[
|
||||
{"Effect":"Allow","Action":"ssm:AddTagsToResource","Resource":"*"},
|
||||
{"Effect":"Deny","Action":"ssm:AddTagsToResource",
|
||||
"Resource":"arn:aws:ssm:us-east-1:000000000000:parameter%s"}]}""".formatted(denied));
|
||||
|
||||
given()
|
||||
.header("Authorization", auth(credentials.accessKeyId(), "ssm"))
|
||||
.header("X-Amz-Target", "AmazonSSM.AddTagsToResource")
|
||||
.contentType("application/x-amz-json-1.1")
|
||||
.body("{\"ResourceType\":\"Parameter\",\"ResourceId\":\"arn:aws:ssm:us-west-2:"
|
||||
+ ACCOUNT + ":parameter" + denied
|
||||
+ "\",\"Tags\":[{\"Key\":\"team\",\"Value\":\"x\"}]}")
|
||||
.when().post("/")
|
||||
.then().statusCode(400).body(containsString("AccessDeniedException"));
|
||||
|
||||
assertTrue(root.listTagsForResource(r -> r.resourceType(ResourceTypeForTagging.PARAMETER)
|
||||
.resourceId(denied)).tagList().isEmpty());
|
||||
} finally {
|
||||
root.deleteParameter(r -> r.name(denied));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void aGrantOnAParameterAllowsTaggingItWhateverNameTheBodyCarries() {
|
||||
String prefix = "/iam-tagging-grant-" + UUID.randomUUID();
|
||||
String allowed = prefix + "/allowed";
|
||||
String other = prefix + "/other";
|
||||
try (SsmClient root = AwsTestClients.create(SsmClient.builder(), ACCOUNT, Region.US_EAST_1)) {
|
||||
try {
|
||||
root.putParameter(r -> r.name(allowed).type(ParameterType.STRING).value("v"));
|
||||
root.putParameter(r -> r.name(other).type(ParameterType.STRING).value("v"));
|
||||
String userName = "ssm-tagging-" + UUID.randomUUID();
|
||||
EnforcementFixtures.UserCredentials credentials = EnforcementFixtures.createUser(
|
||||
cleanup, RestAssured.port, auth(ACCOUNT, "iam"), userName);
|
||||
EnforcementFixtures.putUserPolicy(RestAssured.port, auth(ACCOUNT, "iam"), userName, "p", """
|
||||
{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":"ssm:AddTagsToResource",
|
||||
"Resource":"arn:aws:ssm:us-east-1:000000000000:parameter%s"}]}""".formatted(allowed));
|
||||
|
||||
given()
|
||||
.header("Authorization", auth(credentials.accessKeyId(), "ssm"))
|
||||
.header("X-Amz-Target", "AmazonSSM.AddTagsToResource")
|
||||
.contentType("application/x-amz-json-1.1")
|
||||
.body("{\"ResourceType\":\"Parameter\",\"ResourceId\":\"" + allowed + "\",\"Name\":\""
|
||||
+ other + "\",\"Tags\":[{\"Key\":\"team\",\"Value\":\"x\"}]}")
|
||||
.when().post("/")
|
||||
.then().statusCode(200);
|
||||
|
||||
assertTrue(root.listTagsForResource(r -> r.resourceType(ResourceTypeForTagging.PARAMETER)
|
||||
.resourceId(other)).tagList().isEmpty());
|
||||
} finally {
|
||||
root.deleteParameter(r -> r.name(other));
|
||||
root.deleteParameter(r -> r.name(allowed));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void aLegacyArnWithoutParameterSlashIsCheckedAgainstTheParameterItTags() {
|
||||
String denied = "iam-tagging-legacy-" + UUID.randomUUID();
|
||||
try (SsmClient root = AwsTestClients.create(SsmClient.builder(), ACCOUNT, Region.US_EAST_1)) {
|
||||
try {
|
||||
root.putParameter(r -> r.name(denied).type(ParameterType.STRING).value("v"));
|
||||
String userName = "ssm-tagging-" + UUID.randomUUID();
|
||||
EnforcementFixtures.UserCredentials credentials = EnforcementFixtures.createUser(
|
||||
cleanup, RestAssured.port, auth(ACCOUNT, "iam"), userName);
|
||||
EnforcementFixtures.putUserPolicy(RestAssured.port, auth(ACCOUNT, "iam"), userName, "p", """
|
||||
{"Version":"2012-10-17","Statement":[
|
||||
{"Effect":"Allow","Action":"ssm:AddTagsToResource","Resource":"*"},
|
||||
{"Effect":"Deny","Action":"ssm:AddTagsToResource",
|
||||
"Resource":"arn:aws:ssm:us-east-1:000000000000:parameter/%s"}]}""".formatted(denied));
|
||||
|
||||
given()
|
||||
.header("Authorization", auth(credentials.accessKeyId(), "ssm"))
|
||||
.header("X-Amz-Target", "AmazonSSM.AddTagsToResource")
|
||||
.contentType("application/x-amz-json-1.1")
|
||||
.body("{\"ResourceType\":\"Parameter\",\"ResourceId\":\"arn:aws:ssm:us-east-1:"
|
||||
+ ACCOUNT + ":parameter" + denied
|
||||
+ "\",\"Tags\":[{\"Key\":\"team\",\"Value\":\"x\"}]}")
|
||||
.when().post("/")
|
||||
.then().statusCode(400).body(containsString("AccessDeniedException"));
|
||||
|
||||
assertTrue(root.listTagsForResource(r -> r.resourceType(ResourceTypeForTagging.PARAMETER)
|
||||
.resourceId(denied)).tagList().isEmpty());
|
||||
} finally {
|
||||
root.deleteParameter(r -> r.name(denied));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,10 @@ strings, or, for an ARN, a member of a structure or of each element of a list of
|
||||
`${SecurityGroupId}`), and it is a name for a name and an id for an id (an `Identifier` either),
|
||||
or the member is a bare `Name`, `Id` or `Identifier`, the variable is named after the type and the
|
||||
operation is about the type, its name past the verb the type's (`DescribeTargetGroups`, but not
|
||||
`StartExecution` for a state machine, whose `name` is the execution's), and no member holds its ARN.
|
||||
`StartExecution` for a state machine, whose `name` is the execution's), and no member holds its ARN,
|
||||
or, when no member does either, a string member whose botocore shape is named after the type (Parameter Store's
|
||||
`GetParametersByPath` names a hierarchy by a `Path` holding a `PSParameterName`, as `GetParameterHistory` names a
|
||||
parameter by its `Name`).
|
||||
Of several members that could fill a variable, one naming the type before the variable wins over a
|
||||
bare one: the snapshot `RestoreFromClusterSnapshot` restores has the cluster its
|
||||
`SnapshotClusterIdentifier` names, not the `ClusterIdentifier` of the cluster it creates, and the
|
||||
@@ -119,9 +122,11 @@ request, never from a member a caller could add. `CLIENTS_NOT_READ` are SDK clie
|
||||
namespace's operations whose requests Floci does not serve, each with its reason.
|
||||
`UNQUALIFIED` are the resource types whose ARN a request may give with a qualifier, one more `:<name>`
|
||||
past its format, and whose service checks it without one: Step Functions checks a version or an alias
|
||||
on its state machine's ARN. `MINTED_IDS` are the resource types whose service follows the name their
|
||||
format ends in with an id it mints, `/<id>`, which the format leaves out and a request naming one by
|
||||
its name does not give: EventBridge's connections and API destinations, whose stored ARN the reader
|
||||
on its state machine's ARN, and Parameter Store a version or a label on its parameter's. A value filling a variable
|
||||
named `...WithoutLeadingSlash` is read as a Parameter Store name, without the whitespace around it and one leading
|
||||
`/`: a parameter's ARN is `parameter/<name>`, whether or not its name starts with a slash. `MINTED_IDS` are the
|
||||
resource types whose service follows the name their format ends in with an id it mints, `/<id>`, which the
|
||||
format leaves out and a request naming one by its name does not give: EventBridge's connections and API destinations, whose stored ARN the reader
|
||||
asks the service for, or else checks with that id open. `FOUND_BY` are the resource types whose ARN is
|
||||
all an id their service mints, which a request names by members the ARN does not hold, with those
|
||||
members: each operation whose request has them all names the type by them (`find`), and the reader
|
||||
@@ -185,8 +190,8 @@ NAMESPACES = ("access-analyzer", "account", "acm", "application-autoscaling", "a
|
||||
"datasync", "ec2", "ecr", "elasticloadbalancing", "elasticmapreduce", "emr-serverless", "es", "events",
|
||||
"firehose", "fis", "globalaccelerator", "inspector2", "kinesisanalytics", "macie2", "oam",
|
||||
"payment-cryptography", "quicksight", "ram", "redshift", "redshift-data", "redshift-serverless",
|
||||
"rekognition", "resource-explorer-2", "route53", "servicediscovery", "servicequotas", "sso", "states", "textract",
|
||||
"timestream-influxdb", "translate", "signer", "xray", "securityhub", "guardduty")
|
||||
"rekognition", "resource-explorer-2", "route53", "servicediscovery", "servicequotas", "ssm", "sso",
|
||||
"states", "textract", "timestream-influxdb", "translate", "signer", "xray", "securityhub", "guardduty")
|
||||
|
||||
# SDK clients the reference lists for a namespace's operations whose requests Floci does not serve, and why: their
|
||||
# members are not read.
|
||||
@@ -205,7 +210,7 @@ QUALIFIED_MEMBERS = ("payment-cryptography",)
|
||||
|
||||
# The namespaces whose resources ResourceArnBuilder builds itself.
|
||||
HAND_BUILT = ("apigateway", "bedrock", "dsql", "dynamodb", "eks", "iam", "kinesis", "kms", "lambda", "logs", "pipes",
|
||||
"resource-groups", "s3", "scheduler", "secretsmanager", "sns", "sqs", "ssm", "sts")
|
||||
"resource-groups", "s3", "scheduler", "secretsmanager", "sns", "sqs", "sts")
|
||||
|
||||
# Operations of a namespace in `HAND_BUILT` read from the reference all the same, each with its reason.
|
||||
_LOGS_DELIVERY = ("CloudWatch Logs vended-log delivery: its requests name a delivery source, destination or delivery "
|
||||
@@ -221,12 +226,6 @@ READ_IN_HAND_BUILT["logs:PutDestination"] = (
|
||||
"CloudWatch Logs destination creation names the destination by destinationName, which ResourceArnBuilder "
|
||||
"reads from the generated request-resource table")
|
||||
|
||||
_SSM_TAGS = ("SSM tagging: a request names its resource by ResourceType and ResourceId, or tags the document or "
|
||||
"association it creates, which the rule reads, while ResourceArnBuilder keeps building the parameter ARNs")
|
||||
READ_IN_HAND_BUILT.update({f"ssm:{operation}": _SSM_TAGS
|
||||
for operation in ("AddTagsToResource", "ListTagsForResource", "RemoveTagsFromResource",
|
||||
"CreateDocument", "CreateAssociation")})
|
||||
|
||||
_LATER = "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint"
|
||||
_REST = ("REST: its requests name their resources in the path, which RequestResources reads from the route a request "
|
||||
"matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet")
|
||||
@@ -594,6 +593,10 @@ UNQUALIFIED: dict[str, str] = {
|
||||
"states:statemachine": "Step Functions authorizes a version or an alias on its state machine's ARN, not on the "
|
||||
"version's or the alias's ('To authorize a version or an alias to invoke an API action, "
|
||||
"Step Functions uses the state machine's ARN instead of using the version ARN or alias ARN')",
|
||||
"ssm:parameter": "Parameter Store reads a version or a label after a parameter's name ('To query by parameter "
|
||||
"label, use \"Name\": \"name:label\". To query by parameter version, use \"Name\": "
|
||||
"\"name:version\"', GetParameter's Name) and checks the read on the parameter, whose name "
|
||||
"holds no colon",
|
||||
}
|
||||
|
||||
# Resource types whose service follows the one variable their format ends in with an id it mints, `/<id>`,
|
||||
@@ -896,6 +899,19 @@ def request_members(models: dict[str, dict], operation: str) -> dict[str, str]:
|
||||
return found
|
||||
|
||||
|
||||
def member_shapes(models: dict[str, dict], operation: str) -> dict[str, str]:
|
||||
"""The botocore shape each top-level member of the operation's request holds, by member name, across the request's
|
||||
clients."""
|
||||
found: dict[str, str] = {}
|
||||
for model in models.values():
|
||||
spec = model["operations"].get(operation)
|
||||
if spec is None or "input" not in spec:
|
||||
continue
|
||||
for name, member in model["shapes"][spec["input"]["shape"]].get("members", {}).items():
|
||||
found.setdefault(name, member["shape"])
|
||||
return found
|
||||
|
||||
|
||||
def enum_members(models: dict[str, dict], operation: str) -> dict[str, set[str]]:
|
||||
"""The top-level string members of the operation's request that this file reads, with the values their enum
|
||||
lists; a member with no enum is left out."""
|
||||
@@ -1212,9 +1228,11 @@ def compatible(member: str, variable: str) -> bool:
|
||||
|
||||
|
||||
def resources_for(operation: str, types: list[str], formats: dict[str, str], members: dict[str, str],
|
||||
arn_members: set[str] | None = None, labels: dict[str, str] | None = None) -> list[dict]:
|
||||
arn_members: set[str] | None = None, labels: dict[str, str] | None = None,
|
||||
shapes: dict[str, str] | None = None) -> list[dict]:
|
||||
"""The resources the rule finds the operation's request naming, as vendored entries. `labels` gives the path
|
||||
segment before each bare member a REST request carries as a path label, stemmed (`path_labels`)."""
|
||||
segment before each bare member a REST request carries as a path label, stemmed (`path_labels`), and `shapes` the
|
||||
botocore shape each member holds (`member_shapes`)."""
|
||||
name = operation.split(":", 1)[1]
|
||||
created = stem(CREATING_RE.sub("", name)) if CREATING_RE.match(name) else None
|
||||
subject = stem(SUBJECT_RE.sub("", name))
|
||||
@@ -1249,7 +1267,8 @@ def resources_for(operation: str, types: list[str], formats: dict[str, str], mem
|
||||
fill: dict[str, str] = {}
|
||||
for variable in sorted(variables, key=lambda v: (v == in_slot, kind_of(v) == "", v)):
|
||||
choice = _filling(variable, kind_stem, len(variables), {m: p for m, p in names.items() if m not in fill.values()},
|
||||
bare=bare, qualified=namespace_of(operation) in QUALIFIED_MEMBERS)
|
||||
bare=bare, qualified=namespace_of(operation) in QUALIFIED_MEMBERS,
|
||||
shapes=shapes if not held else None)
|
||||
if choice is not None:
|
||||
fill[variable] = choice
|
||||
used[kind] = choice
|
||||
@@ -1367,11 +1386,12 @@ def by_members_key_is_empty(kinds: list[str], filled: dict[str, dict[str, str]])
|
||||
|
||||
|
||||
def _filling(variable: str, kind_stem: str, variables: int, names: dict[str, str], bare: set[str],
|
||||
qualified: bool = False) -> str | None:
|
||||
qualified: bool = False, shapes: dict[str, str] | None = None) -> str | None:
|
||||
"""The member that fills the variable: one of a compatible kind whose stem relates to the variable's,
|
||||
or, for the variable named after the type or a type's only one, a member named after the type, or a
|
||||
bare `Name` or `Id` among those `bare` gives, of a compatible kind; the closest of them, and a string
|
||||
before a list."""
|
||||
bare `Name` or `Id` among those `bare` gives, of a compatible kind, or else a string member whose botocore
|
||||
shape is named after the type, of a compatible kind (Parameter Store's `Path` and `GetParameterHistory`'s
|
||||
`Name` hold a `PSParameterName`); the closest of them, and a string before a list."""
|
||||
variable_stem = stem(variable)
|
||||
candidates = [member for member in names
|
||||
if stem(member) and related(stem(member), variable_stem) and compatible(member, variable)]
|
||||
@@ -1380,6 +1400,10 @@ def _filling(variable: str, kind_stem: str, variables: int, names: dict[str, str
|
||||
and ((member in bare and member.lower() in BARE)
|
||||
or (stem(member) and (related(stem(member), kind_stem)
|
||||
or (qualified and names_type(member, kind_stem)))))]
|
||||
if not candidates and (related(variable_stem, kind_stem) or variables == 1):
|
||||
candidates = [member for member in names if member in (shapes or {}) and not names[member].endswith("[]")
|
||||
and "." not in member and stem(shapes[member]) and related(stem(shapes[member]), kind_stem)
|
||||
and compatible(shapes[member], variable) and compatible(member, variable)]
|
||||
if not candidates:
|
||||
return None
|
||||
# A member naming the type before the variable (`SnapshotClusterIdentifier` for the snapshot's `ClusterName`,
|
||||
@@ -1492,7 +1516,8 @@ def entry_for(operation: str, upstream: dict, formats: dict[str, str], models: d
|
||||
resources = picked_by_enum(types, formats, members, enum_members(models, operation.split(":", 1)[1]))
|
||||
if resources is None:
|
||||
resources = with_through(with_found(with_parent_ids(resources_for(operation, types, formats, members,
|
||||
arn_members, labels),
|
||||
arn_members, labels,
|
||||
member_shapes(models, operation.split(":", 1)[1])),
|
||||
formats, types, members),
|
||||
namespace_of(operation), types, members),
|
||||
namespace_of(operation), types, members)
|
||||
|
||||
@@ -919,7 +919,7 @@ def test_the_vendored_file_is_well_formed():
|
||||
for operation, entry in operations.items() if operation.startswith("events:")
|
||||
and "endpoint" in json.dumps(entry) for resource in entry["resources"])
|
||||
# A state machine's version or alias is checked on the state machine.
|
||||
assert document["unqualified"] == {"states": ["statemachine"]}
|
||||
assert document["unqualified"] == {"ssm": ["parameter"], "states": ["statemachine"]}
|
||||
# A listener is made under a load balancer, and a rule under a listener.
|
||||
assert operations["elasticloadbalancing:CreateListener"]["creates"] == [
|
||||
{"type": f"listener/{kind}", "parent": f"loadbalancer/{kind}/", "arn": "LoadBalancerArn"}
|
||||
@@ -1317,3 +1317,14 @@ def test_an_enum_value_picks_a_type_ignoring_case_and_hyphens_and_the_resource_i
|
||||
"when": {"ResourceType": ["ManagedInstance"]}},
|
||||
{"type": "parameter", "fill": {"ParameterNameWithoutLeadingSlash": "ResourceId"},
|
||||
"when": {"ResourceType": ["Parameter"]}}]
|
||||
|
||||
|
||||
def test_a_member_whose_shape_is_named_after_the_type_names_it():
|
||||
assert r.resources_for("svc:GetThingsByPath", ["thing"], FORMATS, members("Path"),
|
||||
shapes={"Path": "ThingName"}) == [{"type": "thing", "fill": {"ThingName": "Path"}}]
|
||||
assert r.resources_for("svc:GetThingsByPath", ["thing"], FORMATS, members("Path")) == []
|
||||
# A shape named for something else, a shape of another kind, or a list names nothing.
|
||||
assert r.resources_for("svc:GetThingsByPath", ["thing"], FORMATS, members("Path"), shapes={"Path": "PathString"}) == []
|
||||
assert r.resources_for("svc:GetPoolsByPath", ["pool"], FORMATS, members("Path"), shapes={"Path": "PoolName"}) == []
|
||||
assert r.resources_for("svc:GetThingsByPath", ["thing"], FORMATS, members("Paths[]"),
|
||||
shapes={"Paths": "ThingName"}) == []
|
||||
Reference in new issue
Block a user