Created
May 27, 2010 13:11
-
-
Save samhendley/415780 to your computer and use it in GitHub Desktop.
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
# this monkey patch for Rails 2.3.5 means each action has its own token, i'm not | |
# sure if this actually makes things more secure or worse. | |
ActionController::RequestForgeryProtection.class_eval do | |
def form_authenticity_token_with_action(*args) | |
session_var_name = "_csrf_token_#{controller_name}_#{action_name}" | |
session[session_var_name.to_sym] ||= ActiveSupport::SecureRandom.base64(32) | |
end | |
alias_method_chain :form_authenticity_token, :action | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment