mirror of
https://github.com/searxng/searxng
synced 2024-01-01 19:24:07 +01:00
limiter_whitelisting: extra checks and fallback to no whitelisting
This commit is contained in:
parent
bbc52eb9d5
commit
04121beb10
1 changed files with 3 additions and 6 deletions
|
@ -50,13 +50,10 @@ WHITELISTED_SUBNET = get_setting('server.limiter_whitelist_subnet', default=[])
|
|||
|
||||
|
||||
def is_whitelist_ip(ip: str) -> bool:
|
||||
'''
|
||||
Check if the given IP address belongs to the whitelisted list
|
||||
of IP addresses or subnets.
|
||||
'''
|
||||
"""Check if the given IP address belongs to the whitelisted list of IP addresses or subnets."""
|
||||
# if ip is empty use the source ip
|
||||
if ip == '':
|
||||
ip = request.remote_addr
|
||||
if ip == "" or ip is None:
|
||||
ip = request.remote_addr or ""
|
||||
logger.debug("checking whitelist rules for: %s", ip)
|
||||
whitelisted = False
|
||||
try:
|
||||
|
|
Loading…
Add table
Reference in a new issue