Unverified Commit a4a0eab5 authored by Wen Hui's avatar Wen Hui Committed by GitHub
Browse files

redis-cli - handle sensitive command redaction for variadic CONFIG SET (#11975)

In the Redis 7.0 and newer version,
config set command support multiply `<parameter> <value>` pairs, thus the previous
sensitive command condition does not apply anymore

For example:

The command:
**config set maxmemory 1GB masteruser aa** will be written to redis_cli historyfile

In this PR, we update the condition for these sensitive commands
config set masteruser <username>
config set masterauth <master-password>
config set requirepass foobared
parent f38aa6bf
...@@ -3261,12 +3261,15 @@ static int isSensitiveCommand(int argc, char **argv) { ...@@ -3261,12 +3261,15 @@ static int isSensitiveCommand(int argc, char **argv) {
return 1; return 1;
} else if (argc > 2 && } else if (argc > 2 &&
!strcasecmp(argv[0],"config") && !strcasecmp(argv[0],"config") &&
!strcasecmp(argv[1],"set") && ( !strcasecmp(argv[1],"set")) {
!strcasecmp(argv[2],"masterauth") || for (int j = 2; j < argc; j = j+2) {
!strcasecmp(argv[2],"masteruser") || if (!strcasecmp(argv[j],"masterauth") ||
!strcasecmp(argv[2],"requirepass"))) !strcasecmp(argv[j],"masteruser") ||
{ !strcasecmp(argv[j],"requirepass")) {
return 1; return 1;
}
}
return 0;
/* HELLO [protover [AUTH username password] [SETNAME clientname]] */ /* HELLO [protover [AUTH username password] [SETNAME clientname]] */
} else if (argc > 4 && !strcasecmp(argv[0],"hello")) { } else if (argc > 4 && !strcasecmp(argv[0],"hello")) {
for (int j = 2; j < argc; j++) { for (int j = 2; j < argc; j++) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment