Repository navigation
Description
What
PermissionsBoundaryUsageCount on AWS's Policy data type is not modelled. v0.113.0's #807 work
renders every other documented member of the IAM policy shapes (Description, IsAttachable) from
state substrate already keeps, and states this one as unmodelled with its cost. This issue is that
cost.
AWS documents it on the Policy type
(https://docs.aws.amazon.com/IAM/latest/APIReference/API_Policy.html):
PermissionsBoundaryUsageCount — The number of entities (users and roles) for which the policy
is used to set the permissions boundary.
API_ListPolicies' sample response renders it, so it belongs on both policy shapes, not only
GetPolicy.
Why it is not a one-liner
Substrate stores a boundary as an ARN on the entity (IAMUser/IAMRole), not as a back-reference on
the policy, so the count is derivable but not stored. Two implementations, both with a real cost:
- Scan on read — enumerate every user and role on each
GetPolicy/ListPoliciesand count
matching boundary ARNs. Correct by construction and needs no new state, but makes a policy read
O(entities) and makesListPoliciesO(policies x entities). - Reference counting — a counter on
IAMPolicymaintained across the four boundary operations
(PutUserPermissionsBoundary,DeleteUserPermissionsBoundary,PutRolePermissionsBoundary,
DeleteRolePermissionsBoundary) and onDeleteUser/DeleteRole, which drop a boundary
implicitly. Cheap to read, but every path that can detach a boundary has to be found and none can
be missed — and a count rebuilt from a recorded event log has to agree with one accumulated live,
or replay diverges.
Option 1 is the more likely answer for an emulator whose entity counts are test-sized, but it is a
performance decision worth making deliberately rather than in passing.
Acceptance criteria
-
PermissionsBoundaryUsageCountis rendered on bothGetPolicyandListPolicies, per AWS's
Policytype and theListPoliciessample - The count reflects users and roles, and reaches zero when the last boundary is removed
- Whichever approach is chosen, replay of a recorded run reports the same count as the live run
- Deleting an entity that has the policy as its boundary decrements the count
- The
iam_xml.gocomment fix(iam): entity shapes over- and under-report documented members #807 left pointing at this issue is replaced by the implementation
Activity
feat(iam): PermissionsBoundaryUsageCount on the policy shapes (#815) (#…
feat(iam): the account authorization snapshot, and MaxItems refused r…