Skip to content

feat(iam): report the members AWS documents per entity shape (#807) - #821

Merged
scttfrdmn merged 1 commit into
mainfrom
feat/807-iam-shape-members
Sep 12, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
feat/807-iam-shape-members

Conversation

@scttfrdmn

Copy link
Copy Markdown
Owner

Substrate's IAM entity shapes both over- and under-reported members the IAM API reference
documents, independently of tags (#796 covered Tags only). This makes each shape report what AWS
documents for that shape, reusing the single-entity/list split #796 built.

Over-reported. ListUsers and ListRoles rendered PermissionsBoundary, which AWS's note on
both operations excludes by name — in the same sentence that excludes Tags:

IAM resource-listing operations return a subset of the available attributes for the resource. This
operation does not return the following attributes, even though they are an attribute of the
returned object: PermissionsBoundary, RoleLastUsed, Tags. To view all of the information for a
role, see GetRole.

That is a divergence in the direction where the emulator is more generous than the service, so a
consumer could write an assertion against a list response that AWS never satisfies and only find
out against real IAM. The boundary moves into a single-entity-only helper beside
iamEntityTagsXML. The users nested in a GetGroup response and the roles nested in an
instance-profile shape are list shapes too and carry no boundary for the same reason — neither
GetGroup's nor GetInstanceProfile's sample response renders one.

Under-reported. IsAttachable and Description have been stored since CreatePolicy and were
never rendered, so a consumer setting a description could not read it back at all. IsAttachable
reaches both policy shapes (AWS's Policy type documents it with no operation restriction, and
ListPolicies' sample renders it on every member); Description is single-entity-only, and there
AWS says so about the member itself: "This element is included in the response to the GetPolicy
operation. It is not included in the response to the ListPolicies operation."
PasswordLastUsed
reaches both user shapes per "This value is returned only in the GetUser and ListUsers
operations"
— the issue had this one backwards. Nothing assigns it, since no password operation is
modeled, so it is omitted in every ordinary run, which is what AWS reports for a user who never
signed in with a password.

Two members stay unmodeled, each filed with its cost rather than guessed at:
PermissionsBoundaryUsageCount (#815) needs either a scan of every user and role per policy read —
making ListPolicies O(policies × entities) — or a counter across the four boundary operations
plus the entity deletes that drop a boundary implicitly, which must agree with a count rebuilt by
replay. RoleLastUsed (#816) needs AssumeRole to write an IAM record, substrate's first write on
a path whose purpose is not to mutate, plus a nested response type and the request's region.

Tests

New emulator/iam_shape_members_test.go, asserting against raw XML rather than a decoded map:
a map cannot tell an absent member from an empty one, since both are the zero value. Each absence
assertion also anchors on an element that must be present, so it cannot pass against a listing that
returned nothing. Against main the three new-behaviour tests fail (ListUsers/ListRoles report
a boundary; no IsAttachable, Description or PasswordLastUsed anywhere).

Compatibility

ListUsers and ListRoles stop reporting PermissionsBoundary; the policy shapes start reporting
IsAttachable, GetPolicy starts reporting Description, and the user shapes gain
PasswordLastUsed (always omitted in practice). A consumer asserting an exact member set on any of
those responses sees the change.

Verification

gofmt/go build/go vet/golangci-lint clean; make test and GOTOOLCHAIN=go1.26.6 make test
pass; coverage holds at the baseline (emulator 83.7%, total 83.1%); docs reference, version and
authz-reference checks pass; npm --prefix docs run build and the e2e suite pass.

Closes #807

@scttfrdmn scttfrdmn added this to the v0.113.0 milestone Sep 12, 2026
@codecov

codecov Bot commented Sep 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn merged commit 3600378 into main Sep 12, 2026
17 checks passed
@scttfrdmn
scttfrdmn deleted the feat/807-iam-shape-members branch September 12, 2026 06:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(iam): entity shapes over- and under-report documented members

1 participant