fix(tls): warn on hostname-check bypass regardless of custom CA cert#462
Merged
Conversation
tls_insecure was set for any TLS connection where hostname checking was disabled, not just the self-signed/custom-CA scenario it was intended for. With a public CA cert (the default case), hostname verification should never be bypassed. The warning log already required tls_server_cert_path; align the tls_insecure condition to match.
The warning "Skipping hostname check" was only emitted when a custom CA cert path was also configured. Users connecting with self-signed certs (no CA file) or by IP address would disable hostname verification silently. Move the warning outside the tls_server_cert_path block so it fires for any TLS connection where tls_server_cert_check_hostname=False, and drop the spurious tls_server_cert_path guard on tls_insecure.
Closed
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.
Summary
The
Skipping hostname checkwarning was only emitted when a custom CA cert path was also configured. Users with self-signed certs (no CA file) or connecting by IP would silence hostname verification without any log message.tls_server_cert_pathblock — it now fires whenevertls_server_cert_check_hostname=Falsefor any TLS connectiontls_server_cert_pathguard that was incorrectly added totls_insecureBehaviour
tls_insecureisTruewhenever the user setscheck_hostname=Falsewith TLS, regardless of whether a custom CA cert is provided. The warning is now always emitted in that case.Test plan
mypyclean