diff options
author | Jeong Arm <kjwonmail@gmail.com> | 2022-02-18 21:51:51 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-18 13:51:51 +0100 |
commit | 1de2e3f980549ce48eeeef99b99ac64987fcce44 (patch) | |
tree | 93cad0210def854559922a6c9adbac4fca7096dd /config/initializers | |
parent | ac99f586bb4138e083676579097d951434e90515 (diff) |
Throttle IPv6 signup for subnet (#17588)
Diffstat (limited to 'config/initializers')
-rw-r--r-- | config/initializers/rack_attack.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/config/initializers/rack_attack.rb b/config/initializers/rack_attack.rb index 964d4266d..80c005f81 100644 --- a/config/initializers/rack_attack.rb +++ b/config/initializers/rack_attack.rb @@ -82,7 +82,9 @@ class Rack::Attack end throttle('throttle_sign_up_attempts/ip', limit: 25, period: 5.minutes) do |req| - req.remote_ip if req.post? && req.path == '/auth' + return unless req.post? && req.path == '/auth' + return req.remote_ip.mask(64) if req.remote_ip.ipv6? + req.remote_ip end throttle('throttle_password_resets/ip', limit: 25, period: 5.minutes) do |req| |