Skip to content

Commit

Permalink
Ignore abuse from 15x.x.x.x IPs.
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeer committed Aug 7, 2024
1 parent 8af23f6 commit cf06b2c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions config/initializers/rack_attack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Attack
{}
end

req.ip if route[:action].in? %w[email sms]
req.ip if route[:action].in? %w(email sms)
end

# Inform throttled clients about limits and when they will get out of jail
Expand All @@ -50,7 +50,8 @@ class Attack

if Settings.throttling.notify_honeybadger && (
((match_data[:limit] - match_data[:count]) < 5) || (match_data[:count] % 10).zero?
) && (request.env['HTTP_USER_AGENT'] || '') !~ /(Google|bot)/i
) && (request.env['HTTP_USER_AGENT'] || '') !~ /(Google|bot)/i &&
!request.ip&.start_with?(/15\d\./) # ignore abuse from hwclouds (among others)
Honeybadger.notify('Throttling request', context: { ip: request.ip, path: request.path }.merge(match_data))
end

Expand Down

0 comments on commit cf06b2c

Please sign in to comment.