ruby-changes:66304
From: aycabta <ko1@a...>
Date: Sat, 22 May 2021 21:45:03 +0900 (JST)
Subject: [ruby-changes:66304] c264d30261 (master): Use YAML.safe_load to use the permitted_classes option
https://git.ruby-lang.org/ruby.git/commit/?id=c264d30261 From c264d30261cb7d79caddd982300a7ae002293967 Mon Sep 17 00:00:00 2001 From: aycabta <aycabta@g...> Date: Fri, 21 May 2021 21:45:03 +0900 Subject: Use YAML.safe_load to use the permitted_classes option --- lib/rdoc/rdoc.rb | 2 +- test/rdoc/test_rdoc_options.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/rdoc/rdoc.rb b/lib/rdoc/rdoc.rb index 904625f..3a3defa 100644 --- a/lib/rdoc/rdoc.rb +++ b/lib/rdoc/rdoc.rb @@ -162,7 +162,7 @@ class RDoc::RDoc https://github.com/ruby/ruby/blob/trunk/lib/rdoc/rdoc.rb#L162 RDoc.load_yaml begin - options = YAML.load_file '.rdoc_options', permitted_classes: [RDoc::Options, Symbol] + options = YAML.safe_load File.read('.rdoc_options'), permitted_classes: [RDoc::Options, Symbol] rescue Psych::SyntaxError raise RDoc::Error, "#{options_file} is not a valid rdoc options file" end diff --git a/test/rdoc/test_rdoc_options.rb b/test/rdoc/test_rdoc_options.rb index 2534c52..f547f5b 100644 --- a/test/rdoc/test_rdoc_options.rb +++ b/test/rdoc/test_rdoc_options.rb @@ -145,7 +145,7 @@ class TestRDocOptions < RDoc::TestCase https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_options.rb#L145 @options.encoding = Encoding::IBM437 - options = YAML.load(YAML.dump(@options), permitted_classes: [RDoc::Options, Symbol]) + options = YAML.safe_load(YAML.dump(@options), permitted_classes: [RDoc::Options, Symbol]) assert_equal Encoding::IBM437, options.encoding end @@ -161,7 +161,7 @@ rdoc_include: https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_options.rb#L161 - /etc YAML - options = YAML.load(yaml, permitted_classes: [RDoc::Options, Symbol]) + options = YAML.safe_load(yaml, permitted_classes: [RDoc::Options, Symbol]) assert_empty options.rdoc_include assert_empty options.static_path @@ -749,7 +749,7 @@ rdoc_include: https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_options.rb#L749 assert File.exist? '.rdoc_options' - assert_equal @options, YAML.load(File.read('.rdoc_options'), permitted_classes: [RDoc::Options, Symbol]) + assert_equal @options, YAML.safe_load(File.read('.rdoc_options'), permitted_classes: [RDoc::Options, Symbol]) end end -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/