Skip to content

PYTHON-2162 Remove support for ssl* URI options #706

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

Conversation

prashantmital
Copy link
Contributor

No description provided.

@prashantmital prashantmital changed the title Python 2702/removed deprecated uri options PYTHON-2162 Remove support for ssl* URI options Aug 12, 2021
@prashantmital prashantmital marked this pull request as ready for review August 12, 2021 17:05
@@ -585,18 +584,11 @@ def validate_tzinfo(dummy, value):


# Dictionary where keys are the names of public URI options, and values
# are lists of aliases for that option. Aliases of option names are assumed
# to have been deprecated.
# are lists of aliases for that option.
URI_OPTIONS_ALIAS_MAP = {
'journal': ['j'],
'wtimeoutms': ['wtimeout'],
'tls': ['ssl'],
Copy link
Member

Choose a reason for hiding this comment

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

Should we remove ssl here (and INTERNAL_URI_OPTION_NAME_MAP) as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the decision was made to keep ssl indefinitely since we never deprecated it? Do you think we should deprecate it in the next 3.x release and remove?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note also that the follow up PR to this will be a better place remove this kind of bookkeeping code as that PR will get rid of all remaining options that have been deprecated in 3.x

Copy link
Member

Choose a reason for hiding this comment

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

Do you think we should deprecate it in the next 3.x release and remove?

I think you're right that we should keep it. The URI-options spec still has ssl and doesn't say to remove it. It might be helpful to ask other drivers what their plan is.

# Implicitly enable TLS when one of the tls* options is set.
use_tls = True

if use_tls is True:
Copy link
Member

Choose a reason for hiding this comment

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

use_tls is True -> use_tls

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

verify_mode = CERT_REQUIRED if cert_reqs is None else cert_reqs
allow_invalid_hostnames,
disable_ocsp_endpoint_check) = args
if allow_invalid_certificates is True:
Copy link
Member

Choose a reason for hiding this comment

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

allow_invalid_certificates is True -> allow_invalid_certificates

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed to a one-liner:

verify_mode = CERT_NONE if allow_invalid_certificates else CERT_REQUIRED

for opt in ('tlsallowinvalidcertificates', 'tlsallowinvalidhostnames',
'tlsdisableocspendpointcheck'):
# A value of False for these options implies tls=True.
if opt in options and options[opt] is False:
Copy link
Member

Choose a reason for hiding this comment

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

Is is False needed or can this be and not options[opt]?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed to and not options[opt]

enabled_tls_opts.append(opt)

if enabled_tls_opts:
if use_tls is False:
Copy link
Member

Choose a reason for hiding this comment

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

Suggest switching the order of the this if so we can replace the use_tls is False with not use_tls.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@ShaneHarvey
Copy link
Member

Did you run the pyopenssl tests as well?

@prashantmital prashantmital merged commit b3118e0 into mongodb:master Aug 19, 2021
@prashantmital prashantmital deleted the PYTHON-2702/removed-deprecated-URI-options branch August 19, 2021 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants