Skip to content

Conversation

@graingert
Copy link
Contributor

@graingert graingert commented Jun 14, 2022

@bedevere-bot bedevere-bot added docs Documentation in the Doc dir awaiting review labels Jun 14, 2022
>>> client_context.maximum_version = ssl.TLSVersion.MAXIMUM_VERSION


The SSL context created above will only allow TLSv1.2 and later (if
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this states the context above supports TLSv1.2-max but the example was TLSv1.3 only

Copy link
Contributor

@janbrasna janbrasna Dec 19, 2023

Choose a reason for hiding this comment

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

@graingert If you update to current main the wording now states "TLSv1.3 and later" — so I'd recommend to match ssl.* min version with main too, but definitely propose the MAXIMUM_SUPPORTED anyways which makes much more sense compared to the current docs.

(While the docs specify "Deprecated since version 3.10: All TLSVersion members except TLSVersion.TLSv1_2 and TLSVersion.TLSv1_3 are deprecated." I believe that doesn't include the magic constants, as I can't see any proof in the deprecation warning code to raise any warnings for the MIN_/MAX_ constants, so it's just the description that's written too broadly.)

Copy link
Contributor

Choose a reason for hiding this comment

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

On the other hand, configuring the max version in this way is superfluous, as that is by the definition the default:

"SSLContext.maximum_version — A TLSVersion enum member representing the highest supported TLS version. The value defaults to TLSVersion.MAXIMUM_SUPPORTED."
https://docs.python.org/3/library/ssl.html#ssl.SSLContext.minimum_version

so there's no point of showing an example set this way.

I'd personally vouch for showing a real range as in #107273 (review)

Comment on lines 2689 to 2751
>>> client_context.minimum_version = ssl.TLSVersion.TLSv1_3
>>> client_context.maximum_version = ssl.TLSVersion.TLSv1_3
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@graingert
Copy link
Contributor Author

I'm not sure if it's better to update the code example or the description here

@graingert
Copy link
Contributor Author

#95816

@graingert graingert changed the title fix client_context example from ssl protocol versions docs gh-95816: fix client_context example from ssl protocol versions docs Aug 9, 2022
@graingert graingert requested a review from tiran August 9, 2022 17:17
Copy link
Contributor

@janbrasna janbrasna left a comment

Choose a reason for hiding this comment

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

There have been some minor changes in the past year, so updating few bits would align this more with the currently published docs, as the explainer bumped versions in e5252c6 (see #95816 (comment) for progress)

Copy link
Contributor

@janbrasna janbrasna left a comment

Choose a reason for hiding this comment

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

The magic constant for TLSVersion is in reality not MAXIMUM_VERSION, but MAXIMUM_SUPPORTED

>>> client_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
>>> client_context.minimum_version = ssl.TLSVersion.TLSv1_3
>>> client_context.maximum_version = ssl.TLSVersion.TLSv1_3
>>> client_context.maximum_version = ssl.TLSVersion.MAXIMUM_SUPPORTED
Copy link
Contributor

Choose a reason for hiding this comment

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

I think just removing maximum_version would automatically make it v1.3+ itself.

@bedevere-app
Copy link

bedevere-app bot commented Jan 9, 2025

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

4 participants