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

Ensure a sid parameter is passed to bind_threepid #5995

Merged
merged 5 commits into from
Sep 6, 2019
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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`.
6 changes: 5 additions & 1 deletion synapse/handlers/identity.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,16 @@ 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

# 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,)
bind_data["id_access_token"] = id_access_token
Expand Down