add exception to protect_from_forgery method and add skip verify_auth… #29
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Modify the way csrf requests are handled
Trello board reference:
Description:
Reviewers:
Notes:
I attach some of the documents I read in order to lean for this approach:
https://nvisium.com/blog/2014/09/10/understanding-protectfromforgery/
https://mathieu.fenniak.net/is-your-web-api-susceptible-to-a-csrf-exploit/
http://stackoverflow.com/questions/10167956/rails-shows-warning-cant-verify-csrf-token-authenticity-from-a-restkit-post
http://stackoverflow.com/questions/20745843/is-this-rails-json-authentication-api-using-devise-secure
Q: What is the simple_token_authentication configuration for an api? gonzalo-bulnes/simple_token_authentication#67
http://jamescpoole.com/2013/10/31/rails-4-csrf-protection-with-clients-using-apis/
Tasks:
Change
protect_from_forgery
fromnull_session
toexception
in all API controllersAdd skip for
verify_authenticity_token
if the request format isjson
Risk: