summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--changelog.d/5995.bugfix1
-rw-r--r--synapse/handlers/identity.py8
2 files changed, 8 insertions, 1 deletions
diff --git a/changelog.d/5995.bugfix b/changelog.d/5995.bugfix
new file mode 100644

index 0000000000..e03ab98bc6 --- /dev/null +++ b/changelog.d/5995.bugfix
@@ -0,0 +1 @@ +Return a M_MISSING_PARAM if `sid` is not provided to `/account/3pid`. \ No newline at end of file diff --git a/synapse/handlers/identity.py b/synapse/handlers/identity.py
index 9f5c8e9a1e..098341a03c 100644 --- a/synapse/handlers/identity.py +++ b/synapse/handlers/identity.py
@@ -167,6 +167,12 @@ 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 @@ -180,7 +186,7 @@ class IdentityHandler(BaseHandler): 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