Skip to content

gh-114905: Test that ssl._create_stdlib_context() rejects check_hostname with CERT_NONE - #155509

Open
serhiy-storchaka wants to merge 1 commit into
python:mainfrom
serhiy-storchaka:gh-114905-ssl-check-hostname
Open

gh-114905: Test that ssl._create_stdlib_context() rejects check_hostname with CERT_NONE#155509
serhiy-storchaka wants to merge 1 commit into
python:mainfrom
serhiy-storchaka:gh-114905-ssl-check-hostname

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Aug 10, 2026

Copy link
Copy Markdown
Member

Pin the current behaviour of ssl._create_stdlib_context() with check_hostname, and explain in a comment why check_hostname is assigned before verify_mode.

With PROTOCOL_TLS_CLIENT, which became the default protocol in 3.10, this is an error. With an explicitly specified legacy protocol it used to succeed, silently raising verify_mode to CERT_REQUIRED and ignoring the requested CERT_NONE.

No caller of _create_stdlib_context() in the standard library passes check_hostname, so no public API reaches it.

…_hostname with CERT_NONE

With PROTOCOL_TLS_CLIENT, which became the default protocol in 3.10, this is
an error.  With an explicitly specified legacy protocol it used to succeed,
silently raising verify_mode to CERT_REQUIRED and ignoring the requested
CERT_NONE.

No caller of ssl._create_stdlib_context() in the standard library passes
check_hostname, so no public API reaches it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant