Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

security(auth)!: reduce default JWT session max age to 14 days (#16593)

Mark Salpeterf0308f0e504b
diff --git a/.env.prod.example b/.env.prod.example
index fa4c47b10d..f960160e90 100644
--- a/.env.prod.example
+++ b/.env.prod.example
@@ -64,7 +64,7 @@ OTEL_SERVICE_NAME="langfuse"
# AUTH_IGNORE_ACCOUNT_FIELDS=foo,bar
# AUTH_DISABLE_USERNAME_PASSWORD=true
# AUTH_DISABLE_SIGNUP=true
-# AUTH_SESSION_MAX_AGE=43200 # 30 days in minutes (default)
+# AUTH_SESSION_MAX_AGE=20160 # 14 days in minutes (default)
# SSO, each group is optional
# AUTH_GOOGLE_CLIENT_ID=
diff --git a/web/src/env.mjs b/web/src/env.mjs
index 3226b0d64c..bb8a024c23 100644
--- a/web/src/env.mjs
+++ b/web/src/env.mjs
@@ -293,7 +293,7 @@ export const env = createEnv({
"AUTH_SESSION_MAX_AGE must be > 5 as session JWT tokens are refreshed every 5 minutes",
)
.optional()
- .default(30 * 24 * 60), // default to 30 days
+ .default(14 * 24 * 60), // default to 14 days
AUTH_HTTP_PROXY: z.url().optional(),
AUTH_HTTPS_PROXY: z.url().optional(),
AUTH_SSO_TIMEOUT: z.coerce.number().int().positive().optional(),
diff --git a/web/src/server/auth.ts b/web/src/server/auth.ts
index c4a65f8bfd..05981b3897 100644
--- a/web/src/server/auth.ts
+++ b/web/src/server/auth.ts
@@ -780,7 +780,7 @@ export async function getAuthOptions(signupAttribution?: {
logger: nextAuthLogger,
session: {
strategy: "jwt",
- maxAge: env.AUTH_SESSION_MAX_AGE * 60, // convert minutes to seconds, default is set in env.mjs
+ maxAge: env.AUTH_SESSION_MAX_AGE * 60, // minutes → seconds
},
callbacks: {
// Harden the callback-URL redirect against malformed input. NextAuth's