ipalEnvRules: PAYLOAD_SECRET at least 32 characters in production
New option secretMinLength (default 32, 0 turns it off); checked only with NODE_ENV=production. Docs: env table, deployment (what changing the secret does, checked in Payload 3.94.1 and payload-2fa), AGENT.md, ipal-reference, ipal-setup. Tests: short secret fails in production, passes in dev, 0 and a custom minimum. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
40fed78da2
commit
36f8f69f82
@@ -116,7 +116,7 @@ describe('IPAL_IP_HEADER', () => {
|
||||
test('ipalEnvRules({ ipHeader }) requires it in production only', async () => {
|
||||
const { assertEnv } = await import('../src/modules/env/assertEnv.js')
|
||||
const { ipalEnvRules } = await import('../src/modules/env/ipalEnvRules.js')
|
||||
const base = { DATABASE_URI: 'x', NEXT_PUBLIC_SERVER_URL: 'https://acme.pl', PAYLOAD_SECRET: 'x' }
|
||||
const base = { DATABASE_URI: 'x', NEXT_PUBLIC_SERVER_URL: 'https://acme.pl', PAYLOAD_SECRET: 'a-long-random-test-secret-of-32-chars' }
|
||||
vi.stubEnv('NODE_ENV', 'production')
|
||||
expect(() => assertEnv(ipalEnvRules({ ipHeader: true }), { env: base })).toThrow(/IPAL_IP_HEADER/)
|
||||
expect(() => assertEnv(ipalEnvRules({ ipHeader: true }), { env: { ...base, IPAL_IP_HEADER: 'cf-connecting-ip' } })).not.toThrow()
|
||||
|
||||
Reference in New Issue
Block a user