ruby-changes:18881
From: yugui <ko1@a...>
Date: Fri, 18 Feb 2011 20:59:40 +0900 (JST)
Subject: [ruby-changes:18881] Ruby:r30906 (ruby_1_9_1): merges r30896 from trunk into ruby_1_9_1.
yugui 2011-02-18 20:59:29 +0900 (Fri, 18 Feb 2011) New Revision: 30906 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=30906 Log: merges r30896 from trunk into ruby_1_9_1. -- * lib/fileutils.rb (FileUtils::remove_entry_secure): there is a race condition in the case where the given path is a directory, and some other user can move that directory, and create a symlink while this method is executing. Reported by: Nicholas Jefferson <nicholas at pythonic.com.au> Modified files: branches/ruby_1_9_1/ChangeLog branches/ruby_1_9_1/lib/fileutils.rb branches/ruby_1_9_1/version.h Index: ruby_1_9_1/ChangeLog =================================================================== --- ruby_1_9_1/ChangeLog (revision 30905) +++ ruby_1_9_1/ChangeLog (revision 30906) @@ -1,3 +1,11 @@ +Fri Feb 18 19:31:31 2011 Shugo Maeda <shugo@r...> + + * lib/fileutils.rb (FileUtils::remove_entry_secure): there is a + race condition in the case where the given path is a directory, + and some other user can move that directory, and create a + symlink while this method is executing. + Reported by: Nicholas Jefferson <nicholas at pythonic.com.au> + Sun Aug 15 19:59:58 2010 Yuki Sonoda (Yugui) <yugui@y...> * lib/webrick/httpresponse.rb (WEBrick::HTTPResponse#set_error): Index: ruby_1_9_1/lib/fileutils.rb =================================================================== --- ruby_1_9_1/lib/fileutils.rb (revision 30905) +++ ruby_1_9_1/lib/fileutils.rb (revision 30906) @@ -665,10 +665,10 @@ # removing directories. This requires the current process is the # owner of the removing whole directory tree, or is the super user (root). # - # WARNING: You must ensure that *ALL* parent directories are not - # world writable. Otherwise this method does not work. - # Only exception is temporary directory like /tmp and /var/tmp, - # whose permission is 1777. + # WARNING: You must ensure that *ALL* parent directories cannot be + # moved by other untrusted users. For example, parent directories + # should not be owned by untrusted users, and should not be world + # writable except when the sticky bit set. # # WARNING: Only the owner of the removing directory tree, or Unix super # user (root) should invoke this method. Otherwise this method does not @@ -711,6 +711,11 @@ end f.chown euid, -1 f.chmod 0700 + unless fu_stat_identical_entry?(st, File.lstat(fullpath)) + # TOC-to-TOU attack? + File.unlink fullpath + return + end } # ---- tree root is frozen ---- root = Entry_.new(path) Index: ruby_1_9_1/version.h =================================================================== --- ruby_1_9_1/version.h (revision 30905) +++ ruby_1_9_1/version.h (revision 30906) @@ -1,13 +1,13 @@ #define RUBY_VERSION "1.9.1" -#define RUBY_PATCHLEVEL 430 +#define RUBY_PATCHLEVEL 431 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 9 #define RUBY_VERSION_TEENY 1 -#define RUBY_RELEASE_YEAR 2010 -#define RUBY_RELEASE_MONTH 8 -#define RUBY_RELEASE_DAY 16 -#define RUBY_RELEASE_DATE "2010-08-16" +#define RUBY_RELEASE_YEAR 2011 +#define RUBY_RELEASE_MONTH 2 +#define RUBY_RELEASE_DAY 18 +#define RUBY_RELEASE_DATE "2011-02-18" #ifdef RUBY_EXTERN RUBY_EXTERN const char ruby_version[]; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/