Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail on empty password verification (without warning on any implementation) #35497

Merged
merged 1 commit into from Feb 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -76,6 +76,9 @@ public function encodePassword($raw, $salt): string
*/
public function isPasswordValid($encoded, $raw, $salt): bool
{
if ('' === $raw) {
return false;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there should be a blank line after this one, same below

if (\strlen($raw) > self::MAX_PASSWORD_LENGTH) {
return false;
}
Expand Down
Expand Up @@ -76,6 +76,9 @@ public function encodePassword($raw, $salt): string
*/
public function isPasswordValid($encoded, $raw, $salt): bool
{
if ('' === $raw) {
return false;
}
if (\strlen($raw) > self::MAX_PASSWORD_LENGTH) {
return false;
}
Expand Down
Expand Up @@ -53,6 +53,7 @@ public function testValidation()
$result = $encoder->encodePassword('password', null);
$this->assertTrue($encoder->isPasswordValid($result, 'password', null));
$this->assertFalse($encoder->isPasswordValid($result, 'anotherPassword', null));
$this->assertFalse($encoder->isPasswordValid($result, '', null));
}

public function testNonArgonValidation()
Expand Down
Expand Up @@ -29,6 +29,7 @@ public function testValidation()
$result = $encoder->encodePassword('password', null);
$this->assertTrue($encoder->isPasswordValid($result, 'password', null));
$this->assertFalse($encoder->isPasswordValid($result, 'anotherPassword', null));
$this->assertFalse($encoder->isPasswordValid($result, '', null));
}

public function testBCryptValidation()
Expand Down