0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-07-01 08:58:19 +02:00

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`.
This commit is contained in:
Andrew Morgan 2019-09-06 15:36:50 +01:00 committed by GitHub
parent a2a695b7ec
commit 78801e7f9e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

1
changelog.d/5995.bugfix Normal file
View file

@ -0,0 +1 @@
Return a M_MISSING_PARAM if `sid` is not provided to `/account/3pid`.

View file

@ -151,12 +151,18 @@ class IdentityHandler(BaseHandler):
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