Skip to content

fix: redact sensitive command args in error objects#2076

Open
wotan-allfather wants to merge 1 commit intoredis:mainfrom
wotan-allfather:fix/redact-auth-credentials
Open

fix: redact sensitive command args in error objects#2076
wotan-allfather wants to merge 1 commit intoredis:mainfrom
wotan-allfather:fix/redact-auth-credentials

Conversation

@wotan-allfather
Copy link
Copy Markdown

When errors are thrown and include command information (e.g., for debugging purposes), sensitive commands like 'auth', 'acl', and 'config' now have their arguments redacted to '[REDACTED]'.

This prevents credentials from being leaked into logs when authentication fails or connections are aborted.

Commands with redacted args:

  • auth (username, password)
  • acl (setuser passwords, etc.)
  • config (requirepass, etc.)

Closes #1713

When errors are thrown and include command information (e.g., for
debugging purposes), sensitive commands like 'auth', 'acl', and
'config' now have their arguments redacted to '[REDACTED]'.

This prevents credentials from being leaked into logs when
authentication fails or connections are aborted.

Commands with redacted args:
- auth (username, password)
- acl (setuser passwords, etc.)
- config (requirepass, etc.)

Closes redis#1713
@jit-ci
Copy link
Copy Markdown

jit-ci bot commented Feb 9, 2026

Hi, I’m Jit, a friendly security platform designed to help developers build secure applications from day zero with an MVS (Minimal viable security) mindset.

In case there are security findings, they will be communicated to you as a comment inside the PR.

Hope you’ll enjoy using Jit.

Questions? Comments? Want to learn more? Get in touch with us.

@PavelPashov
Copy link
Copy Markdown
Contributor

@wotan-allfather, thanks for the PR, I’ll take a look when I get a chance and follow up with any feedback or questions.

Comment on lines +365 to +369
const SENSITIVE_COMMANDS = new Set([
"auth",
"acl",
"config",
]);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might make sense to add these in the CommandNameFlags

Comment on lines +365 to +369
const SENSITIVE_COMMANDS = new Set([
"auth",
"acl",
"config",
]);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's worth adding the HELLO & MIGRATE commands, which take an optional AUTH token, however the sanitization logic will be more complex then

Comment on lines +384 to +391
if (SENSITIVE_COMMANDS.has(lowerName)) {
// For auth, acl setuser, config set requirepass - redact all args
// to avoid leaking username/password combinations
return {
name,
args: args.map(() => "[REDACTED]"),
};
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will over-redact all ACL and CONFIG commands even though not all of them take sensitive arguments, again this will lead to more complex logic here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Errors contain credentials in plaintext

2 participants