M1 review: account rules before 2FA, the SMTP password stays with its server, the rest of the findings

M1-1 the first-user route is the plugin's own endpoint in front of Payload's; nothing is read from the path.
M1-2 the account rules are put on the collections before the 2FA package wraps them.
M1-6 the admin rule only where the roles are the plugin's; other staff collections: an account of that collection.
     update / delete get the matching defaults (accounts.adminOnlyWrite); doctor rule staff-accounts-open.
M1-5 access.firstUserAdmin: false with a role below the panel role: the default panel role steps aside, an explicit one is refused.
M1-3 a save that changes the SMTP server, port, user or encryption must send the password again (secrets.reenterOnChange);
     new panel field smtpRequireTls.
M1-4 a restore of a version masks the secrets (maskSecretsOnRestore).
M1-7 a refused origin is logged once with the ways to allow it; default ports are normalised.
Minors: m1 day boundary, m3 e-mail check on reset and bulk update, m4 text of 'all', m5 the mask is never kept.
The account suite runs with 2FA off and on.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-11-25 00:39:23 +01:00
co-authored by Claude Fable 5.2
parent 81cee02e78
commit 1141c749de
28 changed files with 1557 additions and 457 deletions
+13 -4
View File
@@ -112,8 +112,10 @@ export type IpalOptions = {
* and link): `'admin'` (default), `'editor'`, `'all'`; an editor below that
* sees a neutral "an integration needs attention — ask an administrator",
* anyone else nothing. `cookies` — who sees the cookie crawl / approval
* alert: `'editor'` (default) or `'all'`. `'all'` = as before. A session
* that still owes its second factor sees none of them.
* alert: `'editor'` (default) or `'all'`. With a role (`'admin'`,
* `'editor'`) a session that still owes its second factor sees nothing.
* `'all'` = as before, and it checks NOTHING — no role and no second
* factor: whoever the dashboard is drawn for sees the full text.
*/
dashboardAlerts?: { cookies?: 'all' | 'editor'; integrations?: 'admin' | 'all' | 'editor' }
@@ -209,9 +211,16 @@ export type IpalOptions = {
* value or the mask keeps what is stored, `'[[clear]]'` removes it. Server
* code reads the real value through the Local API (access control off, the
* default). `{ writeOnly: false }` = the value is returned to whoever may
* read the global, as before 1.16.7. docs/security.md "Stored secrets".
* read the global, as before 1.16.7.
*
* The SMTP password is bound to its server: a save in the panel that changes
* the server, the port, the user name, the transport or "require an encrypted
* connection" must send the password again, or remove it — otherwise a stolen
* admin session points the server at its own machine and a test e-mail hands
* the password over. `{ reenterOnChange: false }` = the stored password
* follows the new server. docs/security.md "Stored secrets".
*/
secrets?: { writeOnly?: false }
secrets?: { reenterOnChange?: false; writeOnly?: false }
seo?: SeoOption
/** Additional fields injected into SiteSettings global */