Skip to content

Commit 693faa3

Browse files
committed
Add a should_block_outgoing_request to service_config.py
1 parent ba836ca commit 693faa3

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

aikido_zen/background_process/service_config.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,13 @@ def set_bypassed_ips(self, bypassed_ips):
7474
def is_bypassed_ip(self, ip):
7575
"""Checks if the IP is on the bypass list"""
7676
return self.bypassed_ips.has(ip)
77+
def should_block_outgoing_request(self, hostname: str) -> bool:
78+
mode = self.domains.get(hostname)
79+
80+
if self.block_new_outgoing_requests:
81+
# Only allow outgoing requests if the mode is "allow"
82+
# mode is None for unknown hostnames, so they get blocked
83+
return mode != "allow"
84+
85+
# Only block outgoing requests if the mode is "block"
86+
return mode == "block"

0 commit comments

Comments
 (0)