Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(middleware/csrf): CookieSameSite default "Lax" #1640

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions middleware/csrf/README.md
Expand Up @@ -46,7 +46,7 @@ app.Use(csrf.New()) // Default config
app.Use(csrf.New(csrf.Config{
KeyLookup: "header:X-Csrf-Token",
CookieName: "csrf_",
CookieSameSite: "Strict",
CookieSameSite: "Lax",
Expiration: 1 * time.Hour,
KeyGenerator: utils.UUID,
}))
Expand Down Expand Up @@ -106,7 +106,7 @@ type Config struct {
CookieHTTPOnly bool

// Indicates if CSRF cookie is requested by SameSite.
// Optional. Default value "Strict".
// Optional. Default value "Lax".
CookieSameSite string

// Expiration is the duration before csrf token will expire
Expand Down Expand Up @@ -138,7 +138,7 @@ type Config struct {
var ConfigDefault = Config{
KeyLookup: "header:X-Csrf-Token",
CookieName: "csrf_",
CookieSameSite: "Strict",
CookieSameSite: "Lax",
Expiration: 1 * time.Hour,
KeyGenerator: utils.UUID,
}
Expand Down
4 changes: 2 additions & 2 deletions middleware/csrf/config.go
Expand Up @@ -50,7 +50,7 @@ type Config struct {
CookieHTTPOnly bool

// Value of SameSite cookie.
// Optional. Default value "Strict".
// Optional. Default value "Lax".
CookieSameSite string

// Expiration is the duration before csrf token will expire
Expand Down Expand Up @@ -96,7 +96,7 @@ type Config struct {
var ConfigDefault = Config{
KeyLookup: "header:X-Csrf-Token",
CookieName: "csrf_",
CookieSameSite: "Strict",
CookieSameSite: "Lax",
Expiration: 1 * time.Hour,
KeyGenerator: utils.UUID,
ErrorHandler: defaultErrorHandler,
Expand Down