Changing the default value for ssl_check_hostname to True, to ensure security validations are not skipped by default#3626
Merged
petyaslavova merged 4 commits intomasterfrom Apr 30, 2025
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR changes the default value for ssl_check_hostname from False to True to enforce stricter security validations by default. Key changes include updating the default in production code (in redis/connection.py, redis/client.py, and their asyncio equivalents) while tests and examples explicitly override the value for backward compatibility or simulation of insecure scenarios.
- Production connection and client constructors now default to ssl_check_hostname=True.
- Tests and examples explicitly pass ssl_check_hostname=False to simulate non-secure connections.
- Documentation examples have been updated to reflect the new production default.
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tests/test_ssl.py | Added explicit override of ssl_check_hostname for SSL connection tests |
| tests/test_connect.py; test_asyncio files | Modified connection parameter overrides to include ssl_check_hostname=False in tests |
| redis/connection.py, redis/client.py, etc. | Updated default ssl_check_hostname parameter from False to True |
| docs/examples/ssl_connection_examples.ipynb | Updated examples to include ssl_check_hostname parameter explicitly |
Comments suppressed due to low confidence (1)
redis/connection.py:1031
- Changing the default to True enhances security by ensuring hostname validation; verify that any integrations or custom overrides still function as expected.
ssl_check_hostname: bool = True,
vladvildanov
requested changes
Apr 30, 2025
…security validations are not skipped by default
a39dd82 to
fc0e050
Compare
vladvildanov
approved these changes
Apr 30, 2025
petyaslavova
added a commit
that referenced
this pull request
Apr 30, 2025
…security validations are not skipped by default (#3626) * Changing the default value for ssl_check_hostname to True, to ensure security validations are not skipped by default * Applying review comments * Removing unused operation in tests. * Removing unneeded comment from tests.
6 tasks
petyaslavova
added a commit
to Kakadus/redis-py
that referenced
this pull request
May 13, 2025
…security validations are not skipped by default (redis#3626) * Changing the default value for ssl_check_hostname to True, to ensure security validations are not skipped by default * Applying review comments * Removing unused operation in tests. * Removing unneeded comment from tests.
harpener
reviewed
Jun 25, 2025
| ssl_ca_certs=None, | ||
| ssl_ca_data=None, | ||
| ssl_check_hostname=False, | ||
| ssl_check_hostname=True, |
There was a problem hiding this comment.
@petyaslavova FYI, you left the docstring a bit misleading. :-)
ssl_check_hostname: If set, match the hostname during the SSL handshake. Defaults to False.
ManelCoutinhoSensei
pushed a commit
to ManelCoutinhoSensei/redis-py
that referenced
this pull request
Jun 30, 2025
…security validations are not skipped by default (redis#3626) * Changing the default value for ssl_check_hostname to True, to ensure security validations are not skipped by default * Applying review comments * Removing unused operation in tests. * Removing unneeded comment from tests.
ManelCoutinhoSensei
pushed a commit
to ManelCoutinhoSensei/redis-py
that referenced
this pull request
Jul 1, 2025
…security validations are not skipped by default (redis#3626) * Changing the default value for ssl_check_hostname to True, to ensure security validations are not skipped by default * Applying review comments * Removing unused operation in tests. * Removing unneeded comment from tests.
scovetta
added a commit
to scovetta/redis-py
that referenced
this pull request
Sep 3, 2025
The default value of `ssl_check_hostname` was changed in redis#3626 but the docstring still stated the default was `False`. This PR just changes that docstring text to match the new default.
1 task
petyaslavova
pushed a commit
that referenced
this pull request
Sep 9, 2025
The default value of `ssl_check_hostname` was changed in #3626 but the docstring still stated the default was `False`. This PR just changes that docstring text to match the new default.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request check-list
Please make sure to review and check all of these items:
NOTE: these things are not required to open a PR and can be done
afterwards / while the PR is open.
Description of change
Changing the default value for ssl_check_hostname to True, to ensure security validations are not skipped by default