whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [whimsy] branch master updated: use safe_load where possible
Date Wed, 21 Oct 2020 13:59:29 GMT
This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new e8fcae2  use safe_load where possible
e8fcae2 is described below

commit e8fcae2f8a31e214b55fbfc11cf724630b55f917
Author: Sebb <sebb@apache.org>
AuthorDate: Wed Oct 21 14:57:59 2020 +0100

    use safe_load where possible
---
 lib/whimsy/asf/ldap.rb                  | 2 +-
 lib/whimsy/asf/orgchart.rb              | 4 ++--
 tools/comdevtalks.rb                    | 4 ++--
 www/board/agenda/spec/secretary_spec.rb | 2 +-
 www/roster/models/orgchart.rb           | 4 ++--
 www/test/example.cgi                    | 2 +-
 6 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/lib/whimsy/asf/ldap.rb b/lib/whimsy/asf/ldap.rb
index 01ea382..d627a95 100644
--- a/lib/whimsy/asf/ldap.rb
+++ b/lib/whimsy/asf/ldap.rb
@@ -66,7 +66,7 @@ module ASF
       # the enclosing method is optional, so we only require the gem here
       require 'yaml'
       require_relative 'git' # just in case
-      @puppet = YAML.load(ASF::Git.infra_puppet('data/common.yaml'))
+      @puppet = YAML.safe_load(ASF::Git.infra_puppet('data/common.yaml'))
     end
 
     # extract the ldapcert from the puppet configuration
diff --git a/lib/whimsy/asf/orgchart.rb b/lib/whimsy/asf/orgchart.rb
index 7c6feba..a288532 100644
--- a/lib/whimsy/asf/orgchart.rb
+++ b/lib/whimsy/asf/orgchart.rb
@@ -18,7 +18,7 @@ module ASF # :nodoc:
         next if @@duties[name] and @@duties[name]['mtime'] > File.mtime(file).to_f
         data = Hash[*File.read(file).split(/^\[(.*)\]\n/)[1..-1].map(&:strip)]
         next unless data['info']
-        data['info'] = YAML.load(data['info'])
+        data['info'] = YAML.safe_load(data['info'])
         data['mtime'] = File.mtime(file).to_f
         @@duties[name] = data
       end
@@ -27,7 +27,7 @@ module ASF # :nodoc:
       unless @@desc['mtime'] and @@desc['mtime'] > File.mtime(file).to_f
         data = Hash[*File.read(file).split(/^\[(.*)\]\n/)[1..-1].map(&:strip)]
         if data['info'] then
-          data = YAML.load(data['info'])
+          data = YAML.safe_load(data['info'])
           data['mtime'] = File.mtime(file).to_f
           @@desc = data
         end
diff --git a/tools/comdevtalks.rb b/tools/comdevtalks.rb
index ff73afa..edf5feb 100644
--- a/tools/comdevtalks.rb
+++ b/tools/comdevtalks.rb
@@ -18,9 +18,9 @@ def parse_talks(dir = "#{COMDEVDIR}")
   Dir[File.join("#{dir}", "*.yaml")].each do |fname|
     begin
       if fname =~ /_/
-        talks["#{File.basename(fname, ".*")}"] = YAML.load(File.read(fname))
+        talks["#{File.basename(fname, ".*")}"] = YAML.safe_load(File.read(fname))
       elsif fname !~ /SKIPFILE/
-        submitters["#{File.basename(fname, ".*")}"] = YAML.load(File.read(fname))
+        submitters["#{File.basename(fname, ".*")}"] = YAML.safe_load(File.read(fname))
       end
     rescue Exception => e
       puts "Bogosity! analyzing #{fname} raised #{e.message[0..255]}"
diff --git a/www/board/agenda/spec/secretary_spec.rb b/www/board/agenda/spec/secretary_spec.rb
index e6a1d2e..764396c 100644
--- a/www/board/agenda/spec/secretary_spec.rb
+++ b/www/board/agenda/spec/secretary_spec.rb
@@ -113,7 +113,7 @@ feature 'report' do
     file = "#{AGENDA_WORK}/board_minutes_#{meeting.gsub('-', '_')}.yml"
     minutes = IO.read(file)
     timestamp = Time.now.gmtime.to_f * 1000
-    IO.write file, YAML.dump(YAML.load(minutes).
+    IO.write file, YAML.dump(YAML.safe_load(minutes).
       merge('complete' => timestamp, 'Adjournment' => '11:45'))
     yield
   ensure
diff --git a/www/roster/models/orgchart.rb b/www/roster/models/orgchart.rb
index 8e9867b..2f37e83 100644
--- a/www/roster/models/orgchart.rb
+++ b/www/roster/models/orgchart.rb
@@ -10,7 +10,7 @@ class OrgChart
       next if @@duties[name] and @@duties[name]['mtime'] > File.mtime(file).to_f
       data = Hash[*File.read(file).split(/^\[(.*)\]\n/)[1..-1].map(&:strip)]
       next unless data['info']
-      data['info'] = YAML.load(data['info'])
+      data['info'] = YAML.safe_load(data['info'])
       data['mtime'] = File.mtime(file).to_f
       @@duties[name] = data
     end
@@ -19,7 +19,7 @@ class OrgChart
     unless @@desc['mtime'] and @@desc['mtime'] > File.mtime(file).to_f
       data = Hash[*File.read(file).split(/^\[(.*)\]\n/)[1..-1].map(&:strip)]
       if data['info'] then
-        data = YAML.load(data['info'])
+        data = YAML.safe_load(data['info'])
         data['mtime'] = File.mtime(file).to_f
         @@desc = data
       end
diff --git a/www/test/example.cgi b/www/test/example.cgi
index 242a73b..9593fd8 100755
--- a/www/test/example.cgi
+++ b/www/test/example.cgi
@@ -23,7 +23,7 @@ end
 def get_svn_data()
   dir = ASF::SVN['comdevtalks']
   filename = 'README.yaml'
-  data = YAML.load(File.read(File.join(dir, filename)))
+  data = YAML.safe_load(File.read(File.join(dir, filename)))
   return data['title']
 end
 


Mime
View raw message