1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/rubygems: Update to RubyGems master dcce4ff. Important changes

in this commit:

  Remove automatic detection of gem dependencies files.  This prevents a
  security hole as described in [ruby-core:58490]

  Fixed bugs for installing git gems.

* test/rubygems:  ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43806 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
drbrain 2013-11-22 18:53:21 +00:00
parent 0a5fc9c35f
commit e8e18cff7a
8 changed files with 57 additions and 9 deletions

View file

@ -1,3 +1,15 @@
Sat Nov 23 03:44:03 2013 Eric Hodel <drbrain@segment7.net>
* lib/rubygems: Update to RubyGems master dcce4ff. Important changes
in this commit:
Remove automatic detection of gem dependencies files. This prevents a
security hole as described in [ruby-core:58490]
Fixed bugs for installing git gems.
* test/rubygems: ditto.
Fri Nov 22 22:30:00 2013 Kenta Murata <mrkn@mrkn.jp> Fri Nov 22 22:30:00 2013 Kenta Murata <mrkn@mrkn.jp>
* ext/bigdecimal/bigdecimal.c (BigDecimal_power): * ext/bigdecimal/bigdecimal.c (BigDecimal_power):

View file

@ -8,7 +8,7 @@
require 'rbconfig' require 'rbconfig'
module Gem module Gem
VERSION = '2.2.0.preview.2' VERSION = '2.2.0'
end end
# Must be first since it unloads the prelude from 1.9.2 # Must be first since it unloads the prelude from 1.9.2
@ -995,12 +995,16 @@ module Gem
# Looks for gem dependency files (gem.deps.rb, Gemfile, Isolate) from the # Looks for gem dependency files (gem.deps.rb, Gemfile, Isolate) from the
# current directory up and activates the gems in the first file found. # current directory up and activates the gems in the first file found.
# #
# This is run automatically when rubygems starts. To disable, set # You can run this automatically when rubygems starts. To enable, set
# the <code>RUBYGEMS_GEMDEPS=</code> environment variable to an empty # the <code>RUBYGEMS_GEMDEPS</code> environment variable to either the path
# string. # of your Gemfile or "-" to auto-discover in parent directories.
#
# NOTE: Enabling automatic discovery on multiuser systems can lead to
# execution of arbitrary code when used from directories outside your
# control.
def self.use_gemdeps def self.use_gemdeps
return unless path = ENV['RUBYGEMS_GEMDEPS'] || '-' return unless path = ENV['RUBYGEMS_GEMDEPS']
path = path.dup.untaint path = path.dup.untaint
if path == "-" if path == "-"

View file

@ -23,9 +23,9 @@ class Gem::Resolver::ComposedSet < Gem::Resolver::Set
# Finds all specs matching +req+ in all sets. # Finds all specs matching +req+ in all sets.
def find_all req def find_all req
res = [] @sets.map do |s|
@sets.each { |s| res += s.find_all(req) } s.find_all req
res end.flatten
end end
## ##

View file

@ -120,6 +120,12 @@ class Gem::Source::Git < Gem::Source
rev_parse[0..11] rev_parse[0..11]
end end
##
# Nothing to download for git gems
def download full_spec, path # :nodoc:
end
## ##
# The directory where the git gem will be installed. # The directory where the git gem will be installed.

View file

@ -2177,7 +2177,7 @@ class Gem::Specification < Gem::BasicSpecification
# Used by Gem::Resolver to order Gem::Specification objects # Used by Gem::Resolver to order Gem::Specification objects
def source # :nodoc: def source # :nodoc:
self Gem::Source::Installed.new
end end
## ##

View file

@ -1258,6 +1258,24 @@ class TestGem < Gem::TestCase
Gem.use_gemdeps Gem.use_gemdeps
refute spec.activated?
ensure
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
end
def test_use_gemdeps_automatic
rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], '-'
spec = util_spec 'a', 1
refute spec.activated?
open 'Gemfile', 'w' do |io|
io.write 'gem "a"'
end
Gem.use_gemdeps
assert spec.activated? assert spec.activated?
ensure ensure
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps

View file

@ -51,6 +51,10 @@ class TestGemSourceGit < Gem::TestCase
assert_equal @head[0..11], @source.dir_shortref assert_equal @head[0..11], @source.dir_shortref
end end
def test_download
refute @source.download nil, nil
end
def test_equals2 def test_equals2
assert_equal @source, @source assert_equal @source, @source

View file

@ -1738,6 +1738,10 @@ dependencies: []
RbConfig::CONFIG['ENABLE_SHARED'] = enable_shared RbConfig::CONFIG['ENABLE_SHARED'] = enable_shared
end end
def test_source
assert_kind_of Gem::Source::Installed, @a1.source
end
def test_full_require_paths def test_full_require_paths
ext_spec ext_spec