Skip to content

Commit 515da43

Browse files
committed
Linting & clarification
1 parent 50eac82 commit 515da43

4 files changed

Lines changed: 14 additions & 6 deletions

File tree

aikido_zen/background_process/cloud_connection_manager/update_service_config_test.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,9 @@ def test_update_service_config_failure():
108108

109109
# Set initial values
110110
connection_manager.conf.set_block_new_outgoing_requests(True)
111-
connection_manager.conf.update_outbound_domains([{"hostname": "test.com", "mode": "block"}])
111+
connection_manager.conf.update_outbound_domains(
112+
[{"hostname": "test.com", "mode": "block"}]
113+
)
112114

113115
# Test failed response
114116
res = {"success": False, "blockNewOutgoingRequests": False, "domains": []}

aikido_zen/background_process/service_config.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ def is_bypassed_ip(self, ip):
7878
return self.bypassed_ips.has(ip)
7979

8080
def update_outbound_domains(self, domains):
81-
self.outbound_domains = {domain["hostname"]: domain["mode"] for domain in domains}
81+
self.outbound_domains = {
82+
domain["hostname"]: domain["mode"] for domain in domains
83+
}
8284

8385
def set_block_new_outgoing_requests(self, value: bool):
8486
"""Set whether to block new outgoing requests"""

aikido_zen/sinks/socket/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
"""
22
Sink module for `socket`
33
"""
4+
45
from aikido_zen.errors import AikidoSSRF
56
from aikido_zen.helpers.get_argument import get_argument
67
from aikido_zen.sinks import on_import, patch_function, after
78
from aikido_zen.sinks.socket.normalize_hostname import normalize_hostname
8-
from aikido_zen.sinks.socket.should_block_outbound_domain import should_block_outbound_domain
9+
from aikido_zen.sinks.socket.should_block_outbound_domain import (
10+
should_block_outbound_domain,
11+
)
912
from aikido_zen.vulnerabilities import run_vulnerability_scan
1013

1114

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
from aikido_zen.context import get_current_context
2-
from aikido_zen.errors import AikidoSSRF
3-
from aikido_zen.sinks.socket.normalize_hostname import normalize_hostname
41
from aikido_zen.thread.thread_cache import get_cache
52

63

74
def should_block_outbound_domain(hostname, port):
85
process_cache = get_cache()
96
if not process_cache:
107
return False
8+
9+
# We store the hostname before checking the blocking status
10+
# This is because if we are in lockdown mode and blocking all new hostnames, it should still
11+
# show up in the dashboard. This allows the user to allow traffic to newly detected hostnames.
1112
process_cache.hostnames.add(hostname, port)
1213

1314
return process_cache.config.should_block_outgoing_request(hostname)

0 commit comments

Comments
 (0)