Skip to content

Commit 3fbdac1

Browse files
xabbuhfabpot
authored andcommitted
prevent timing attacks in digest auth listener
1 parent 85c378b commit 3fbdac1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Firewall/DigestAuthenticationListener.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Symfony\Component\Security\Core\SecurityContextInterface;
1515
use Symfony\Component\Security\Core\User\UserProviderInterface;
16+
use Symfony\Component\Security\Core\Util\StringUtils;
1617
use Symfony\Component\Security\Http\EntryPoint\DigestAuthenticationEntryPoint;
1718
use Psr\Log\LoggerInterface;
1819
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
@@ -99,7 +100,7 @@ public function handle(GetResponseEvent $event)
99100
return;
100101
}
101102

102-
if ($serverDigestMd5 !== $digestAuth->getResponse()) {
103+
if (!StringUtils::equals($serverDigestMd5, $digestAuth->getResponse())) {
103104
if (null !== $this->logger) {
104105
$this->logger->debug(sprintf('Expected response: "%s" but received: "%s"; is AuthenticationDao returning clear text passwords?', $serverDigestMd5, $digestAuth->getResponse()));
105106
}

0 commit comments

Comments
 (0)