Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Ensure a sid parameter is passed to bind_threepid (#5995)
Browse files Browse the repository at this point in the history
  • Loading branch information
anoadragon453 committed Feb 25, 2020
2 parents 4f37881 + 78801e7 commit d071a1c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.d/5995.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Return a M_MISSING_PARAM if `sid` is not provided to `/account/3pid`.
8 changes: 7 additions & 1 deletion synapse/handlers/identity.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,12 @@ def bind_threepid(self, creds, mxid, use_v2=True):
creds
)

sid = creds.get("sid")
if not sid:
raise SynapseError(
400, "No sid in three_pid_creds", errcode=Codes.MISSING_PARAM
)

# If an id_access_token is not supplied, force usage of v1
if id_access_token is None:
use_v2 = False
Expand All @@ -180,7 +186,7 @@ def bind_threepid(self, creds, mxid, use_v2=True):
id_server_host = id_server

# Decide which API endpoint URLs to use
bind_data = {"sid": creds["sid"], "client_secret": client_secret, "mxid": mxid}
bind_data = {"sid": sid, "client_secret": client_secret, "mxid": mxid}
if use_v2:
bind_url = "https://%s/_matrix/identity/v2/3pid/bind" % (id_server_host,)
bind_data["id_access_token"] = id_access_token
Expand Down

0 comments on commit d071a1c

Please sign in to comment.