Project

General

Profile

Actions

Bug #3733

closed

$SAFE==1環境下でtaintな文字列のFile.expand_path

Added by tdtds (Tadashi TADA) over 13 years ago. Updated almost 13 years ago.

Status:
Closed
Target version:
-
ruby -v:
1.9.2p0
Backport:
[ruby-dev:42089]

Description

=begin
ただただしです。

$SAFEが1な環境下で、taintな文字列をFile.expand_pathにかけると、
Insecure operationになります。1.8では発生しませんでした。

% ruby18 -ve '$SAFE=1;File.expand_path(".".taint)'
ruby 1.8.7 (2010-06-23 patchlevel 299) [i686-linux]

% ruby19 -ve '$SAFE=1;File.expand_path(".".taint)'
ruby 1.9.2p0 (2010-08-18 revision 29036) [i686-linux]
-e:1:in expand_path': Insecure operation - expand_path (SecurityError) from -e:1:in '

意図したものかどうかわからなかったので、とりあえずBugで報告して
おきます。この影響でopen-uriが$SAFE=1では動かない場面が出ています。
=end

Actions #1

Updated by tdtds (Tadashi TADA) over 13 years ago

=begin
ただただしです。

ちょっと追いかけてみました。tmpdir.rbの実装が変わって、$SAFE > 0の
時に常にEtc.systmpdirを使うようになっていて、これがtaintな文字列を
返すためみたいです。

以前「/tmpは危険とみなす」ような話があったと思うので、これは意図的?

tmpdir.rb内のDir::tmpdirで、@@systmpdir.unraintとすれば動くようにな
りましたが、たぶんこれは許容できないんでしょうね……。
=end

Actions #2

Updated by shyouhei (Shyouhei Urabe) over 13 years ago

  • Status changed from Open to Assigned
  • Assignee set to nobu (Nobuyoshi Nakada)

=begin

=end

Actions #3

Updated by nobu (Nobuyoshi Nakada) over 13 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

=begin
This issue was solved with changeset r29209.
Tadashi, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0