M1 review round 2: docs, agent guide, skills, changelog; the reference types without the removed field
Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5.2
parent
7002ebbfa6
commit
3e44863c98
@@ -104,10 +104,11 @@ through this procedure. Ask only when you are missing something you cannot get y
|
||||
| `POST /api/<slug>/first-register` answers `403` on an empty collection | `accounts.firstUserRoute`: only the panel's login collection may register its first account that way (the plugin's own endpoint sits in front of Payload's) | an admin creates the account; or the collection's own `create: () => true` (sign-up); or `accounts: { firstUserRoute: ['<slug>'] }` |
|
||||
| an editor (or a script with its token) gets `403` creating an account in the project's own `users` | `accounts.adminOnlyCreate`: only admins create staff accounts where the roles are the plugin's | create as an admin; or write the collection's `create` rule; or `adminOnlyCreate: false` |
|
||||
| an account gets `403` changing or deleting ANOTHER account of a staff collection (it worked before) | `accounts.adminOnlyWrite`: an admin, or the account itself (update only); on a collection with roles of its own: accounts of that collection | do it as an admin; or write the collection's `update` / `delete` rule; or `adminOnlyWrite: false` |
|
||||
| an account saves its own profile and its `roles` do not change (no error) | `accounts.adminOnlyWrite`: nobody changes its own roles; with the plugin's roles only an admin changes roles | an admin changes the role; or give the `roles` field its own `access.update` |
|
||||
| a logged-in visitor (customer) gets `403` reading a staff collection — an author box went empty | `accounts.staffOnlyRead`: only staff accounts read a staff collection without a `read` rule | write that collection's `read` rule; or `staffOnlyRead: false` |
|
||||
| the site does not start: `[ipal] access names "…" as a staff collection, but this config has no auth collection with that slug` | a slug in `access.staffCollections` / `access.authCollection` is not an auth collection (a typo, a removed collection) | fix the slug or add the collection |
|
||||
| a fresh site with `access.firstUserAdmin: false`: the first account sees "Unauthorized", or the start fails with `leaves a fresh site with nobody who can open the panel` | the first account gets the default role, below the panel role | `access.defaultRole: 'editor'`, or `accounts: { panelRole: false }`, or drop `firstUserAdmin: false` |
|
||||
| saving Site integrations fails on the password field: "Enter the password again…" | the server, port, user name or "Require encryption" changed (or the transport switched to SMTP) and the stored SMTP password is kept only for the settings it was saved with | type the password again; or "Remove the stored value" for a server without one; a seed with the Local API is not asked; `secrets: { reenterOnChange: false }` |
|
||||
| e-mail fails with `Error upgrading connection with STARTTLS` | "Require encryption" is ticked and the server offers no STARTTLS on that port | the right port (587, or 465); or untick it (the password then travels unencrypted) |
|
||||
| SQL site after the upgrade: Site integrations cannot be read, `column "smtp_require_tls" does not exist` | the new checkbox needs a migration | `pnpm payload migrate:create`, commit, deploy (deployment.md §4.3) |
|
||||
| saving Site integrations fails on the password field: "Enter the password again…" | the server, port or user name changed and the stored SMTP password is kept only for the settings it was saved with — also when the transport says Microsoft Graph | type the password again; or "Remove the stored value" for a server without one; a seed with the Local API is not asked; `secrets: { reenterOnChange: false }` |
|
||||
| creating an account / changing a password fails with "The password must have at least 12 characters." | `accounts.password` (applies to new passwords of staff accounts, in scripts too) | a longer password; `accounts: { password: { minLength } }` or `false` |
|
||||
| the API returns `"smtpPassword":"********"` / own code "lost" the SMTP password or Turnstile secret | write-only secrets: reads through access control never get the value | read on the server: `payload.findGlobal({ slug: 'site-integrations' })` (access control off); `secrets: { writeOnly: false }` restores the old behaviour |
|
||||
| the SMTP password "disappears" after saving Site integrations | it does not: the field shows "A value is set"; an empty save keeps it | to change it type a new one; to remove it press "Remove the stored value" (API: `'[[clear]]'`) |
|
||||
|
||||
@@ -34,11 +34,12 @@ description: Complete map of everything @intecion/ipal-kit provides — every ip
|
||||
| `accounts` | on (all rules) | rules for the accounts of the staff collection; each key below | `false` = none of them |
|
||||
| `accounts.panelRole` | `'editor'` | the lowest role that may open the admin panel (Payload's `access.admin` on the collection with the roles): an account with only `user` sees "Unauthorized"; the API is not touched; the role decides, not the second factor. First start logs `N account(s) … cannot open the admin panel` (an error when it is everyone). Needs `access` | `'user'` / `false` = everyone, as before; `'admin'`; your own `access.admin` / `access.authAccess.admin` wins |
|
||||
| `accounts.adminOnlyCreate` | on | a staff collection (panel login collection, `access.authCollection`, `access.staffCollections`) without a `create` rule gets one instead of Payload's "any logged-in user" — also the project's own collection. With the plugin's roles (`access.authCollection`, or a `roles` select with only `user` / `editor` / `admin`): an admin, fully signed in. With roles of its own, or none: an account of that same collection, or a plugin admin of another staff collection | `false` = Payload's default; a `create` rule you wrote always wins |
|
||||
| `accounts.adminOnlyWrite` | on | the same for `update` and `delete`: with the plugin's roles — update: an admin or the account itself, delete: an admin; otherwise an account of that same collection, or a plugin admin. Closes Payload's default, under which a visitor account could change a staff account's password. `read` is not touched | `false` = Payload's default; rules you wrote always win |
|
||||
| `accounts.adminOnlyWrite` | on | the same for `update`, `delete` and `unlock`: with the plugin's roles — update: an admin or the account itself; delete, unlock: an admin; otherwise an account of that same collection, or a plugin admin. With it the collection's `roles` field (when it has no `access.update`) is closed for self-promotion: with the plugin's roles only an admin changes roles; with role values of the project's own an account never changes its own (the plugin cannot rank them — write that collection's rules). Closes Payload's default, under which a visitor account could change a staff account's password | `false` = Payload's default, the `roles` field left alone; rules you wrote always win |
|
||||
| `accounts.staffOnlyRead` | on | `read` on a staff collection without a `read` rule: a fully signed-in account of a staff collection (Payload's default let a visitor account list the staff accounts) | `false` = Payload's default; a `read` rule you wrote wins |
|
||||
| `accounts.firstUserRoute` | `'panel'` | which auth collections `POST /api/<slug>/first-register` answers for while they are empty: only the one the panel logs in with (the first account of a site → admin). Others get `403`, a second staff collection included, in any spelling of the URL (the plugin's own endpoint sits in front of Payload's); a collection whose own `create` allows an anonymous request keeps its route. With `access.firstUserAdmin: false` and a default role below the panel role, the default `panelRole` is not applied (logged) and an explicit one is refused at start | a list of slugs; `'all'` = Payload's behaviour |
|
||||
| `accounts.password` | `{ minLength: 12 }` | when a password is SET on a staff collection (create, first-user screen, change, reset by e-mail; panel, API and Local API): at least `minLength` characters, not the account's e-mail address. Existing passwords are never checked — a shorter one keeps logging in | `{ minLength }`; `false` = Payload's rule (3 characters) |
|
||||
| `secrets.writeOnly` | on | `smtpPassword` and `turnstileSecretKey` (Site integrations) are never returned: REST, GraphQL and the panel get `'********'` when a value is stored; a save with nothing / empty / the mask keeps it, a new value replaces it, `'[[clear]]'` removes it; the Local API with access control off reads the real value. The panel is the source of these secrets — no env variable. A restore of a version is masked too | `false` = returned to whoever may read the global, as before |
|
||||
| `secrets.reenterOnChange` | on | a save through access control that changes `smtpHost`, `smtpPort`, `smtpUser`, `smtpRequireTls`, or switches `emailTransport` to SMTP, while a password is stored, must send the password again or remove it (`400` on the field otherwise) — so an admin session cannot send the stored password to a server of its own. The Local API with access control off is not asked | `false` = the stored password follows the new server |
|
||||
| `secrets.reenterOnChange` | on | a save through access control that changes `smtpHost`, `smtpPort` or `smtpUser` while a password is stored must send the password again or remove it (`400` on the field otherwise), whatever `emailTransport` says — so an admin session cannot send the stored password to a server of its own. A change of the transport alone, and the Local API with access control off, are not asked | `false` = the stored password follows the new server |
|
||||
| `dashboardAlerts` | `{ integrations: 'admin', cookies: 'editor' }` | who sees the plugin's dashboard alerts: integration details (error text, link) for `integrations` and above, a neutral "ask an administrator" for editors below it, nothing for others; the cookie crawl / approval alert for `cookies` and above. With a role, a session that owes its second factor sees none | `integrations: 'editor' | 'all'`, `cookies: 'all'` (`'all'` = as before: no role and no second factor is checked) |
|
||||
| `adminRoute` | `'/admin'` | `config.routes.admin`; stats link and views, `IntegrationAlerts` | the project moves `app/(payload)/<route>/` itself and adds the route to the proxy matcher (security.md) |
|
||||
| `twoFactor` | **none = error** | `@clocklimited/payload-2fa` with `forceSetup: true` (TOTP enforced, also checked in the API) | `twoFactor: false` (discouraged); omitting the option throws `[ipal] twoFactor.issuer is required` |
|
||||
|
||||
@@ -67,10 +67,10 @@ Admin panel components from `@intecion/ipal-kit/admin` — the project does NOT
|
||||
| `isAdmin(user, source?)` | `@intecion/ipal-kit`; in client components `@intecion/ipal-kit/client` | Predicate → `boolean`: staff account with the `admin` role (see `hasMinimumRole`). In hooks and endpoints: `isAdmin(req.user, req.payload)`; in a client component: `isAdmin(user, config)` from `/client` — the main entry does not build there with webpack (`'server-only' cannot be imported…`). |
|
||||
| `isEditor(user, source?)` | `@intecion/ipal-kit`; in client components `@intecion/ipal-kit/client` | Predicate → `boolean`: staff account with `editor` or higher. |
|
||||
| `panelAccess(minimum?)`, `applyPanelRole(config, slug, role)`, `resolvePanelRole(option)`, `countBelowPanelRole(payload, slug, role)`, `DEFAULT_PANEL_ROLE` | `@intecion/ipal-kit` | `accounts.panelRole`: an `access.admin` function ("holds at least `minimum`", default `'editor'`; role only, not the second factor); the applier (skips a collection that has its own `access.admin`); the option → role or `null` when off; `{ all, below }` counts for the start-up line; `'editor'`. |
|
||||
| `staffCreateAccess`, `staffUpdateAccess(slug)`, `sameStaffCollectionAccess(slug)`, `hasPluginRoles(collection)`, `applyStaffAccountAccess(config, staffSlugs, { create?, write?, pluginRoles? })` | `@intecion/ipal-kit` | `accounts.adminOnlyCreate` / `adminOnlyWrite`: the access functions — "an admin, fully signed in" (create, delete); "an admin, or the account itself" (update; self = an account of THAT collection); "an account of this staff collection, or a plugin admin of another" (a collection whose roles are not the plugin's); whether a collection carries the plugin's roles (a top-level `roles` select with only `user` / `editor` / `admin`); the applier — puts the rules on the named staff collections for the operations that have none, `pluginRoles` = slugs whose roles field is injected later. Run it before any plugin that wraps access (the 2FA package). |
|
||||
| `buildFirstUserEndpoint(option?)`, `applyFirstUserRoute(config, option?)`, `openSignUpCollections(payload)`, `staffCollectionsOpenToOthers(payload)` | `@intecion/ipal-kit` | `accounts.firstUserRoute`: the plugin's own `POST /first-register` collection endpoint, matched before Payload's — `403` unless the collection is the panel's login collection (`'panel'`), is in the list, or its own `create` lets an anonymous request through; otherwise it calls Payload's handler (and sets `req.context.ipalFirstRegister`); the applier (every auth collection; `'all'` adds nothing; `endpoints: false` is left alone). For the doctor: slugs of auth collections with open sign-up; `'<slug>:<operation>'` for every staff collection an account of a non-staff collection may create in, update or delete from. |
|
||||
| `staffCreateAccess`, `staffUpdateAccess(slug)`, `staffReadAccess`, `sameStaffCollectionAccess(slug)`, `rolesByAdminOnly`, `rolesNotOwn(slug)`, `hasPluginRoles(collection)`, `applyStaffAccountAccess(config, staffSlugs, { create?, write?, read?, pluginRoles? })` | `@intecion/ipal-kit` | `accounts.adminOnlyCreate` / `adminOnlyWrite` / `staffOnlyRead`: the access functions — "an admin, fully signed in" (create, delete, unlock); "an admin, or the account itself" (update; self = an account of THAT collection); "a fully signed-in account of a staff collection" (read); "an account of this staff collection, or a plugin admin of another" (a collection whose roles are not the plugin's); the two field-access functions for a `roles` field (`update`: only an admin / never the account itself); whether a collection carries the plugin's roles (a `roles` select at the top level of the data with only `user` / `editor` / `admin`); the applier — puts the rules on the named staff collections for the operations that have none and closes the `roles` field where the plugin's `update` rule is in force, `pluginRoles` = slugs whose roles field is injected later. Run it before any plugin that wraps access (the 2FA package). |
|
||||
| `buildFirstUserEndpoint(option?)`, `applyFirstUserRoute(config, option?)`, `adoptLateAuthCollections(payload, staffSlugs, { access?, beforeOperation?, firstUserRoute? })`, `unknownStaffCollections(payload, staffSlugs)`, `openSignUpCollections(payload)`, `staffCollectionsOpenToOthers(payload)`, `staffCollectionsOnOwnRoles(payload)` | `@intecion/ipal-kit` | `accounts.firstUserRoute`: the plugin's own `POST /first-register` collection endpoint, matched before Payload's — `403` unless the collection is the panel's login collection (`'panel'`), is in the list, or its own `create` lets an anonymous request through; otherwise it calls Payload's handler (and sets `req.context.ipalFirstRegister`); the applier (every auth collection; `'all'` adds nothing; `endpoints: false` is left alone). For the doctor: slugs of auth collections with open sign-up; `'<slug>:<operation>'` for every staff collection an account of a non-staff collection may create in, read, update, delete from or unlock; slugs of staff collections with role values of their own on the default rules. `adoptLateAuthCollections` gives auth collections that a plugin listed after ipalKit added the same rules on the live config (called by the plugin at start and on a dev reload; returns the slugs); `unknownStaffCollections` lists staff slugs that are not auth collections (the plugin stops the start on any). |
|
||||
| `checkPassword(password, { email?, minLength? })`, `buildPasswordRuleHook({ minLength? })`, `applyPasswordRule(config, slugs, rule)`, `resolvePasswordRule(option)`, `DEFAULT_PASSWORD_MIN_LENGTH` | `@intecion/ipal-kit` | `accounts.password`: `'short' \| 'email' \| null` for a new password (length in characters); the `beforeOperation` hook for `create` / `update` / `resetPassword` (throws Payload's `ValidationError` on `password`, text in the panel's language; the account's address is looked up by id, reset token or bulk query when the request carries none; a password that is not text is refused; login is never checked); the applier; the option → `{ minLength }` or `null`; `12`. |
|
||||
| `writeOnlySecret(field, options?)`, `writeOnlySecrets(fields, names, optionsByName?)`, `maskSecretAfterRead`, `keepSecretBeforeValidate`, `buildKeepSecret(options?)`, `SECRET_MASK`, `SECRET_CLEAR`, `isSecretMask(value)`, `INTEGRATION_SECRET_FIELDS`, `SMTP_PASSWORD_BOUND_TO` | `@intecion/ipal-kit` | Write-only secret fields (`secrets.writeOnly`): the wrapper for one field and for named fields anywhere in a tree (tabs, rows, groups); the two field hooks (reads through access control get `'********'`, the Local API with access control off gets the value; a save with nothing / empty / the mask keeps the stored value, `'[[clear]]'` removes it); the hook builder with options — `{ boundTo: ['siblingField'], appliesWhen?: (siblingData) => boolean }`: a save through access control that changes a bound sibling field without sending the secret throws a `ValidationError` on the secret (`secrets.reenterOnChange`); the two constants; the plugin's own secret field names (`smtpPassword`, `turnstileSecretKey`); the fields the SMTP password is bound to (`emailTransport`, `smtpHost`, `smtpPort`, `smtpUser`, `smtpRequireTls`). |
|
||||
| `writeOnlySecret(field, options?)`, `writeOnlySecrets(fields, names, optionsByName?)`, `maskSecretAfterRead`, `keepSecretBeforeValidate`, `buildKeepSecret(options?)`, `SECRET_MASK`, `SECRET_CLEAR`, `isSecretMask(value)`, `INTEGRATION_SECRET_FIELDS`, `SMTP_PASSWORD_BOUND_TO` | `@intecion/ipal-kit` | Write-only secret fields (`secrets.writeOnly`): the wrapper for one field and for named fields anywhere in a tree (tabs, rows, groups); the two field hooks (reads through access control get `'********'`, the Local API with access control off gets the value; a save with nothing / empty / the mask keeps the stored value, `'[[clear]]'` removes it); the hook builder with options — `{ boundTo: ['siblingField'], appliesWhen?: (siblingData) => boolean }`: a save through access control that changes a bound sibling field without sending the secret throws a `ValidationError` on the secret (`secrets.reenterOnChange`); the two constants; the plugin's own secret field names (`smtpPassword`, `turnstileSecretKey`); the fields the SMTP password is bound to (`smtpHost`, `smtpPort`, `smtpUser` — not the transport: the mail adapter may fall back to SMTP). |
|
||||
| `maskSecretsOnRestore`, `maskWriteOnlySecrets(data, fields)` | `@intecion/ipal-kit` | Versions and write-only secrets: the `afterRead` hook for a global or a collection (a restore answers with the version document, fields under `version`, where field hooks do not run — it masks them there for reads through access control); the walker it uses (masks every write-only field in `data`, following tabs, rows, groups, arrays and blocks). On Site integrations by default; add the hook to your own entity that has both. |
|
||||
| `requestFromOwnOrigin(req, extraOrigins?)`, `ownOrigins(req, extraOrigins?)`, `reportRefusedOrigin(req, extraOrigins?)` | `@intecion/ipal-kit` | `twoFactor.sameOrigin`: `false` when a browser marks the request as coming from another origin (`Origin` not among the request's host, `serverURL`, `csrf`, `cors`, the extras; a default port written out on the host is ignored; else `Sec-Fetch-Site` not `same-origin` / `none`); `true` without those headers. `ownOrigins` → `{ hosts, origins }`. `reportRefusedOrigin` writes one log line per refused origin and process (at most 50) with the ways to allow it, and returns whether it wrote. For your own state-changing endpoint. |
|
||||
| `buildVerifyLimit(collection, { max?, windowMinutes?, store? })`, `verifyLimitKey(collection, id)`, `clearVerifyLimits()` | `@intecion/ipal-kit` | `twoFactor.verifyLimit`: `async (req) => Response \| null` — counts an attempt of `req.user` in memory and, unless `store: 'memory'`, in `payload.kv`; a `429` with `Retry-After` past `max`. The kv key of an account's count; emptying the in-memory counts (tests). |
|
||||
@@ -81,7 +81,7 @@ Admin panel components from `@intecion/ipal-kit/admin` — the project does NOT
|
||||
| `buildRolesField(defaultRole?, { firstUserAdmin? })` | `@intecion/ipal-kit` | The `roles` select field the plugin injects (only admins set roles; `firstUserAdmin` default `true` = the account made on "Create first user" gets `admin`). The plugin wires it itself — use it only for an auth collection the plugin does not manage. |
|
||||
| `injectRoles(config, accessOption)` | `@intecion/ipal-kit` | Adds `roles` to `accessOption.authCollection` in a config. The plugin calls it itself with `access` — do not call. |
|
||||
|
||||
**Types:** `AccountsOptions` (`accounts`: `panelRole`, `adminOnlyCreate`, `adminOnlyWrite`, `firstUserRoute`, `password`), `WriteOnlySecretOptions` (`{ boundTo?, appliesWhen? }`), `PasswordRuleOptions` (`{ minLength? }`), `FirstUserRouteOption` (`'panel' \| 'all' \| string[]`), `TurnstileOnConfigError` / `TurnstileOnConfigErrorOption` / `TurnstileFormKind` (`@intecion/ipal-kit/server`), `VerifyLimitOptions` (`twoFactor.verifyLimit`: `{ max?, windowMinutes?, store? }`), `RequireSetupOptions` (`twoFactor.requireSetup`), `TwoFactorResetOptions`, `TwoFactorSetupState`, `SafeBackRule` / `SafeBackContext` (`twoFactor.safeBack` as a function: `(back, { adminRoute, origin? }) => string`), `TotpViewComponent` (a view component as registered: a path or `{ path, exportName?, clientProps?, serverProps? }`), `SafeTotpViewProps` (`@intecion/ipal-kit/admin`), `Role` (`'user' \| 'editor' \| 'admin'`), `AccessOption` (the plugin's `access` option: `authCollection`, `defaultRole`, `authAccess`, `firstUserAdmin`, `staffCollections`).
|
||||
**Types:** `AccountsOptions` (`accounts`: `panelRole`, `adminOnlyCreate`, `adminOnlyWrite`, `staffOnlyRead`, `firstUserRoute`, `password`), `StaffAccountAccessOptions` (`{ create?, write?, read?, pluginRoles? }`), `StaffAccountRules` (what the plugin put on a staff collection, in `custom.ipalAccountRules`: `{ applied, ownRoles }`), `WriteOnlySecretOptions` (`{ boundTo?, appliesWhen? }`), `PasswordRuleOptions` (`{ minLength? }`), `FirstUserRouteOption` (`'panel' \| 'all' \| string[]`), `TurnstileOnConfigError` / `TurnstileOnConfigErrorOption` / `TurnstileFormKind` (`@intecion/ipal-kit/server`), `VerifyLimitOptions` (`twoFactor.verifyLimit`: `{ max?, windowMinutes?, store? }`), `RequireSetupOptions` (`twoFactor.requireSetup`), `TwoFactorResetOptions`, `TwoFactorSetupState`, `SafeBackRule` / `SafeBackContext` (`twoFactor.safeBack` as a function: `(back, { adminRoute, origin? }) => string`), `TotpViewComponent` (a view component as registered: a path or `{ path, exportName?, clientProps?, serverProps? }`), `SafeTotpViewProps` (`@intecion/ipal-kit/admin`), `Role` (`'user' \| 'editor' \| 'admin'`), `AccessOption` (the plugin's `access` option: `authCollection`, `defaultRole`, `authAccess`, `firstUserAdmin`, `staffCollections`).
|
||||
|
||||
## Accessibility — widget (`accessibility`) — details: `node_modules/@intecion/ipal-kit/docs/accessibility.md`
|
||||
|
||||
|
||||
@@ -250,9 +250,14 @@ the panel shows Site settings, Site integrations, Cookies, Form messages, the Fo
|
||||
- **Account rules** (`accounts`, on by default; `false` or key by key to change): the panel opens for `editor`
|
||||
and above (`panelRole`; an account with only `user` sees "Unauthorized", the API is not touched — give panel
|
||||
users at least `editor`); only an admin creates staff accounts, and an account is changed by an admin or by
|
||||
itself — also in the project's own staff collection (`adminOnlyCreate`, `adminOnlyWrite`; a staff collection
|
||||
with role values of its own gets "an account of that collection, or a plugin admin" instead, so write its
|
||||
`create` / `update` / `delete` / `read` rules yourself); Payload's first-user route answers only for the
|
||||
itself, nobody changes its own roles, and only staff accounts read staff accounts — also in the project's own
|
||||
staff collection and in one a later plugin adds (`adminOnlyCreate`, `adminOnlyWrite`, `staffOnlyRead`). **A
|
||||
staff collection with role values of its own** (not `user` / `editor` / `admin`) gets only "an account of that
|
||||
collection, or a plugin admin": the plugin cannot rank your roles, so inside it every account may create an
|
||||
account with any role — **write its `create` / `update` / `delete` rules and the field access of its `roles`
|
||||
field yourself** (`ipal-doctor --url` → `staff-own-roles`). Give every staff collection a `roles` field: without
|
||||
one each of its accounts is an admin to the plugin. Every slug in `access.staffCollections` must be an auth
|
||||
collection of the config, or the site does not start; Payload's first-user route answers only for the
|
||||
panel's login collection (`firstUserRoute`) — so **create the first account right after the first deploy**, it
|
||||
becomes the admin; a new password has at least 12 characters (`password`). A customer collection with
|
||||
sign-up: write its own `create: () => true`; the rules do not touch it. Do not combine
|
||||
@@ -266,8 +271,7 @@ the panel shows Site settings, Site integrations, Cookies, Form messages, the Fo
|
||||
them; `TURNSTILE_SECRET_KEY` is deprecated (local test keys in `.env` still work). Read them only on the
|
||||
server with the Local API. `secrets: { writeOnly: false }` turns it off. Changing the SMTP server, port or
|
||||
user name in the panel asks for the password again (`secrets.reenterOnChange`); a seed with the Local API is
|
||||
not asked. Tick **Require encryption** in Site integrations → E-mail sending where the mail server supports
|
||||
STARTTLS (off by default; the field `smtpRequireTls` needs a migration on Postgres / SQLite).
|
||||
not asked.
|
||||
- **Forms with files** are refused while Turnstile cannot check (wrong keys, Cloudflare down); text forms are
|
||||
still accepted. `forms: { turnstileOnConfigError: … }` changes either.
|
||||
- A second auth collection (`customers`, a client zone): set `admin: { user: 'users' }` in `buildConfig`; its
|
||||
|
||||
@@ -424,11 +424,10 @@ setup screen with "Set up two-step verification by …"; after the code it is in
|
||||
account → "Two-step verification: Set up." and the reset button; delete the account.
|
||||
|
||||
**→ the release with `accounts` / `secrets` (CHANGELOG "Unreleased — hardening"; PROGRAMISTA §6, item 69) — read every point, most sites change nothing:**
|
||||
1. Update the package, `pnpm install`, `pnpm ipal:skills`, `pnpm payload generate:types`. No import-map change.
|
||||
**One new field**: `smtpRequireTls` (a checkbox) in Site integrations — MongoDB needs nothing; **Postgres /
|
||||
SQLite: `pnpm payload migrate:create`, commit, deploy the migration with the code** (deployment.md §4.3), or
|
||||
Site integrations cannot be read (no e-mail, no Turnstile). The verify count uses Payload's own `payload-kv`
|
||||
collection.
|
||||
1. Update the package, `pnpm install`, `pnpm ipal:skills`, `pnpm payload generate:types`. No import-map change, **no
|
||||
schema change and no migration** on any database (the verify count uses Payload's own `payload-kv`
|
||||
collection). `grep -n "staffCollections\|authCollection" src/payload.config.ts`: every slug there must be an
|
||||
auth collection of the config — a wrong one now stops the start with the slug in the message.
|
||||
2. **Panel access by role.** After the first start read the log: `[ipal] N account(s) of "users" are below the
|
||||
role "editor" and cannot open the admin panel`. Those accounts (role `user`, or no role) now see
|
||||
"Unauthorized" in the panel. Give the people who work in the panel `editor`, or set
|
||||
@@ -440,11 +439,9 @@ account → "Two-step verification: Set up." and the reset button; delete the ac
|
||||
them over REST / GraphQL as an admin, or with `overrideAccess: false`, now gets `'********'`: read them on the
|
||||
server with `payload.findGlobal({ slug: 'site-integrations' })`. A script that saves the whole global back
|
||||
keeps the secrets (the mask means "keep"). **New:** a save in the panel or over the API that changes the SMTP
|
||||
server, port, user name or "Require encryption" must send the password again ("Enter the password again…");
|
||||
a script that does that over REST / GraphQL sends the password with it, a seed with the Local API is not
|
||||
asked. `secrets: { reenterOnChange: false }` turns it off. With the owner, consider ticking **Require
|
||||
encryption** (Site integrations → E-mail sending) where the server supports STARTTLS, then send a test
|
||||
e-mail. During a rolling update a page opened under the new version and saved against the OLD one stores
|
||||
server, port or user name must send the password again ("Enter the password again…"), also when the transport
|
||||
is set to Microsoft Graph; a script that does that over REST / GraphQL sends the password with it, a seed
|
||||
with the Local API is not asked. `secrets: { reenterOnChange: false }` turns it off. During a rolling update a page opened under the new version and saved against the OLD one stores
|
||||
`********` as the password: after the deploy, check that a test e-mail goes out.
|
||||
4. **`TURNSTILE_SECRET_KEY` is deprecated** (it still works). If the log says `[ipal] Deprecated: the Turnstile
|
||||
secret key comes from the TURNSTILE_SECRET_KEY environment variable` or `ipal-doctor --url` reports
|
||||
@@ -455,18 +452,26 @@ account → "Two-step verification: Set up." and the reset button; delete the ac
|
||||
File field is now refused (text forms are accepted as before). Check `ipal-doctor --url` → no
|
||||
`turnstile-degraded`; to keep the old behaviour: `forms: { turnstileOnConfigError: { files: 'allow' } }`.
|
||||
6. **Account creation and changes.** A project whose **own** staff collection has no `create` / `update` /
|
||||
`delete` rule gets one (before: any signed-in account of any auth collection — a customer could change a
|
||||
staff password):
|
||||
`delete` / `unlock` / `read` rule gets one (before: any signed-in account of any auth collection — a customer
|
||||
could change a staff password, list the staff accounts, lift a login lock):
|
||||
- the collection carries the plugin's roles (`access.authCollection`, or a `roles` select with only `user` /
|
||||
`editor` / `admin`): create and delete — an admin; update — an admin or the account itself. **Check:** does
|
||||
a non-admin create or edit other accounts there today? Then write the rule you want;
|
||||
`editor` / `admin`): create, delete, unlock — an admin; update — an admin or the account itself; its
|
||||
`roles` field — only an admin (when the field has no `access.update` of its own). **Check:** does a
|
||||
non-admin create or edit other accounts, or change roles, there today? Then write the rule you want;
|
||||
- the collection has **role values of its own** (`superadmin`, …) or no roles: accounts of that collection
|
||||
keep working as before; accounts of other collections are refused. Nothing to do, but write your own rules
|
||||
— the plugin does not know your roles.
|
||||
keep working as before, except that an account no longer changes its **own** roles; accounts of other
|
||||
collections are refused. **Write your own rules** — the plugin does not know your roles, and inside the
|
||||
collection every account can still create an account with any role (`ipal-doctor --url` →
|
||||
`staff-own-roles`);
|
||||
- `read`: only staff accounts read a staff collection. **Check:** does the front end show staff accounts
|
||||
(an author box) to logged-in visitors with the visitor's session? Then write that collection's `read` rule,
|
||||
or `accounts: { staffOnlyRead: false }`. Anonymous visitors never could.
|
||||
A staff collection added by a plugin listed after ipalKit gets the same rules at start.
|
||||
`first-register` on any auth collection other than the panel's login collection answers `403` unless that
|
||||
collection allows sign-up. `access.firstUserAdmin: false` with a default role below `editor`: the panel role
|
||||
is not applied (a warning at start), or — with `accounts.panelRole` set — the start fails with the fix in the
|
||||
message. Wanted otherwise: `accounts: { adminOnlyCreate: false, adminOnlyWrite: false, firstUserRoute: 'all' }`.
|
||||
message. Wanted otherwise: `accounts: { adminOnlyCreate: false, adminOnlyWrite: false, staffOnlyRead: false,
|
||||
firstUserRoute: 'all' }`.
|
||||
7. **Passwords.** New passwords of staff accounts need 12 characters; **existing shorter passwords keep
|
||||
working** — nobody is logged out or asked to change. A script that creates staff accounts with a short
|
||||
password fails with a validation error: lengthen it, or `accounts: { password: { minLength: 8 } }`.
|
||||
@@ -482,7 +487,7 @@ account → "Two-step verification: Set up." and the reset button; delete the ac
|
||||
error text; accounts with only `user` see no alerts. `dashboardAlerts: { integrations: 'all' }` restores it
|
||||
(`'all'` checks no role and no second factor).
|
||||
**Check:** `pnpm exec ipal-doctor --url <site>` (new rules: `access-missing`, `csrf-empty`, `open-signup`,
|
||||
`staff-accounts-open`, `turnstile-degraded`, `turnstile-env-key`); as an admin `GET /api/globals/site-integrations` shows
|
||||
`staff-accounts-open`, `staff-own-roles`, `turnstile-degraded`, `turnstile-env-key`); as an admin `GET /api/globals/site-integrations` shows
|
||||
`"smtpPassword":"********"`; a test e-mail and a test form still work; an editor and an admin still log in.
|
||||
|
||||
## 2. Inventory (no code changes)
|
||||
|
||||
Reference in New Issue
Block a user