This file is indexed.

/usr/lib/ruby/vendor_ruby/chef_zero/endpoints/cookbook_artifacts_endpoint.rb is in chef-zero 4.5.0-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
require 'chef_zero/chef_data/data_normalizer'

module ChefZero
  module Endpoints
    class CookbookArtifactsEndpoint < RestBase
      # GET /organizations/ORG/cookbook_artifacts
      def get(request)
        data = {}

        artifacts = begin
          list_data(request)
        rescue Exception => e
          if e.response_code == 404
            return already_json_response(200, "{}")
          end
        end

        artifacts.each do |cookbook_artifact|
          cookbook_url = build_uri(request.base_uri, request.rest_path + [cookbook_artifact])

          versions = []
          list_data(request, request.rest_path + [cookbook_artifact]).each do |identifier|
            artifact_url = build_uri(request.base_uri, request.rest_path + [cookbook_artifact, identifier])
            versions << { url: artifact_url, identifier: identifier }
          end

          data[cookbook_artifact] = { url: cookbook_url, versions: versions }
        end

        return json_response(200, data)
      end
    end
  end
end