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

Bug: $hash in User::SetPasswordHash not nullable #1234

Open
ludis opened this issue Dec 6, 2024 · 1 comment
Open

Bug: $hash in User::SetPasswordHash not nullable #1234

ludis opened this issue Dec 6, 2024 · 1 comment
Labels
bug Something isn't working waiting for info Issues or pull requests that need further clarification from the author

Comments

@ludis
Copy link

ludis commented Dec 6, 2024

PHP Version

8.3.4

CodeIgniter4 Version

4.5.2

Shield Version

1.1.0

Which operating systems have you tested for this bug?

macOS

Which server did you use?

apache

Database

MySQL 5.7

Did you customize Shield?

No

What happened?

Create new user with password empty
User requests a login link

Error: CRITICAL - 2024-12-06 12:38:16 --> TypeError: CodeIgniter\Shield\Entities\User::setPasswordHash(): Argument #1 ($hash) must be of type string, null given

Steps to Reproduce

See 'what happened'

Expected Output

CodeIgniter\Shield\Entities\User::setPasswordHash() should accept NULL values I think.
Since private property $password_hash of class User is nullable.
Parameter $hash should be nullable, like this:
public function setPasswordHash(?string $hash)

Anything else?

No response

@ludis ludis added the bug Something isn't working label Dec 6, 2024
@datamweb
Copy link
Collaborator

datamweb commented Feb 6, 2025

@ludis Why do you allow null values for passwords? Have you validated the input before storing it? And what is your plan to ensure the security of accounts with empty passwords?

@datamweb datamweb added the waiting for info Issues or pull requests that need further clarification from the author label Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working waiting for info Issues or pull requests that need further clarification from the author
Projects
None yet
Development

No branches or pull requests

2 participants