Skip to content

Commit

Permalink
Merge branch '5.2' into 5.x
Browse files Browse the repository at this point in the history
* 5.2:
  [CI][Psalm] Install stable/released PHPUnit
  [Security] Add missing Finnish translations
  [Security][Guard] Prevent user enumeration via response content
  • Loading branch information
nicolas-grekas committed May 12, 2021
2 parents 1336b3e + dbb5559 commit 647d192
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion DependencyInjection/SecurityExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ private function createFirewall(ContainerBuilder $container, string $id, array $
->replaceArgument(0, $authenticators)
->replaceArgument(2, new Reference($firewallEventDispatcherId))
->replaceArgument(3, $id)
->replaceArgument(6, $firewall['required_badges'] ?? [])
->replaceArgument(7, $firewall['required_badges'] ?? [])
->addTag('monolog.logger', ['channel' => 'security'])
;

Expand Down
1 change: 1 addition & 0 deletions Resources/config/guard.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
abstract_arg('Provider-shared Key'),
abstract_arg('Authenticators'),
service('logger')->nullOnInvalid(),
param('security.authentication.hide_user_not_found'),
])
->tag('monolog.logger', ['channel' => 'security'])
;
Expand Down
1 change: 1 addition & 0 deletions Resources/config/security_authenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
abstract_arg('provider key'),
service('logger')->nullOnInvalid(),
param('security.authentication.manager.erase_credentials'),
param('security.authentication.hide_user_not_found'),
abstract_arg('required badges'),
])
->tag('monolog.logger', ['channel' => 'security'])
Expand Down
2 changes: 1 addition & 1 deletion Tests/DependencyInjection/CompleteConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function testAuthenticatorManager()
$this->assertEquals(AuthenticatorManager::class, $authenticatorManager->getClass());

// required badges
$this->assertEquals([CsrfTokenBadge::class, RememberMeBadge::class], $authenticatorManager->getArgument(6));
$this->assertEquals([CsrfTokenBadge::class, RememberMeBadge::class], $authenticatorManager->getArgument(7));

// login link
$expiredStorage = $container->getDefinition($expiredStorageId = 'security.authenticator.expired_login_link_storage.main');
Expand Down
2 changes: 1 addition & 1 deletion Tests/Functional/AuthenticatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function testFirewallUserProvider($email, $withinFirewall)
if ($withinFirewall) {
$this->assertJsonStringEqualsJsonString('{"email":"'.$email.'"}', $client->getResponse()->getContent());
} else {
$this->assertJsonStringEqualsJsonString('{"error":"Username could not be found."}', $client->getResponse()->getContent());
$this->assertJsonStringEqualsJsonString('{"error":"Invalid credentials."}', $client->getResponse()->getContent());
}
}

Expand Down
2 changes: 1 addition & 1 deletion Tests/Functional/FormLoginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public function testLoginThrottling()

break;
case 2: // Third attempt with unexisting username
$this->assertStringContainsString('Username could not be found.', $text, 'Invalid response on 3rd attempt');
$this->assertStringContainsString('Invalid credentials.', $text, 'Invalid response on 3rd attempt');

break;
case 3: // Fourth attempt : still login throttling !
Expand Down

0 comments on commit 647d192

Please sign in to comment.