Skip to content

Commit ac266d3

Browse files
capJavertclaude
andcommitted
fix: correct cookie maxAge values from milliseconds to seconds
The maxAge option in @fastify/cookie is in seconds, not milliseconds. All cookie definitions were using a `1000 *` prefix as if they were milliseconds, resulting in cookies living ~1000x longer than intended (e.g. auth cookie living ~10 days instead of 15 minutes). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent ee6ec75 commit ac266d3

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

src/cookies.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const cookies: {
88
} = {
99
tracking: {
1010
opts: {
11-
maxAge: 1000 * 60 * 60 * 24 * 365 * 10,
11+
maxAge: 60 * 60 * 24 * 365 * 10,
1212
httpOnly: false,
1313
signed: false,
1414
secure: false,
@@ -18,7 +18,7 @@ export const cookies: {
1818
},
1919
session: {
2020
opts: {
21-
maxAge: 1000 * 60 * 30,
21+
maxAge: 60 * 30,
2222
httpOnly: false,
2323
signed: false,
2424
secure: false,
@@ -28,7 +28,7 @@ export const cookies: {
2828
},
2929
auth: {
3030
opts: {
31-
maxAge: 1000 * 60 * 15,
31+
maxAge: 60 * 15,
3232
httpOnly: true,
3333
signed: true,
3434
secure: env === 'production',
@@ -38,7 +38,7 @@ export const cookies: {
3838
},
3939
funnel: {
4040
opts: {
41-
maxAge: 1000 * 60 * 30,
41+
maxAge: 60 * 30,
4242
httpOnly: true,
4343
signed: false,
4444
secure: env === 'production',
@@ -48,7 +48,7 @@ export const cookies: {
4848
},
4949
onboarding: {
5050
opts: {
51-
maxAge: 1000 * 60 * 30,
51+
maxAge: 60 * 30,
5252
httpOnly: true,
5353
signed: false,
5454
secure: env === 'production',
@@ -72,7 +72,7 @@ export const cookies: {
7272
authSession: {
7373
key: env === 'production' ? '__Secure-dast' : 'dast',
7474
opts: {
75-
maxAge: 1000 * 60 * 60 * 24 * 7,
75+
maxAge: 60 * 60 * 24 * 7,
7676
signed: false,
7777
httpOnly: true,
7878
secure: env === 'production',
@@ -82,7 +82,7 @@ export const cookies: {
8282
baForce: {
8383
key: 'da_ba',
8484
opts: {
85-
maxAge: 1000 * 60 * 60 * 24 * 365 * 10,
85+
maxAge: 60 * 60 * 24 * 365 * 10,
8686
httpOnly: true,
8787
signed: false,
8888
secure: env === 'production',

0 commit comments

Comments
 (0)