Blame SOURCES/rubygem-actionview-4.1.14.2-secure_inline_with_params-tests.patch

8489f9
From f8e2fe8810d67adfcef8acd95b0e51a31de16acd Mon Sep 17 00:00:00 2001
8489f9
From: Arthur Neves <arthurnn@gmail.com>
8489f9
Date: Wed, 24 Feb 2016 20:29:10 -0500
8489f9
Subject: [PATCH] Don't allow render(params) on views.
8489f9
8489f9
If `render(params)` is called in a view it should be protected the same
8489f9
 way it is in the controllers. We should raise an error if thats happens.
8489f9
8489f9
Fix CVE-2016-2098.
8489f9
---
8489f9
 actionview/test/template/render_test.rb         | 19 +++++++++++++++++++
8489f9
 1 files changed, 19 insertions(+), 0 deletion(-)
8489f9
8489f9
diff --git a/actionview/test/template/render_test.rb b/actionview/test/template/render_test.rb
8489f9
index caf6d13..b3de94f 100644
8489f9
--- a/actionview/test/template/render_test.rb
8489f9
+++ b/actionview/test/template/render_test.rb
8489f9
@@ -149,6 +149,25 @@ module RenderTestCases
8489f9
     end
8489f9
   end
8489f9
 
8489f9
+  def test_render_with_strong_parameters
8489f9
+    params = { :inline => '<%= RUBY_VERSION %>' }
8489f9
+    def params.permitted?
8489f9
+      false
8489f9
+    end
8489f9
+    e = assert_raises ArgumentError do
8489f9
+      @view.render(params)
8489f9
+    end
8489f9
+    assert_equal "render parameters are not permitted", e.message
8489f9
+  end
8489f9
+
8489f9
+  def test_render_with_permitted_strong_parameters
8489f9
+    params = { inline: "<%= 'hello' %>" }
8489f9
+    def params.permitted?
8489f9
+      true
8489f9
+    end
8489f9
+    assert_equal 'hello', @view.render(params)
8489f9
+  end
8489f9
+
8489f9
   def test_render_partial
8489f9
     assert_equal "only partial", @view.render(:partial => "test/partial_only")
8489f9
   end
8489f9
-- 
8489f9
2.5.4 (Apple Git-61)
8489f9