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
+15
-1
@@ -329,6 +329,17 @@ export type IpalOptions = {
|
||||
* package's views as they are. Run generate:importmap. docs/security.md.
|
||||
*/
|
||||
safeBack?: false | SafeBackRule
|
||||
/**
|
||||
* 2FA verify and setup attempts (`POST /api/verify-totp`, `/api/setup-totp`)
|
||||
* are accepted only from the site's own origin: a request that a browser
|
||||
* marks as coming from elsewhere (`Origin`, `Sec-Fetch-Site`) is refused
|
||||
* with 403 and not counted — so another page, a sibling subdomain included,
|
||||
* cannot burn an account's verify attempts and lock its owner out. Own
|
||||
* origins: the request's host, `serverURL`, Payload's `csrf` / `cors`
|
||||
* lists, and `{ origins: ['https://app.example.com'] }` here. Requests
|
||||
* without those headers (scripts, servers) pass. `false` = off.
|
||||
*/
|
||||
sameOrigin?: { origins?: string[] } | false
|
||||
/**
|
||||
* Texts of the 2FA screens and user field. Default: ipal-kit's English and
|
||||
* Polish (`TOTP_TEXTS`), merged over the package's; your own
|
||||
@@ -340,7 +351,10 @@ export type IpalOptions = {
|
||||
* 2FA package never counts tries, and a six-digit code can be guessed by
|
||||
* whoever holds the password. Default `{ max: 5, windowMinutes: 10 }`: the
|
||||
* sixth attempt in ten minutes, right or wrong, is refused (429) until the
|
||||
* window ends. `false` = no limit (a limiter in front of the site).
|
||||
* window ends. The count is kept in memory and in the database (Payload's
|
||||
* `payload.kv`), so a restart or a second instance does not reset it;
|
||||
* `{ store: 'memory' }` = this instance only. `false` = no limit (a limiter
|
||||
* in front of the site).
|
||||
*/
|
||||
verifyLimit?: false | VerifyLimitOptions
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user