mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix(iam): check OpenSearch's, S3 Tables' and EKS's list calls on the resources AWS checks them on (#9258)
es:ListDomainNames, s3tables:ListTableBuckets and eks:ListClusters act on no resource type in the Service Reference, so Floci checked them on * and refused a policy scoped to domain/*, bucket/* or cluster/*. AWS checks each on that wildcard, as measured in #9039. Each is now a MEASURED entry of the request-resources generator with that measurement as its evidence, and the table is regenerated with only these three operations changed. Part of #9039.
This commit is contained in:
1 parent
5c7ab956f9
commit
2219ec72c2
4 files changed
+46
-5
No files matched your search
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"_source": {"generator": "tools/aws/regen_iam_request_resources.py", "reference": "https://servicereference.us-east-1.amazonaws.com/", "botocore": "botocore 1.44.9 (local/aws/botocore)", "retrieved": "2026-11-22", "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."},
|
||||
"_source": {"generator": "tools/aws/regen_iam_request_resources.py", "reference": "https://servicereference.us-east-1.amazonaws.com/", "botocore": "botocore 1.44.9 (local/aws/botocore)", "retrieved": "2026-11-23", "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"], "apigateway": ["apigateway", "apigatewayv2"], "application-autoscaling": ["application-autoscaling"], "aps": ["amp"], "athena": ["athena"], "bcm-data-exports": ["bcm-data-exports"], "bcm-pricing-calculator": ["bcm-pricing-calculator"], "bedrock": ["bedrock", "bedrock-agent", "bedrock-agent-runtime", "bedrock-data-automation", "bedrock-data-automation-runtime", "bedrock-runtime"], "budgets": ["budgets"], "ce": ["ce"], "cloudformation": ["cloudcontrol", "cloudformation"], "cloudfront": ["cloudfront"], "cloudfront-keyvaluestore": ["cloudfront-keyvaluestore"], "cloudtrail": ["cloudtrail"], "codebuild": ["codebuild"], "codepipeline": ["codepipeline"], "cognito-identity": ["cognito-identity"], "cognito-idp": ["cognito-idp"], "controlcatalog": ["controlcatalog"], "controltower": ["controltower"], "cur": ["cur"], "datasync": ["datasync"], "dsql": ["dsql"], "dynamodb": ["dynamodb", "dynamodbstreams"], "ec2": ["ec2"], "ec2-instance-connect": ["ec2-instance-connect"], "ecr": ["ecr"], "ecs": ["ecs"], "eks": ["eks"], "elasticloadbalancing": ["elb", "elbv2"], "elasticmapreduce": ["emr"], "emr-containers": ["emr-containers"], "emr-serverless": ["emr-serverless"], "es": ["es", "opensearch"], "events": ["eventbridgev2", "events"], "firehose": ["firehose"], "fis": ["fis"], "globalaccelerator": ["globalaccelerator"], "glue": ["glue"], "guardduty": ["guardduty"], "iam": ["iam", "iam-toolbox"], "inspector2": ["inspector2"], "kinesis": ["kinesis"], "kinesisanalytics": ["kinesisanalytics", "kinesisanalyticsv2"], "kms": ["kms"], "lambda": ["lambda", "lambda-core", "lambda-microvms", "lambda-web"], "logs": ["logs"], "macie2": ["macie2"], "oam": ["oam"], "payment-cryptography": ["payment-cryptography", "payment-cryptography-data"], "pipes": ["pipes"], "quicksight": ["quicksight"], "ram": ["ram"], "rds": ["docdb", "neptune", "rds"], "redshift": ["redshift"], "redshift-data": ["redshift-data"], "redshift-serverless": ["redshift-serverless"], "rekognition": ["rekognition"], "resource-explorer-2": ["resource-explorer-2"], "resource-groups": ["resource-groups"], "route53": ["route53"], "s3": ["s3", "s3control"], "s3tables": ["s3tables"], "s3vectors": ["s3vectors"], "scheduler": ["scheduler"], "secretsmanager": ["secretsmanager"], "securityhub": ["securityhub"], "servicediscovery": ["servicediscovery"], "servicequotas": ["service-quotas"], "signer": ["signer", "signer-data"], "sns": ["sns"], "sqs": ["sqs"], "ssm": ["ssm"], "sso": ["sso", "sso-admin"], "states": ["stepfunctions"], "sts": ["sts"], "textract": ["textract"], "timestream-influxdb": ["timestream-influxdb"], "translate": ["translate"], "xray": ["xray"]},
|
||||
"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", "autoscaling": "not read yet: AWS's group and launch configuration ARNs carry an id the service mints, `autoScalingGroup:<id>:autoScalingGroupName/<name>`, while Floci mints `autoScalingGroup:<name>`, which other services (ECS capacity providers) read back; the mint is fixed first", "aws-marketplace": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "backup": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "batch": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "bedrock-agentcore": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "cloudhsm": "not read yet: its ARN formats end in ${CloudHsmClusterInstanceName} and ${CloudHsmBackupInstanceName}, names, while its requests give ClusterId and BackupId, ids, which the rules do not fill a name from, so nearly every operation's resource would be left open", "cloudwatch": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "codeartifact": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "codedeploy": "not read yet: the Service Reference gives an on-premises instance's ARN as `instance:${InstanceName}`, while the CodeDeploy permissions reference gives arn:aws:codedeploy:region:account-id:instance/instance-ID and AWS's GetOnPremisesInstance example answers instance/<name>_<id>, an id the service mints after the name; reading it needs that format corrected", "codeguru-reviewer": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "comprehend": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "config": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "connect": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "detective": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "dlm": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "dms": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "elasticache": "not read yet: a later batch, with the tests that show its ARNs are the ones its handlers mint", "elasticbeanstalk": "not read yet: an environment's ARN carries its application's name, `environment/<application>/<name>`, while most of its requests name it by EnvironmentName or EnvironmentId alone, so reading it needs the stored environment those find", "elasticfilesystem": "REST: its requests name their resources in the path, which RequestResources reads from the route a request matched in the vendored REST routes (regen_rest_routes.MODELS), which do not have its model yet", "execute-api": "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", "identitystore": "not read yet: a later batchLine truncated
|
||||
"otherNamespaces": ["a4b", "account-access", "acm-pca", "aco-automation", "agent-registry", "aidevops", "aiops", "airflow-serverless", "amplify", "amplifybackend", "amplifyuibuilder", "aoss", "apiportal", "appfabric", "appflow", "application-signals", "application-signals-mcp", "appmesh", "appmesh-preview", "apprunner", "appstream", "apptest", "arc-region-switch", "arc-zonal-shift", "artifact", "assurance", "auditmanager", "aws-external-anthropic", "b2bi", "backup-gateway", "backup-search", "bcm-data-hub", "bedrock-mantle", "bedrock-websearch", "billing", "billingconductor", "braket", "bugbust", "cases", "cassandra", "chatbot", "chime", "cleanrooms", "cleanrooms-ml", "cloud9", "clouddirectory", "cloudsearch", "cloudshell", "cloudtrail-data", "codecatalyst", "codecommit", "codeconnections", "codeguru-profiler", "codeguru-security", "codestar-connections", "codestar-notifications", "codewhisperer", "cognito-sync", "connect-campaigns", "consoleapp", "continuum", "databrew", "dataexchange", "datapipeline", "datazone", "dax", "deadline", "devicefarm", "devops-guru", "directconnect", "docdb-elastic", "drs", "ds", "ds-data", "ebs", "ecr-public", "eks-auth", "elastictranscoder", "elemental-appliances-software", "elemental-inference", "elemental-support-cases", "end-user-messaging", "entityresolution", "evs", "finspace", "finspace-api", "fms", "forecast", "frauddetector", "freertos", "fsx", "gamelift", "gameliftstreams", "geo", "geo-maps", "geo-places", "geo-routes", "glacier", "grafana", "greengrass", "groundstation", "health", "health-agent", "healthlake", "honeycode", "identity-sync", "imagebuilder", "interconnect", "internetmonitor", "invoicing", "iotanalytics", "iotdeviceadvisor", "iotfleethub", "iotfleetwise", "iotjobsdata", "iotmanagedintegrations", "iotsitewise", "iottwinmaker", "iotwireless", "iq", "iq-permission", "ivs", "ivschat", "kafka-cluster", "kafkaconnect", "kendra", "kendra-ranking", "kinesisvideo", "launchwizard", "lex", "license-manager", "license-manager-linux-subscriptions", "license-manager-user-subscriptions", "lookoutequipment", "lookoutmetrics", "lookoutvision", "m2", "machinelearning", "managedblockchain", "mapcredits", "mediaconnect", "mediaconvert", "medialive", "mediapackage", "mediapackage-vod", "mediapackagev2", "mediastore", "mediatailor", "medical-imaging", "mgh", "mgn", "migrationhub-orchestrator", "mobiletargeting", "monitron", "mpa", "neptune-db", "neptune-graph", "network-security-manager", "networkflowmonitor", "networkmanager", "networkmonitor", "nimble", "notifications", "notifications-contacts", "nova-act", "observabilityadmin", "odb", "omics", "one", "opensearch", "opsworks", "osis", "osm", "outposts", "panorama", "partnercentral", "payments", "pca-connector-ad", "pca-connector-scep", "pcs", "personalize", "pi", "polly", "private-networks", "profile", "proton", "purchase-orders", "q", "qapps", "qbusiness", "qdeveloper", "qldb", "rbin", "rds-db", "refactor-spaces", "repostspace", "resiliencehub", "robomaker", "rolesanywhere", "route53-recovery-cluster", "route53-recovery-control-config", "route53-recovery-readiness", "route53globalresolver", "route53profiles", "rtbfabric", "s3-object-lambda", "s3-outposts", "s3express", "s3files", "sagemaker-geospatial", "sagemaker-mlflow", "savingsplans", "schemas", "scn", "sdb", "security-ir", "securityagent", "securitylake", "serverlessrepo", "shield", "simspaceweaver", "sms-voice", "snow-device-management", "social-messaging", "sqlworkbench", "ssm-contacts", "ssm-incidents", "ssm-quicksetup", "ssm-sap", "ssmmessages", "storagegateway", "supportauthz", "synthetics", "thinclient", "timestream", "tnb", "transform", "transform-custom", "trustedadvisor", "ts", "vendor-insights", "voiceid", "vpc-lattice", "vpc-lattice-svcs", "vpce", "waf", "waf-regional", "wellarchitected", "wickr", "wisdom", "workdocs", "worklink", "workmail", "workmailmessageflow", "workspaces", "workspaces-instances", "workspaces-web"],
|
||||
@@ -2656,7 +2656,7 @@
|
||||
"eks:ListAssociatedAccessPolicies": {"action": "eks:ListAssociatedAccessPolicies", "types": ["access-entry"], "resources": [{"types": ["access-entry"], "arn": "principalArn"}, {"type": "access-entry", "fill": {"ClusterName": "clusterName"}}], "located": {"clusterName": "{name}", "principalArn": "{principalArn}"}},
|
||||
"eks:ListCapabilities": {"action": "eks:ListCapabilities", "types": ["cluster"], "resources": [{"type": "cluster", "fill": {"ClusterName": "clusterName"}}], "located": {"clusterName": "{name}"}},
|
||||
"eks:ListCertificateAuthorities": {"action": "eks:ListCertificateAuthorities", "types": ["cluster"], "resources": [{"type": "cluster", "fill": {"ClusterName": "clusterName"}}], "located": {"clusterName": "{name}"}},
|
||||
"eks:ListClusters": {"action": "eks:ListClusters", "types": [], "resources": []},
|
||||
"eks:ListClusters": {"action": "eks:ListClusters", "types": [], "resources": [{"type": "cluster", "fill": {}}]},
|
||||
"eks:ListEksAnywhereSubscriptions": {"action": "eks:ListEksAnywhereSubscriptions", "types": [], "resources": []},
|
||||
"eks:ListFargateProfiles": {"action": "eks:ListFargateProfiles", "types": ["cluster"], "resources": [{"type": "cluster", "fill": {"ClusterName": "clusterName"}}], "located": {"clusterName": "{name}"}},
|
||||
"eks:ListIdentityProviderConfigs": {"action": "eks:ListIdentityProviderConfigs", "types": ["cluster"], "resources": [{"type": "cluster", "fill": {"ClusterName": "clusterName"}}], "located": {"clusterName": "{name}"}},
|
||||
@@ -2946,7 +2946,7 @@
|
||||
"es:ListDataSources": {"action": "es:ListDataSources", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}], "located": {"DomainName": "{DomainName}"}},
|
||||
"es:ListDirectQueryDataSources": {"action": "es:ListDirectQueryDataSources", "types": ["datasource"], "resources": []},
|
||||
"es:ListDomainMaintenances": {"action": "es:ListDomainMaintenances", "types": ["domain"], "resources": [{"type": "domain", "fill": {"DomainName": "DomainName"}}], "located": {"DomainName": "{DomainName}"}},
|
||||
"es:ListDomainNames": {"action": "es:ListDomainNames", "types": [], "resources": []},
|
||||
"es:ListDomainNames": {"action": "es:ListDomainNames", "types": [], "resources": [{"type": "domain", "fill": {}}]},
|
||||
"es:ListDomainsForPackage": {"action": "es:ListDomainsForPackage", "types": [], "resources": []},
|
||||
"es:ListElasticsearchInstanceTypes": {"action": "es:ListElasticsearchInstanceTypes", "types": [], "resources": []},
|
||||
"es:ListElasticsearchVersions": {"action": "es:ListElasticsearchVersions", "types": [], "resources": []},
|
||||
@@ -5611,7 +5611,7 @@
|
||||
"s3tables:GetTableReplicationStatus": {"action": "s3tables:GetTableReplicationStatus", "types": ["Table"], "resources": [{"types": ["Table"], "arn": "tableArn"}], "located": {"tableArn": "?tableArn"}},
|
||||
"s3tables:GetTableStorageClass": {"action": "s3tables:GetTableStorageClass", "types": ["Table"], "resources": [{"type": "Table", "fill": {}, "find": ["tableBucketARN", "namespace", "name"]}], "located": {"name": "{name}", "namespace": "{namespace}", "tableBucketARN": "{tableBucketARN}"}},
|
||||
"s3tables:ListNamespaces": {"action": "s3tables:ListNamespaces", "types": ["TableBucket"], "resources": [{"types": ["TableBucket"], "arn": "tableBucketARN"}], "located": {"tableBucketARN": "{tableBucketARN}"}},
|
||||
"s3tables:ListTableBuckets": {"action": "s3tables:ListTableBuckets", "types": [], "resources": []},
|
||||
"s3tables:ListTableBuckets": {"action": "s3tables:ListTableBuckets", "types": [], "resources": [{"type": "TableBucket", "fill": {}}], "located": {"type": "?type"}},
|
||||
"s3tables:ListTableMigrations": {"action": "s3tables:ListTableMigrations", "types": ["Table", "TableBucket"], "resources": [{"types": ["Table", "TableBucket"], "arn": "tableARN"}, {"type": "Table", "fill": {}, "find": ["tableBucketARN", "namespace", "name"], "when": {"tableARN": [null]}}], "located": {"name": "?name", "namespace": "?namespace", "tableARN": "?tableARN", "tableBucketARN": "?tableBucketARN"}},
|
||||
"s3tables:ListTables": {"action": "s3tables:ListTables", "types": ["TableBucket"], "resources": [{"types": ["TableBucket"], "arn": "tableBucketARN"}], "located": {"tableBucketARN": "{tableBucketARN}"}},
|
||||
"s3tables:ListTagsForResource": {"action": "s3tables:ListTagsForResource", "types": ["Table", "TableBucket"], "resources": [{"types": ["Table", "TableBucket"], "arn": "resourceArn"}], "located": {"resourceArn": "{resourceArn}"}},
|
||||
|
||||
@@ -547,6 +547,24 @@ class IamRestRouteEnforcementIntegrationTest {
|
||||
refused(as(user, "lambda").get("/2015-03-31/functions/route-fn/").then(), "lambda:GetFunction");
|
||||
}
|
||||
|
||||
@Test
|
||||
void aListCallAwsChecksOnItsServicesResourcesIsAllowedByAPolicyScopedToThem() {
|
||||
// AWS checks these list calls on every resource of the type, not on *, as measured in #9039: a policy on
|
||||
// the type's wildcard allows the call, and one on a single resource of the type does not.
|
||||
String user = user("route-measured-list");
|
||||
String[][] calls = {
|
||||
{"es:ListDomainNames", "es", "/2021-01-01/domain", "arn:aws:es:us-east-1:" + ACCOUNT + ":domain/"},
|
||||
{"s3tables:ListTableBuckets", "s3tables", "/buckets",
|
||||
"arn:aws:s3tables:us-east-1:" + ACCOUNT + ":bucket/"},
|
||||
{"eks:ListClusters", "eks", "/clusters", "arn:aws:eks:us-east-1:" + ACCOUNT + ":cluster/"}};
|
||||
for (String[] call : calls) {
|
||||
policy(user, allow(call[0], call[3] + "*"));
|
||||
as(user, call[1]).get(call[2]).then().statusCode(200);
|
||||
policy(user, allow(call[0], call[3] + "one"));
|
||||
refused(as(user, call[1]).get(call[2]).then(), call[0]);
|
||||
}
|
||||
}
|
||||
|
||||
/** Creates an EKS cluster as the account's admin, removed afterwards, and returns its ARN. */
|
||||
private String eksCluster(String name) {
|
||||
return eksCluster(name, "{}");
|
||||
|
||||
@@ -2544,7 +2544,9 @@ class ResourceArnBuilderTest {
|
||||
eks(eks, "GET", "/clusters/held", "eks:DescribeCluster"));
|
||||
assertEquals(List.of("arn:aws:eks:us-east-1:000000000000:cluster/held"),
|
||||
eks(eks, "GET", "/clusters/held/node-groups", "eks:ListNodegroups"));
|
||||
assertEquals(List.of("*"), eks(eks, "GET", "/clusters", "eks:ListClusters"));
|
||||
// ListClusters is checked on every cluster of the account, as measured on AWS (MEASURED, #9039).
|
||||
assertEquals(List.of("arn:aws:eks:us-east-1:000000000000:cluster/*"),
|
||||
eks(eks, "GET", "/clusters", "eks:ListClusters"));
|
||||
}
|
||||
|
||||
/** CreateCluster is checked on the cluster its body names, as the EKS user guide's example policy grants it. */
|
||||
|
||||
@@ -432,6 +432,27 @@ MEASURED: dict[str, tuple[list[dict], str]] = {
|
||||
"(https://github.com/aws/aws-emulator/blob/main/issues/things-that-do-not-work/"
|
||||
"20261024T015148Z-dynamodb-does-not-enforce-iam-listtables-succeeds-for.md); the Service Reference lists no "
|
||||
"resource type for the action"),
|
||||
"es:ListDomainNames": (
|
||||
[{"type": "domain", "fill": {}}],
|
||||
"real AWS probes in https://github.com/floci-io/floci/issues/9039 (OpenSearch, us-east-1, 2026-11-19, an "
|
||||
"assumed role per case): with no permissions the call is refused '... is not authorized to perform: "
|
||||
"es:ListDomainNames on resource: arn:aws:es:us-east-1:<account>:domain/* because no identity-based policy "
|
||||
"allows the es:ListDomainNames action', and a role whose one statement allows the action on domain/* alone "
|
||||
"is allowed it; the Service Reference lists no resource type for the action"),
|
||||
"s3tables:ListTableBuckets": (
|
||||
[{"type": "TableBucket", "fill": {}}],
|
||||
"real AWS probes in https://github.com/floci-io/floci/issues/9039 (S3 Tables, us-east-1, 2026-11-19, an "
|
||||
"assumed role per case): with no permissions the call is refused '... is not authorized to perform: "
|
||||
"s3tables:ListTableBuckets on resource: arn:aws:s3tables:us-east-1:<account>:bucket/* because no "
|
||||
"identity-based policy allows the s3tables:ListTableBuckets action', and a role whose one statement allows "
|
||||
"the action on bucket/* alone is allowed it; the Service Reference lists no resource type for the action"),
|
||||
"eks:ListClusters": (
|
||||
[{"type": "cluster", "fill": {}}],
|
||||
"real AWS probes in https://github.com/floci-io/floci/issues/9039 (Amazon EKS, us-east-1, 2026-11-19, an "
|
||||
"assumed role per case): with no permissions the call is refused '... is not authorized to perform: "
|
||||
"eks:ListClusters on resource: arn:aws:eks:us-east-1:<account>:cluster/* because no identity-based policy "
|
||||
"allows the eks:ListClusters action', and a role whose one statement allows the action on cluster/* alone "
|
||||
"is allowed it; the Service Reference lists no resource type for the action"),
|
||||
**{f"states:{operation}": ([{"type": kind, "fill": {}, "find": ["taskToken"]} for kind in ("activity", "statemachine")],
|
||||
_SEND_TASK_EVIDENCE)
|
||||
for operation in ("SendTaskSuccess", "SendTaskFailure", "SendTaskHeartbeat")},
|
||||
|
||||
Reference in new issue
Block a user