add secret length verification in production

This commit is contained in:
sk1982 2024-04-07 06:16:55 -04:00
parent df7d086ab9
commit a7b8cbb4cd

View File

@ -16,6 +16,11 @@ export async function register() {
console.error('[FATAL] insecure secret detected, please set NEXTAUTH_SECRET variable to a random string'); console.error('[FATAL] insecure secret detected, please set NEXTAUTH_SECRET variable to a random string');
process.exit(1); process.exit(1);
} }
if (secret.length < 32) {
console.error('[FATAL] secret is too short, please set it to a random string that is at least 32 characters long');
process.exit(1);
}
} }
let url: URL; let url: URL;