Skip to content

fix(redis): add default auth to redis clusters #37337

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

jaylindquist
Copy link
Contributor

Changes

Using redis in a cluster with authentication causes the following error:

WARN: Error while setting Redis cache value (repository=/)
"err": {"message": "NOAUTH Authentication required."}

This change adds the username and password from the redis URL as defaults for connections to non-root node servers as described in the node redis docs

Context

Logs and motivation in #37319

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

jaylindquist and others added 3 commits August 4, 2025 13:38
The createCluster call is only authenticating with the rootNode, connections to other nodes in the cluster require default username and password when creating the client
@jaylindquist jaylindquist requested a review from rarkins August 5, 2025 20:49
Copy link
Collaborator

@rarkins rarkins left a comment

Choose a reason for hiding this comment

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

We need some time to check with some known users of cluster mode to confirm that none of them are using username/password. If they are, then we need to reconfirm the assumptions which lead to this PR

@rarkins rarkins added the auto:no-merge-from-main Advise contributors not to merge from main unnecessarily label Aug 7, 2025
Copy link
Contributor

github-actions bot commented Aug 7, 2025

Hi there,

Please don't merge from main into your PR's branch unless you have a merge conflict or have a specific reason to do so. Doing so consumes CI systems unnecessarily, and also resets CI approvals if this is your first PR to the repo. This repo uses GitHub's Merge Queue, which will automatically test your PR against main before merging, so it's no longer necessary to always keep branches up-to-date.

Thanks,

The Renovate team


describe('init', () => {
beforeEach(() => {
vi.clearAllMocks();
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
vi.clearAllMocks();

done globally

Comment on lines +37 to +39
vi.mocked(createClient).mockReturnValue({
connect: vi.fn(),
} as unknown as RedisClientType);
Copy link
Member

Choose a reason for hiding this comment

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

use our partial helper method

renovate/test/util.ts

Lines 25 to 30 in 643d489

export function partial<T>(): T;
export function partial<T>(obj: Partial<T>): T;
export function partial<T>(obj: Partial<T>[]): T[];
export function partial(obj: unknown = {}): unknown {
return obj;
}

Comment on lines +132 to +135
clusterConfig.defaults = {
...clusterConfig.defaults,
password: parsedUrl.password,
};
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
clusterConfig.defaults = {
...clusterConfig.defaults,
password: parsedUrl.password,
};
clusterConfig.defaults ??= { }
clusterConfig.defaults.password = parsedUrl.password;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto:no-merge-from-main Advise contributors not to merge from main unnecessarily
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants