/usr/lib/ruby/vendor_ruby/rack/attack/store_proxy.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
module StoreProxy
PROXIES = [DalliProxy, RedisStoreProxy]
def self.build(store)
# RedisStore#increment needs different behavior, so detect that
# (method has an arity of 2; must call #expire separately
if defined?(::ActiveSupport::Cache::RedisStore) && store.is_a?(::ActiveSupport::Cache::RedisStore)
# ActiveSupport::Cache::RedisStore doesn't expose any way to set an expiry,
# so use the raw Redis::Store instead
store = store.instance_variable_get(:@data)
end
klass = PROXIES.find { |proxy| proxy.handle?(store) }
klass ? klass.new(store) : store
end
end
end
end
|