Repository navigation
fix(iam): check Resource Groups requests on the groups the generated table gives them - #9074
Conversation
…table gives them Resource Groups was built by hand: ResourceArnBuilder read a group from the body's Group or GroupName, or CreateGroup's Name, the request resources table held no Resource Groups operation, and nothing gave a policy condition a group's tags. resource-groups moves from HAND_BUILT to NAMESPACES, so the table gives each operation the group its Group names, by its name or its ARN, and the ARN a tagging route carries; CreateGroup, for which the Service Reference lists no resource type, is checked on *, as AWS checks it. ResourceArnBuilder's Resource Groups branch goes. ResourceGroupsStoredResourceArns answers a group's stored tags, read in place from the group record the service stores whole. Only Resource Groups' operations change in the table.
PR Summary by QodoAlign Resource Groups IAM checks with generated request resources
AI Description
Merge Risk
|
Code Review by Qodo
1.
|
Summary
Resource Groups was one of the namespaces
ResourceArnBuilderbuilt by hand: it read a group from the body'sGrouporGroupName, or CreateGroup'sName,iam-request-resources.jsonheld no Resource Groups operation, and nothing gave a policy condition a group's tags, soaws:ResourceTag/on a group saw none. It now comes from the generated table, as every namespace is meant to.resource-groupsmoves fromHAND_BUILTtoNAMESPACES, and the generator's existing rules give each operation the group itsGroupnames, by its name or its ARN (botocore documents it as "The name or the Amazon resource name (ARN) of the resource group"), and the ARN a tagging route carries. ListGroups, SearchResources and the account settings act on no resource type and are checked on*, as before.ResourceArnBuilder's Resource Groups branch is gone.*. The Service Reference lists no resource type for it, so AWS checks it on every resource, and a Deny naming one group's ARN does not stop creating that group; the hand builder checked it ongroup/<Name>. The group a create makes is still where its request tags are checked.GroupName. botocore marks GetGroup's, DeleteGroup's and the query and update calls'GroupNamedeprecated ("Use Group instead"), and the table reads the group fromGroup, which fills the same ARN variable. A request naming its group only byGroupNameis therefore checked on*: a grant or a Deny on the group's ARN does not reach it, where the hand builder read it. A request usingGroupis checked on its group as before.ResourceGroupsStoredResourceArnsanswersresource-groups:storedTagsreads a group's tags in the request's account, in place, by the name its ARN gives in the ARN's Region, and matches the whole ARN the group records. The service stores a group as one record, so the read is of one whole set.make iam-request-resources-checkpasses on it.ResourceArnBuilderTest's Resource Groups case, which drove the hand builder, now drives the table: a group by its name and by its ARN in three partitions, and CreateGroup on*.ResourceGroupsIamEnforcementIntegrationTestchecks an allow on a team's tag against two tagged groups, a Deny on one group across every operation on it after creating it, and a request naming its group only byGroupNamechecked on*.docs/services/iam.mdmoves Resource Groups from the services whose ARNs Floci builds itself to those the table gives, and names it among those that answer stored tags;StoredResourceArnssays so.Type of change
fix:)feat:)feat!:orfix!:)AWS Compatibility
The Service Authorization Reference gives the Resource Groups group actions the
groupresource type,arn:${Partition}:resource-groups:${Region}:${Account}:group/${GroupName}, withaws:ResourceTag/${TagKey}, and lists no resource type for CreateGroup. A condition such as"StringEquals": {"aws:ResourceTag/team": "data"}on a group action now reads the tags of the group the request names; before, it saw none, so such an Allow never applied and such a Deny never matched.Checklist
./mvnw testpasses locally (ran the generator's tests, the request resource reader, builder, filter and condition context tests, the Resource Groups test classes, the Auto Scaling and EC2 capacity reservation classes that use groups, the cross-service partition smoke test, and the request resource, REST route and namespace coverage enforcement classes, not the whole suite)