summaryrefslogtreecommitdiff
path: root/src/acl.c
diff options
context:
space:
mode:
authorMadelyn Olson <34459052+madolson@users.noreply.github.com>2021-05-19 08:23:54 -0700
committerGitHub <noreply@github.com>2021-05-19 08:23:54 -0700
commita59e75a475782d86d7ce2b5b9c6f5bb4a5ef0bd6 (patch)
treecb3d9aa81aa2ada903e1465b64e2d733103837e8 /src/acl.c
parentd67e66de72edc49a5493c963fd7cb97411165d8c (diff)
downloadredis-a59e75a475782d86d7ce2b5b9c6f5bb4a5ef0bd6.tar.gz
Hide migrate command from slowlog if they include auth (#8859)
Redact commands that include sensitive data from slowlog and monitor
Diffstat (limited to 'src/acl.c')
-rw-r--r--src/acl.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/acl.c b/src/acl.c
index 6a2ade646..86f73fe7e 100644
--- a/src/acl.c
+++ b/src/acl.c
@@ -1892,10 +1892,6 @@ void addACLLogEntry(client *c, int reason, int argpos, sds username) {
void aclCommand(client *c) {
char *sub = c->argv[1]->ptr;
if (!strcasecmp(sub,"setuser") && c->argc >= 3) {
- /* Consider information about passwords or permissions
- * to be sensitive, which will be the arguments for this
- * subcommand. */
- preventCommandLogging(c);
sds username = c->argv[2]->ptr;
/* Check username validity. */
if (ACLStringHasSpaces(username,sdslen(username))) {
@@ -1912,6 +1908,12 @@ void aclCommand(client *c) {
user *u = ACLGetUserByName(username,sdslen(username));
if (u) ACLCopyUser(tempu, u);
+ /* Initially redact all of the arguments to not leak any information
+ * about the user. */
+ for (int j = 2; j < c->argc; j++) {
+ redactClientCommandArgument(c, j);
+ }
+
for (int j = 3; j < c->argc; j++) {
if (ACLSetUser(tempu,c->argv[j]->ptr,sdslen(c->argv[j]->ptr)) != C_OK) {
const char *errmsg = ACLSetUserStringError();
@@ -2245,6 +2247,8 @@ void authCommand(client *c) {
addReplyErrorObject(c,shared.syntaxerr);
return;
}
+ /* Always redact the second argument */
+ redactClientCommandArgument(c, 1);
/* Handle the two different forms here. The form with two arguments
* will just use "default" as username. */
@@ -2264,6 +2268,7 @@ void authCommand(client *c) {
} else {
username = c->argv[1];
password = c->argv[2];
+ redactClientCommandArgument(c, 2);
}
if (ACLAuthenticateUser(c,username,password) == C_OK) {