Repository navigation
Description
ListPolicies parses both Scope and PathPrefix and applies neither, and it enumerates
only policies created through CreatePolicy. The 52 bundled AWS managed policies are
invisible to every listing, so --scope AWS returns whatever the caller happened to
create and --path-prefix /service-role/ returns the same thing.
Found while verifying #484, which reported the narrower case: GetPolicy could not resolve
five service-role ARNs AttachRolePolicy accepted. Seeding the catalog fixed that
(v0.87.0). This is unrelated to that report and wider than it — the catalog is now correct
and ListPolicies still cannot see it.
Current behaviour
iam_plugin.go:1110 (listPolicies) reads Scope, PathPrefix, OnlyAttached,
MaxItems and Marker out of the request, then lists state keys under policy: and
returns them. No parameter narrows the result.
What AWS does
Per the ListPolicies reference:
Scope—All(default),AWS(AWS managed policies only), orLocal(customer
managed only).PathPrefix— lists only policies whosePathbegins with it./service-role/is the
case a consumer reaches for.OnlyAttached— only policies with a non-zeroAttachmentCount.
Scope=AWS on real IAM returns roughly 1,200 policies; substrate can only ever return the
52 it bundles, which is a documented gap rather than a bug, but returning zero is the
bug.
Why it matters
A consumer discovering a policy ARN rather than hardcoding it — list-policies --scope AWS --path-prefix /service-role/ then picking a name — gets an empty list, so their
discovery path is untestable. It also breaks the pairing a reader expects: an ARN
GetPolicy resolves does not appear in any listing.
Acceptance criteria
-
ListPoliciesincludes the bundled managed policies, withAttachmentCountfrom
stored attachments. -
Scope=AWSreturns only bundled policies;Scope=LocalonlyCreatePolicyones;
All/absent returns both. -
PathPrefix=/service-role/returns only the service-role policies. -
OnlyAttached=truenarrows to attached policies. -
docs/services.mdstates that the AWS-managed scope is the seeded catalog, not the
full ~1,200. - Tests cover each parameter, the combination of
ScopeandPathPrefix, and that
pagination still holds with the catalog in the result set.
Activity
feat(iam): bundle the five service-role managed policies (#484) (#500)
fix(iam): decode query-protocol scalar parameters (#642) (#643)
fix(iam): ListPolicies applies its filters and sees the catalog (#497) (