Skip to content
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

check if shared_ciphers() is None before logging #700

Merged
merged 1 commit into from
Aug 1, 2023

Conversation

kevinAlbs
Copy link
Contributor

Summary

Check for None return in ssl.SSLSocket.shared_ciphers()

Background & Motivation

This is motivated by an observed exception in the PyKMIP server logs:

2023-06-21 19:35:58,173 - kmip.server.session.00000003 - WARNING - Failure parsing request message.
2023-06-21 19:35:58,173 - kmip.server.session.00000003 - ERROR - object of type 'NoneType' has no len()
Traceback (most recent call last):
  File "/data/mci/ed2138b4a01580ba489bb7e3b9bc6679/drivers-tools/.evergreen/csfle/kmstlsvenv/lib/python3.11/site-packages/kmip/services/server/session.py", line 133, in _handle_message_loop
    "Possible session ciphers: {0}".format(len(shared_ciphers))
                                           ^^^^^^^^^^^^^^^^^^^
TypeError: object of type 'NoneType' has no len()

shared_ciphers is documented as possibly returning None:

shared_ciphers() returns None if no connection has been established or the socket is a client socket.

Python 3.11.3 changed behavior of ssl.SSLSocket.shared_ciphers(). Which appears to result in None being returned in additional scenarios.

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