Accept "user <name> on|off" ACL rule

Open Beginner friendly
#8,299 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
cpp

Research direction

Start in acl_family.cc at MaterializeFileContents and inspect how ACL file lines are tokenized and validated. Reproduce with an ACL file containing user default off using --aclfile or ACL LOAD, then verify that the minimal rule loads successfully without unintended category, key, or pubsub changes.

Written by the indexing model from the issue text.

Description

bug

Describe the bug
Dragonfly's ACL file parser rejects lines with fewer than 4 whitespace-separated tokens, including minimal lines like user default off that Redis and Valkey accept.

To Reproduce
Create an ACL file containing:

user default off

Start Dragonfly with --aclfile=/path/to/file or run ACL LOAD.

Expected behavior
Matching Redis/Valkey, the file loads successfully, creating/updating the default user with no additional category/key/pubsub changes beyond.

Actual behavior

ERR Error loading: /path/users.acl Error materializing acl file

Root cause
In acl_family.cc, MaterializeFileContents requires at least 4 tokens per line:

std::vector<std::string_view> cmds = absl::StrSplit(command, ' ', absl::SkipEmpty());
if (!absl::EqualsIgnoreCase(cmds[0], "USER") || cmds.size() < 4) {
  return {};
}

user default off produces only 3 tokens (USER, default, off), so it's rejected outright.

Dominant language
C++
Stars
31.6k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
126

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dragonflydb/dragonfly

All issues in dragonflydb/dragonfly

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.