10000 fixes a bug in the SwitchUserListener · dpb587/symfony@c660fcd · GitHub
[go: up one dir, main page]

Skip to content

Commit c660fcd

Browse files
schmittjohfabpot
authored andcommitted
fixes a bug in the SwitchUserListener
1 parent 2014ff6 commit c660fcd

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

UPDATE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ PR11 to PR12
2626
<app:engine>twig</app:engine>
2727
<twig:extension>twig.extension.debug</twig:extension>
2828

29+
* Fixes a critical security issue which allowed all users to switch to
30+
arbitrary accounts when the SwitchUserListener was activated. Configurations
31+
which do not use the SwitchUserListener are not affected.
32+
2933
PR10 to PR11
3034
------------
3135

src/Symfony/Component/Security/Http/Firewall/SwitchUserListener.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\Security\Http\Firewall;
1313

14+
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
1415
use Symfony\Component\Security\Core\SecurityContextInterface;
1516
use Symfony\Component\Security\Core\User\UserProviderInterface;
1617
use Symfony\Component\Security\Core\User\UserCheckerInterface;
@@ -112,7 +113,9 @@ private function attemptSwitchUser(Request $request)
112113
throw new \LogicException(sprintf('You are already switched to "%s" user.', $token->getUsername()));
113114
}
114115

115-
$this->accessDecisionManager->decide($token, array($this->role));
116+
if (false === $this->accessDecisionManager->decide($token, array($this->role))) {
117+
throw new AccessDeniedException();
118+
}
116119

117120
$username = $request->get($this->usernameParameter);
118121

0 commit comments

Comments
 (0)
0