We develop an OpenId Connect server with asp.net core and IdentityServer4 and we use cross-site requests forgery (CSRF) protection provided by the asp.net framework.
Currently, we add the [AutoValidateAntiforgeryToken]
attribute to controllers, which adds the CSRF protection to all POST endpoints within the controller.
I understand that CSRF protection is needed in these cases:
- state-changing requests for authenticated users (because a browser could automatically add the auth cookie to the request)
- submitting forms that log the user in (to prevent Login CSRF)
But does it make any sense to have CSRF protection for following POST endpoints that are used by unauthenticated users?
- forgot password (submit username or email for the user who should receive a password reset email)
- password reset (submit new password)
- new user registration
- user activation (submit password and possibly additional personal data)