Repository navigation
Add tests for client auth - #3685
Conversation
🛡️ Jit Security Scan Results✅ No security findings were detected in this PR
Security scan by Jit
|
kiryazovi-redis
left a comment
There was a problem hiding this comment.
Sorry for the delay on writing here, I've had some pressing work I had to finish
LGTM
Its a really basic functionality that is to be tested, but I guess getting the mtls to you took some trial and error.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
| } catch (Exception e) { | ||
| // Connection may fail on Redis versions < 8.6 that don't support mTLS client auth | ||
| // Tests will be skipped in beforeEach() due to null connection | ||
| } |
There was a problem hiding this comment.
Silent exception swallowing hides real setup failures
Low Severity
The catch (Exception e) in beforeAll() silently discards all exceptions from initializeClient(), including ones caused by genuine misconfiguration (wrong certificates, incorrect ports, bad SSL options). When tests are silently skipped due to a swallowed setup error, diagnosing failures becomes very difficult. At minimum, logging the exception message would aid debugging without changing the skip-on-old-Redis behavior.
|
|
||
| @Override | ||
| public RedisCommands<String, String> commands() { | ||
| return ClusterTestUtil.redisCommandsOverCluster(conn); |
There was a problem hiding this comment.
New proxy created on every commands() call
Low Severity
The commands() method in the cluster TestConnection calls ClusterTestUtil.redisCommandsOverCluster(conn) on every invocation, allocating a new reflective proxy each time. Since the test calls testConn.commands() multiple times per test, caching the result (or calling it once in the caller) avoids unnecessary object creation and keeps the pattern consistent with the standalone implementation which calls conn.sync().


Add integration tests for Redis 8.6+ mTLS automatic authentication, where clients are authenticated based on their certificate's Common Name without explicit AUTH commands.
Approach
Changes
Note
Medium Risk
Mostly test and docker-environment changes, but it rewires TLS cluster ports/config and certificate handling, which can break or destabilize integration test runs if the local/CI docker setup diverges.
Overview
Adds a new integration-test suite for Redis 8.6+ mTLS automatic client authentication (ACL user derived from client cert CN), covering standalone, cluster, and a RESP2 variant, including reconnect behavior, explicit
defaultauth, multi-user certs, and CN case-sensitivity scenarios.Updates test utilities to support mTLS by introducing reusable TLS constants and
createMtlsSslOptions/ClientCertificatehelpers, plus newmtlsStandalonePort/mtlsClusterPortsettings.Reworks the docker test environment and related SSL cluster tests to use native Redis TLS + mTLS (enables TLS for
ssl-test-cluster, adds TLS ports 7443-7445, updates redis.conf with TLS/ACL users), and adjusts existing cluster SSL integration tests accordingly (port 7442→7443,verifyPeertoCA, andreloadPartitions→refreshPartitions).Written by Cursor Bugbot for commit ad2facb. This will update automatically on new commits. Configure here.