-
-
Notifications
You must be signed in to change notification settings - Fork 45
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
Feature request: Also block DNS lookups (socket.getaddrinfo) #43
Labels
Comments
This issue is stale because it has been open for 90 days with no activity. |
This issue was closed because it has been inactive for 30 days since being marked as stale. |
I think this is still a valid feature request? There's even been a PR for it (#64). |
Closed
This issue is stale because it has been open for 90 days with no activity. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you for this plugin, which helps keep our tests fast and safe! One piece of information that can still leak out even when using it, though, is DNS lookups. It would be great if we could also block calls to
socket.getaddrinfo
in the same way.I believe this can be done in a basic way by adding
socket.getaddrinfo = guarded
to thedisable_socket()
method here:pytest-socket/pytest_socket.py
Lines 73 to 80 in cb5e7c5
...and perhaps updating the exception message to not specifically reference
socket.socket
.I have not sent a PR for this because I don't know the pytest API well enough to understand how and when
disable_socket
is getting called, or how this should interact withsocket_allow_hosts()
further down — but if that's not a concern, I'd be happy to submit that change for consideration.Thanks again!
The text was updated successfully, but these errors were encountered: