What is CSRF - Cross Site Request Forgery When an unwanted action is forced to perform on a trusted site which the user is currently authenticated to , it's called a CSRF. What is a double submit cookie pattern and how it works Basically, there are are two patterns for stopping CSRF attacks: Double-Submit Cookie and Synchronizer Token. Lets see how Double Submit Cookie Pattern works! It works like this. If a view is protected against CSRF, when the view responds to any petition whose request method is “unsafe”, e.g. POST , PUT , and DELETE , it requires a csrfmiddlewaretoken to be passed in the request payload. It checks the value of this token against the csrftoken , a cookie which is also passed along with the request. If they don’t have the same value, the request is rejected. The key here is that the browser passes two tokens in the request which must have the same value. The csrfmiddlewaretoken , in the request body, and the csrftoken in the c...
Dedicated for everyone who thinks that security in a system should not just be an after-thought.