summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2017-07-14 14:06:09 +0100
committerErik Johnston <erik@matrix.org>2017-07-14 14:06:55 +0100
commitcb3aee8219b68e99fc391b96813e6588279e8d86 (patch)
tree396c842fd693621c88313905cd313d8354dbfdc7
parentAdd DEFAULT_ROLE_ID (diff)
downloadsynapse-cb3aee8219b68e99fc391b96813e6588279e8d86.tar.xz
Ensure category and role ids are non-null
-rw-r--r--synapse/federation/transport/server.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/synapse/federation/transport/server.py b/synapse/federation/transport/server.py
index 304c2a2a4c..4f7d2546cf 100644
--- a/synapse/federation/transport/server.py
+++ b/synapse/federation/transport/server.py
@@ -785,6 +785,9 @@ class FederationGroupsSummaryRoomsServlet(BaseFederationServlet):
         if get_domain_from_id(requester_user_id) != origin:
             raise SynapseError(403, "requester_user_id doesn't match origin")
 
+        if category_id == "":
+            raise SynapseError(400, "category_id cannot be empty string")
+
         resp = yield self.handler.update_group_summary_room(
             group_id, requester_user_id,
             room_id=room_id,
@@ -800,6 +803,9 @@ class FederationGroupsSummaryRoomsServlet(BaseFederationServlet):
         if get_domain_from_id(requester_user_id) != origin:
             raise SynapseError(403, "requester_user_id doesn't match origin")
 
+        if category_id == "":
+            raise SynapseError(400, "category_id cannot be empty string")
+
         resp = yield self.handler.delete_group_summary_room(
             group_id, requester_user_id,
             room_id=room_id,
@@ -854,6 +860,9 @@ class FederationGroupsCategoryServlet(BaseFederationServlet):
         if get_domain_from_id(requester_user_id) != origin:
             raise SynapseError(403, "requester_user_id doesn't match origin")
 
+        if category_id == "":
+            raise SynapseError(400, "category_id cannot be empty string")
+
         resp = yield self.handler.upsert_group_category(
             group_id, requester_user_id, category_id, content,
         )
@@ -866,6 +875,9 @@ class FederationGroupsCategoryServlet(BaseFederationServlet):
         if get_domain_from_id(requester_user_id) != origin:
             raise SynapseError(403, "requester_user_id doesn't match origin")
 
+        if category_id == "":
+            raise SynapseError(400, "category_id cannot be empty string")
+
         resp = yield self.handler.delete_group_category(
             group_id, requester_user_id, category_id,
         )
@@ -918,6 +930,9 @@ class FederationGroupsRoleServlet(BaseFederationServlet):
         if get_domain_from_id(requester_user_id) != origin:
             raise SynapseError(403, "requester_user_id doesn't match origin")
 
+        if role_id == "":
+            raise SynapseError(400, "role_id cannot be empty string")
+
         resp = yield self.handler.update_group_role(
             group_id, requester_user_id, role_id, content,
         )
@@ -930,6 +945,9 @@ class FederationGroupsRoleServlet(BaseFederationServlet):
         if get_domain_from_id(requester_user_id) != origin:
             raise SynapseError(403, "requester_user_id doesn't match origin")
 
+        if role_id == "":
+            raise SynapseError(400, "role_id cannot be empty string")
+
         resp = yield self.handler.delete_group_role(
             group_id, requester_user_id, role_id,
         )
@@ -956,6 +974,9 @@ class FederationGroupsSummaryUsersServlet(BaseFederationServlet):
         if get_domain_from_id(requester_user_id) != origin:
             raise SynapseError(403, "requester_user_id doesn't match origin")
 
+        if role_id == "":
+            raise SynapseError(400, "role_id cannot be empty string")
+
         resp = yield self.handler.update_group_summary_user(
             group_id, requester_user_id,
             user_id=user_id,
@@ -971,6 +992,9 @@ class FederationGroupsSummaryUsersServlet(BaseFederationServlet):
         if get_domain_from_id(requester_user_id) != origin:
             raise SynapseError(403, "requester_user_id doesn't match origin")
 
+        if role_id == "":
+            raise SynapseError(400, "role_id cannot be empty string")
+
         resp = yield self.handler.delete_group_summary_user(
             group_id, requester_user_id,
             user_id=user_id,