# UNDF: UNDF-2026-000000132 --- a/keystone/api/users.py +++ b/keystone/api/users.py @@ -663,7 +663,7 @@ class UsersResource(ks_flask.ResourceBase): # credential users from escallating their privileges to include # additional roles that the trustor or application credential # creator has assigned on the project. - token_roles = [r['id'] for r in token.roles] + token_role_ids = {r['id'] for r in token.roles} for role in roles: - if role['id'] not in token_roles: + if role['id'] not in token_role_ids: detail = _( 'Cannot create an application credential with ' 'unassigned role'