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

socket_allow_hosts doesn't handle AF_UNIX sockets #70

Closed
NSchrading opened this issue Jul 22, 2021 · 1 comment
Closed

socket_allow_hosts doesn't handle AF_UNIX sockets #70

NSchrading opened this issue Jul 22, 2021 · 1 comment

Comments

@NSchrading
Copy link

socket_allow_hosts will always block AF_UNIX sockets, even if you pass --allow-unix-socket. The issue is that the code as currently written only handles AF_INET sockets, since host_from_connect_args assumes the args are always tuples, and will return None as the host otherwise.

A simple reproduction can be tested by creating a multiprocessing manager:

manager = multiprocessing.Manager()
lst = manager.list([1, 2, 3])

This will raise something like:

pytest_socket.SocketConnectBlockedError: A test tried to use socket.socket.connect() with host None (allowed: "foo").

socket_allow_hosts should allow any AF_UNIX socket connection if --allow-unix-socket is specified, and it should also work for AF_UNIX sockets with known socket (file) names if you pass the correct name in --allow-hosts.

@miketheman
Copy link
Owner

Hello! This should be resolved in #93 - to be released in 0.50.0 soon.

I was unable to reproduce this specific scenario with multiprocessing - please re-test on the new code, and reopen if needed!

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 a pull request may close this issue.

2 participants