This file is indexed.

/usr/lib/ruby/vendor_ruby/chef_zero/endpoints/actors_endpoint.rb is in chef-zero 2.0.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
require 'json'
require 'chef_zero/endpoints/rest_list_endpoint'

module ChefZero
  module Endpoints
    # /clients or /users
    class ActorsEndpoint < RestListEndpoint
      def post(request)
        # First, find out if the user actually posted a public key.  If not, make
        # one.
        request_body = JSON.parse(request.body, :create_additions => false)
        public_key = request_body['public_key']
        if !public_key
          private_key, public_key = server.gen_key_pair
          request_body['public_key'] = public_key
          request.body = JSON.pretty_generate(request_body)
        end

        result = super(request)
        if result[0] == 201
          # If we generated a key, stuff it in the response.
          response = JSON.parse(result[2], :create_additions => false)
          response['private_key'] = private_key if private_key
          response['public_key'] = public_key
          json_response(201, response)
        else
          result
        end
      end
    end
  end
end