summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2020-10-22 13:19:06 +0100
committerGitHub <noreply@github.com>2020-10-22 13:19:06 +0100
commitb19b63e6b4c0c654226c066999bd82c54952920c (patch)
treee3f1d3bc9d07eb527848819280bd36d863c5df18
parentType hints for RegistrationStore (#8615) (diff)
downloadsynapse-b19b63e6b4c0c654226c066999bd82c54952920c.tar.xz
Don't 500 for invalid group IDs (#8628)
-rw-r--r--changelog.d/8628.bugfix1
-rw-r--r--synapse/handlers/groups_local.py5
2 files changed, 5 insertions, 1 deletions
diff --git a/changelog.d/8628.bugfix b/changelog.d/8628.bugfix
new file mode 100644

index 0000000000..1316136ca2 --- /dev/null +++ b/changelog.d/8628.bugfix
@@ -0,0 +1 @@ +Fix handling of invalid group IDs to return a 400 rather than log an exception and return a 500. diff --git a/synapse/handlers/groups_local.py b/synapse/handlers/groups_local.py
index 9684e60fc8..b2def93bb1 100644 --- a/synapse/handlers/groups_local.py +++ b/synapse/handlers/groups_local.py
@@ -17,7 +17,7 @@ import logging from synapse.api.errors import HttpResponseException, RequestSendFailed, SynapseError -from synapse.types import get_domain_from_id +from synapse.types import GroupID, get_domain_from_id logger = logging.getLogger(__name__) @@ -28,6 +28,9 @@ def _create_rerouter(func_name): """ async def f(self, group_id, *args, **kwargs): + if not GroupID.is_valid(group_id): + raise SynapseError(400, "%s was not legal group ID" % (group_id,)) + if self.is_mine_id(group_id): return await getattr(self.groups_server_handler, func_name)( group_id, *args, **kwargs