Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Security] roles on token are ignored since 7.3 #60656

Closed
@dmaicher

Description

@dmaicher

Symfony version(s) affected

7.3.0

Description

We have some logic in our app that impersonating a user adds some additional roles to the token.

Those roles are now not available anymore since this change and voting on those roles is denying access.

cc @nicolas-grekas so I think your assumption was not quite correct that those roles are not used in case the user implements EquatableInterface 🤔

It now just falls back to just the user roles as the additionally added roles are ignored during serialization.

How to reproduce

Code looks something like

$additionalRoles = [...];

$token = new SwitchUserToken(
    $impersonatedUser,
    '...',
    array_merge($impersonatedUser->getRoles(), $additionalRoles), // here we pass additional roles which are ignored now
    $originalToken,
);

Our $impersonatedUser object implements EquatableInterface.

Possible Solution

Revert #59558 🤔

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions