Skip to content

iam: tags are stored but no entity read reports them #796

Closed

Description

@scttfrdmn

IAM tags are stored but never rendered. TagUser/TagRole merge them onto the entity record
(emulator/iam_plugin.go:2197-2219, :2345-2401) and IAMUser.Tags/IAMRole.Tags persist them
(emulator/iam_types.go:19-42), but no read operation reports them:

  • iamUserXMLFields (emulator/iam_xml.go:76-98) emits no <Tags> member
  • iamRoleXMLFields (emulator/iam_xml.go:117-176) emits no <Tags> member

So GetUser, GetRole, ListUsers, ListRoles, CreateUser and CreateRole all report a user
or role with no tags, where AWS publishes a Tags member on every one of those responses. The
tags are readable only through ListUserTags/ListRoleTags, which are the two operations that
already call iamTagListXML (emulator/iam_xml.go:347) — so the renderer exists and is simply not
reached from the entity shapes.

The observable consequence is a consumer that tags a role at create time and then reads the role
back: CreateRole accepts and stores Tags.member.N (#639 fixed the wire decoding), and GetRole
answers as though it had stored nothing. A CDK or Terraform run that reconciles what it asked for
against what it reads back sees a permanent drift.

Two adjacent gaps in the same area, worth deciding in the same piece of work rather than separately:

  • IAMGroup (iam_types.go:46-52) and IAMPolicy (iam_types.go:55-67) have no Tags field at
    all, so there is nowhere for a policy's or group's tags to go.
  • TagPolicy, UntagPolicy, ListPolicyTags, TagInstanceProfile, UntagInstanceProfile and
    ListInstanceProfileTags are not implemented — absent from the HandleRequest switch
    (iam_plugin.go:54-212).

Found while surveying the IAM authorization door for #770; deliberately not folded into that
release, which is about the resource an IAM request is authorized against rather than what the
response reports.

Acceptance criteria

  • GetUser, GetRole, ListUsers, ListRoles, CreateUser and CreateRole report a Tags
    member, in the shape the IAM API reference documents for each response
  • A tag set through TagUser/TagRole is visible through the entity read, not only through
    ListUserTags/ListRoleTags — asserted end to end rather than at the renderer
  • An untagged entity reports what AWS reports for one (an absent member, not an empty list) —
    cited, since the two are different on the wire
  • Whether IAMGroup/IAMPolicy gain a Tags field, and whether the six unimplemented
    tagging operations are in scope, is decided in this issue rather than left implicit
  • docs/services.md's IAM section states what carries tags and what does not

Activity

  1. added
    type: bug
    area: iam
    on Sep 11, 2026
  2. added this to the v0.112.0 milestone on Sep 11, 2026
  3. scttfrdmn commented on Sep 11, 2026

    @scttfrdmn
    OwnerAuthor

    Planned for v0.112.0. The fourth criterion — decide what is in scope rather than leaving it implicit
    — is settled here, against the API reference and the User Guide.

    What gets a Tags member on a read

    GetUser, CreateUser, GetRole, CreateRole, CreateServiceLinkedRole, GetPolicy,
    CreatePolicy, GetInstanceProfile, CreateInstanceProfile — omitted entirely when the entity
    has no tags.

    Tags is documented Required: No on API_User, API_Role, API_Policy and
    API_InstanceProfile; every reference sample response for an untagged entity omits the element; and
    CreateInstanceProfile's sample proves omission is deliberate rather than sample-trimming by
    rendering its required empty list as <Roles/> while carrying no <Tags> at all. So substrate
    must not emit <Tags></Tags> here — which means iamTagListXML (emulator/iam_xml.go:347), whose
    wrapper is unconditional, stays as it is for ListUserTags/ListRoleTags (where Tags is a
    required response element) and is guarded at the entity-shape call sites.

    What does not — and this corrects the issue text above

    The list shapes must not report tags. AWS says so on the operation pages, verbatim
    (https://docs.aws.amazon.com/IAM/latest/APIReference/API_ListRoles.html; the same note appears on
    ListUsers, ListPolicies and ListInstanceProfiles):

    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.

    So the first criterion's inclusion of ListUsers and ListRoles is wrong and will not be
    implemented: those two report no tags, deliberately, and a test asserts it with the note quoted.
    GetGroup's nested Users list and the roles nested inside instance-profile shapes
    (iamRoleMembersXML, iam_xml.go:393) are excluded on the same grounds.

    This forces the real shape of the work: iamUserXMLFields and iamRoleXMLFields are each shared by
    a single-entity shape and a listing shape, so they must be split rather than extended.

    IAMGroup and IAMPolicy

    The six unimplemented operations

    In scope: TagPolicy, UntagPolicy, ListPolicyTags, TagInstanceProfile,
    UntagInstanceProfile, ListInstanceProfileTags — as parallels of the existing user/role handlers,
    plus Tags.member.N decoding on CreatePolicy and CreateInstanceProfile and six
    iamAuthzOperationResource rows.

    Out of scope, with reasons: TagGroup/UntagGroup/ListGroupTags do not exist; and
    TagMFADevice, TagSAMLProvider, TagOpenIDConnectProvider, TagServerCertificate and their
    partners have nothing to tag, because those entities are not modelled at all.

    Split out of this issue

    Two adjacent findings are filed separately rather than folded in, because each turns a request
    substrate accepts today into one it refuses (or removes a member a consumer reads today) and so earns
    its own compatibility note:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: iamarea: taggingtype: bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions