In your experience, what are the most common mistakes made when implementing CSRF protections?

In my experience, common mistakes in implementing CSRF protections include:    

1. Neglecting to use anti-CSRF tokens : These unique, random values associated with a user’s session are crucial for preventing attacks.

2. Inadequate token protection : Tokens must be securely generated and stored. If compromised, they can enable CSRF attacks.

3. Ignoring GET requests : While POST requests are often targeted, GET requests can also be exploited, so both should have CSRF protections.

4. Not validating referrer headers : This is an additional layer of security that checks if the request came from an authorized source.

5. Overlooking AJAX requests : These too need CSRF protection as they can be manipulated by attackers.

6. Failing to implement same-site cookies : These restrict cookie usage to first-party contexts, reducing risk.

7. Misunderstanding CORS policy : Cross-Origin Resource Sharing (CORS) policies don’t prevent CSRF; they control resource access between different origins.