@@ -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
0 commit comments