summary refs log tree commit diff
path: root/synapse/config/ratelimiting.py
diff options
context:
space:
mode:
authorBrendan Abolivier <babolivier@matrix.org>2022-02-03 14:28:15 +0100
committerGitHub <noreply@github.com>2022-02-03 14:28:15 +0100
commitd80d39b0359d3891d0078e9c8b53e189986d417f (patch)
treea22614399664657d9dd41a799e14f5cc4b6c6868 /synapse/config/ratelimiting.py
parentAllow specifying the application service-specific `user_id` parameter in the ... (diff)
downloadsynapse-d80d39b0359d3891d0078e9c8b53e189986d417f.tar.xz
Add a ratelimiter for 3pid invite (#11892)
Diffstat (limited to 'synapse/config/ratelimiting.py')
-rw-r--r--synapse/config/ratelimiting.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/synapse/config/ratelimiting.py b/synapse/config/ratelimiting.py
index 36636ab07e..e9ccf1bd62 100644
--- a/synapse/config/ratelimiting.py
+++ b/synapse/config/ratelimiting.py
@@ -134,6 +134,14 @@ class RatelimitConfig(Config):
             defaults={"per_second": 0.003, "burst_count": 5},
         )
 
+        self.rc_third_party_invite = RateLimitConfig(
+            config.get("rc_third_party_invite", {}),
+            defaults={
+                "per_second": self.rc_message.per_second,
+                "burst_count": self.rc_message.burst_count,
+            },
+        )
+
     def generate_config_section(self, **kwargs):
         return """\
         ## Ratelimiting ##
@@ -168,6 +176,9 @@ class RatelimitConfig(Config):
         #   - one for ratelimiting how often a user or IP can attempt to validate a 3PID.
         #   - two for ratelimiting how often invites can be sent in a room or to a
         #     specific user.
+        #   - one for ratelimiting 3PID invites (i.e. invites sent to a third-party ID
+        #     such as an email address or a phone number) based on the account that's
+        #     sending the invite.
         #
         # The defaults are as shown below.
         #
@@ -217,6 +228,10 @@ class RatelimitConfig(Config):
         #  per_user:
         #    per_second: 0.003
         #    burst_count: 5
+        #
+        #rc_third_party_invite:
+        #  per_second: 0.2
+        #  burst_count: 10
 
         # Ratelimiting settings for incoming federation
         #