diff --git a/lib/rubygems/commands/owner_command.rb b/lib/rubygems/commands/owner_command.rb index 8e2271657a95..637b5bdc4dfe 100644 --- a/lib/rubygems/commands/owner_command.rb +++ b/lib/rubygems/commands/owner_command.rb @@ -64,7 +64,7 @@ def show_owners name end with_response response do |resp| - owners = YAML.load resp.body + owners = Gem::SafeYAML.load resp.body say "Owners for gem: #{name}" owners.each do |owner| diff --git a/test/rubygems/test_gem_commands_owner_command.rb b/test/rubygems/test_gem_commands_owner_command.rb index 44652c10938b..05230772d995 100644 --- a/test/rubygems/test_gem_commands_owner_command.rb +++ b/test/rubygems/test_gem_commands_owner_command.rb @@ -2,6 +2,9 @@ require 'rubygems/test_case' require 'rubygems/commands/owner_command' +class Foo +end + class TestGemCommandsOwnerCommand < Gem::TestCase def setup @@ -43,6 +46,31 @@ def test_show_owners assert_match %r{- 4}, @ui.output end + def test_show_owners_dont_load_objects + skip "testing a psych-only API" unless defined?(::Psych::DisallowedClass) + + response = <