-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Exception on _switch_user when not logged in. #22729
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for the report! I could reproduce the issue and proposed a fix here #22732 |
…ken (dmaicher) This PR was merged into the 2.7 branch. Discussion ---------- [Security] fix switch user _exit without having current token | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #22729 | License | MIT | Doc PR | - Attempting to `_exit` from a switched user caused an error when not having any token in the storage (for example happens when not logged in + disallowing anonymous users on that firewall): `[1] Symfony\Component\Debug\Exception\FatalThrowableError: Type error: Argument 1 passed to Symfony\Component\Security\Http\Firewall\SwitchUserListener::getOriginalToken() must be an instance of Symfony\Component\Security\Core\Authentication\Token\TokenInterface, null given, called in symfony/symfony/src/Symfony/Component/Security/Http/Firewall/SwitchUserListener.php on line 164` Commits ------- 16da686 [Security] fix switch user _exit without having current token
I still have this problem with Symfony-3.3.3... The problem is indeed solved when passing
Best regards |
@peter17 thanks for the report. But it also fails for older symfony versions (like Seems we need to apply a similar fix for switching as well like we did for exiting. |
It is still present in my project upgraded to Symfony 4.2.3...
So this bug was never really solved... is it possible to repen it? |
Can you create a small example application that will allow us to reproduce the issue? |
…ntoine Lamirault) This PR was merged into the 3.4 branch. Discussion ---------- [Security] fix switch user without having current token | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #22729 | License | MIT Attempting to switch a user cause an error when not having any token in the storage Commits ------- 15db914 [Security] fix switch user without having current token
The following problem appears on all my Symfony projects.
I set up a firewall on
^/admin
withswitch_user
enabled. Everything works fine except one thing: any anonymous user can throw an Error 500 by visiting any/admin/xxx
existing URL if they pass the_switch_user=_exit
parameter in the URL.For instance, when I am not logged in, if I visit:
https://www.mydomainnameforthisproject.com/app_dev.php/admin/index?_switch_user=_exit
I obtain this stack trace:
This is my firewall configuration.
I think this is a bug, because an anonymous user should NOT ne able to do anything (especially producing an uncaught Exception) on the
/admin/xxx
URLs...Regards
The text was updated successfully, but these errors were encountered: