Skip to content

Commit

Permalink
fix: set max-age default cookie option to a sensible value
Browse files Browse the repository at this point in the history
  • Loading branch information
hf committed Aug 28, 2024
1 parent a48fe6f commit 4f8fb0b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
20 changes: 10 additions & 10 deletions src/__snapshots__/createServerClient.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ exports[`createServerClient > use cases > should refresh session correctly as ty
"name": "custom-storage-key.0",
"options": {
"httpOnly": false,
"maxAge": 31536000000,
"maxAge": 34560000,
"path": "/",
"sameSite": "lax",
},
Expand All @@ -44,7 +44,7 @@ exports[`createServerClient > use cases > should refresh session correctly as ty
"name": "custom-storage-key.1",
"options": {
"httpOnly": false,
"maxAge": 31536000000,
"maxAge": 34560000,
"path": "/",
"sameSite": "lax",
},
Expand Down Expand Up @@ -75,7 +75,7 @@ exports[`createServerClient > use cases > should refresh session correctly as ty
"name": "sb-project-ref-auth-token.0",
"options": {
"httpOnly": false,
"maxAge": 31536000000,
"maxAge": 34560000,
"path": "/",
"sameSite": "lax",
},
Expand All @@ -85,7 +85,7 @@ exports[`createServerClient > use cases > should refresh session correctly as ty
"name": "sb-project-ref-auth-token.1",
"options": {
"httpOnly": false,
"maxAge": 31536000000,
"maxAge": 34560000,
"path": "/",
"sameSite": "lax",
},
Expand All @@ -100,7 +100,7 @@ exports[`createServerClient > use cases > should set PKCE code verifier correctl
"name": "custom-storage-key-code-verifier",
"options": {
"httpOnly": false,
"maxAge": 31536000000,
"maxAge": 34560000,
"path": "/",
"sameSite": "lax",
},
Expand All @@ -115,7 +115,7 @@ exports[`createServerClient > use cases > should set PKCE code verifier correctl
"name": "sb-project-ref-auth-token-code-verifier",
"options": {
"httpOnly": false,
"maxAge": 31536000000,
"maxAge": 34560000,
"path": "/",
"sameSite": "lax",
},
Expand All @@ -140,7 +140,7 @@ exports[`createServerClient > use cases > should set exchange PKCE code for sess
"name": "custom-storage-key.0",
"options": {
"httpOnly": false,
"maxAge": 31536000000,
"maxAge": 34560000,
"path": "/",
"sameSite": "lax",
},
Expand All @@ -150,7 +150,7 @@ exports[`createServerClient > use cases > should set exchange PKCE code for sess
"name": "custom-storage-key.1",
"options": {
"httpOnly": false,
"maxAge": 31536000000,
"maxAge": 34560000,
"path": "/",
"sameSite": "lax",
},
Expand Down Expand Up @@ -195,7 +195,7 @@ exports[`createServerClient > use cases > should set exchange PKCE code for sess
"name": "sb-project-ref-auth-token.0",
"options": {
"httpOnly": false,
"maxAge": 31536000000,
"maxAge": 34560000,
"path": "/",
"sameSite": "lax",
},
Expand All @@ -205,7 +205,7 @@ exports[`createServerClient > use cases > should set exchange PKCE code for sess
"name": "sb-project-ref-auth-token.1",
"options": {
"httpOnly": false,
"maxAge": 31536000000,
"maxAge": 34560000,
"path": "/",
"sameSite": "lax",
},
Expand Down
4 changes: 3 additions & 1 deletion src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ export const DEFAULT_COOKIE_OPTIONS: CookieOptions = {
path: "/",
sameSite: "lax",
httpOnly: false,
maxAge: 60 * 60 * 24 * 365 * 1000,
// https://developer.chrome.com/blog/cookie-max-age-expires
// https://httpwg.org/http-extensions/draft-ietf-httpbis-rfc6265bis.html#name-cookie-lifetime-limits
maxAge: 400 * 24 * 60 * 60,
};

0 comments on commit 4f8fb0b

Please sign in to comment.