Skip to content

fix(iam): check Resource Groups requests on the groups the generated table gives them - #9074

Merged
pgermosen merged 1 commit into
mainfrom
fix/iam-resource-groups-request-resources
Nov 20, 2026
Merged

pgermosen merged 1 commit into
mainfrom
fix/iam-resource-groups-request-resources

Conversation

@pgermosen

Copy link
Copy Markdown
Member

Summary

Resource Groups was one of the namespaces ResourceArnBuilder built by hand: it read a group from the body's Group or GroupName, or CreateGroup's Name, iam-request-resources.json held no Resource Groups operation, and nothing gave a policy condition a group's tags, so aws:ResourceTag/ on a group saw none. It now comes from the generated table, as every namespace is meant to.

  • Resource Groups is read from the table. resource-groups moves from HAND_BUILT to NAMESPACES, and the generator's existing rules give each operation the group its Group names, 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.
  • CreateGroup is checked on *. 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 on group/<Name>. The group a create makes is still where its request tags are checked.
  • The deprecated GroupName. botocore marks GetGroup's, DeleteGroup's and the query and update calls' GroupName deprecated ("Use Group instead"), and the table reads the group from Group, which fills the same ARN variable. A request naming its group only by GroupName is 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 using Group is checked on its group as before.
  • Resource Groups only looks up. ResourceGroupsStoredResourceArns answers resource-groups: storedTags reads 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.
  • Only this namespace. The table keeps every other namespace's entries as they were, and make iam-request-resources-check passes on it.
  • Tests. 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 *. ResourceGroupsIamEnforcementIntegrationTest checks 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 by GroupName checked on *.
  • Docs. docs/services/iam.md moves Resource Groups from the services whose ARNs Floci builds itself to those the table gives, and names it among those that answer stored tags; StoredResourceArns says so.

Type of change

  • Bug fix (fix:)
  • New feature (feat:)
  • Breaking change (feat!: or fix!:)
  • Docs / chore

AWS Compatibility

The Service Authorization Reference gives the Resource Groups group actions the group resource type, arn:${Partition}:resource-groups:${Region}:${Account}:group/${GroupName}, with aws: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 test passes 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)
  • New or updated integration test added
  • Commit messages follow Conventional Commits
  • I have no more than 2 open, non-draft pull requests and no more than 4 open pull requests in total (drafts included) in this repository (maintainers and dependency bots are exempt).

…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.
@pgermosen pgermosen added bug Something isn't working iam AWS Identity and Access Management (IAM) labels Nov 20, 2026
@qodo-code-review

qodo-code-review Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

PR Summary by Qodo

Align Resource Groups IAM checks with generated request resources

🐞 Bug fix ✨ Enhancement 🧪 Tests 📝 Documentation 🕐 20-40 Minutes

Grey Divider

AI Description

• Check Resource Groups operations against generated resource targets, including wildcard checks for
 CreateGroup.
Merge Risk 🟡 Medium

Blast radius 🟡 Medium 💥 2 capabilities

  • 2 affected capabilities within one bounded functional scope: resource-groups-iam-integration.
  • Create, get, delete, add-resource and list-resource operations are distinct entry points but one bounded functional integration: authorization of operations on Resource Groups groups.
  • The generated resource contract supplies the group ARN and the service supplies the corresponding persisted group state; these are propagation hops of the same management behavior, not independent scopes.
  • This is a separate end-to-end outcome from ordinary resource selection: IAM policies using aws:ResourceTag conditions must observe the tags of the specifically named group.
  • It shares the bounded Resource Groups IAM integration scope because it consumes the same group ARN and persisted group record, while producing a distinct policy-condition decision.
Behavioral complexity 🟡 Medium 🧩 Compatibility cases

  • Before: Resource Groups was a hand-built exception in ResourceArnBuilder that extracted Name, Group or GroupName directly and produced a group ARN or wildcard.
  • After: Resource Groups is handled by the generated request-resource contract, while IAM resource-tag evaluation additionally crosses into persisted Resource Groups state.
  • New correctness condition: each supported operation's modeled request member precedence and ARN shape must match the actual caller, including ARN versus name selectors and deprecated GroupName behavior, and the resulting ARN must identify the same persisted group whose tags are evaluated.
  • The change introduces compatibility cases between generated operation metadata, request shapes, IAM resource selection and stored-state lookup; it does not rely on the unrelated complexity of existing IAM infrastructure.
Potential damage 🔴 High 🩹 Integrity

  • An under-constraining resource mapping could allow an identity to mutate or delete a group outside its intended resource policy.
  • The effect is limited to Resource Groups management authorization, but a successful unauthorized mutation changes persistent group state.
  • Reverting the code restores the prior authorization behavior; any already-performed deletion or membership mutation requires manual state recreation or repair and is not automatically undone by code rollback.
  • Code rollback can stop further incorrect decisions.
  • Persistent group deletion or membership changes already accepted require manual restoration from the caller's intended configuration; no automatic repair worker or compensation path was found.
Assessed commit 26547cc
Diagram

graph TD
  Request["Resource Groups request"] --> Builder["ResourceArnBuilder"] --> Table["Generated resource table"] --> Policy["IAM policy check"]
  Policy --> Tags["Stored tags adapter"] --> Groups[("Group records")]
Loading
High-Level Assessment

Use the generated table for operation targets and a service-local adapter for stored tags. Keeping the hand-built branch would duplicate targeting rules and preserve its incorrect CreateGroup behavior; putting storage access directly in IAM would break the existing service-lookup boundary.

Files changed (9) +196 / -54

Enhancement (2) +72 / -0
ResourceGroupsService.javaExpose account-scoped group-tag lookup +16/-0

Expose account-scoped group-tag lookup

• Adds an in-place lookup keyed by the ARN's region and group name. It returns tags only when the stored group's full ARN matches the requested ARN.

src/main/java/io/floci/aws/services/resourcegroups/ResourceGroupsService.java

ResourceGroupsStoredResourceArns.javaProvide Resource Groups tags to IAM conditions +56/-0

Provide Resource Groups tags to IAM conditions

• Registers a namespace-specific StoredResourceArns implementation. It validates the ARN's namespace, account, and region before reading group tags and normalizes null tag values to empty strings.

src/main/java/io/floci/aws/services/resourcegroups/ResourceGroupsStoredResourceArns.java

Bug fix (2) +27 / -21
ResourceArnBuilder.javaRemove hand-built Resource Groups ARN selection +0/-17

Remove hand-built Resource Groups ARN selection

• Deletes the Resource Groups switch branch and request-body ARN builder. Resource Groups operations now follow the existing generated request-resource path.

src/main/java/io/floci/aws/services/iam/ResourceArnBuilder.java

iam-request-resources.jsonAdd generated Resource Groups authorization rules +27/-4

Add generated Resource Groups authorization rules

• Adds the group ARN format and Resource Groups operation entries, using Group selectors or explicit ARNs where applicable. CreateGroup has no authorization resource type and remains separately identified as making a group; operations without named targets resolve to wildcard checks.

src/main/resources/aws/iam-request-resources.json

Tests (2) +87 / -23
ResourceArnBuilderTest.javaTest generated group targets across partitions +18/-11

Test generated group targets across partitions

• Replaces the hand-built Resource Groups test with operation-aware assertions for group names and ARNs in AWS, China, and GovCloud partitions. Verifies CreateGroup resolves to '*'.

src/test/java/io/floci/aws/services/iam/ResourceArnBuilderTest.java

ResourceGroupsIamEnforcementIntegrationTest.javaCover group-scoped policies and tag conditions +69/-12

Cover group-scoped policies and tag conditions

• Verifies a group-specific Deny does not block CreateGroup but blocks operations targeting that group by name or ARN. Adds checks that deprecated GroupName-only requests resolve to '*' and that a resource-tag condition distinguishes two tagged groups.

src/test/java/io/floci/aws/services/resourcegroups/ResourceGroupsIamEnforcementIntegrationTest.java

Documentation (2) +8 / -7
iam.mdDocument table-driven Resource Groups targets and stored tags +5/-4

Document table-driven Resource Groups targets and stored tags

• Moves Resource Groups from the hand-built ARN list to the generated-table list. Adds its groups to the resources whose stored tags populate IAM conditions.

docs/services/iam.md

StoredResourceArns.javaDocument Resource Groups as a stored-tag provider +3/-3

Document Resource Groups as a stored-tag provider

• Updates the interface documentation to include Resource Groups group tags among the service-owned data available to IAM.

src/main/java/io/floci/aws/core/common/StoredResourceArns.java

Other (1) +2 / -3
regen_iam_request_resources.pyGenerate Resource Groups rules instead of marking them hand-built +2/-3

Generate Resource Groups rules instead of marking them hand-built

• Moves 'resource-groups' from HAND_BUILT to NAMESPACES so regeneration derives its authorization resources from the existing Service Reference and botocore rules.

tools/aws/regen_iam_request_resources.py

@qodo-code-review

qodo-code-review Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Action required

1. Group denies miss legacy requests ✗ Dismissed
Description
The generated entries for group operations fill the authorization ARN from Group alone, although
ResourceGroupsService.selected() still accepts GroupName as a selector. When a caller supplies
only GroupName, IAM checks * instead of the selected group's ARN, so a broad Allow overrides the
intended effect of an ARN-scoped Deny even for deletion and membership changes.

Grey Divider

Context sources
✅ Compliance rules (platform): 21 rules
✅ Cross-repo context — repo relationships
  Explored: repo: floci-io/floci-ui (sha: 11c808ad) — View relationship
Review mode: Auto: ⚖️ Balanced: IAM authorization is risky but cohesive; standard review should suffice.

Grey Divider

Tip of the day
💡 Did you know, you can turn on the rule miner and Qodo learns your standards from review history

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@pgermosen
pgermosen merged commit dc97ce5 into main Nov 20, 2026
29 of 31 checks passed
@pgermosen
pgermosen deleted the fix/iam-resource-groups-request-resources branch November 20, 2026 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working iam AWS Identity and Access Management (IAM)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant