This file is indexed.

/usr/lib/ruby/vendor_ruby/web_console/whitelist.rb is in ruby-web-console 2.2.1-2.

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
33
34
35
36
37
38
39
40
41
42
require 'ipaddr'

module WebConsole
  # Whitelist of allowed networks that can access Web Console.
  #
  # Networks are represented by standard IPAddr and can be either IPv4 or IPv6
  # networks.
  class Whitelist
    # IPv4 and IPv6 localhost should be always whitelisted.
    ALWAYS_WHITELISTED_NETWORKS = %w( 127.0.0.0/8 ::1 )

    def initialize(networks = nil)
      @networks = normalize_networks(networks).map(&method(:coerce_network_to_ipaddr)).uniq
    end

    def include?(network)
      @networks.any? { |whitelist| whitelist.include?(network.to_s) }
    end

    def to_s
      @networks.map(&method(:human_readable_ipaddr)).join(', ')
    end

    private

      def normalize_networks(networks)
        Array(networks).concat(ALWAYS_WHITELISTED_NETWORKS)
      end

      def coerce_network_to_ipaddr(network)
        if network.is_a?(IPAddr)
          network
        else
          IPAddr.new(network)
        end
      end

      def human_readable_ipaddr(ipaddr)
        ipaddr.to_range.to_s.split('..').uniq.join('/')
      end
  end
end