Repository navigation
Description
GetRole and GetUser report an entity's permissions boundary under member names that do not exist on AWS's shape, so an SDK decodes the element into an empty struct and a consumer reading the boundary's ARN gets "".
iamPermissionsBoundaryXML (emulator/iam_xml.go:139-146) emits:
return "<PermissionsBoundary><PolicyArn>" + xmlEsc(boundary.PolicyARN) +
"</PolicyArn><PolicyName>" + xmlEsc(boundary.PolicyName) +
"</PolicyName></PermissionsBoundary>"The PermissionsBoundary member on User, Role, UserDetail and RoleDetail is an AttachedPermissionsBoundary, whose Contents section lists exactly two members:
PermissionsBoundaryArn — The ARN of the policy used to set the permissions boundary for the user or role. Type: String. Length Constraints: Minimum length of 20. Maximum length of 2048. Required: No
PermissionsBoundaryType — The permissions boundary usage type that indicates what type of IAM resource is used as the permissions boundary for an entity. This data type can only have a value of
Policy. Type: String. Valid Values:PermissionsBoundaryPolicy. Required: No
Neither PolicyArn nor PolicyName is on it. A grep for either AWS name across the tree returns nothing — substrate has never emitted them — so this has been wrong since the element was added.
Why the existing test does not catch it. emulator/iam_shape_members_test.go:88 asserts only that the <PermissionsBoundary> tag is present. A decoded struct cannot distinguish an absent member from an empty one, which is exactly the failure mode here, so the fix has to be asserted against raw XML.
PermissionsBoundaryType's value
AWS's page contradicts itself: the prose says the type "can only have a value of Policy" while the same page's enumeration says "Valid Values: PermissionsBoundaryPolicy". The AWS CLI v2 reference for get-role, generated from the service model, renders the structure as:
PermissionsBoundaryType -> (string)… Possible values:PermissionsBoundaryPolicy
PermissionsBoundaryArn -> (string)… Constraints: min: 20, max: 2048
Under #671's binding rule — only what the API model states — the wire value is PermissionsBoundaryPolicy, with the prose contradiction recorded rather than silently resolved.
What this moots
#846's second acceptance criterion asks that "the PolicyName stored on the entity comes from the resolved policy". AWS's boundary shape has no PolicyName member at all, so there is nowhere for a better-sourced name to go. The arnPolicyName string surgery at emulator/iam_plugin.go:2789-2795 stays on the stored record — ListAttachedRolePolicies renders a name, where AWS's AttachedPolicy shape does have one — and stops reaching the wire here.
Acceptance criteria
-
iamPermissionsBoundaryXMLrendersPermissionsBoundaryArnandPermissionsBoundaryType, and no longer rendersPolicyArnorPolicyName. -
PermissionsBoundaryTyperendersPermissionsBoundaryPolicy, with the enum-versus-prose contradiction recorded in a doc comment. - Asserted against raw XML for both
GetRoleandGetUser, so an absent member cannot pass as an empty one. - The value is a named constant, so a shape added later (
GetAccountAuthorizationDetails, iam: GetAccountAuthorizationDetails is authorizable but unimplemented #848) cannot pick the other spelling.
Compatibility: a consumer parsing PolicyArn out of the boundary breaks; one using an SDK starts working. That is the intended direction — the SDK path is the one AWS's model describes.
Activity
fix(iam): a boundary an SDK can read, and a count something wrote (#852…