diff options
author | Neil Johnson <neil@matrix.org> | 2018-08-17 12:42:59 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-17 12:42:59 +0000 |
commit | a2d872e7b3770c454569d838bf1bb92115d9f32a (patch) | |
tree | 34c1b42c256987be5e0b56139a3da75d1f69ae8c /synapse/handlers | |
parent | Merge pull request #3712 from matrix-org/travis/register-admin-docs (diff) | |
parent | remove errant yield (diff) | |
download | synapse-a2d872e7b3770c454569d838bf1bb92115d9f32a.tar.xz |
Merge pull request #3708 from matrix-org/neilj/resource_Limit_block_event_creation
Neilj/resource limit block event creation
Diffstat (limited to 'synapse/handlers')
-rw-r--r-- | synapse/handlers/message.py | 6 | ||||
-rw-r--r-- | synapse/handlers/room.py | 4 |
2 files changed, 9 insertions, 1 deletions
diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py index 893c9bcdc4..4d006df63c 100644 --- a/synapse/handlers/message.py +++ b/synapse/handlers/message.py @@ -276,10 +276,14 @@ class EventCreationHandler(object): where *hashes* is a map from algorithm to hash. If None, they will be requested from the database. - + Raises: + ResourceLimitError if server is blocked to some resource being + exceeded Returns: Tuple of created event (FrozenEvent), Context """ + yield self.auth.check_auth_blocking(requester.user.to_string()) + builder = self.event_builder_factory.new(event_dict) self.validator.validate_new(builder) diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py index 6a17c42238..c3f820b975 100644 --- a/synapse/handlers/room.py +++ b/synapse/handlers/room.py @@ -98,9 +98,13 @@ class RoomCreationHandler(BaseHandler): Raises: SynapseError if the room ID couldn't be stored, or something went horribly wrong. + ResourceLimitError if server is blocked to some resource being + exceeded """ user_id = requester.user.to_string() + self.auth.check_auth_blocking(user_id) + if not self.spam_checker.user_may_create_room(user_id): raise SynapseError(403, "You are not permitted to create rooms") |