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

[security][2fa] totp possible null argument #19

Open
jrushlow opened this issue Feb 12, 2022 · 0 comments
Open

[security][2fa] totp possible null argument #19

jrushlow opened this issue Feb 12, 2022 · 0 comments

Comments

@jrushlow
Copy link

Possible null argument in App\Entity\User::getTotpAuthenticationConfiguration() method.

User::totpSecret is nullable:

#[ORM\Column(type: Types::STRING, nullable: true)]
private ?string $totpSecret = null;

User::getTotpAuthenticationConfiguration() returns null|TotpConfigurationInterface. To prevent \RuntimeExceptions and comply w/ the interface method signature, we should be doing:

// App\Entity\User

public function getTotpAuthenticationConfiguration(): ?TotpConfigurationInterface
{
    return $this->totpSecret ? new TotpConfiguration($this->totpSecret, TotpConfiguration::ALGORITHM_SHA1, 30, 6) : null;
}

image

@jrushlow jrushlow changed the title [security] totp possible null argument [security][2fa] totp possible null argument Feb 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant