Created
February 9, 2011 07:11
-
-
Save mataki/818088 to your computer and use it in GitHub Desktop.
path for csrf risk on rails 2.3.11
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
module ActionController | |
module RequestForgeryProtection | |
protected | |
def verify_authenticity_token | |
verified_request? || handle_unverified_request | |
end | |
# Process logout | |
def handle_unverified_request | |
reset_session | |
end | |
def verified_request? | |
!protect_against_forgery? || | |
request.get? || | |
form_authenticity_token == form_authenticity_param || | |
form_authenticity_token == request.headers['X-CSRF-Token'] | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment