Skip to content

gh-161503: Check hostname in ssl.get_server_certificate with custom ca_certs - #161507

Open
brettcs wants to merge 3 commits into
python:mainfrom
brettcs:ssl-check-hostname-with-ca-certs
Open

brettcs wants to merge 3 commits into
python:mainfrom
brettcs:ssl-check-hostname-with-ca-certs

Conversation

@brettcs

@brettcs brettcs commented Nov 6, 2026 •

Copy link
Copy Markdown

This branch implements the suggested fix along with a test that fails on current main. CC @sethmlarson @StanFromIreland

Comment thread Lib/ssl.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please update:

    If 'ca_certs' is specified, validate the server cert against it and
    check that it matches the hostname.

Same for docs.

JFYI, we generally prefer to open these in the private fork first to straighten out such things, but this is small so we should be fine.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Please update:

Both done.

JFYI, we generally prefer to open these in the private fork first to straighten out such things, but this is small so we should be fine.

Heard, Seth suggested working on this one in public just because it's low-impact (and I needed an issue number for the blurb anyway).

Comment thread Doc/library/ssl.rst Resolved
@read-the-docs-community

read-the-docs-community Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #35707548 | 📁 Comparing e05d003 against main (2781ffe)

  🔍 Preview build  

2 files changed
± library/ssl.html
± whatsnew/changelog.html

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.

3 participants