Files
floci/docs/services
Priamo Germosen 0a8aaf9a19 fix(iam): check AWS Organizations requests on the resources they name (#10208)
Organizations was one of the namespaces the request-resources table left unread ("a later batch"), so every request
of it was checked on *: a grant scoped to an account's or an OU's ARN never matched, a deny scoped to one never held,
and an aws:ResourceTag condition read nothing. organizations joins the table now, so each request is checked on the
resources the Service Reference gives its action, read from the request.

An Organizations ARN carries the organization's id beside the id a request gives
(account/o-<organization>/<account id>), so the table fills one variable of it and asks the service for the rest.
OrganizationsStoredResourceArns finds the account, OU, root or policy a request names by its id alone in the caller's
organization, as the caller's handler finds it, and a handshake where the caller sent it or receives it: the account
it invites, any account for an invitation by email naming none, which may claim it, and each member for one enabling
all features, as AcceptHandshake lets them act on it. It answers the tags Organizations keeps on an account,
root, OU, policy or resource policy, matched on the whole ARN without moving it, which an aws:ResourceTag condition
reads. The lookups of an OU or a policy by its id in an organization move into organizationalUnitIn and policyIn,
beside accountIn, which DescribeOrganizationalUnit's and DescribePolicy's handlers and the new lookups share.

An organization's resources belong to its management account, so a member's request on one is judged across
accounts, the organization's resource policy deciding beside the member's own policies, as the existing
OrganizationsResourcePolicyProvider already supplies it. A handshake's recipient acts on it on its own policies: an
invitee belongs to no organization, and AcceptHandshake and DeclineHandshake are no actions a delegation policy grants
(the Organizations User Guide's supported delegation policy actions). So a handshake the caller receives is reached in
the management account (reachedInItsAccount), as a RAM invitation is, and the provider supplies no delegation policy
for it.

TagResource, UntagResource and ListTagsForResource, and the calls naming a parent or a target by its id (ListChildren,
ListPoliciesForTarget), are checked on *, and AttachPolicy and DetachPolicy on the policy alone, as the generated table
reads them.

IamRequestResourceEnforcementIntegrationTest checks, in an organization of its own, that a grant on one account's ARN
reads it by its id and refuses another, that an aws:ResourceTag condition reads the tags of an OU, that a member's
read of an OU is refused on its own grant alone and allowed where the organization's resource policy grants it too,
and that the account the organization invites reads the handshake on its own policy naming the handshake's ARN, with
that resource policy in place, and is refused on another. OrganizationsServiceTest checks each lookup for a member,
the management account, an outsider, an invitee, a claimant of an invitation by email and the members receiving a
handshake enabling all features, and the stored tags of each kind, the resource policy among them, against another
management account, organization, kind or service.
2026-12-05 00:27:28 -04:00
..