Author miguendes
Recipients miguendes
Date 2021-05-01.12:48:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1619873334.22.0.268428103779.issue43952@roundup.psfhosted.org>
In-reply-to
Content
I tried debugging this and from what I can see it's because there's an if that checks if the authkey is not None in the Client constructor:

https://github.com/python/cpython/blob/v3.9.4/Lib/multiprocessing/connection.py#L512

```
    if authkey is not None:
        answer_challenge(c, authkey)
        deliver_challenge(c, authkey)
```

Whereas in the Listener, the check is different:

https://github.com/python/cpython/blob/v3.9.4/Lib/multiprocessing/connection.py#L469

```
        c = self._listener.accept()
        if self._authkey:
            deliver_challenge(c, self._authkey)
            answer_challenge(c, self._authkey)
        return c
```

If I change the Listener to:

```
        if self._authkey is not None:
            deliver_challenge(c, self._authkey)
            answer_challenge(c, self._authkey)
        return c
```

it works.


The docs say:

"""
If authkey is given and not None, it should be a byte string and will be used as the secret key for an HMAC-based authentication challenge. No authentication is done if authkey is None. AuthenticationError is raised if authentication fails. See Authentication keys.
"""


Now the question is, if None is OK because no auth will be done what about empty bytes? Can it be used as secret key? If empty bytes is not accepted shouldn't Listener/Client raise an exception in the constructor?
History
Date User Action Args
2021-05-01 12:48:54miguendessetrecipients: + miguendes
2021-05-01 12:48:54miguendessetmessageid: <1619873334.22.0.268428103779.issue43952@roundup.psfhosted.org>
2021-05-01 12:48:54miguendeslinkissue43952 messages
2021-05-01 12:48:53miguendescreate