summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
Diffstat (limited to 'pkg')
-rw-r--r--pkg/web/cookie/cookie_test.go2
-rw-r--r--pkg/web/cookie/new.go5
2 files changed, 3 insertions, 4 deletions
diff --git a/pkg/web/cookie/cookie_test.go b/pkg/web/cookie/cookie_test.go
index c91efdc..9ac1817 100644
--- a/pkg/web/cookie/cookie_test.go
+++ b/pkg/web/cookie/cookie_test.go
@@ -11,7 +11,7 @@ import (
func TestCookie(t *testing.T) {
t.Run("New", func(t *testing.T) {
t.Run("returns a cookie pinned to the HOST", func(t *testing.T) {
- env.With(env.Vars{"HOST": "sparkle.example.com", "APP_ENV": "production"}, func() {
+ env.With(env.Vars{"HOST": "sparkle.example.com"}, func() {
cookie := New("name", "value", time.Now().Add(1*time.Minute))
assert.Equal(t, cookie.Domain, "sparkle.example.com")
assert.Equal(t, cookie.HttpOnly, true)
diff --git a/pkg/web/cookie/new.go b/pkg/web/cookie/new.go
index e1d8477..335b305 100644
--- a/pkg/web/cookie/new.go
+++ b/pkg/web/cookie/new.go
@@ -8,15 +8,14 @@ import (
)
func New(name, value string, expires time.Time) *http.Cookie {
- production := env.Fetch("APP_ENV", "development") == "production"
return &http.Cookie{
Name: name,
Value: value, // TODO:: digitally sign the value
Expires: expires,
MaxAge: int(time.Until(expires).Seconds()),
Path: "/",
- HttpOnly: production,
- Secure: production,
+ HttpOnly: true,
+ Secure: true,
SameSite: http.SameSiteDefaultMode,
Domain: env.Fetch("HOST", "localhost"),
}