Skip to content

Commit

Permalink
#188414493 Refactor: Fix substring sanitization (#27)
Browse files Browse the repository at this point in the history
Refactor: Fix substring sanitization
  • Loading branch information
keyur9 authored Oct 29, 2024
1 parent e31304a commit 9ee072f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions moesifpythonrequest/utility_function/utility_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ def get_current_time(self):
return datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%S.%f")[:-3]

# Function to check if the allowed url is valid
def is_valid_url(url, allowed_hosts):
@classmethod
def is_valid_url(cls, url):
try:
parsed_url = urlparse(url)
return parsed_url.netloc.endswith('moesif.net')
return parsed_url.netloc.endswith('.moesif.net')
except:
return False

Expand All @@ -22,7 +23,7 @@ def is_moesif(self, request_headers, url):
if request_headers.get('X-Moesif-SDK', None) is not None or request_headers.get('X-Moesif-Application-Id', None) is not None:
return True

return is_valid_url(url)
return self.is_valid_url(url)

# Function to mask the body
def mask_body(self, body, masks):
Expand Down

0 comments on commit 9ee072f

Please sign in to comment.