Skip to content

Fix incompatibility issue between OCSP dependencies #1666

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

Closed
wants to merge 1 commit into from
Closed

Fix incompatibility issue between OCSP dependencies #1666

wants to merge 1 commit into from

Conversation

oh2fih
Copy link
Contributor

@oh2fih oh2fih commented Jun 10, 2024

PyOpenSSL < 23.2.0 is incompatible with cryptography >= 42.0.0; PyOpenSSL 23.2.0 stopped referencing X509_V_FLAG_NOTIFY_POLICY that was removed in cryptography 42.0.0. Using compatible minimum versions is an easy solution.

Ref. cve-search/cve-search#1099 (comment) & conda/conda#13619 (comment)

@oh2fih
Copy link
Contributor Author

oh2fih commented Jun 10, 2024

Another problem remains: if an older version of PyOpenSSL is already installed by anything else than pip install "pymongo[ocsp]", the ssl_support.py still defaults to using pymongo.pyopenssl_context over pymongo.ssl_context (standard library SSL). Instead of blindly importing pyOpenSSL, ssl_support.py should be able to check whether the installed version meets the requirements. Any suggestions on how this should be checked?

@ShaneHarvey
Copy link
Member

As PyMongo is a library (not a standalone app) we aim for it to be installable+useable in as wide a range of environments as possible. That means we leave our dependencies as open as we can so bumping the minimum versions of pyopenssl/cryptography here goes against our practices. In this case, it is the user's responsibility to have a functioning install of pyopenssl.

Instead of blindly importing pyOpenSSL, ssl_support.py should be able to check whether the installed version meets the requirements. Any suggestions on how this should be checked?

I agree this is a problem. We will consider adding a feature to control when stdlib ssl or pyopenssl is used. I opened a feature request for the idea here: https://jira.mongodb.org/browse/PYTHON-4491

@oh2fih
Copy link
Contributor Author

oh2fih commented Jun 11, 2024

I can understand why this approach would be against your practices. I have another suggestion for handling the exception caused by this situation without interrupting the entire program available in #1669; it should be more backwards compatible. The feature request can be discussed in https://jira.mongodb.org/browse/PYTHON-4491 as the exception handling is not conflicting with the idea, but complementary.

@oh2fih oh2fih closed this Jun 11, 2024
@oh2fih oh2fih deleted the pyopenssl-dependencies branch June 11, 2024 11:04
@ShaneHarvey
Copy link
Member

Thanks, #1669 looks like a good idea to me.

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