Skip to content

Commit

Permalink
fixes a bug in the SwitchUserListener
Browse files Browse the repository at this point in the history
  • Loading branch information
schmittjoh authored and fabpot committed Apr 19, 2011
1 parent 2014ff6 commit c660fcd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions UPDATE.md
Expand Up @@ -26,6 +26,10 @@ PR11 to PR12
<app:engine>twig</app:engine>
<twig:extension>twig.extension.debug</twig:extension>

* Fixes a critical security issue which allowed all users to switch to
arbitrary accounts when the SwitchUserListener was activated. Configurations
which do not use the SwitchUserListener are not affected.

PR10 to PR11
------------

Expand Down
Expand Up @@ -11,6 +11,7 @@

namespace Symfony\Component\Security\Http\Firewall;

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

$this->accessDecisionManager->decide($token, array($this->role));
if (false === $this->accessDecisionManager->decide($token, array($this->role))) {
throw new AccessDeniedException();
}

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

Expand Down

0 comments on commit c660fcd

Please sign in to comment.