浏览代码

Set SameSite cookie attribute to Strict

Frédéric Guillot 6 年之前
父节点
当前提交
5ac55518ab
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      http/cookie/cookie.go

+ 2 - 2
http/cookie/cookie.go

@@ -27,7 +27,7 @@ func New(name, value string, isHTTPS bool, path string) *http.Cookie {
 		Secure:   isHTTPS,
 		Secure:   isHTTPS,
 		HttpOnly: true,
 		HttpOnly: true,
 		Expires:  time.Now().Add(cookieDuration * 24 * time.Hour),
 		Expires:  time.Now().Add(cookieDuration * 24 * time.Hour),
-		SameSite: http.SameSiteLaxMode,
+		SameSite: http.SameSiteStrictMode,
 	}
 	}
 }
 }
 
 
@@ -41,7 +41,7 @@ func Expired(name string, isHTTPS bool, path string) *http.Cookie {
 		HttpOnly: true,
 		HttpOnly: true,
 		MaxAge:   -1,
 		MaxAge:   -1,
 		Expires:  time.Date(1970, 1, 1, 0, 0, 0, 0, time.UTC),
 		Expires:  time.Date(1970, 1, 1, 0, 0, 0, 0, time.UTC),
-		SameSite: http.SameSiteLaxMode,
+		SameSite: http.SameSiteStrictMode,
 	}
 	}
 }
 }