summary refs log tree commit diff
path: root/synapse/api
diff options
context:
space:
mode:
authorDavid Robertson <davidr@element.io>2021-08-20 15:47:03 +0100
committerGitHub <noreply@github.com>2021-08-20 15:47:03 +0100
commitee3b2ac59a5645cb213b3c11c473613b80fe1e0f (patch)
treee6ec57cf1b94e684cd8245611e58d3e68e935500 /synapse/api
parentSplit `on_receive_pdu` in half (#10640) (diff)
downloadsynapse-ee3b2ac59a5645cb213b3c11c473613b80fe1e0f.tar.xz
Validate device_keys for C-S /keys/query requests (#10593)
* Validate device_keys for C-S /keys/query requests

Closes #10354

A small, not particularly critical fix. I'm interested in seeing if we
can find a more systematic approach though. #8445 is the place for any discussion.
Diffstat (limited to 'synapse/api')
-rw-r--r--synapse/api/errors.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/synapse/api/errors.py b/synapse/api/errors.py
index dc662bca83..9480f448d7 100644
--- a/synapse/api/errors.py
+++ b/synapse/api/errors.py
@@ -147,6 +147,14 @@ class SynapseError(CodeMessageException):
         return cs_error(self.msg, self.errcode)
 
 
+class InvalidAPICallError(SynapseError):
+    """You called an existing API endpoint, but fed that endpoint
+    invalid or incomplete data."""
+
+    def __init__(self, msg: str):
+        super().__init__(HTTPStatus.BAD_REQUEST, msg, Codes.BAD_JSON)
+
+
 class ProxiedRequestError(SynapseError):
     """An error from a general matrix endpoint, eg. from a proxied Matrix API call.