Skip to content

Add tests for client auth - #3685

Merged
a-TODO-rov merged 12 commits into
mainfrom
test-mtls
Mar 13, 2026
Merged

a-TODO-rov merged 12 commits into
mainfrom
test-mtls

Conversation

@a-TODO-rov

@a-TODO-rov a-TODO-rov commented Mar 4, 2026 •

Copy link
Copy Markdown
Collaborator

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

  • Test hierarchy with abstract base class for shared logic, concrete subclasses for standalone/cluster with RESP2/RESP3 variants
  • Reusable SSL configuration helper to reduce duplication across mTLS and legacy SSL tests
  • Graceful skip on Redis < 8.6 to avoid CI failures on older versions

Changes

  • New mTLS integration tests for standalone and cluster modes
  • Extended test utilities to support mTLS
  • Updated test container configurations for mTLS support

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 default auth, multi-user certs, and CN case-sensitivity scenarios.

Updates test utilities to support mTLS by introducing reusable TLS constants and createMtlsSslOptions/ClientCertificate helpers, plus new mtlsStandalonePort/mtlsClusterPort settings.

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, verifyPeer to CA, and reloadPartitions→refreshPartitions).

Written by Cursor Bugbot for commit ad2facb. This will update automatically on new commits. Configure here.

@jit-ci

jit-ci Bot commented Mar 4, 2026 •

Copy link
Copy Markdown

🛡️ Jit Security Scan Results

CRITICAL HIGH MEDIUM

✅ No security findings were detected in this PR


Security scan by Jit

@a-TODO-rov
a-TODO-rov marked this pull request as ready for review March 4, 2026 14:06

@kiryazovi-redis kiryazovi-redis left a comment

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.

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.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Fix in Cursor Fix in Web


@Override
public RedisCommands<String, String> commands() {
return ClusterTestUtil.redisCommandsOverCluster(conn);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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().

Fix in Cursor Fix in Web

@a-TODO-rov a-TODO-rov changed the title Test mTLS Add tests for client auth Mar 13, 2026
@a-TODO-rov
a-TODO-rov merged commit a830766 into main Mar 13, 2026
10 of 11 checks passed
@a-TODO-rov
a-TODO-rov deleted the test-mtls branch March 13, 2026 09:27
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.

2 participants

⌂ 换网址