summary refs log tree commit diff
diff options
context:
space:
mode:
authorShay <hillerys@element.io>2022-06-30 09:22:40 -0700
committerGitHub <noreply@github.com>2022-06-30 09:22:40 -0700
commit046a6513bcad2f7111e12e3b750eb798466731da (patch)
tree55c049e43a2fbffb06aa8614a764ef637647edc0
parentCleanup references to sample config in the docs and redirect users to configu... (diff)
downloadsynapse-046a6513bcad2f7111e12e3b750eb798466731da.tar.xz
Don't process /send requests for users who have hit their ratelimit (#13134)
-rw-r--r--changelog.d/13134.misc1
-rw-r--r--synapse/handlers/message.py3
2 files changed, 4 insertions, 0 deletions
diff --git a/changelog.d/13134.misc b/changelog.d/13134.misc
new file mode 100644
index 0000000000..e3e16056d1
--- /dev/null
+++ b/changelog.d/13134.misc
@@ -0,0 +1 @@
+Apply ratelimiting earlier in processing of /send request.
\ No newline at end of file
diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py
index 189f52fe5a..c6b40a5b7a 100644
--- a/synapse/handlers/message.py
+++ b/synapse/handlers/message.py
@@ -903,6 +903,9 @@ class EventCreationHandler:
             await self.clock.sleep(random.randint(1, 10))
             raise ShadowBanError()
 
+        if ratelimit:
+            await self.request_ratelimiter.ratelimit(requester, update=False)
+
         # We limit the number of concurrent event sends in a room so that we
         # don't fork the DAG too much. If we don't limit then we can end up in
         # a situation where event persistence can't keep up, causing