This file is indexed.

/usr/lib/ruby/vendor_ruby/octocatalog-diff/catalog/json.rb is in octocatalog-diff 1.5.3-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
33
34
35
36
37
38
39
40
41
42
43
# frozen_string_literal: true

require_relative '../catalog'
require_relative '../catalog-util/fileresources'

require 'json'

module OctocatalogDiff
  class Catalog
    # Represents a Puppet catalog that is read in directly from a JSON file.
    class JSON < OctocatalogDiff::Catalog
      # Constructor
      # @param :json [String] REQUIRED: Content of catalog, will be parsed as JSON
      # @param :node [String] Node name (if not supplied, will be determined from catalog)
      def initialize(options)
        super

        unless options[:json].is_a?(String)
          raise ArgumentError, "Must supply :json as string in options: #{options[:json].class}"
        end

        @catalog_json = options.fetch(:json)
        begin
          @catalog = ::JSON.parse(@catalog_json)
          @error_message = nil
          @node ||= @catalog['name'] if @catalog.key?('name') # Puppet 4.x
          @node ||= @catalog['data']['name'] if @catalog.key?('data') && @catalog['data'].is_a?(Hash) # Puppet 3.x
        rescue ::JSON::ParserError => exc
          @error_message = "Catalog JSON input failed to parse: #{exc.message}"
          @catalog = nil
          @catalog_json = nil
        end
      end

      # Convert file resources source => "puppet:///..." to content => "actual content of file".
      def convert_file_resources(dry_run = false)
        return @options.key?(:basedir) if dry_run
        return false unless @options[:basedir]
        OctocatalogDiff::CatalogUtil::FileResources.convert_file_resources(self, environment)
      end
    end
  end
end