Staff sign-in rules: failures per IP and address, own origin, current password for own changes (1.18.0)

Q2 (IAWL idea 16): Payload locks a staff account after 5 wrong passwords
from anybody, so a stranger kept the owner out without a password. Failed
sign-ins are now counted per client IP and typed address (folded: NFKC,
lower case, trim): 5 in 15 min, then 429 for that IP and address only;
only failures count (a place taken before the compare, given back on
success or refusal; "try again in a moment" while others are being
checked). Payload's own lock stays as the net at 50 failures for an hour
where the project set none. The mail service's account-mail limit now
counts per address per visitor (5) with 20 per address in all, so one
stranger no longer blocks the owner's own reset mail.
Q3 (idea 7): staff login, forgot and reset password refuse a request a
browser marks as coming from another origin (403 before anything is
counted or sent); visitor collections untouched.
Q5 (idea 29): an account that changes its own e-mail, username or password
must send its current password (panel field on the account page via the
plugin's MaskedField, no import-map change; REST and GraphQL). Admins
changing others, server code and API keys are not asked; wrong ones count
like failed sign-ins.
Options accounts.signInLimit / signInSameOrigin / confirmOwnChanges, all
validated at start. Tests: 15 HTTP tests (2FA on/off, all off), fail
before on 1.17.1; built-site spec own-account.spec.ts in e2e:built.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-12-01 11:12:40 +01:00
co-authored by Claude Opus 5.5
parent fc70a34f3e
commit 52710021ef
28 changed files with 839 additions and 21 deletions
+6 -4
View File
@@ -191,9 +191,11 @@ is read — and is renewed after a send, once an hour; until the site has enroll
plugin has no number of its own).
**Account mail is limited by the site itself.** "Forgot password" is a visitor's lever like a form, and the
service lets account mail use the whole hour. So the relay transport holds back more than **5 account e-mails to
one address** and more than **10 asked for by one visitor** within an hour (`mail.relay.accountMail`:
`{ perAddress, perVisitor, windowMinutes }`, or `false`). A held-back message is reported as `relay-quota` in the
service lets account mail use the whole hour. So the relay transport holds back, within an hour, more than **5 account
e-mails to one address asked for by one visitor**, more than **20 to one address from everybody** and more than **10
asked for by one visitor** (`mail.relay.accountMail`: `{ perAddress, perAddressTotal, perVisitor, windowMinutes }`, or
`false`). Since 1.18.0 `perAddress` counts per visitor (the requesting IP): before, five requests from anybody used
the address's hour up, and its owner's own reset mail was held back too. A held-back message is reported as `relay-quota` in the
log and the panel; the visitor is told nothing. Pin the address header for it: `IAPL_IP_HEADER`
([security.md](./security.md)).
@@ -466,7 +468,7 @@ message); "Connect again" asks at once. Other causes: `host-not-allowed` (not a
| `token` | — | a token from elsewhere (`string` or a function): the stored token is not used and the site does not enrol |
| `senderName` | panel, then site name | a fixed name, or a function |
| `kind` | — | the kind of a message nobody marked |
| `accountMail` | `{ perAddress: 5, perVisitor: 10, windowMinutes: 60 }` | the site's own limit on account mail; `false` = none |
| `accountMail` | `{ perAddress: 5, perAddressTotal: 20, perVisitor: 10, windowMinutes: 60 }` | the site's own limit on account mail: per address and visitor, per address from everybody (1.18.0), per visitor; `false` = none |
| `confirmRateLimit` | `{ max: 10, windowMs: 60000 }` | calls to the public confirm route per address |
| `totalTimeoutMs` | `10000`; `30000` with files | everything one message may take — enrolment, attempts and waits together. Somebody waits for the request that sends the mail; after it the message is reported ("not confirmed" when an attempt was cut off). A number, or `{ plain, files }` |
| `timeoutMs` | `30000` | one attempt of a send; never more than what is left of `totalTimeoutMs` |