Repository navigation
Description
What is wrong
listInstanceProfiles (emulator/iam_plugin.go:3233-3257) decodes no request parameters at all — there is no parseIAMBody call and no params struct. It authorizes, lists the account's instance-profile keys, decodes each record, and returns every profile with IsTruncated hardcoded false.
API_ListInstanceProfiles publishes three request parameters, and substrate accepts and ignores every one:
| Parameter | Published | Today |
|---|---|---|
MaxItems |
Integer, "Valid Range: Minimum value of 1. Maximum value of 1000", default 100 | ignored; every profile is returned |
Marker |
String, 1-320, pattern [ -ÿ]+ |
ignored |
PathPrefix |
String, 1-512, "If it is not included, it defaults to a slash (/), listing all instance profiles" | ignored; a caller filtering by path gets everything |
IsTruncated is hardcoded false, so a caller is told the page is complete whichever of those it sent. ListRoles, ListUsers, ListGroups and ListPolicies all decode and apply their equivalents, so this is the one listing in the plugin that does not.
Why it is worth fixing rather than leaving
This is the accepted-and-ignored class — the same shape as a 200 written for a request nothing acted on. A consumer's paginator asks for MaxItems=10, receives every profile in the account with IsTruncated=false, and concludes correctly from substrate's answer and incorrectly about AWS. A consumer filtering with PathPrefix=/service-role/ gets profiles from every path and cannot tell.
It is also why #868 could not cover it: that fix range-checks a decoded MaxItems, and there is nothing decoded here to check. #868's own inventory listed this operation (as iam_plugin.go:2123, before line drift), and the correction is recorded on that issue.
ListInstanceProfileTags — a different operation, in iam_tagging.go — does decode and validate MaxItems, so the two disagree about the same parameter name within one entity's operations.
What to do
- Decode
MaxItems,MarkerandPathPrefixwithparseIAMBody, aslistRolesdoes. - Apply
iamValidateMaxItems(emulator/iam_max_items.go) before any work, so the refusal matches the nineteen operations iam: paginateIAMKeys silently rewrites an out-of-range MaxItems to 100 at eight operations AWS refuses #868 guarded. - Page through
paginateIAMKeys, which sorts the key space and base64-encodes the marker, and report the realIsTruncatedandMarker. - Apply
PathPrefixbefore paginating, not after.listUsersandlistRolesfilter after the page is cut, which can under-fill a page; that is a separate defect and this operation should not copy it. - Validate
PathPrefix's pattern, or record explicitly that it is not validated, so the decision is not implied by the absence of a check.
Acceptance criteria
-
MaxItems=1over three profiles returns one profile,IsTruncatedtrue and aMarker; the marker round-trips and the walk returns each profile exactly once. -
MaxItems=0andMaxItems=1001are refused withValidationError/400, matching the nineteen operations iam: paginateIAMKeys silently rewrites an out-of-range MaxItems to 100 at eight operations AWS refuses #868 guarded. - An absent
MaxItemsstill returns up to 100 profiles and reportsIsTruncatedtruthfully. -
PathPrefix=/service-role/returns only profiles under that path, and the filter is applied before the page is cut — asserted with more profiles outside the prefix than the page size, so a filter-after-paginate implementation under-fills and fails. -
docs/services.md'sListInstanceProfilesrow stops recording the parameters as ignored.
Compatibility
A caller that sent MaxItems or PathPrefix and relied on receiving everything anyway will now receive a page or a filtered set. Any such caller was relying on substrate ignoring a parameter AWS applies.
Surfaced while implementing #868, whose inventory named this operation from a stale line number.
Activity
feat(iam): the account authorization snapshot, and MaxItems refused r…
fix(iam): decode MaxItems, Marker and PathPrefix on ListInstanceProfi…