rubygems-update 1.8.9 → 1.8.10

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rubygems-update might be problematic. Click here for more details.

data.tar.gz.sig CHANGED
Binary file
@@ -1,5 +1,22 @@
1
1
  # coding: UTF-8
2
2
 
3
+ === 1.8.10 / 2011-08-25
4
+
5
+ RubyGems 1.8.10 contains a security fix that prevents malicious gems from
6
+ executing code when their specification is loaded. See
7
+ https://github.com/rubygems/rubygems/pull/165 for details.
8
+
9
+ * 5 bug fixes:
10
+
11
+ * RubyGems escapes strings in ruby-format specs using #dump instead of #to_s
12
+ and %q to prevent code injection. Issue #165 by Postmodern
13
+ * RubyGems attempt to activate the psych gem now to obtain bugfixes from
14
+ psych.
15
+ * Gem.dir has been restored to the front of Gem.path. Fixes remaining
16
+ problem with Issue #115
17
+ * Fixed Syck DefaultKey infecting ruby-format specifications.
18
+ * `gem uninstall a b` no longer stops if gem "a" is not installed.
19
+
3
20
  === 1.8.9 / 2011-08-23
4
21
 
5
22
  * Bug fixes:
@@ -118,7 +118,7 @@ require "rubygems/deprecate"
118
118
  # -The RubyGems Team
119
119
 
120
120
  module Gem
121
- VERSION = '1.8.9'
121
+ VERSION = '1.8.10'
122
122
 
123
123
  ##
124
124
  # Raised when RubyGems is unable to load or activate a gem. Contains the
@@ -644,7 +644,15 @@ module Gem
644
644
 
645
645
  def self.load_yaml
646
646
  begin
647
- require 'psych'
647
+ gem 'psych', '~> 1.2', '>= 1.2.1' unless ENV['TEST_SYCK']
648
+ rescue Gem::LoadError
649
+ # It's OK if the user does not have the psych gem installed. We will
650
+ # attempt to require the stdlib version
651
+ end
652
+
653
+ begin
654
+ # Try requiring the gem version *or* stdlib version of psych.
655
+ require 'psych' unless ENV['TEST_SYCK']
648
656
  rescue ::LoadError
649
657
  ensure
650
658
  require 'yaml'
@@ -78,6 +78,8 @@ class Gem::Commands::UninstallCommand < Gem::Command
78
78
  get_all_gem_names.each do |gem_name|
79
79
  begin
80
80
  Gem::Uninstaller.new(gem_name, options).uninstall
81
+ rescue Gem::InstallError => e
82
+ alert e.message
81
83
  rescue Gem::GemNotInHomeException => e
82
84
  spec = e.spec
83
85
  alert("In order to remove #{spec.name}, please execute:\n" \
@@ -1,5 +1,4 @@
1
1
  ##
2
- #
3
2
  # Gem::PathSupport facilitates the GEM_HOME and GEM_PATH environment settings
4
3
  # to the rest of RubyGems.
5
4
  #
@@ -43,18 +42,16 @@ class Gem::PathSupport
43
42
  # Set the Gem search path (as reported by Gem.path).
44
43
 
45
44
  def path=(gpaths)
46
- # FIX: it should be [home, *path], not [*path, home]
47
-
48
- gem_path = []
45
+ gem_path = [@home]
49
46
 
50
47
  # FIX: I can't tell wtf this is doing.
51
48
  gpaths ||= (ENV['GEM_PATH'] || "").empty? ? nil : ENV["GEM_PATH"]
52
49
 
53
- if gpaths
54
- if gpaths.kind_of?(Array)
55
- gem_path = gpaths.dup
50
+ if gpaths then
51
+ if gpaths.kind_of?(Array) then
52
+ gem_path.push(*gpaths)
56
53
  else
57
- gem_path = gpaths.split(File::PATH_SEPARATOR)
54
+ gem_path.push(*gpaths.split(File::PATH_SEPARATOR))
58
55
  end
59
56
 
60
57
  if File::ALT_SEPARATOR then
@@ -62,14 +59,10 @@ class Gem::PathSupport
62
59
  this_path.gsub File::ALT_SEPARATOR, File::SEPARATOR
63
60
  end
64
61
  end
65
-
66
- gem_path << @home
67
62
  else
68
- gem_path = Gem.default_path + [@home]
63
+ gem_path.push(*Gem.default_path)
69
64
 
70
- if defined?(APPLE_GEM_HOME)
71
- gem_path << APPLE_GEM_HOME
72
- end
65
+ gem_path << APPLE_GEM_HOME if defined?(APPLE_GEM_HOME)
73
66
  end
74
67
 
75
68
  @path = gem_path.uniq
@@ -16,6 +16,9 @@ module YAML
16
16
  if !defined? Syck
17
17
  module Syck
18
18
  class DefaultKey
19
+ def to_s
20
+ '='
21
+ end
19
22
  end
20
23
  end
21
24
  end
@@ -1459,7 +1459,7 @@ class Gem::Specification
1459
1459
  # TODO: do we need these?? Kill it
1460
1460
  glob = File.join(self.lib_dirs_glob, glob)
1461
1461
 
1462
- Dir[glob].map { |f| f.untaint } # FIX our tests are brokey, run w/ SAFE=1
1462
+ Dir[glob].map { |f| f.untaint } # FIX our tests are broken, run w/ SAFE=1
1463
1463
  end
1464
1464
 
1465
1465
  ##
@@ -1690,11 +1690,11 @@ class Gem::Specification
1690
1690
 
1691
1691
  def ruby_code(obj)
1692
1692
  case obj
1693
- when String then '%q{' + obj + '}'
1693
+ when String then obj.dump
1694
1694
  when Array then '[' + obj.map { |x| ruby_code x }.join(", ") + ']'
1695
- when Gem::Version then obj.to_s.inspect
1696
- when Date then '%q{' + obj.strftime('%Y-%m-%d') + '}'
1697
- when Time then '%q{' + obj.strftime('%Y-%m-%d') + '}'
1695
+ when Gem::Version then obj.to_s.dump
1696
+ when Date then obj.strftime('%Y-%m-%d').dump
1697
+ when Time then obj.strftime('%Y-%m-%d').dump
1698
1698
  when Numeric then obj.inspect
1699
1699
  when true, false, nil then obj.inspect
1700
1700
  when Gem::Platform then "Gem::Platform.new(#{obj.to_a.inspect})"
@@ -733,7 +733,7 @@ class TestGem < Gem::TestCase
733
733
 
734
734
  Gem.instance_variable_set :@paths, nil
735
735
 
736
- assert_equal [Gem.default_path, Gem.dir].flatten.uniq, Gem.path
736
+ assert_equal [Gem.dir, *Gem.default_path].uniq, Gem.path
737
737
  ensure
738
738
  Object.const_set :APPLE_GEM_HOME, orig_APPLE_GEM_HOME if orig_APPLE_GEM_HOME
739
739
  end
@@ -772,11 +772,10 @@ class TestGem < Gem::TestCase
772
772
 
773
773
  ENV['GEM_PATH'] = @additional.join(File::PATH_SEPARATOR)
774
774
 
775
- assert_equal @additional, Gem.path[0,2]
775
+ assert_equal [Gem.dir, *@additional], Gem.path
776
776
 
777
777
  assert_equal path_count + @additional.size, Gem.path.size,
778
778
  "extra path components: #{Gem.path[2..-1].inspect}"
779
- assert_equal Gem.dir, Gem.path.last
780
779
  end
781
780
 
782
781
  def test_self_path_duplicate
@@ -789,8 +788,7 @@ class TestGem < Gem::TestCase
789
788
 
790
789
  assert_equal @gemhome, Gem.dir
791
790
 
792
- paths = [Gem.dir]
793
- assert_equal @additional + paths, Gem.path
791
+ assert_equal [Gem.dir, *@additional], Gem.path
794
792
  end
795
793
 
796
794
  def test_self_path_overlap
@@ -802,8 +800,7 @@ class TestGem < Gem::TestCase
802
800
 
803
801
  assert_equal @gemhome, Gem.dir
804
802
 
805
- paths = [Gem.dir]
806
- assert_equal @additional + paths, Gem.path
803
+ assert_equal [Gem.dir, *@additional], Gem.path
807
804
  end
808
805
 
809
806
  def test_self_platforms
@@ -923,7 +920,7 @@ class TestGem < Gem::TestCase
923
920
  ENV["GEM_HOME"] = @gemhome
924
921
  Gem.paths = { "GEM_PATH" => path }
925
922
 
926
- assert_equal [@userhome, other, @gemhome], Gem.path
923
+ assert_equal [@gemhome, @userhome, other], Gem.path
927
924
  end
928
925
 
929
926
  def test_self_paths_eq_nonexistent_home
@@ -936,7 +933,7 @@ class TestGem < Gem::TestCase
936
933
 
937
934
  Gem.paths = { "GEM_PATH" => other }
938
935
 
939
- assert_equal [other, @gemhome], Gem.path
936
+ assert_equal [@gemhome, other], Gem.path
940
937
  end
941
938
 
942
939
  def test_self_source_index
@@ -983,7 +980,7 @@ class TestGem < Gem::TestCase
983
980
  Gem.use_paths @gemhome, @additional
984
981
 
985
982
  assert_equal @gemhome, Gem.dir
986
- assert_equal @additional + [Gem.dir], Gem.path
983
+ assert_equal [Gem.dir, *@additional], Gem.path
987
984
  end
988
985
 
989
986
  def test_self_user_dir
@@ -135,7 +135,7 @@ class TestGemCommandsSpecificationCommand < Gem::TestCase
135
135
  end
136
136
 
137
137
  assert_match %r|Gem::Specification.new|, @ui.output
138
- assert_match %r|s.name = %q\{foo\}|, @ui.output
138
+ assert_match %r|s.name = "foo"|, @ui.output
139
139
  assert_equal '', @ui.error
140
140
  end
141
141
 
@@ -45,6 +45,19 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase
45
45
  assert_includes output, "Successfully uninstalled #{@other.full_name}"
46
46
  end
47
47
 
48
+ def test_execute_mulitple_nonexistent
49
+ @cmd.options[:args] = %w[x y]
50
+
51
+ use_ui @ui do
52
+ @cmd.execute
53
+ end
54
+
55
+ output = @ui.output.split "\n"
56
+
57
+ assert_includes output, 'INFO: gem "x" is not installed'
58
+ assert_includes output, 'INFO: gem "y" is not installed'
59
+ end
60
+
48
61
  def test_execute_removes_executable
49
62
  ui = Gem::MockGemUi.new
50
63
  util_setup_gem ui
@@ -25,7 +25,7 @@ class TestGemGemRunner < Gem::TestCase
25
25
  gr = Gem::GemRunner.new
26
26
  gr.send :do_configuration, %W[--config-file #{temp_conf}]
27
27
 
28
- assert_equal [other_gem_path, other_gem_home], Gem.path
28
+ assert_equal [other_gem_home, other_gem_path], Gem.path
29
29
  assert_equal %w[--commands], Gem::Command.extra_args
30
30
  assert_equal %w[--all], Gem::DocManager.configured_args
31
31
  end
@@ -22,10 +22,10 @@ class TestGemPathSupport < Gem::TestCase
22
22
  def test_initialize_home
23
23
  ps = Gem::PathSupport.new "GEM_HOME" => "#{@tempdir}/foo"
24
24
 
25
- assert_equal File.join(@tempdir, "foo"), ps.home
25
+ expected = File.join(@tempdir, "foo")
26
+ assert_equal expected, ps.home
26
27
 
27
- expected = util_path + [File.join(@tempdir, 'foo')]
28
- assert_equal expected, ps.path
28
+ assert_equal [expected, *util_path], ps.path
29
29
  end
30
30
 
31
31
  if defined?(File::ALT_SEPARATOR) and File::ALT_SEPARATOR
@@ -43,9 +43,9 @@ class TestGemPathSupport < Gem::TestCase
43
43
  assert_equal ENV["GEM_HOME"], ps.home
44
44
 
45
45
  expected = [
46
+ ENV["GEM_HOME"],
46
47
  File.join(@tempdir, 'foo'),
47
48
  File.join(@tempdir, 'bar'),
48
- ENV["GEM_HOME"],
49
49
  ]
50
50
 
51
51
  assert_equal expected, ps.path
@@ -61,6 +61,32 @@ class TestGemPathSupport < Gem::TestCase
61
61
  assert_equal expected, ps.path
62
62
  end
63
63
 
64
+ def test_path_equals
65
+ ps = Gem::PathSupport.new
66
+
67
+ ps.send :path=, ['a', 'b']
68
+
69
+ assert_equal [@tempdir, 'a', 'b'], ps.path
70
+ end
71
+
72
+ def test_path_equals_empty
73
+ ps = Gem::PathSupport.new
74
+
75
+ ps.send :path=, nil
76
+
77
+ assert_equal [@tempdir, 'something'], ps.path
78
+ end
79
+
80
+ def test_path_equals_empty_no_GEM_PATH
81
+ ENV.delete 'GEM_PATH'
82
+
83
+ ps = Gem::PathSupport.new
84
+
85
+ ps.send :path=, nil
86
+
87
+ assert_equal [@tempdir, *Gem.default_path], ps.path
88
+ end
89
+
64
90
  def util_path
65
91
  ENV["GEM_PATH"].split(File::PATH_SEPARATOR)
66
92
  end
@@ -114,7 +114,7 @@ end
114
114
  assert_equal @current_version, new_spec.specification_version
115
115
  end
116
116
 
117
- def test_self_from_yaml_syck_bug
117
+ def test_self_from_yaml_syck_date_bug
118
118
  # This is equivalent to (and totally valid) psych 1.0 output and
119
119
  # causes parse errors on syck.
120
120
  yaml = @a1.to_yaml
@@ -128,6 +128,41 @@ end
128
128
  assert_kind_of Time, new_spec.date
129
129
  end
130
130
 
131
+ def test_self_from_yaml_syck_default_key_bug
132
+ skip 'syck default_key bug is only for ruby 1.8' unless RUBY_VERSION < '1.9'
133
+ # This is equivalent to (and totally valid) psych 1.0 output and
134
+ # causes parse errors on syck.
135
+ yaml = <<-YAML
136
+ --- !ruby/object:Gem::Specification
137
+ name: posix-spawn
138
+ version: !ruby/object:Gem::Version
139
+ version: 0.3.6
140
+ prerelease:
141
+ dependencies:
142
+ - !ruby/object:Gem::Dependency
143
+ name: rake-compiler
144
+ requirement: &70243867725240 !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - =
148
+ - !ruby/object:Gem::Version
149
+ version: 0.7.6
150
+ type: :development
151
+ prerelease: false
152
+ version_requirements: *70243867725240
153
+ platform: ruby
154
+ files: []
155
+ test_files: []
156
+ bindir:
157
+ YAML
158
+
159
+ new_spec = with_syck do
160
+ Gem::Specification.from_yaml yaml
161
+ end
162
+
163
+ refute_match %r%DefaultKey%, new_spec.to_ruby
164
+ end
165
+
131
166
  def test_self_load
132
167
  full_path = @a2.spec_file
133
168
  write_file full_path do |io|
@@ -141,6 +176,51 @@ end
141
176
  assert_equal @a2, spec
142
177
  end
143
178
 
179
+ def test_self_load_escape_curly
180
+ @a2.name = 'a};raise "improper escaping";%q{'
181
+
182
+ full_path = @a2.spec_file
183
+ write_file full_path do |io|
184
+ io.write @a2.to_ruby_for_cache
185
+ end
186
+
187
+ spec = Gem::Specification.load full_path
188
+
189
+ @a2.files.clear
190
+
191
+ assert_equal @a2, spec
192
+ end
193
+
194
+ def test_self_load_escape_interpolation
195
+ @a2.name = 'a#{raise %<improper escaping>}'
196
+
197
+ full_path = @a2.spec_file
198
+ write_file full_path do |io|
199
+ io.write @a2.to_ruby_for_cache
200
+ end
201
+
202
+ spec = Gem::Specification.load full_path
203
+
204
+ @a2.files.clear
205
+
206
+ assert_equal @a2, spec
207
+ end
208
+
209
+ def test_self_load_escape_quote
210
+ @a2.name = 'a";raise "improper escaping";"'
211
+
212
+ full_path = @a2.spec_file
213
+ write_file full_path do |io|
214
+ io.write @a2.to_ruby_for_cache
215
+ end
216
+
217
+ spec = Gem::Specification.load full_path
218
+
219
+ @a2.files.clear
220
+
221
+ assert_equal @a2, spec
222
+ end
223
+
144
224
  def test_self_load_legacy_ruby
145
225
  spec = Deprecate.skip_during do
146
226
  eval LEGACY_RUBY_SPEC
@@ -754,19 +834,19 @@ end
754
834
  # -*- encoding: utf-8 -*-
755
835
 
756
836
  Gem::Specification.new do |s|
757
- s.name = %q{a}
758
- s.version = \"2\"
837
+ s.name = "a"
838
+ s.version = "2"
759
839
 
760
840
  s.required_rubygems_version = Gem::Requirement.new(\"> 0\") if s.respond_to? :required_rubygems_version=
761
- s.authors = [%q{A User}]
762
- s.date = %q{#{Gem::Specification::TODAY.strftime "%Y-%m-%d"}}
763
- s.description = %q{This is a test description}
764
- s.email = %q{example@example.com}
765
- s.files = [%q{lib/code.rb}]
766
- s.homepage = %q{http://example.com}
767
- s.require_paths = [%q{lib}]
768
- s.rubygems_version = %q{#{Gem::VERSION}}
769
- s.summary = %q{this is a summary}
841
+ s.authors = ["A User"]
842
+ s.date = "#{Gem::Specification::TODAY.strftime "%Y-%m-%d"}"
843
+ s.description = "This is a test description"
844
+ s.email = "example@example.com"
845
+ s.files = ["lib/code.rb"]
846
+ s.homepage = "http://example.com"
847
+ s.require_paths = ["lib"]
848
+ s.rubygems_version = "#{Gem::VERSION}"
849
+ s.summary = "this is a summary"
770
850
 
771
851
  if s.respond_to? :specification_version then
772
852
  s.specification_version = #{Gem::Specification::CURRENT_SPECIFICATION_VERSION}
@@ -801,18 +881,18 @@ end
801
881
  # -*- encoding: utf-8 -*-
802
882
 
803
883
  Gem::Specification.new do |s|
804
- s.name = %q{a}
805
- s.version = \"2\"
884
+ s.name = "a"
885
+ s.version = "2"
806
886
 
807
887
  s.required_rubygems_version = Gem::Requirement.new(\"> 0\") if s.respond_to? :required_rubygems_version=
808
- s.authors = [%q{A User}]
809
- s.date = %q{#{Gem::Specification::TODAY.strftime "%Y-%m-%d"}}
810
- s.description = %q{This is a test description}
811
- s.email = %q{example@example.com}
812
- s.homepage = %q{http://example.com}
813
- s.require_paths = [%q{lib}]
814
- s.rubygems_version = %q{#{Gem::VERSION}}
815
- s.summary = %q{this is a summary}
888
+ s.authors = ["A User"]
889
+ s.date = "#{Gem::Specification::TODAY.strftime "%Y-%m-%d"}"
890
+ s.description = "This is a test description"
891
+ s.email = "example@example.com"
892
+ s.homepage = "http://example.com"
893
+ s.require_paths = ["lib"]
894
+ s.rubygems_version = "#{Gem::VERSION}"
895
+ s.summary = "this is a summary"
816
896
 
817
897
  if s.respond_to? :specification_version then
818
898
  s.specification_version = #{Gem::Specification::CURRENT_SPECIFICATION_VERSION}
@@ -848,26 +928,26 @@ end
848
928
  # -*- encoding: utf-8 -*-
849
929
 
850
930
  Gem::Specification.new do |s|
851
- s.name = %q{a}
852
- s.version = \"1\"
931
+ s.name = "a"
932
+ s.version = "1"
853
933
  s.platform = Gem::Platform.new(#{expected_platform})
854
934
 
855
935
  s.required_rubygems_version = Gem::Requirement.new(\">= 0\") if s.respond_to? :required_rubygems_version=
856
- s.authors = [%q{A User}]
857
- s.date = %q{#{Gem::Specification::TODAY.strftime "%Y-%m-%d"}}
858
- s.description = %q{This is a test description}
859
- s.email = %q{example@example.com}
860
- s.executables = [%q{exec}]
861
- s.extensions = [%q{ext/a/extconf.rb}]
862
- s.files = [%q{lib/code.rb}, %q{test/suite.rb}, %q{bin/exec}, %q{ext/a/extconf.rb}]
863
- s.homepage = %q{http://example.com}
864
- s.licenses = [%q{MIT}]
865
- s.require_paths = [%q{lib}]
866
- s.requirements = [%q{A working computer}]
867
- s.rubyforge_project = %q{example}
868
- s.rubygems_version = %q{#{Gem::VERSION}}
869
- s.summary = %q{this is a summary}
870
- s.test_files = [%q{test/suite.rb}]
936
+ s.authors = ["A User"]
937
+ s.date = "#{Gem::Specification::TODAY.strftime "%Y-%m-%d"}"
938
+ s.description = "This is a test description"
939
+ s.email = "example@example.com"
940
+ s.executables = ["exec"]
941
+ s.extensions = ["ext/a/extconf.rb"]
942
+ s.files = ["lib/code.rb", "test/suite.rb", "bin/exec", "ext/a/extconf.rb"]
943
+ s.homepage = "http://example.com"
944
+ s.licenses = ["MIT"]
945
+ s.require_paths = ["lib"]
946
+ s.requirements = ["A working computer"]
947
+ s.rubyforge_project = "example"
948
+ s.rubygems_version = "#{Gem::VERSION}"
949
+ s.summary = "this is a summary"
950
+ s.test_files = ["test/suite.rb"]
871
951
 
872
952
  if s.respond_to? :specification_version then
873
953
  s.specification_version = 3
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubygems-update
3
3
  version: !ruby/object:Gem::Version
4
- hash: 37
4
+ hash: 35
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 8
9
- - 9
10
- version: 1.8.9
9
+ - 10
10
+ version: 1.8.10
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jim Weirich
@@ -38,7 +38,7 @@ cert_chain:
38
38
  x52qPcexcYZR7w==
39
39
  -----END CERTIFICATE-----
40
40
 
41
- date: 2011-08-23 00:00:00 Z
41
+ date: 2011-08-27 00:00:00 Z
42
42
  dependencies:
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: minitest
@@ -404,7 +404,7 @@ post_install_message:
404
404
  rdoc_options:
405
405
  - --main
406
406
  - README.rdoc
407
- - --title=RubyGems 1.8.9 Documentation
407
+ - --title=RubyGems 1.8.10 Documentation
408
408
  require_paths:
409
409
  - hide_lib_for_update
410
410
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -430,7 +430,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
430
430
  requirements: []
431
431
 
432
432
  rubyforge_project: rubygems
433
- rubygems_version: 1.8.8
433
+ rubygems_version: 1.8.9
434
434
  signing_key:
435
435
  specification_version: 3
436
436
  summary: RubyGems is a package management framework for Ruby
metadata.gz.sig CHANGED
Binary file