M1 (8): 2FA attempts only from the own origin; the verify count is stored
R3-2. (b) POST /api/verify-totp and /api/setup-totp refuse a request that a browser marks as coming from another origin (Origin, Sec-Fetch-Site) — before it is counted, so another page (a sibling subdomain included) cannot burn an account's attempts and lock its owner out. Own origins: the request's host, serverURL, Payload's csrf / cors lists, twoFactor.sameOrigin.origins; requests without those headers pass. twoFactor.sameOrigin: false turns it off. (a) The verify count is kept in memory (exact for parallel bursts) and in Payload's key-value store (payload.kv, no new collection), so a restart or a second instance does not reset it; the higher count decides, and a failing store never opens the gate. verifyLimit.store: 'memory' = this instance only. Doctor: csrf-empty (static, warning) when neither serverURL nor csrf is set. Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5.2
parent
0b4c4e8295
commit
f7296edc71
@@ -181,6 +181,13 @@ describe('M1 rules: access-missing, turnstile-degraded, turnstile-env-key', () =
|
||||
expect(await run(cfg, ['turnstile-env-key'])).toEqual([])
|
||||
})
|
||||
|
||||
test('csrf-empty: without serverURL and csrf Payload takes the login cookie from any origin', async () => {
|
||||
expect(await run("export default buildConfig({ plugins: [ipalKit({ access: { authCollection: 'users' } })] })", ['csrf-empty'])).toEqual(['csrf-empty:warning'])
|
||||
expect(await run('export default buildConfig({ serverURL: process.env.NEXT_PUBLIC_SERVER_URL, plugins: [] })', ['csrf-empty'])).toEqual([])
|
||||
expect(await run("export default buildConfig({ csrf: ['https://site.example'], plugins: [] })", ['csrf-empty'])).toEqual([])
|
||||
expect(await run('// not a Payload config', ['csrf-empty'])).toEqual([])
|
||||
})
|
||||
|
||||
test('open-signup: an auth collection anyone can register in is said, as info', async () => {
|
||||
const cfg = "ipalKit({ access: { authCollection: 'users' } })"
|
||||
expect(await run(cfg, ['open-signup'], { openSignUp: ['customers', 'members'] })).toEqual(['open-signup:info', 'open-signup:info'])
|
||||
|
||||
Reference in New Issue
Block a user