Skip to content

fix: cluster topology connect fails with NOAUTH when username is empty string#252

Merged
ravjotbrar merged 1 commit intovalkey-io:mainfrom
alexey-temnikov:fix/cluster-topology-noauth-empty-username
Mar 27, 2026
Merged

fix: cluster topology connect fails with NOAUTH when username is empty string#252
ravjotbrar merged 1 commit intovalkey-io:mainfrom
alexey-temnikov:fix/cluster-topology-noauth-empty-username

Conversation

@alexey-temnikov
Copy link
Copy Markdown
Collaborator

@alexey-temnikov alexey-temnikov commented Mar 26, 2026

Bug

When connecting to a discovered cluster node via the Cluster Topology page, clicking the power icon on any node other than the initially-connected one fails with a NOAUTH error.

Root Cause

In cluster-node.tsx, handleNodeConnect spreads credentials into the connection payload using:

// BEFORE (buggy)
...(primary.username && primary.password && {
  username: primary.username,
  password: await secureStorage.encrypt(primary.password),
}),

When username is "" (empty string) — which is the case for the ElastiCache default user — the expression short-circuits to false, so neither username nor password is included in the connectPending payload. The server then attempts an unauthenticated connection and receives NOAUTH.

Fix

Gate only on password presence and default username to "":

// AFTER (fixed)
...(primary.password && {
  username: primary.username ?? "",
  password: await secureStorage.encrypt(primary.password),
}),

Also includes a Dockerfile.app fix to install ca-certificates, required for TLS connections to ElastiCache.


How It Was Tested

Tested against a live AWS ElastiCache Valkey cluster (cluster-mode enabled, 6 shards × 3 nodes = 18 nodes, TLS enabled, auth user default with password).

Steps:

  1. Connected to the first node (****:6379) with username default, password set, TLS enabled
  2. Navigated to Cluster Topology — all 6 shards (18 nodes) discovered, 1 connected
  3. Clicked the power icon on shard 0002-001

Before fix: NOAUTH error — connection failed
After fix: Dashboard loaded for 0002-001 — connection succeeded, zero console errors

The fix was verified on the deployed Docker container on EC2 (Amazon Linux 2023, t3.medium).

…y string

When connecting to a discovered cluster node via the Cluster Topology page,
credentials were silently dropped if username was an empty string (e.g. the
ElastiCache 'default' user).

The condition `primary.username && primary.password` short-circuits to false
when username is "", so neither username nor password was sent in the
connectPending payload, causing a NOAUTH error on the server side.

Fix: gate only on password presence and default username to empty string.

Also includes a Dockerfile fix to install ca-certificates for TLS connections.

Signed-off-by: Alexey Temnikov <[email protected]>
@alexey-temnikov alexey-temnikov force-pushed the fix/cluster-topology-noauth-empty-username branch from 5cf1c2a to ef360b3 Compare March 26, 2026 22:07
alexey-temnikov added a commit to alexey-temnikov/valkey-admin that referenced this pull request Mar 26, 2026
- Fix cluster node switching in header dropdown
- Fix RequireConnection guard for cluster routes
- Fix server-side client resolution for non-entry cluster nodes
- Fix credential passing for empty username (PR valkey-io#252)
- Add ca-certificates to Dockerfile for TLS
- Make entire badge clickable for dropdown toggle

Signed-off-by: Alexey Temnikov <[email protected]>
@ravjotbrar ravjotbrar merged commit 083478b into valkey-io:main Mar 27, 2026
7 checks passed
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.

Unable to connect to cluster nodes from topology view when authentication is enabled

2 participants