Преглед изворни кода

add secure, http only, and strict mode to cookies

Alexander Belanger пре 4 година
родитељ
комит
d9ab3342ca
1 измењених фајлова са 5 додато и 2 уклоњено
  1. 5 2
      internal/auth/sessionstore/sessionstore.go

+ 5 - 2
internal/auth/sessionstore/sessionstore.go

@@ -120,8 +120,11 @@ func NewStore(repo *repository.Repository, conf config.ServerConf) (*PGStore, er
 	dbStore := &PGStore{
 		Codecs: securecookie.CodecsFromPairs(keyPairs...),
 		Options: &sessions.Options{
-			Path:   "/",
-			MaxAge: 86400 * 30,
+			Path:     "/",
+			MaxAge:   86400 * 30,
+			Secure:   true,
+			HttpOnly: true,
+			SameSite: http.SameSiteStrictMode,
 		},
 		Repo: repo,
 	}