Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-4658

Deprecation warning from cryptography library in pymongo's OCSP support

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Python Drivers
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      When running build scripts

      ./buildscripts/scons.py         --variables-files=./etc/scons/mongodbtoolchain_stable_clang.vars --link-model=dynamic         --ninja generate-ninja ICECC=icecc CCACHE=ccache BAZEL_FLAGS=--config=local --modules=

      we're encountering deprecation warnings from the cryptography library used in pymongo's OCSP support. These warnings suggest updating the use of datetime properties in the ocsp_support.py file.

      Specific warnings:

      /home/ubuntu/python3-venv/lib/python3.10/site-packages/pymongo/ocsp_support.py:280: CryptographyDeprecationWarning: Properties that return a naïve datetime object have been deprecated. Please switch to this_update_utc.
        if response.this_update > now:
      /home/ubuntu/python3-venv/lib/python3.10/site-packages/pymongo/ocsp_support.py:284: CryptographyDeprecationWarning: Properties that return a naïve datetime object have been deprecated. Please switch to next_update_utc.
        if response.next_update and response.next_update < now:
      /home/ubuntu/python3-venv/lib/python3.10/site-packages/pymongo/ocsp_cache.py:65: CryptographyDeprecationWarning: Properties that return a naïve datetime object have been deprecated. Please switch to next_update_utc.
        if value.next_update is None:
      /home/ubuntu/python3-venv/lib/python3.10/site-packages/pymongo/ocsp_cache.py:71: CryptographyDeprecationWarning: Properties that return a naïve datetime object have been deprecated. Please switch to this_update_utc.
        value.this_update
      /home/ubuntu/python3-venv/lib/python3.10/site-packages/pymongo/ocsp_cache.py:73: CryptographyDeprecationWarning: Properties that return a naïve datetime object have been deprecated. Please switch to next_update_utc.
        < value.next_update
      /home/ubuntu/python3-venv/lib/python3.10/site-packages/pymongo/ocsp_cache.py:81: CryptographyDeprecationWarning: Properties that return a naïve datetime object have been deprecated. Please switch to next_update_utc.
        cached_value.next_update is not None
      /home/ubuntu/python3-venv/lib/python3.10/site-packages/pymongo/ocsp_cache.py:82: CryptographyDeprecationWarning: Properties that return a naïve datetime object have been deprecated. Please switch to next_update_utc.
        and cached_value.next_update < value.next_update

      It appears that the 'this_update' and 'next_update' properties should be replaced with 'this_update_utc' and 'next_update_utc' respectively.

      We're using the latest version of pymongo (v4.8.0), and these warnings persist. Could you please update the OCSP support code to use the new API from the cryptography library to resolve these deprecation warnings?

            Assignee:
            Unassigned Unassigned
            Reporter:
            juan.gu@mongodb.com Juan Gu
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: