Skip to content

Commit

Permalink
removing non-ip chars
Browse files Browse the repository at this point in the history
  • Loading branch information
EricAndrechek committed Mar 18, 2024
1 parent a98d42c commit 0ae7853
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tracking-dashboard/backend/utils/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,4 +231,8 @@ def get_client_ip(self, request):
if ip is None:
ip = request.remote_addr

# only allow valid ip addresses
# remove invalid characters (ipv4 and ipv6)
ip = "".join([c for c in ip if c in "0123456789abcdef.:"])

self.data["ip"] = ip if ip is not None else "unknown"

0 comments on commit 0ae7853

Please sign in to comment.