Skip to content

Fix copy-paste error in CacheProxyConnection server version check#3918

Merged
petyaslavova merged 2 commits intoredis:masterfrom
Nepomuk5665:fix-cache-proxy-server-version-check
Jan 26, 2026
Merged

Fix copy-paste error in CacheProxyConnection server version check#3918
petyaslavova merged 2 commits intoredis:masterfrom
Nepomuk5665:fix-cache-proxy-server-version-check

Conversation

@Nepomuk5665
Copy link
Contributor

Summary

  • Fix a copy-paste bug in CacheProxyConnection.connect() where the condition incorrectly checks server_ver is None or server_ver is None instead of server_ver is None or server_name is None

Bug Description

In redis/connection.py at line 1417, the validation check for server metadata has a typo where server_ver is checked twice instead of checking both server_ver and server_name.

Before:

if server_ver is None or server_ver is None:
    raise ConnectionError("Cannot retrieve information about server version")

After:

if server_ver is None or server_name is None:
    raise ConnectionError("Cannot retrieve information about server version")

Impact

This bug would allow server_name to be None without raising an error during connection validation. Later at line 1424, server_name is used in a comparison (server_name != self.DEFAULT_SERVER_NAME), which would cause unexpected behavior if server_name was None.

Testing

The fix is a simple one-character change that corrects the variable name in the condition. No new functionality is added.

@jit-ci
Copy link

jit-ci bot commented Jan 23, 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.

The condition on line 1417 incorrectly checked 'server_ver is None or server_ver is None'
when it should check 'server_ver is None or server_name is None'.

This bug would allow server_name to be None without raising an error, which would
then cause issues when server_name is used later in the comparison at line 1424.
@Nepomuk5665 Nepomuk5665 force-pushed the fix-cache-proxy-server-version-check branch from a2b7db5 to ebc2a5b Compare January 23, 2026 19:28
Copy link
Collaborator

@petyaslavova petyaslavova left a comment

Choose a reason for hiding this comment

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

Hi @Nepomuk5665, thank you for your contribution! The change LGTM.

@petyaslavova petyaslavova added the maintenance Maintenance (CI, Releases, etc) label Jan 26, 2026
@petyaslavova petyaslavova merged commit 42f823f into redis:master Jan 26, 2026
70 of 71 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance Maintenance (CI, Releases, etc)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants