Skip to content

Commit 8f51b51

Browse files
committed
Before blocking check if its a bypassed ip
1 parent aaf9933 commit 8f51b51

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

aikido_zen/sinks/socket.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
22
Sink module for `socket`
33
"""
4-
4+
from aikido_zen.context import get_current_context
55
from aikido_zen.helpers.get_argument import get_argument
66
from aikido_zen.helpers.register_call import register_call
77
from aikido_zen.sinks import on_import, patch_function, before, after
@@ -18,6 +18,12 @@ def _getaddrinfo_before(func, instance, args, kwargs):
1818
# Check if we should block this outgoing request based on configuration
1919
cache = get_cache()
2020
if cache and cache.config:
21+
22+
# Allow bypassed ips to access all hostnames
23+
context = get_current_context()
24+
if context and cache.is_bypassed_ip(context.remote_address):
25+
return
26+
2127
if cache.config.should_block_outgoing_request(host):
2228
raise AikidoSSRF(
2329
f"Zen has blocked an outbound connection: socket.getaddrinfo to {host}"

0 commit comments

Comments
 (0)