Q: Why add csrf tokens?
A: Cross Site Request Forgery is generally a security issue where the cookie
for one web site is used to make a valid data submission to different web site
when both pages are using the same web browser.
Csrf protection is the addition of a random csrf token to the html code
of a web page html file by the web server before sending the file to the browser.
The csrf token can be submitted to the web server with future API requests
to reduce the risk of cross-site data submissions.
Csrf protection was primarily added to protect the admin editor <form>
elements during critical security actions like creating a new user based on
input data entered into the form.
Since it was available, csrf protection was added to the oauth login form, the
password change form, and the oauth client trust decision form.
This may not be necessary, because the trust decision already includes a random
oauthorize transaction code, and both login and password forms require
a previously known valid user passwords. Thus, except for the admin editor,
adding csrf protection to the oauth forms may be adding complexity
and increasing the attack surface without a security benefit.
It's currently installed, but may be removed in the future.
Feedback? Suggestions? What is best practice?