Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 17f4fe4

Browse filesBrowse files
bug #50582 [Security/Http] Fix false-string handling in RememberMeAuthenticator (ossinkine)
This PR was merged into the 5.4 branch. Discussion ---------- [Security/Http] Fix false-string handling in `RememberMeAuthenticator` | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exists, explain below instead --> | License | MIT | Doc PR | symfony/symfony-docs#... <!-- required for new features --> I found some errors "No remember-me cookie is found." in my logs. I didn't find another way to reproduce it other than set "false-string" to the cookie value, for example `0`. This PR fixes this. Commits ------- 87c2bc2 [Security] Fix false-string handling in RememberMeAuthenticator
2 parents 7723dca + 87c2bc2 commit 17f4fe4
Copy full SHA for 17f4fe4

File tree

2 files changed

+4
-1
lines changed
Filter options

2 files changed

+4
-1
lines changed

‎src/Symfony/Component/Security/Http/Authenticator/RememberMeAuthenticator.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Http/Authenticator/RememberMeAuthenticator.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function supports(Request $request): ?bool
7070
return false;
7171
}
7272

73-
if (!$request->cookies->has($this->cookieName)) {
73+
if (!$request->cookies->has($this->cookieName) || !\is_scalar($request->cookies->all()[$this->cookieName] ?: null)) {
7474
return false;
7575
}
7676

‎src/Symfony/Component/Security/Http/Tests/Authenticator/RememberMeAuthenticatorTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Http/Tests/Authenticator/RememberMeAuthenticatorTest.php
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ public static function provideSupportsData()
6161
$request = Request::create('/', 'GET', [], ['_remember_me_cookie' => 'rememberme']);
6262
$request->attributes->set(ResponseListener::COOKIE_ATTR_NAME, new Cookie('_remember_me_cookie', null));
6363
yield [$request, false];
64+
65+
$request = Request::create('/', 'GET', [], ['_remember_me_cookie' => '0']);
66+
yield [$request, false];
6467
}
6568

6669
public function testAuthenticate()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.