mirror of
https://github.com/samsonjs/rack-attack.git
synced 2026-04-27 15:07:41 +00:00
Enable rubocop Naming cops
This commit is contained in:
parent
972a19006a
commit
e6854bcb02
2 changed files with 9 additions and 4 deletions
|
|
@ -16,6 +16,11 @@ Layout:
|
||||||
Lint:
|
Lint:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
Naming:
|
||||||
|
Enabled: true
|
||||||
|
Exclude:
|
||||||
|
- "lib/rack/attack/path_normalizer.rb"
|
||||||
|
|
||||||
Performance:
|
Performance:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,15 +38,15 @@ class Rack::Attack
|
||||||
self.blocklists[name] = Blocklist.new(name, block)
|
self.blocklists[name] = Blocklist.new(name, block)
|
||||||
end
|
end
|
||||||
|
|
||||||
def blocklist_ip(ip)
|
def blocklist_ip(ip_address)
|
||||||
@ip_blocklists ||= []
|
@ip_blocklists ||= []
|
||||||
ip_blocklist_proc = lambda { |request| IPAddr.new(ip).include?(IPAddr.new(request.ip)) }
|
ip_blocklist_proc = lambda { |request| IPAddr.new(ip_address).include?(IPAddr.new(request.ip)) }
|
||||||
@ip_blocklists << Blocklist.new(nil, ip_blocklist_proc)
|
@ip_blocklists << Blocklist.new(nil, ip_blocklist_proc)
|
||||||
end
|
end
|
||||||
|
|
||||||
def safelist_ip(ip)
|
def safelist_ip(ip_address)
|
||||||
@ip_safelists ||= []
|
@ip_safelists ||= []
|
||||||
ip_safelist_proc = lambda { |request| IPAddr.new(ip).include?(IPAddr.new(request.ip)) }
|
ip_safelist_proc = lambda { |request| IPAddr.new(ip_address).include?(IPAddr.new(request.ip)) }
|
||||||
@ip_safelists << Safelist.new(nil, ip_safelist_proc)
|
@ip_safelists << Safelist.new(nil, ip_safelist_proc)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue