This file is indexed.

/usr/lib/ruby/vendor_ruby/rack/attack/store_proxy.rb is in ruby-rack-attack 4.4.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
23
24
25
26
27
28
29
30
31
32
module Rack
  class Attack
    module StoreProxy
      PROXIES = [DalliProxy, MemCacheProxy, RedisStoreProxy]

      ACTIVE_SUPPORT_WRAPPER_CLASSES = Set.new(['ActiveSupport::Cache::MemCacheStore', 'ActiveSupport::Cache::RedisStore']).freeze
      ACTIVE_SUPPORT_CLIENTS = Set.new(['Redis::Store', 'Dalli::Client', 'MemCache']).freeze

      def self.build(store)
        client = unwrap_active_support_stores(store)
        klass = PROXIES.find { |proxy| proxy.handle?(client) }
        klass ? klass.new(client) : client
      end


      private
      def self.unwrap_active_support_stores(store)
        # ActiveSupport::Cache::RedisStore doesn't expose any way to set an expiry,
        # so use the raw Redis::Store instead.
        # We also want to use the underlying Dalli client instead of ::ActiveSupport::Cache::MemCacheStore,
        # and the MemCache client if using Rails 3.x

        client = store.instance_variable_get(:@data)
        if ACTIVE_SUPPORT_WRAPPER_CLASSES.include?(store.class.to_s) && ACTIVE_SUPPORT_CLIENTS.include?(client.class.to_s)
          client
        else
          store
        end
      end
    end
  end
end