Skip to content

[BUG] User parsing in redis-cli URI should ignore empty string #9186

@beornf

Description

@beornf

Describe the bug

User parsing #8048 the redis URI will always set config.user even in the case of '' empty string.

redis/src/redis-cli.c

Lines 423 to 432 in 74fe15b

/* Extract user info. */
if ((userinfo = strchr(curr,'@'))) {
if ((username = strchr(curr, ':')) && username < userinfo) {
config.user = percentDecode(curr, username - curr);
curr = username + 1;
}
config.auth = percentDecode(curr, userinfo - curr);
curr = userinfo + 1;
}

To reproduce

Given the redis URI following the standard format:

redis://:<password>@<host>:<port>

The user will be parsed as '' empty string. Failing to AUTH as the default user.

Expected behavior

The same behavior as the redis URI:

redis://<password>@<host>:<port>

Which will correctly AUTH as the default user.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions