Skip to content

server: console user and role deletes leave the cached creation time #787

Open

Description

@robinnsc

The console's Delete user and Delete role handlers drop the deleted principal's cached credentials, policies, boundary and tags, but not its cached creation time. The management API handlers drop that too. A user or role that is deleted and then created again with the same name can therefore be evaluated with the old principal's creation time for up to auth.cache.ttl_seconds (60 s by default).

Mechanism

The creation time is an input to the principal's aws:userid (crates/auth/src/policy/principal_id.rs) and is read through the user_created_at and role_created_at caches (crates/server/src/authorization.rs:104, :206).

On main (2287d17):

  • management/iam_user.rs:212 calls invalidate_user_created_at, and management/iam_role.rs:174 calls invalidate_role_created_at, after the delete.
  • console/pages/user_pages.rs delete_user (invalidations at lines 359-379) and console/pages/role_pages.rs delete_role (lines 316-337) call every other invalidation but not these two.

So after a console delete, a same-name principal created within the TTL gets the deleted principal's aws:userid, and a policy condition on aws:userid written for the old principal matches the new one until the entry expires.

Reproduction

  1. Create user u with an access key, and make one request with it so the creation time is cached.
  2. Delete u in the console, create u again through the management API, and give it an access key.
  3. Within 60 s, make a request that is decided by an aws:userid condition. It is evaluated with the old user's id. After the TTL, or with the delete done through the management API, it uses the new id.

Expected

The console delete handlers drop the creation-time entry, as the management handlers do.

Found while writing #786.

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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions