Blame SOURCES/rubygem-actionview-4.1.14.2-CVE-2016-2097-render_data_leak_2-tests.patch

8489f9
From 1a65dd1c21cb7a70db054793deeb19dea1b357cf Mon Sep 17 00:00:00 2001
8489f9
From: Aaron Patterson <aaron.patterson@gmail.com>
8489f9
Date: Tue, 26 Jan 2016 17:06:31 -0800
8489f9
Subject: [PATCH 1/2] Change render "foo" to render a template and not a file.
8489f9
8489f9
Previously, calling `render "foo/bar"` in a controller action is
8489f9
equivalent to `render file: "foo/bar"`. This has been changed to
8489f9
mean `render template: "foo/bar"` instead. If you need to render a
8489f9
file, please change your code to use the explicit form
8489f9
(`render file: "foo/bar"`) instead.
8489f9
8489f9
Test that we are not allowing you to grab a file with an absolute path
8489f9
outside of your application directory. This is dangerous because it
8489f9
could be used to retrieve files from the server like `/etc/passwd`.
8489f9
8489f9
Fix CVE-2016-2097.
8489f9
---
8489f9
 .../test/actionpack/controller/render_test.rb      | 23 ++++-------------
8489f9
 1 files changed, 5 insertions(+), 18 deletions(-)
8489f9
8489f9
diff --git a/actionview/test/actionpack/controller/render_test.rb b/actionview/test/actionpack/controller/render_test.rb
8489f9
index 45b8049..a9991fe 100644
8489f9
--- a/actionview/test/actionpack/controller/render_test.rb
8489f9
+++ b/actionview/test/actionpack/controller/render_test.rb
8489f9
@@ -91,17 +91,17 @@ class TestController < ApplicationController
8489f9
 
8489f9
   # :ported:
8489f9
   def render_hello_world
8489f9
-    render :template => "test/hello_world"
8489f9
+    render "test/hello_world"
8489f9
   end
8489f9
 
8489f9
   def render_hello_world_with_last_modified_set
8489f9
     response.last_modified = Date.new(2008, 10, 10).to_time
8489f9
-    render :template => "test/hello_world"
8489f9
+    render "test/hello_world"
8489f9
   end
8489f9
 
8489f9
   # :ported: compatibility
8489f9
   def render_hello_world_with_forward_slash
8489f9
-    render :template => "/test/hello_world"
8489f9
+    render "/test/hello_world"
8489f9
   end
8489f9
 
8489f9
   # :ported:
8489f9
@@ -111,7 +111,7 @@ class TestController < ApplicationController
8489f9
 
8489f9
   # :deprecated:
8489f9
   def render_template_in_top_directory_with_slash
8489f9
-    render :template => '/shared'
8489f9
+    render '/shared'
8489f9
   end
8489f9
 
8489f9
   # :ported:
8489f9
@@ -160,13 +160,6 @@ class TestController < ApplicationController
8489f9
   end
8489f9
 
8489f9
   # :ported:
8489f9
-  def render_file_as_string_with_instance_variables
8489f9
-    @secret = 'in the sauce'
8489f9
-    path = File.expand_path(File.join(File.dirname(__FILE__), '../../fixtures/test/render_file_with_ivar'))
8489f9
-    render path
8489f9
-  end
8489f9
-
8489f9
-  # :ported:
8489f9
   def render_file_not_using_full_path
8489f9
     @secret = 'in the sauce'
8489f9
     render :file => 'test/render_file_with_ivar'
8489f9
@@ -194,7 +187,7 @@ class TestController < ApplicationController
8489f9
 
8489f9
   def render_file_as_string_with_locals
8489f9
     path = File.expand_path(File.join(File.dirname(__FILE__), '../../fixtures/test/render_file_with_locals'))
8489f9
-    render path, :locals => {:secret => 'in the sauce'}
8489f9
+    render file: path, :locals => {:secret => 'in the sauce'}
8489f9
   end
8489f9
 
8489f9
   def accessing_request_in_template
8489f9
@@ -781,12 +774,6 @@ class RenderTest < ActionController::TestCase
8489f9
   end
8489f9
 
8489f9
   # :ported:
8489f9
-  def test_render_file_as_string_with_instance_variables
8489f9
-    get :render_file_as_string_with_instance_variables
8489f9
-    assert_equal "The secret is in the sauce\n", @response.body
8489f9
-  end
8489f9
-
8489f9
-  # :ported:
8489f9
   def test_render_file_not_using_full_path
8489f9
     get :render_file_not_using_full_path
8489f9
     assert_equal "The secret is in the sauce\n", @response.body
8489f9
-- 
8489f9
2.7.0
8489f9