/usr/lib/ruby/vendor_ruby/rack/attack/check.rb is in ruby-rack-attack 4.3.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | module Rack
class Attack
class Check
attr_reader :name, :block, :type
def initialize(name, options = {}, block)
@name, @block = name, block
@type = options.fetch(:type, nil)
end
def [](req)
block[req].tap {|match|
if match
req.env["rack.attack.matched"] = name
req.env["rack.attack.match_type"] = type
Rack::Attack.instrument(req)
end
}
end
end
end
end
|