Repository navigation
Description
iam:GetAccountAuthorizationDetails appears in substrate's authorization reference
(emulator/authz_reference_gen.go:1570) — so a policy can grant or deny it — but the operation
has no handler. The IAM plugin's action switch (emulator/iam_plugin.go:47-226) has no arm for
it, so a call falls through to the default and answers unknownActionError.
That is the one asymmetry worth fixing on its own: substrate can authorize the call and then
cannot serve it. Two of substrate's own doc comments already record the absence rather than
route around it — emulator/iam_xml.go:262-266 ("GetAccountAuthorizationDetails is not among
the operations…") and emulator/iam_policy_versions.go:90.
Why it matters more than a missing operation usually does
It is the only IAM operation that returns every entity and policy in one snapshot, which is
what a consumer uses to assert on an account's whole permission surface after deploying IaC —
exactly substrate's audience. It is also the one operation that would prove three members
substrate has just shipped are consistent across every shape that reports them:
RoleLastUsed (#816), PermissionsBoundaryUsageCount (#815) and AttachmentCount (#847,
which is wrong on GetPolicy today).
What AWS documents
Retrieves information about all IAM users, groups, roles, and policies in your AWS account,
including their relationships to one another. Use this operation to obtain a snapshot of the
configuration of IAM permissions (users, groups, roles, and policies) in your account.
Request parameters
Filter.member.N— "A list of entity types used to filter the results. Only the entities that
match the types you specify are included in the output. Use the valueLocalManagedPolicyto
include customer managed policies." Valid Values:User | Role | Group | LocalManagedPolicy | AWSManagedPolicy. Required: No.Marker— min length 1, pattern[ -ÿ]+. Required: No.MaxItems— "If you do not include this parameter, the number of items defaults to 100."
Range 1–1000. Required: No.
Response elements — UserDetailList.member.N (UserDetail),
GroupDetailList.member.N (GroupDetail), RoleDetailList.member.N (RoleDetail),
Policies.member.N (ManagedPolicyDetail), IsTruncated, and Marker ("When IsTruncated is
true, this element is present").
Errors — ServiceFailure / 500 only. There is no NoSuchEntity and no InvalidInput; an
unparseable Filter value falls to the common ValidationError.
Policy documents are URL-encoded:
Policies returned by this operation are URL-encoded compliant with RFC 3986. You can use a URL
decoding method to convert the policy back to plain JSON text.
That is a real wire difference from GetPolicyVersion, and a consumer that does not decode sees
escaped text — so it has to be got right rather than approximated.
The nested shapes are deep. From the sample response, a RoleDetail member carries
RolePolicyList, AttachedManagedPolicies, InstanceProfileList (each entry carrying its own
Roles list, whose members carry AssumeRolePolicyDocument, RoleId and RoleLastUsed),
Path, Arn, RoleName, AssumeRolePolicyDocument, CreateDate, RoleId. A
ManagedPolicyDetail member carries PolicyVersionList (with Document, IsDefaultVersion,
VersionId, CreateDate per version) plus AttachmentCount, IsAttachable, DefaultVersionId,
PolicyId, CreateDate, UpdateDate.
Acceptance criteria
-
GetAccountAuthorizationDetailsis routed and returnsUserDetailList,
GroupDetailList,RoleDetailListandPoliciesin AWS's element shapes, rendered
through the same helpers the single-entity operations use wherever one exists — the
point is that a member cannot diverge between two operations, which is the defect iam: GetPolicy reports the stored AttachmentCount (always 0) while ListPolicies derives it #847
describes. Where a shared helper does not fit, the reason is recorded in the doc comment. -
Filter.member.Nis honoured for all five values, and an unrecognised value is refused
with the enum messageiamEnumMessagealready produces. -
MaxItemsdefaults to 100, is clamped to 1–1000, andIsTruncated/Markerpaginate —
Markerpresent only whenIsTruncatedis true. - Every policy document in the response is URL-encoded per RFC 3986, asserted against raw
XML rather than through a decoding client, and stated indocs/services.mdas a
difference fromGetPolicyVersion. -
RoleDetailcarriesRoleLastUsed(IAM: model RoleLastUsed on GetRole #816's member, whose scope note names this operation)
andManagedPolicyDetailcarriesPermissionsBoundaryUsageCount(IAM: model PermissionsBoundaryUsageCount on the policy shapes #815) and a derived
AttachmentCount. -
InstanceProfileListnests itsRoleslist, and a role in an instance profile reports
RoleLastUsedthere too, as the sample response shows. - Bundled AWS managed policies appear under
AWSManagedPolicyand customer-managed ones
underLocalManagedPolicy; the bundled catalog's size is checked againstMaxItems's
1000 ceiling so the default page is not silently the whole catalog. - The
#…comments atemulator/iam_xml.go:262-266and
emulator/iam_policy_versions.go:90recording the absence are replaced. -
docs/services.mdgains the operation, andmake authz-reference-checkstill passes.
Activity
scttfrdmn commentedon Sep 14, 2026
Moved to v0.116.0, where it is the natural headline. Its prerequisite shipped in v0.115.0.
The prerequisite is met
This is the one operation that returns every entity and policy in a single snapshot, which makes it the thing that proves the shapes reporting a derived value cannot diverge from each other. Two of those three landed in v0.115.0:
GetPolicynow derivesAttachmentCountrather than reading a field nothing wrote. It reported 0 for every policy in every state whileListPoliciesreported the truth.GetAccountAuthorizationDetailsrenders the same count onManagedPolicyDetail, so implementing it against the old behaviour would have shipped a third answer.PermissionsBoundaryArn,PermissionsBoundaryType). This operation'sRoleDetailandUserDetailcarry the sameAttachedPermissionsBoundary, so the fix is inherited rather than repeated.PermissionsBoundaryUsageCountand IAM: model RoleLastUsed on GetRole #816'sRoleLastUsedwere already in place.Size and shape
M–L on its own: four detail shapes,
InstanceProfileListnesting its ownRoleslist carryingRoleLastUsed, fiveFiltervalues, andMaxItems1–1000 pagination.One decision to make deliberately, not in passing
Its page states policy documents are RFC-3986 URL-encoded, which conflicts with substrate's deliberate plain-JSON rendering. That is the same contradiction
API_GetRoleshows — the prose claims URL-encoding and the page's own sample response is plain JSON. v0.115.0 deliberately did not pre-empt it. Whichever way it goes, it should be one decision applied to every operation that returns a policy document, not a per-operation choice.scttfrdmn commentedon Sep 15, 2026
Verified this issue against the tree at
b30af41before implementing it. The scope holds and the operation is worth exactly what the body claims, but one acceptance criterion is backwards, two are stated against behaviour the tree does not have, a correctness trap is missing, and one design decision AWS does not document is unnamed. Recording all of it here so the PR is not a silent reversal.AC 4 is backwards — substrate already percent-encodes the document
The body says URL-encoding here "is a real wire difference from
GetPolicyVersion". It is not a difference: substrate already percent-encodesGetPolicyVersion's document.iamEscapeRFC3986(emulator/iam_policy_versions.go:244, withisRFC3986Unreservedat:261) is applied atiam_policy_versions.go:227, and it is documented atdocs/services.md:1573("Returns the document, URL-encoded per RFC 3986") and:2724.Substrate's plain-JSON policy-document renderings are only two, and both are deliberate and already recorded:
AssumeRolePolicyDocument—emulator/iam_xml.go:279-285, rationale at:258-272: botocore'safter-call.iamhandler unquotes thenjson.loadseverypolicyDocumentTypemember, and unquoting plain JSON is a no-op.PolicyDocument(GetRolePolicy/GetUserPolicy/GetGroupPolicy) —emulator/iam_plugin.go:2035.The resolution, and it needs no breaking change: follow the per-shape pages, not the operation page's blanket note. Only
PolicyVersion.Document's own type page carries the RFC-3986 mandate ("The policy document returned in this structure is URL-encoded compliant with RFC 3986…").PolicyDetail.PolicyDocumentcarries no such sentence, and neither doesRoleDetail.AssumeRolePolicyDocument. AndAPI_GetAccountAuthorizationDetails' blanket claim is contradicted by its own sample response, in which every document is rendered as plain JSON.API_GetRoleshows the same contradiction.So:
PolicyVersionList[].DocumentreusesiamPolicyVersionXML— percent-encoded, byte-identical toGetPolicyVersion.UserPolicyList/GroupPolicyList/RolePolicyListPolicyDocumentandRoleDetail.AssumeRolePolicyDocumentreuseiam_xml.go's builders — plain JSON, byte-identical toGetRolePolicy/GetRole.Two conventions in one document is what AWS's model has, and it satisfies the invariant this issue exists to protect — a shape must not diverge between the operations that report it — exactly, at zero compatibility cost. The alternative (encode everything) would be a breaking wire change to five shipped operations and to
test/e2e/journey_iam_update_assume_role_policy_test.go:116-120, whose comment records the plain-JSON decision.AC 4's assertion-against-raw-XML requirement stands, and gets stronger: the test asserts that
PolicyVersionList[].Documentis percent-encoded whileAssumeRolePolicyDocumentis plain JSON in the same response body. Thedocs/services.mdsentence AC 4 asks for is written as that per-shape rule, and records AWS's self-contradiction rather than silently resolving it.AC 3 says "clamped"; AWS refuses
MaxItemsoutside 1–1000 must be refused, not clamped.paginateIAMKeys(iam_plugin.go:2769-2771) isif maxItems <= 0 || maxItems > 1000 { maxItems = 100 }, which silently rewrites the value at seven pre-existing operations — filed separately as #868, with the citation for why the code isValidationError/400 here andInvalidInputiniam_simulate.go. This operation validates in the handler before calling the shared helper and inherits none of the coercion. An absentMaxItemsstill defaults to 100, which is what AWS documents and whatiamInt's doc comment (iam_query.go:57-79) protects.AC 6 cannot be met from the stored instance profile —
IAMInstanceProfile.Rolesis a frozen snapshotaddRoleToInstanceProfilestoresprofile.Roles = []IAMRole{role}(iam_plugin.go:3079), a copy taken at attach time. STS writesRoleLastUsedonto the role record and never onto that embedded copy. AWS's sample response renders<RoleLastUsed>insideRoleDetailList → InstanceProfileList → Roles → member, so rendering from the stored copy reportsnilthere for essentially every role — and the defect is invisible to any test that attaches a profile and immediately reads it back.The handler therefore re-loads each embedded role by name via
p.loadRole(iam_plugin.go:2639). The behavioural test attaches a role to an instance profile and then assumes it, which fails against the stored copy and passes against the re-read.Three existing builders are not reusable as-is, because the detail shapes have different members
AC 1's "same helpers wherever one exists" is right in intent, but three of them render members these shapes do not have, verified member by member against the type pages:
iamRoleXMLFields(iam_xml.go:250-257) emitsMaxSessionDurationandDescription—RoleDetailhas neither.iamUserXMLFields(:103-107) emitsPasswordLastUsed—UserDetailhas no such member.GroupDetail's five non-list members matchiamGroupXMLFieldsverbatim, andiamPolicyXMLFieldsmatchesManagedPolicyDetail's scalars.Note the asymmetry that makes this easy to get wrong:
InstanceProfile.Rolesis an array ofRole, notRoleDetail, soDescriptionandMaxSessionDurationare admissible there. The two shapes genuinely differ, and the reason goes in the doc comment as AC 1 requires.Three wrapper names also need hoisting to a parameter, following
iamStringListXML(:572, the only wrapper-parameterized builder today): AWS usesAttachedManagedPolicies(notAttachedPolicies, hardcoded at:541) andInstanceProfileList(notInstanceProfiles,:613), plus the three*DetailLists.<Policies>already matches.AC 7's worry is inverted, and one decision AWS does not document is unnamed
There are 52 bundled managed policies (
ListManagedPolicies,emulator/iam_managed.go:2236) against a defaultMaxItemsof 100. So with any customer entities at all, truncation is on the default path — not the edge case the criterion guards against. That makes theMarkerround-trip the load-bearing test, not an afterthought.Which forces a decision the page does not settle and the body does not name: whether
MaxItemscounts across the four lists combined or per list.API_GetAccountAuthorizationDetailssays only "the maximum number of items". Substrate pages one combined, ordered key space with composite keys ("user/alice","policy/arn:…") so aMarkeris unambiguous about which list it resumes — the interleaving precedent isiam_list_policies.go:137-139. That is substrate's reading, stated as such indocs/services.mdand in the doc comment, not a claim about AWS.Markeremitted only when non-empty already satisfies the rest of AC 3.AC 8's references have drifted, and it is three rules rather than two mentions
emulator/iam_xml.go:262-266is now:296-300(insideiamRoleLastUsedXML);iam_policy_versions.go:90is still accurate;iam_xml.go:178is a third mention (iamPermissionsBoundaryTypePolicy, which names this operation as the future second caller and exists precisely so it cannot pick the other spelling).More than the mentions, three doc-comment rules are broken by design here and each needs rewriting rather than deleting:
iam_xml.go:118-138— "called from the single-entity wrappers only, never from a listing builder" forPermissionsBoundary.:195-206— the same forTags.:289-305—RoleLastUsedsingle-entity-only, which already names iam: GetAccountAuthorizationDetails is authorizable but unimplemented #848 as the condition for its own amendment.The detail shapes are neither the single-entity shape nor the reduced list shape; they are a third population, and the rewritten comments say which member reaches which of the three and why.
Two stale facts
iam_plugin.go:55-226, not:47-226.AttachmentCount(iam: GetPolicy reports the stored AttachmentCount (always 0) while ListPolicies derives it #847, which is wrong onGetPolicytoday)" — that shipped in v0.115.0;getPolicyderives the count viaiamPolicyAttachmentCountsatiam_plugin.go:1370. The consistency AC 5 asks for is now a three-way assertion acrossGetPolicy,ListPoliciesand this operation rather than a fix.Confirmed as written
The authorization wiring:
emulator/authzref/iam.json:365-368gives{"Name": "GetAccountAuthorizationDetails", "Resources": []}andauthz_reference_gen.go:1570gives"iam:GetAccountAuthorizationDetails": {}— an empty value meaning AWS supports no resource-level permissions — so the only wiring needed is the handler's ownp.authorize(…)line, andiamAuthzOperationResource(iam_authz_resources.go:78-169) must not gain a row::62-63states the invariant that every no-resource-type action is absent from that table, and a test enforces it.The five
Filtervalues, the 1–1000MaxItemsrange with default 100,Marker's min length 1 and[ -ÿ]+pattern, the four response lists plusIsTruncated/Marker, andServiceFailure/500 as the only published error are all verified. One derivation is genuinely new — role name → containing instance profiles, becauseListInstanceProfilesForRoleis not implemented;listInstanceProfiles(iam_plugin.go:3186-3210) is the scan to copy.iamPolicyAttachmentCounts(iam_list_policies.go:209),iamBoundaryUsageCounts(iam_boundary_usage.go:61),arnPolicyName,paginateIAMKeys,iamMemberList(iam_query.go:248-260, theFilter.member.Nprecedent),iamEnumMessage,parseIAMBodyandiamXMLResponseare reused as-is, with the policy value copied before assignment (iam_list_policies.go:131-133) because the catalog hands back shared pointers.