Skip to content

Instantly share code, notes, and snippets.

@mataki
Created February 9, 2011 07:11
Show Gist options
  • Save mataki/818088 to your computer and use it in GitHub Desktop.
Save mataki/818088 to your computer and use it in GitHub Desktop.
path for csrf risk on rails 2.3.11
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