Skip to content

Commit

Permalink
Update rec for CSRF Token Not Unique Per Request
Browse files Browse the repository at this point in the history
  • Loading branch information
RRudder committed May 5, 2023
1 parent e6286ff commit f54e40e
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@

A Cross-Site Request Forgery (CSRF) token should be included within all relevant requests. The CSRF token needs to be unpredictable, tied to a user's session, strictly validated before actions are executed, and not be stored within cookies.

CSRF tokens can be used to prevent CSRF attacks by making it near impossible for a malicious attacker to predict and construct a valid HTTP request of a user because they don't know the value of the CSRF token. Therefore, any request that a malicious attacker attempts to construct will not have all of the necessary parameters for the application to validate and execute the request.
Some other best practices include the following:

- Ensure that the framework is using built-in or existing CSRF prevention protections that exist within most major frameworks
- Use the `SameSite` cookie attribute, which can have the values of `Lax`, `Strict`, or `None`. For example:

``` HTTP
Set-Cookie: JSESSIONID=xxxxx; SameSite=Strict
```
For more information, please see:
Expand Down

0 comments on commit f54e40e

Please sign in to comment.