mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-01-23 02:35:14 +00:00
proper cidr validation server-side
This commit is contained in:
parent
9f96529707
commit
789d29c97a
4 changed files with 78 additions and 12 deletions
|
|
@ -29,7 +29,7 @@ def validate_logo_file(file):
|
|||
|
||||
|
||||
def get_client_ip(request):
|
||||
x_forwarded_for = request.META.get("HTTP_X_FORWARDED_FOR")
|
||||
x_forwarded_for = request.META.get("HTTP_X_REAL_IP")
|
||||
if x_forwarded_for:
|
||||
# X-Forwarded-For can be a comma-separated list of IPs
|
||||
ip = x_forwarded_for.split(",")[0].strip()
|
||||
|
|
@ -44,7 +44,7 @@ def network_access_allowed(request, settings_key):
|
|||
cidrs = (
|
||||
network_access[settings_key].split(",")
|
||||
if settings_key in network_access
|
||||
else "0.0.0.0/0"
|
||||
else ["0.0.0.0/0"]
|
||||
)
|
||||
|
||||
network_allowed = False
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue