You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Rails protect_from_forgery function helps protect against cross-site
request forgery attacks, as described on Wikipedia:
http://en.wikipedia.org/wiki/Cross-site_request_forgery
These attacks involve a hostile site sending requests to a site where
the user is logged in, exploiting the user's session cookie to do
various bad things.
The protect_from_forgery function works by requiring all POST (and PUT
and UPDATE) requests to have an authenticity_token parameter that
corresponds to a value in the user's session. This is automatically
included in generated forms by the various form helpers, and checked in
the controller. However, we still need to deal with some cases
(specifically Ajax.Request) manually.
We make several types of changes to get everything working again:
- Some POST requests were changed to GET requests, when appropriate.
- The token was added manually to other POST requests. This was
done using the new init_mephisto_authenticity_token.
- Forgery protection was disabled in the test environment.
Note that we still need to review the authentication controller closely,
and eliminate various XSS attacks against our application before this
protection will do much good.
I tested this code by manually using the admin/ interface, editing
articles, adding users, and working with assets. There's probably still
some breakage somewhere that I missed, so let me know if you have problems.
I also updated the TODO list for Rails 2.2 and added security-auditing
notes.
0 commit comments