Skip to content

Commit 94be78c

Browse files
committed
security #cve-2021-21424 [security] fix cve-2021-21424 legacy Symfony 3.x + MakerBundle (jrushlow)
This PR was squashed before being merged into the 3.x branch.
2 parents 313b566 + b162ace commit 94be78c

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

CHANGELOG.md

+10
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
# Changelog
2+
3+
## [v1.29.2](https://github.com/symfony/maker-bundle/releases/tag/v1.29.2)
4+
5+
*May 18th, 2021*
6+
7+
### Security
8+
9+
- [#882](https://github.com/symfony/maker-bundle/pull/882) - [security] fix cve-2021-21424 legacy Symfony 3.x + MakerBundle- *@jrushlow*
10+
111
1.29
212
====
313

src/Resources/skeleton/authenticator/LoginFormAuthenticator.tpl.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
1010
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
1111
<?= $user_needs_encoder ? "use Symfony\\Component\\Security\\Core\\Encoder\\UserPasswordEncoderInterface;\n" : null ?>
12-
use Symfony\Component\Security\Core\Exception\CustomUserMessageAuthenticationException;
1312
use Symfony\Component\Security\Core\Exception\InvalidCsrfTokenException;
13+
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
1414
use Symfony\Component\Security\Core\Security;
1515
use Symfony\Component\Security\Core\User\UserInterface;
1616
use Symfony\Component\Security\Core\User\UserProviderInterface;
@@ -74,7 +74,7 @@ public function getUser($credentials, UserProviderInterface $userProvider)
7474

7575
if (!$user) {
7676
// fail authentication with a custom error
77-
throw new CustomUserMessageAuthenticationException('<?= ucfirst($username_field_label) ?> could not be found.');
77+
throw new UsernameNotFoundException('<?= ucfirst($username_field_label) ?> could not be found.');
7878
}
7979

8080
return $user;

tests/fixtures/MakeRegistrationFormVerifyEmailFunctionalTest/src/Security/LoginFormAuthenticator.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
1010
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
1111
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
12-
use Symfony\Component\Security\Core\Exception\CustomUserMessageAuthenticationException;
1312
use Symfony\Component\Security\Core\Exception\InvalidCsrfTokenException;
13+
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
1414
use Symfony\Component\Security\Core\Security;
1515
use Symfony\Component\Security\Core\User\UserInterface;
1616
use Symfony\Component\Security\Core\User\UserProviderInterface;
@@ -70,7 +70,7 @@ public function getUser($credentials, UserProviderInterface $userProvider)
7070
$user = $this->entityManager->getRepository(User::class)->findOneBy(['email' => $credentials['email']]);
7171

7272
if (!$user) {
73-
throw new CustomUserMessageAuthenticationException('Email could not be found.');
73+
throw new UsernameNotFoundException('Email could not be found.');
7474
}
7575

7676
return $user;

0 commit comments

Comments
 (0)