Skip to content

Roles of original users are not persisted through SET SESSION AUTHORIZATION calls  #25166

@homar

Description

@homar

Roles of original users are not persisted through SET SESSION AUTHORIZATION calls which leads to failure of each subsequent queries done by impersonated user.
The reason is that each of those queries will be first checked with checkCanImpersonateUser check and each of them will fail because original user won't have any enabled roles that would allow impersonation.

Example:

  1. user 'alicecallsSET SESSION AUTHORIZATION 'bob'`
  2. that leads to invocation of io.trino.security.AccessControl#checkCanImpersonateUser
  3. this check passes
  4. then user 'bob' calls 'SHOW CATALOGS' (or any other query)
  5. that leads to invocation of io.trino.security.AccessControl#checkCanImpersonateUser
  6. this check fails as alice has no roles enabled

This incorrect behaviour is demonstrated in this draft PR in TestImpersonation.testImpersonate()

Basically after bob is impersonated no roles are assigned to him and thus following checkCanImpersonateUser checks fail.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions