about summary refs log tree commit diff
path: root/config/initializers/rack_attack.rb
diff options
context:
space:
mode:
Diffstat (limited to 'config/initializers/rack_attack.rb')
-rw-r--r--config/initializers/rack_attack.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/config/initializers/rack_attack.rb b/config/initializers/rack_attack.rb
index cd29afac5..f11e87b11 100644
--- a/config/initializers/rack_attack.rb
+++ b/config/initializers/rack_attack.rb
@@ -105,6 +105,10 @@ class Rack::Attack
     req.session[:attempt_user_id] || req.params.dig('user', 'email').presence if req.post? && req.path == '/auth/sign_in'
   end
 
+  throttle('throttle_matrix_auth_attempts/ip', limit: 5, period: 1.minute) do |req|
+    req.remote_ip if req.path == '/_matrix-internal/identity/v1/check_credentials'
+  end
+
   self.throttled_response = lambda do |env|
     now        = Time.now.utc
     match_data = env['rack.attack.match_data']