fix(auth): isolate session cookies via AUTH_COOKIE_PREFIX (#5773)

Prefix all Auth.js cookies (default "homarr") so they no longer collide
with other Auth.js apps on the same hostname.
This commit is contained in:
ajnart committed 2026-06-18 09:33:01 +02:00
1 parent 7debe34e24
commit 3d358f664d
5 files changed
+30 -7

No files matched your search

+4 -2
View File
@@ -4,9 +4,11 @@ import { generateSecureRandomToken } from "@homarr/common/server";
import type { Database } from "@homarr/db";
import { getCurrentUserPermissionsAsync } from "./callbacks";
import { env } from "./env";
// Default of authjs
export const sessionTokenCookieName = "authjs.session-token";
// Prefixed (AUTH_COOKIE_PREFIX, default "homarr") to avoid cookie collisions
// with other Auth.js apps on the same host. See https://github.com/homarr-labs/homarr/issues/5773
export const sessionTokenCookieName = `${env.AUTH_COOKIE_PREFIX}.session-token`;
export const expireDateAfter = (seconds: number) => {
return new Date(Date.now() + seconds * 1000);