From a50bc9f3c8e0696ede25305c03eadecc543b863b Mon Sep 17 00:00:00 2001 From: Jeremy Evans Date: Thu, 20 Jun 2019 11:50:22 -0700 Subject: Do not always taint the result of File#path The result should only be tainted if the path given to the method was tainted. The code to always taint the result was added in a4934a42cbb84b6679912226581c71b435671f55 (svn revision 4892) in 2003 by matz. However, the change wasn't mentioned in the commit message, and it may have been committed by accident. Skip part of a readline test that uses Reline. Reline in general would pass the test, but Reline's test mode doesn't raise a SecurityError if passing a tainted prompt and $SAFE >= 1. This was hidden earlier because File#path was always returning a tainted string. Fixes [Bug #14485] --- test/readline/test_readline.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'test/readline/test_readline.rb') diff --git a/test/readline/test_readline.rb b/test/readline/test_readline.rb index e040ac53c3..e71d329973 100644 --- a/test/readline/test_readline.rb +++ b/test/readline/test_readline.rb @@ -41,6 +41,11 @@ module BasetestReadline assert_equal("> ", stdout.read(2)) assert_equal(1, Readline::HISTORY.length) assert_equal("hello", Readline::HISTORY[0]) + + # Work around lack of SecurityError in Reline + # test mode with tainted prompt + return if kind_of?(TestRelineAsReadline) + Thread.start { $SAFE = 1 assert_raise(SecurityError) do -- cgit v1.2.3