Skip to content

Commit c17588f

Browse files
fix wording
1 parent cf71ede commit c17588f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pages/csrf.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ This is a very simple method where each session has a unique CSRF [token](/serve
7171

7272
If storing the token server-side is not an option, using signed double-submit cookies is another approach. This is different from the basic double submit cookie in that the token included in the form is signed with a secret.
7373

74-
A new [token](/server-side-tokens) is generated and hashed with HMAC SHA-256 using a secret key. Each HMAC must be linked to the user's session.
74+
A new [token](/server-side-tokens) is generated and hashed with HMAC SHA-256 using a secret key. Each HMAC must be linked to the user's session. You can alternatively encrypt the token with algorithms like AES.
7575

7676
```go
7777
func generateCSRFToken(sessionId string) (string, []byte) {
@@ -85,7 +85,7 @@ func generateCSRFToken(sessionId string) (string, []byte) {
8585
}
8686
```
8787

88-
The token is stored as a cookie and the HMAC is stored in the form. The cookie should have a `Secure`, `HttpOnly`, and `SameSite` flag. To validate a request, the cookie can be used to verify the signature sent in the form data.
88+
The token is stored as a cookie and the HMAC is embedded in the form. The cookie should have the `Secure`, `HttpOnly`, and `SameSite` attribute. To validate a request, the cookie can be used to verify the signature sent in the form data.
8989

9090
#### Traditional double-submit cookies
9191

0 commit comments

Comments
 (0)