summaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-06-03 20:08:23 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-06-03 20:08:23 +0000
commit70b0d5722b9fddb0fa67372e6d827de94b384944 (patch)
treef617ea1cec7178f9414c635d673c22e7708c72fd /config
parent3883d5e2db4f6cc61bab02460bf7d9aaafb94925 (diff)
downloadredmine-70b0d5722b9fddb0fa67372e6d827de94b384944.tar.gz
redmine-70b0d5722b9fddb0fa67372e6d827de94b384944.zip
Rails CVE-2012-2660.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@9767 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'config')
-rw-r--r--config/initializers/10-patches.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/config/initializers/10-patches.rb b/config/initializers/10-patches.rb
index 959107048..43cd7d0a8 100644
--- a/config/initializers/10-patches.rb
+++ b/config/initializers/10-patches.rb
@@ -85,4 +85,30 @@ module ActionController
end
end
end
+
+ # CVE-2012-2660
+ # https://groups.google.com/group/rubyonrails-security/browse_thread/thread/f1203e3376acec0f
+ class Request
+ protected
+
+ # Remove nils from the params hash
+ def deep_munge(hash)
+ hash.each_value do |v|
+ case v
+ when Array
+ v.grep(Hash) { |x| deep_munge(x) }
+ when Hash
+ deep_munge(v)
+ end
+ end
+
+ keys = hash.keys.find_all { |k| hash[k] == [nil] }
+ keys.each { |k| hash[k] = nil }
+ hash
+ end
+
+ def parse_query(qs)
+ deep_munge(super)
+ end
+ end
end