8000 gh-107361: strengthen default SSL context flags by woodruffw · Pull Request #112389 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-107361: strengthen default SSL context flags #112389

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Mar 6, 2024
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ssl: expand comment
  • Loading branch information
woodruffw committed Nov 25, 2023
commit 732b953f3de5c60dbba1fee88eeb39bf2f602970
8000
9 changes: 6 additions & 3 deletions Lib/ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -704,9 +704,12 @@ def create_default_context(purpose=Purpose.SERVER_AUTH, *, cafile=None,
else:
raise ValueError(purpose)

# Make OpenSSL's chain building behave more like RFC 3280 5280,
# which specify that chain building stops with the first trust
# anchor, even if that anchor is not self-signed.
# `VERIFY_X509_PARTIAL_CHAIN` makes OpenSSL's chain building behave more
# like RFC 3280 and 5280, which specify that chain building stops with the
# first trust anchor, even if that anchor is not self-signed.
# `VERIFY_X509_STRICT` makes OpenSSL more conservative about the
# certificates it accepts, including "disabling workarounds for
# some broken certificates."
context.verify_flags |= (_ssl.VERIFY_X509_PARTIAL_CHAIN |
_ssl.VERIFY_X509_STRICT)

Expand Down
0