dice icon indicating copy to clipboard operation
dice copied to clipboard

Add support for `AUTH` command

Open arpitbbhayani opened this issue 1 year ago • 11 comments

Add support for the AUTH command in DiceDB similar to Redis' AUTH Command. Please refer to how AUTH is implemented in Redis.

Write unit and integration tests for the command referring to the tests written in the Redis codebase 7.2.5. For integration tests, you can refer to the tests folder. Note: they have used TCL for the test suite, and we need to port that to our way of writing integration tests using the relevant helper methods. Please refer to our tests directory.

For the command, benchmark the code and measure the time taken and memory allocs using benchmem and try to keep them to the bare minimum.

arpitbbhayani avatar Jul 12 '24 07:07 arpitbbhayani

Redis functionality

Prior to Redis 6, authentication for a connection was enabled by passing in requirepass in the redis.conf or while starting the redis server. If the above config is set, prior to any command, the authentication has to be by running the following command:

AUTH '<password>'

After Redis 6, the concept of ACLs was introduced which allowed users to define a combination of users with multiple passwords per user. ACLs also provided the ability to restrict usage based on Commands, Channels, Keys, etc.

Some ACL functionalities from the Redis documentation can be found here :

  • Enable and disallow users
  • Allow and disallow commands
  • Allow and disallow certain keys and key permissions
  • Allow and disallow Pub/Sub channels
  • Configure valid passwords for the user
  • Configure selectors for the user

Implementation phases

The implementation for the AUTH should be broken down into the following phases:

  1. Allow users to define Username/Password(s) combination and perform authentication on the configured input
  2. Provide authorisation actions on different objects using ACLs.

gsarmaonline avatar Jul 24 '24 14:07 gsarmaonline

@arpitbbhayani @JyotinderSingh Please assign this task to me.

gsarmaonline avatar Jul 26 '24 11:07 gsarmaonline

@arpitbbhayani @JyotinderSingh Please assign this task to me.

Assigned

JyotinderSingh avatar Jul 26 '24 11:07 JyotinderSingh

hello, can u assign me for this task, i can see the task is unassigned to no one

romanchechyotkin avatar Aug 01 '24 07:08 romanchechyotkin

I can work on this !!!

hanshal101 avatar Aug 01 '24 14:08 hanshal101

@JyotinderSingh Looks like I will not be able to spend much time on this issue this week. You can assign the issue to someone else if it's required a little earlier. For others, there is a draft PR that you may want to take up https://github.com/DiceDB/dice/pull/179

gsarmaonline avatar Aug 01 '24 14:08 gsarmaonline

@JyotinderSingh Looks like I will not be able to spend much time on this issue this week. You can assign the issue to someone else if it's required a little earlier.

For others, there is a draft PR that you may want to take up https://github.com/DiceDB/dice/pull/179

You already have significant progress on the issue, Gaurav. I would recommend you stick with it. No rush to complete this, please take your time.

However, if you do want to give up this issue, let me know.

JyotinderSingh avatar Aug 01 '24 14:08 JyotinderSingh

Thanks @JyotinderSingh , I will continue on the same and will try to have a reviewable PR by the weekend

gsarmaonline avatar Aug 01 '24 14:08 gsarmaonline

but u can publish PR in order to other guys continue this task

romanchechyotkin avatar Aug 01 '24 14:08 romanchechyotkin

@JyotinderSingh can you assign it to me?

gsarmaonline avatar Aug 01 '24 14:08 gsarmaonline

@JyotinderSingh can you assign it to me?

Assigned

JyotinderSingh avatar Aug 01 '24 14:08 JyotinderSingh

https://github.com/DiceDB/dice/pull/179

arpitbbhayani avatar Aug 05 '24 18:08 arpitbbhayani

@gauravsarma1992 Are you going to support ACL in the same PR?

VipinRaiP avatar Aug 09 '24 13:08 VipinRaiP