Sentinel: don't log auth-pass value for better security
@@ -4156,6 +4156,7 @@ void sentinelSetCommand(client *c) {
int j, changes = 0;
int badarg = 0; /* Bad argument position for error reporting. */
char *option;
+ int redacted;
if ((ri = sentinelGetMasterByNameOrReplyError(c,c->argv[2]))
== NULL) return;
@@ -4166,6 +4167,7 @@ void sentinelSetCommand(client *c) {
option = c->argv[j]->ptr;
long long ll;
int old_j = j; /* Used to know what to log as an event. */
+ redacted = 0;
if (!strcasecmp(option,"down-after-milliseconds") && moreargs > 0) {
/* down-after-milliseconds <milliseconds> */
@@ -4240,6 +4242,7 @@ void sentinelSetCommand(client *c) {
sdsfree(ri->auth_pass);
ri->auth_pass = strlen(value) ? sdsnew(value) : NULL;
changes++;
+ redacted = 1;
} else if (!strcasecmp(option,"auth-user") && moreargs > 0) {
/* auth-user <username> */
char *value = c->argv[++j]->ptr;
@@ -4287,7 +4290,7 @@ void sentinelSetCommand(client *c) {
switch(numargs) {
case 2:
sentinelEvent(LL_WARNING,"+set",ri,"%@ %s %s",(char*)c->argv[old_j]->ptr,
- (char*)c->argv[old_j+1]->ptr);
+ redacted ? "******" : (char*)c->argv[old_j+1]->ptr);
break;
case 3:
sentinelEvent(LL_WARNING,"+set",ri,"%@ %s %s %s",(char*)c->argv[old_j]->ptr,
