mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 17:33:03 -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
@@ -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. */
|
||||
|
||||
Reference in new issue
Block a user