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

Fix: Ensure proper authentication when password is set against an user #1412

Merged
merged 2 commits into from
Jan 23, 2025

Conversation

pankajjs
Copy link
Contributor

Description
This PR sets password against an user when password is set with --password flag while starting the server with
go run main.go --password pass command.

Working Proof
  • Starting the server with password flag
Screenshot 2025-01-23 at 1 20 42 AM
  • Connecting cli and executing command without auth
Screenshot 2025-01-23 at 1 21 09 AM
  • Auth with wrong password
Screenshot 2025-01-23 at 1 21 24 AM
  • Auth with correct password
Screenshot 2025-01-23 at 1 21 36 AM
  • Executing command with after successful auth
Screenshot 2025-01-23 at 1 21 46 AM

@arpitbbhayani
Copy link
Contributor

arpitbbhayani commented Jan 23, 2025

Thanks for the patch. Couple of pointers.

  1. What are the cases where SetPassword would fail? I see that error will cascade from bcrypt, bu what are the scenarios? because if it is highly unlikely, we can get rid of it.
  2. Look at LOGGING and reword the log message.

@pankajjs
Copy link
Contributor Author

pankajjs commented Jan 23, 2025

Thanks for the patch. Couple of pointers.

  1. What are the cases where SetPassword would fail? I see that error will cascade from bcrypt, bu what are the scenarios? because if it is highly unlikely, we can get rid of it.
  2. Look at LOGGING and reword the log message.
  1. The SetPassword may fail when bcrypt.DefaultCost is not within the valid range which is highly unlikely to happen because it is a predefined constant.
  2. The SetPassword may fail when bcrypt fails to perform hashing operation. This can unlikely to happen.

Considering above cases, We can get rid of the check.

@arpitbbhayani arpitbbhayani merged commit 99fe4ba into DiceDB:master Jan 23, 2025
1 of 2 checks passed
@arpitbbhayani
Copy link
Contributor

Awesome. Merged your changes. thanks.

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

Successfully merging this pull request may close these issues.

AUTH not respecting password
2 participants