Skip to content

Commit 1260b9f

Browse files
committed
Rename to check_firewall_lists_res
1 parent 19039c7 commit 1260b9f

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

aikido_zen/background_process/commands/check_firewall_lists.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def process_check_firewall_lists(
1414
"""
1515
Checks whether an IP is blocked and whether there is an ongoing attack wave
1616
data: {"ip": string, "user-agent": string, "is_attack_wave_request" ?: bool}
17-
returns -> FirewallListsCheckRes
17+
returns -> CheckFirewallListsRes
1818
"""
1919
ip = data["ip"]
2020
if ip is not None and isinstance(ip, str):
@@ -25,23 +25,23 @@ def process_check_firewall_lists(
2525
# Global IP Blocklist (e.g. blocking known threat actors)
2626
reason = connection_manager.firewall_lists.is_blocked_ip(ip)
2727
if reason:
28-
return FirewallListsCheckRes(blocked=True, type="blocklist", reason=reason)
28+
return CheckFirewallListsRes(blocked=True, type="blocklist", reason=reason)
2929

3030
user_agent = data["user-agent"]
3131
if user_agent is not None and isinstance(user_agent, str):
3232
# User agent blocking (e.g. blocking AI scrapers)
3333
if connection_manager.firewall_lists.is_user_agent_blocked(user_agent):
34-
return FirewallListsCheckRes(blocked=True, type="bot-blocking")
34+
return CheckFirewallListsRes(blocked=True, type="bot-blocking")
3535

3636
is_attack_wave_request = data.get("is_attack_wave_request", None)
3737
if is_attack_wave_request and ip is not None:
3838
if connection_manager.attack_wave_detector.check(ip):
39-
return FirewallListsCheckRes(blocked=False, is_attack_wave=True)
39+
return CheckFirewallListsRes(blocked=False, is_attack_wave=True)
4040

41-
return FirewallListsCheckRes()
41+
return CheckFirewallListsRes()
4242

4343

44-
class FirewallListsCheckRes:
44+
class CheckFirewallListsRes:
4545
def __init__(self, blocked=False, is_attack_wave=False, type=None, reason=None):
4646
self.blocked = blocked
4747
self.is_attack_wave = is_attack_wave

aikido_zen/sources/functions/request_handler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from aikido_zen.thread.thread_cache import get_cache
88
from .ip_allowed_to_access_route import ip_allowed_to_access_route
99
import aikido_zen.background_process.comms as c
10-
from ...background_process.commands.check_firewall_lists import FirewallListsCheckRes
10+
from ...background_process.commands.check_firewall_lists import CheckFirewallListsRes
1111
from ...background_process.queue_helpers import ReportingQueueAttackWaveEvent
1212
from ...vulnerabilities.attack_wave_detection.is_web_scanner import is_web_scanner
1313

@@ -73,7 +73,7 @@ def pre_response():
7373
)
7474
if not check_fw_lists_res["success"] or not check_fw_lists_res["data"]["blocked"]:
7575
return
76-
res: FirewallListsCheckRes = check_fw_lists_res["data"]
76+
res: CheckFirewallListsRes = check_fw_lists_res["data"]
7777

7878
if res.is_attack_wave:
7979
# Report to core & increase stats

0 commit comments

Comments
 (0)