Created
December 4, 2013 21:28
-
-
Save joseph-ravenwolfe/7795942 to your computer and use it in GitHub Desktop.
Rails DDOS Vulnerability Patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/initializers/action_view_header_caching_handler.rb | |
ActiveSupport.on_load(:action_view) do | |
ActionView::LookupContext::DetailsKey.class_eval do | |
class << self | |
alias :old_get :get | |
def get(details) | |
if details[:formats] | |
details = details.dup | |
syms = Set.new Mime::SET.symbols | |
details[:formats] = details[:formats].select { |v| | |
syms.include? v | |
} | |
end | |
old_get details | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment