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

Commit 78801e7

Browse files
Ensure a sid parameter is passed to bind_threepid (#5995)
`sid` is required to be part of `three_pid_creds`. We were 500'ing if it wasn't provided instead of returning `M_MISSING_PARAM`.
1 parent a2a695b commit 78801e7

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

changelog.d/5995.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Return a M_MISSING_PARAM if `sid` is not provided to `/account/3pid`.

synapse/handlers/identity.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,18 @@ def bind_threepid(self, creds, mxid, use_v2=True):
151151
creds
152152
)
153153

154+
sid = creds.get("sid")
155+
if not sid:
156+
raise SynapseError(
157+
400, "No sid in three_pid_creds", errcode=Codes.MISSING_PARAM
158+
)
159+
154160
# If an id_access_token is not supplied, force usage of v1
155161
if id_access_token is None:
156162
use_v2 = False
157163

158164
# Decide which API endpoint URLs to use
159-
bind_data = {"sid": creds["sid"], "client_secret": client_secret, "mxid": mxid}
165+
bind_data = {"sid": sid, "client_secret": client_secret, "mxid": mxid}
160166
if use_v2:
161167
bind_url = "https://%s/_matrix/identity/v2/3pid/bind" % (id_server,)
162168
bind_data["id_access_token"] = id_access_token

0 commit comments

Comments
 (0)