diff options
author | Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> | 2019-09-06 15:36:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-06 15:36:50 +0100 |
commit | 78801e7f9e355660d2c80f0923ff7c4c19f0f004 (patch) | |
tree | 47150b2e549dadbea1ebcd2879a7fd1b4dc5db14 /synapse | |
parent | Merge pull request #5998 from matrix-org/erikj/fixup_federate_flag (diff) | |
download | synapse-78801e7f9e355660d2c80f0923ff7c4c19f0f004.tar.xz |
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`.
Diffstat (limited to 'synapse')
-rw-r--r-- | synapse/handlers/identity.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/synapse/handlers/identity.py b/synapse/handlers/identity.py index 71b5a87392..45db1c1c06 100644 --- a/synapse/handlers/identity.py +++ b/synapse/handlers/identity.py @@ -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 |