Skip to content

Commit

Permalink
SSRF vulnerability fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ineshbose committed Oct 7, 2020
1 parent 84cfab7 commit 890f1d5
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions boyd_bot/services/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ def __init__(self, platform_token):
"""
Initialise class with a token provided by the platform.
"""
self.p_token = platform_token
self.url = "https://graph.facebook.com/v7.0/"
self.platform_token = platform_token
self.msg_char_limit = 2000

def sanitize_messages(self, message):
Expand Down Expand Up @@ -47,7 +46,8 @@ def send_message(self, uid, message):
"""
return [
requests.post(
f"{self.url}me/messages?access_token={self.p_token}",
"https://graph.facebook.com/v7.0/me/messages",
params={"access_token": self.platform_token},
json={
"recipient": {"id": uid},
"message": {"text": m},
Expand All @@ -61,8 +61,10 @@ def get_user_data(self, uid):
"""
Get basic information about the user from the platform.
"""
req = requests.get(f"{self.url}{uid}?access_token={self.p_token}")
return req.json()
return requests.get(
f"https://graph.facebook.com/v7.0/{uid}",
params={"access_token": self.platform_token}
).json()

def get_id(self, data):
"""
Expand Down

0 comments on commit 890f1d5

Please sign in to comment.