chore: secure dashboard proxy endpoint and decouple lan checks
Deploy Dashboard / deploy (push) Successful in 1m48s
Deploy Dashboard / deploy (push) Successful in 1m48s
This commit is contained in:
@@ -46,3 +46,17 @@ CHAT_SUMMARY_DB = os.environ.get("CHAT_SUMMARY_DB", "/app/data/chat-summarizer/c
|
||||
|
||||
# OpenClaw
|
||||
OPENCLAW_GATEWAY_TOKEN = os.environ.get("OPENCLAW_GATEWAY_TOKEN", "")
|
||||
|
||||
# Networking configs
|
||||
LAN_IP_RANGES = os.environ.get("LAN_IP_RANGES", "192.168.31.0/24,100.64.0.0/10").split(",")
|
||||
|
||||
def is_lan_ip(ip_str: str) -> bool:
|
||||
import ipaddress
|
||||
try:
|
||||
ip_obj = ipaddress.ip_address(ip_str)
|
||||
for subnet_str in LAN_IP_RANGES:
|
||||
if ip_obj in ipaddress.ip_network(subnet_str.strip()):
|
||||
return True
|
||||
return False
|
||||
except ValueError:
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user