[#23231] What do you think about changing the return value of Kernel#require and Kernel#load to the source encoding of the required file? — =?ISO-8859-15?Q?Wolfgang_N=E1dasi-Donner?= <ed.odanow@...>

Dear Ruby developers and users!

8 messages 2009/04/17

[#23318] [Feature #1408] 0.1.to_r not equal to (1/10) — Heesob Park <redmine@...>

Feature #1408: 0.1.to_r not equal to (1/10)

19 messages 2009/04/26

[ruby-core:23261] Re: File.expand_path tainting its return value

From: Marc-Andre Lafortune <ruby-core-mailing-list@...>
Date: 2009-04-20 05:26:53 UTC
List: ruby-core #23261
Just to note that __FILE__ is not tainted in ruby 1.8.6 (although it is
indeed in 1.9.1). File.expand_path and, in a similar way, Dir.pwd are
tainted.

On Sun, Apr 19, 2009 at 11:27 PM, Yukihiro Matsumoto <matz@ruby-lang.org>wrote:

> Hi,
>
> In message "Re: [ruby-core:23256] File.expand_path tainting its return
> value"
>     on Sun, 19 Apr 2009 23:31:45 +0900, Tom Epperly <tepperly@gmail.com>
> writes:
>
> |METRICS_PATH = [ File.join(File.dirname(File.expand_path(__FILE__)),
> |'fonts') ]
> |File.expand_path taints its return, and this causes METRICS_PATH to be nil
> |and PDF::Writer to fail.
> |
> |I am not a Ruby guru, but it seems to me very unintuitive that Ruby taints
> |this result when it doesn't seem to depend on the value of any environment
> |variables. The description of the operator implies that it should only use
> |environment variables if a ~ appears in the string.
>
> It's not expand_path but __FILE__ is tainted.  Ruby taints every data
> that relies on external information, that includes path to the scripts
> (__FILE__).  It cannot decide the path structure can be reliable or
> not, so it takes safer side.  I could untaint __FILE if I could be
> sure that any script cannot be fooled by __FILE__.  I haven't been
> sure yet.
>
>
>                                                        matz.
>
>

In This Thread

Prev Next