20300: Call safe_load explicitly instead of using safe_yaml gem.
[arvados.git] / services / api / script / arvados-git-sync.rb
index 3a8ed2724f236b9966f0f9e64d625e11db36486f..ceebc3518a08d22586a4f6ee2b184f1d90744253 100755 (executable)
@@ -1,4 +1,7 @@
 #!/usr/bin/env ruby
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
 
 require 'rubygems'
 require 'pp'
@@ -9,7 +12,7 @@ require 'fileutils'
 
 # This script does the actual gitolite config management on disk.
 #
-# Ward Vandewege <ward@curoverse.com>
+# Ward Vandewege <ward@curii.com>
 
 # Default is development
 production = ARGV[0] == "production"
@@ -22,8 +25,8 @@ DEBUG = 1
 # load and merge in the environment-specific application config info
 # if present, overriding base config parameters as specified
 path = File.absolute_path('../../config/arvados-clients.yml', __FILE__)
-if File.exists?(path) then
-  cp_config = YAML.load_file(path)[ENV['RAILS_ENV']]
+if File.exist?(path) then
+  cp_config = YAML.safe_load_file(path)[ENV['RAILS_ENV']]
 else
   puts "Please create a\n #{path}\n file"
   exit 1
@@ -214,7 +217,7 @@ end
 
 begin
   # Get our local gitolite-admin repo up to snuff
-  if not File.exists?(gitolite_admin) then
+  if not File.exist?(gitolite_admin) then
     ensure_directory(gitolite_tmpdir, 0700)
     Dir.chdir(gitolite_tmpdir)
     `git clone #{gitolite_url}`