mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Protect #filter_parameters created by filter_parameter_logging [José Valim] [#196 state:resolved]
This commit is contained in:
parent
49846f8586
commit
8d37bd08ee
2 changed files with 39 additions and 32 deletions
|
@ -504,6 +504,7 @@ module ActionController #:nodoc:
|
|||
|
||||
filtered_parameters
|
||||
end
|
||||
protected :filter_parameters
|
||||
end
|
||||
|
||||
# Don't render layouts for templates with the given extensions.
|
||||
|
|
|
@ -27,7 +27,7 @@ class FilterParamTest < Test::Unit::TestCase
|
|||
|
||||
test_hashes.each do |before_filter, after_filter, filter_words|
|
||||
FilterParamController.filter_parameter_logging(*filter_words)
|
||||
assert_equal after_filter, @controller.filter_parameters(before_filter)
|
||||
assert_equal after_filter, @controller.send!(:filter_parameters, before_filter)
|
||||
|
||||
filter_words.push('blah')
|
||||
FilterParamController.filter_parameter_logging(*filter_words) do |key, value|
|
||||
|
@ -37,7 +37,13 @@ class FilterParamTest < Test::Unit::TestCase
|
|||
before_filter['barg'] = {'bargain'=>'gain', 'blah'=>'bar', 'bar'=>{'bargain'=>{'blah'=>'foo'}}}
|
||||
after_filter['barg'] = {'bargain'=>'niag', 'blah'=>'[FILTERED]', 'bar'=>{'bargain'=>{'blah'=>'[FILTERED]'}}}
|
||||
|
||||
assert_equal after_filter, @controller.filter_parameters(before_filter)
|
||||
assert_equal after_filter, @controller.send!(:filter_parameters, before_filter)
|
||||
end
|
||||
end
|
||||
|
||||
def test_filter_parameters_is_protected
|
||||
FilterParamController.filter_parameter_logging
|
||||
assert !@controller.send!(:action_methods).include?(:filter_parameters)
|
||||
assert (begin @controller.filter_parameters rescue true end)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue