mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
feat(iam): read Route 53 Resolver from the generated tables (#9368)
Move `route53resolver` from NOT_COVERED to NAMESPACES in regen_iam_request_resources.py, so Route 53 Resolver requests are checked on the resources they name instead of `*`: a resolver rule, an endpoint or a firewall domain list by its id, as <type>/<id>, the ARN the service mints, and a tag call on its ResourceArn. The reference's DNSSEC configuration format takes a ResourceId, which the request gives as the VPC's id, so the DNSSEC calls are checked under the VPC's id. A member whose botocore pattern is another service's ARN now holds nothing of the namespace, read where every rule first reads the request's members: CreateOutpostResolver's OutpostArn, an outposts ARN whose name begins the outpost resolver's, had taken the place of the resolver it makes, which is now checked as outpost-resolver/*. Over the whole table that rule changes this one operation. No other namespace's rows change. A managed firewall domain list, which AWS owns, was checked under the caller's account, though the service gives it an ARN of its own, so a grant on the ARN ListFirewallDomainLists returns was refused. Route 53 Resolver's request-resource lookup now answers a managed list's ARN for its id, which the reader already asks a service for for a resource filled from one member; a custom list stays in the caller's account.
This commit is contained in:
1 parent
e15b64d07b
commit
464aaaf734
8 files changed
+251
-11
No files matched your search
+44
@@ -3626,6 +3626,50 @@ class IamRequestResourceEnforcementIntegrationTest {
|
||||
"{\"ACLName\":\"" + acl + "-other\"}"), "memorydb:DescribeAcls");
|
||||
}
|
||||
|
||||
/**
|
||||
* A Route 53 Resolver firewall domain list is checked on the ARN its id gives, {@code firewall-domain-list/<id>},
|
||||
* the one Route 53 Resolver mints, so a grant on one lets the caller read it and not another.
|
||||
*/
|
||||
@Test
|
||||
void aRoute53ResolverDomainListIsCheckedOnTheArnItsIdGives() {
|
||||
String allowed = domainList("res-fdl-" + suffix());
|
||||
String other = domainList("res-fdl-other-" + suffix());
|
||||
User user = user("res-resolver");
|
||||
user.policy(allowOn("route53resolver:GetFirewallDomainList",
|
||||
"arn:aws:route53resolver:" + REGION + ":" + ACCOUNT + ":firewall-domain-list/" + allowed));
|
||||
send(user, "route53resolver", "Route53Resolver.GetFirewallDomainList", "1.1",
|
||||
"{\"FirewallDomainListId\":\"" + allowed + "\"}").statusCode(200);
|
||||
refusedJson(send(user, "route53resolver", "Route53Resolver.GetFirewallDomainList", "1.1",
|
||||
"{\"FirewallDomainListId\":\"" + other + "\"}"), "route53resolver:GetFirewallDomainList");
|
||||
}
|
||||
|
||||
/**
|
||||
* A managed firewall domain list, which AWS owns, is checked on the ARN Route 53 Resolver gives it, so a grant on
|
||||
* the ARN ListFirewallDomainLists returns lets the caller read that list.
|
||||
*/
|
||||
@Test
|
||||
void aManagedRoute53ResolverDomainListIsCheckedOnTheArnTheServiceGivesIt() {
|
||||
String id = adminJson("route53resolver", "Route53Resolver.ListFirewallDomainLists").body("{}").post("/")
|
||||
.then().statusCode(200).extract().path("FirewallDomainLists.find { it.ManagedOwnerName != null }.Id");
|
||||
String arn = adminJson("route53resolver", "Route53Resolver.ListFirewallDomainLists").body("{}").post("/")
|
||||
.then().statusCode(200).extract()
|
||||
.path("FirewallDomainLists.find { it.Id == '" + id + "' }.Arn");
|
||||
User user = user("res-resolver-managed");
|
||||
user.policy(allowOn("route53resolver:GetFirewallDomainList", arn));
|
||||
send(user, "route53resolver", "Route53Resolver.GetFirewallDomainList", "1.1",
|
||||
"{\"FirewallDomainListId\":\"" + id + "\"}").statusCode(200);
|
||||
}
|
||||
|
||||
/** A firewall domain list of the name, created as the admin and deleted after the test; its id. */
|
||||
private String domainList(String name) {
|
||||
String id = adminJson("route53resolver", "Route53Resolver.CreateFirewallDomainList")
|
||||
.body("{\"CreatorRequestId\":\"" + name + "\",\"Name\":\"" + name + "\"}")
|
||||
.post("/").then().statusCode(200).extract().path("FirewallDomainList.Id");
|
||||
cleanup.register(() -> adminJson("route53resolver", "Route53Resolver.DeleteFirewallDomainList")
|
||||
.body("{\"FirewallDomainListId\":\"" + id + "\"}").post("/"));
|
||||
return id;
|
||||
}
|
||||
|
||||
private static ValidatableResponse glue(String operation, String body) {
|
||||
return adminJson("glue", "AWSGlue." + operation).body(body).post("/").then();
|
||||
}
|
||||
|
||||
@@ -2092,6 +2092,30 @@ class ResourceArnBuilderTest {
|
||||
builder.buildResources("memorydb", "memorydb:DeleteCluster", ctx, "us-east-1", ACCOUNT, "aws"));
|
||||
}
|
||||
|
||||
// ── Route 53 Resolver ───────────────────────────────────────────────────────
|
||||
|
||||
/**
|
||||
* A Route 53 Resolver request is checked on the rule, endpoint or domain list its id names, as {@code <type>/<id>},
|
||||
* the ARN Route 53 Resolver mints. A DNSSEC configuration's format takes a ResourceId, which the request gives as
|
||||
* the VPC's id, so the generated table checks the configuration under the VPC's id.
|
||||
*/
|
||||
@Test
|
||||
void route53ResolverChecksTheResourceItsIdNames() {
|
||||
setJsonBody("{\"ResolverRuleId\":\"rslvr-rr-abc123\"}");
|
||||
assertEquals(List.of("arn:aws:route53resolver:us-east-1:000000000000:resolver-rule/rslvr-rr-abc123"),
|
||||
builder.buildResources("route53resolver", "route53resolver:GetResolverRule", ctx, "us-east-1",
|
||||
ACCOUNT, "aws"));
|
||||
setJsonBody("{\"ResourceId\":\"vpc-0abc\"}");
|
||||
assertEquals(List.of("arn:aws:route53resolver:us-east-1:000000000000:resolver-dnssec-config/vpc-0abc"),
|
||||
builder.buildResources("route53resolver", "route53resolver:GetResolverDnssecConfig", ctx,
|
||||
"us-east-1", ACCOUNT, "aws"));
|
||||
// An outpost resolver's create names the Outpost it runs on, another service's ARN, and makes its own.
|
||||
setJsonBody("{\"Name\":\"edge\",\"OutpostArn\":\"arn:aws:outposts:us-east-1:000000000000:outpost/op-1\"}");
|
||||
assertEquals(List.of("arn:aws:route53resolver:us-east-1:000000000000:outpost-resolver/*"),
|
||||
builder.buildResources("route53resolver", "route53resolver:CreateOutpostResolver", ctx, "us-east-1",
|
||||
ACCOUNT, "aws"));
|
||||
}
|
||||
|
||||
// ── S3 and S3 Control ───────────────────────────────────────────────────────
|
||||
|
||||
/** The resources an S3 or S3 Control request names, read from the generated table on the route it matches. */
|
||||
|
||||
Reference in new issue
Block a user