Skip to content

Commit

Permalink
Fix Rails 4 suite
Browse files Browse the repository at this point in the history
  • Loading branch information
santib committed Oct 16, 2023
1 parent ceabba1 commit 3fcf9cf
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/rack/attack/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,15 @@ def blocklist(name = nil, &block)
end

def blocklist_ip(ip_address)
@anonymous_blocklists << Blocklist.new { |request| IPAddr.new(ip_address).include?(IPAddr.new(*request.ip)) }
@anonymous_blocklists << Blocklist.new do |request|
request.ip && !request.ip.empty? && IPAddr.new(ip_address).include?(IPAddr.new(request.ip))
end
end

def safelist_ip(ip_address)
@anonymous_safelists << Safelist.new { |request| IPAddr.new(ip_address).include?(IPAddr.new(*request.ip)) }
@anonymous_safelists << Safelist.new do |request|
request.ip && !request.ip.empty? && IPAddr.new(ip_address).include?(IPAddr.new(request.ip))
end
end

def throttle(name, options, &block)
Expand Down

0 comments on commit 3fcf9cf

Please sign in to comment.