M1 review: docs, agent guide, skills and changelog follow the fixes
Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5.2
parent
1141c749de
commit
fd203de326
+79
-25
@@ -11,8 +11,12 @@ once there are more than 20.
|
||||
## Unreleased — hardening (M1; version to be set at release)
|
||||
|
||||
> **Read before upgrading.** Several defaults get stricter. Most sites change nothing, but check
|
||||
> "Requires project changes": an account with only the role `user` can no longer open the panel, and a form with
|
||||
> files is refused while Turnstile is misconfigured. No import-map change, no schema change, no migration.
|
||||
> "Requires project changes". What can stop people: an account with only the role `user` can no longer open the
|
||||
> panel; a form with files is refused while Turnstile is misconfigured; a script that creates staff accounts
|
||||
> with a password under 12 characters fails; behind a proxy that hides the site's address and without
|
||||
> `serverURL` nobody can enter a 2FA code; a project's own staff collection without access rules gets rules;
|
||||
> changing the SMTP server in the panel asks for the password again. No import-map change. One new field
|
||||
> (`smtpRequireTls`): **Postgres / SQLite need a migration**, MongoDB nothing.
|
||||
|
||||
### Security
|
||||
- **Stored secrets are write-only.** `smtpPassword` and `turnstileSecretKey` (Site integrations) were returned
|
||||
@@ -21,49 +25,78 @@ once there are more than 20.
|
||||
only server code (the Local API with access control off) reads the value. A save that sends nothing, an empty
|
||||
value or the mask keeps the stored value; `'[[clear]]'` removes it. The panel is the source of these secrets
|
||||
([security.md](./security.md) "Stored secrets").
|
||||
- **Nobody creates an account for themselves.** (1) Payload's first-user route
|
||||
- **The SMTP password stays with the server it was saved for.** Hiding the value was not enough: an admin
|
||||
session could point the SMTP server at a machine of its own and have a test e-mail deliver the password. A
|
||||
save in the panel or over the API that changes the server, the port, the user name or "Require encryption"
|
||||
(or switches the transport to SMTP) while a password is stored must now send the password again, or remove
|
||||
it (`secrets.reenterOnChange`). Server code with the Local API is not asked.
|
||||
- **"Require encryption" for SMTP** (`smtpRequireTls` in Site integrations → E-mail sending, off by default):
|
||||
with it the password is never sent over an unencrypted connection (a server without STARTTLS gets nothing).
|
||||
- **Restoring a version of Site integrations** (only where a project turned versions on for that global)
|
||||
answered with the stored secrets; they are masked there too (`maskSecretsOnRestore`).
|
||||
- **Nobody creates an account for themselves, or takes one over.** (1) Payload's first-user route
|
||||
(`POST /api/<slug>/first-register`) answers for every empty auth collection. On an empty **second staff
|
||||
collection** (`access.staffCollections`) the first visitor became a staff account — an admin to the plugin.
|
||||
It now answers only for the collection the panel logs in with. (2) A project's **own** staff collection without
|
||||
a `create` rule let any signed-in account create accounts (Payload's default); now only an admin does.
|
||||
Anonymous sign-up into the staff collection was already refused. No known site has a second staff collection
|
||||
It now answers only for the collection the panel logs in with, in any spelling of the URL (the plugin's own
|
||||
endpoint sits in front of Payload's). (2) A project's **own** staff collection without `create`, `update` or
|
||||
`delete` rules had Payload's default, "any logged-in user" — an account of any auth collection: a visitor
|
||||
account could create a staff account, or change a staff account's password and roles. Such a collection now
|
||||
gets rules for the operations it has none for: with the plugin's roles — an admin (update: or the account
|
||||
itself); with role values of its own, or none — an account of that same collection, or a plugin admin. The
|
||||
rules hold with 2FA on and off. Anonymous sign-up into the staff collection was already refused; the
|
||||
plugin's injected collection already had these rules. No known site has a second staff collection
|
||||
([access.md](./access.md) "Account rules").
|
||||
- **2FA verify and setup attempts only from the site's own origin.** A page on another origin that the browser
|
||||
still sends the login cookie to (a sibling subdomain, when neither `serverURL` nor `csrf` is set) could burn an
|
||||
account's five verify attempts and lock its owner out, without the password. Such requests are refused before
|
||||
they are counted. **The verify count is also stored in the database**, so a restart or a second instance no
|
||||
longer resets it.
|
||||
they are counted. A refusal is logged once per origin with the ways to allow it. **The verify count is also
|
||||
stored in the database**, so a restart or a second instance no longer resets it.
|
||||
- **Dashboard alerts no longer show integration error texts to every panel role**: details for admins, a neutral
|
||||
line for editors, nothing for others or for a session that still owes its second factor.
|
||||
line for editors, nothing for others or for a session that still owes its second factor (`'all'` restores the
|
||||
old behaviour and checks neither).
|
||||
|
||||
### Changed
|
||||
- **The admin panel opens for `editor` and above** (`accounts.panelRole`). An account that holds only `user`
|
||||
sees "Unauthorized" in the panel; the API is not touched.
|
||||
sees "Unauthorized" in the panel; the API is not touched. With `access.firstUserAdmin: false` and a default
|
||||
role below the panel role the first account of a fresh site could not get in: the default panel role is then
|
||||
not applied (a warning at start), and an explicit `accounts.panelRole` is refused at start with the fix.
|
||||
- **A password set on a staff account has at least 12 characters** and is not the account's e-mail address
|
||||
(`accounts.password`). Existing passwords are never checked.
|
||||
(`accounts.password`) — also in a reset by e-mail and a bulk update. Existing passwords are never checked.
|
||||
- **A form with files is refused while Turnstile cannot check** (wrong or missing secret, Cloudflare down); a
|
||||
text form is accepted as before (`forms.turnstileOnConfigError`).
|
||||
- **`TURNSTILE_SECRET_KEY` from the environment is deprecated.** It still works when the panel field is empty
|
||||
and logs a notice once per start. It will be removed in a later release, named here in advance.
|
||||
|
||||
### Added
|
||||
- Options: `accounts` (`panelRole`, `adminOnlyCreate`, `firstUserRoute`, `password`), `secrets.writeOnly`,
|
||||
`forms.turnstileOnConfigError`, `twoFactor.sameOrigin`, `twoFactor.verifyLimit.store`, `dashboardAlerts`.
|
||||
- Options: `accounts` (`panelRole`, `adminOnlyCreate`, `adminOnlyWrite`, `firstUserRoute`, `password`),
|
||||
`secrets.writeOnly`, `secrets.reenterOnChange`, `forms.turnstileOnConfigError`, `twoFactor.sameOrigin`,
|
||||
`twoFactor.verifyLimit.store`, `dashboardAlerts`. Panel: "Require encryption" (`smtpRequireTls`).
|
||||
- ipal-doctor rules: `access-missing` (no `access` option: every panel account is an admin), `csrf-empty`
|
||||
(neither `serverURL` nor `csrf`), and with `--url`: `open-signup` (info), `turnstile-degraded` (warning, error
|
||||
after a day), `turnstile-env-key`. The deep status gained `openSignUp`, `turnstile`, `turnstileSecretFromEnv`
|
||||
(states and slugs, never a key).
|
||||
(neither `serverURL` nor `csrf`), and with `--url`: `open-signup` (info), `staff-accounts-open` (error: a staff
|
||||
collection an account of another collection may write to), `turnstile-degraded` (warning, error after 24
|
||||
hours), `turnstile-env-key`. The deep status gained `openSignUp`, `staffOpenToOthers`, `turnstile`,
|
||||
`turnstileSecretFromEnv` (states and slugs, never a key).
|
||||
- Exports: `writeOnlySecret`, `writeOnlySecrets`, `SECRET_MASK`, `SECRET_CLEAR`, `maskSecretAfterRead`,
|
||||
`keepSecretBeforeValidate`, `isSecretMask`, `INTEGRATION_SECRET_FIELDS`; `panelAccess`, `applyPanelRole`,
|
||||
`resolvePanelRole`, `countBelowPanelRole`, `DEFAULT_PANEL_ROLE`; `staffCreateAccess`, `applyAdminOnlyCreate`,
|
||||
`buildFirstUserGuard`, `applyFirstUserRoute`, `openSignUpCollections`; `checkPassword`,
|
||||
`keepSecretBeforeValidate`, `buildKeepSecret`, `isSecretMask`, `INTEGRATION_SECRET_FIELDS`,
|
||||
`SMTP_PASSWORD_BOUND_TO`, `maskSecretsOnRestore`, `maskWriteOnlySecrets`; `panelAccess`, `applyPanelRole`,
|
||||
`resolvePanelRole`, `countBelowPanelRole`, `DEFAULT_PANEL_ROLE`; `staffCreateAccess`, `staffUpdateAccess`,
|
||||
`sameStaffCollectionAccess`, `hasPluginRoles`, `applyStaffAccountAccess`, `buildFirstUserEndpoint`,
|
||||
`applyFirstUserRoute`, `openSignUpCollections`, `staffCollectionsOpenToOthers`; `checkPassword`,
|
||||
`buildPasswordRuleHook`, `applyPasswordRule`, `resolvePasswordRule`, `DEFAULT_PASSWORD_MIN_LENGTH`;
|
||||
`requestFromOwnOrigin`, `ownOrigins`; `buildVerifyLimit`, `verifyLimitKey`, `clearVerifyLimits`;
|
||||
`requestFromOwnOrigin`, `ownOrigins`, `reportRefusedOrigin`; `buildVerifyLimit`, `verifyLimitKey`, `clearVerifyLimits`;
|
||||
`turnstileSecretFromEnv`, `TURNSTILE_SECRET_ENV`; from `/server`: `passTurnstile`, `passSubmitGates`,
|
||||
`resolveTurnstileOnConfigError`, `TURNSTILE_ON_CONFIG_ERROR_DEFAULT`.
|
||||
- `MaskedField` says "A value is set" for a write-only field and offers "Remove the stored value".
|
||||
|
||||
### Requires project changes
|
||||
- **Postgres / SQLite: a migration.** Site integrations has a new checkbox, `smtpRequireTls`:
|
||||
`pnpm payload migrate:create`, commit, deploy it with the code ([deployment.md](./deployment.md) §4.3). Without
|
||||
it the global cannot be read (no e-mail, no Turnstile check). MongoDB needs nothing.
|
||||
- **Set `serverURL`** if it is not set. Behind a reverse proxy that rewrites `Host` and sends no
|
||||
`X-Forwarded-Host` (nginx's plain `proxy_pass`; Coolify / Traefik keep `Host`) the server does not know its
|
||||
own address, and the 2FA code page is refused as "another origin": **nobody can enter a code**. The log says
|
||||
`[ipal] 2FA: a code from origin "…" was refused` once per origin, with the fix. Other ways out:
|
||||
`twoFactor: { …, sameOrigin: { origins: ['https://…'] } }`, or make the proxy send `X-Forwarded-Host`.
|
||||
- **Every site: read the first start's log.** `[ipal] N account(s) of "users" are below the role "editor" and
|
||||
cannot open the admin panel` — give the people who work in the panel `editor`, or set
|
||||
`accounts: { panelRole: 'user' }`. `NOBODY can open the admin panel` (an error): no account has the role —
|
||||
@@ -77,19 +110,39 @@ once there are more than 20.
|
||||
`turnstile-env-key`).
|
||||
- **Forms with a File field:** make sure Turnstile works (`ipal-doctor --url` → no `turnstile-degraded`); while
|
||||
it does not, those forms are refused. To keep accepting them: `forms: { turnstileOnConfigError: { files: 'allow' } }`.
|
||||
- **A project's own staff collection without a `create` rule:** only admins create accounts now. Write the rule
|
||||
you want, or `accounts: { adminOnlyCreate: false }`. `first-register` for other auth collections: `403` unless
|
||||
the collection allows sign-up, or `accounts: { firstUserRoute: 'all' }`.
|
||||
- **A project's own staff collection without `create` / `update` / `delete` rules** gets them. With the plugin's
|
||||
roles (`access.authCollection`, or a `roles` select with only `user` / `editor` / `admin`): only an admin
|
||||
creates and deletes accounts, and an account is changed by an admin or by itself — if non-admins did that on
|
||||
your site, write the rule you want. With **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 the
|
||||
plugin does not know your roles, so write your own rules. Off: `accounts: { adminOnlyCreate: false,
|
||||
adminOnlyWrite: false }`. `first-register` for other auth collections: `403` unless the collection allows
|
||||
sign-up, or `accounts: { firstUserRoute: 'all' }`.
|
||||
- **`access.firstUserAdmin: false`** with `access.defaultRole` below `editor`: the panel role is not applied (a
|
||||
warning at start); with `accounts.panelRole` set the start fails — set `access.defaultRole: 'editor'` or
|
||||
`accounts: { panelRole: false }`.
|
||||
- **A script that changes the SMTP server, port or user name over REST / GraphQL** must send the password with
|
||||
it (`400` "Enter the password again…" otherwise); a seed with the Local API is not asked. In the panel the
|
||||
person types the password again. `secrets: { reenterOnChange: false }` turns it off.
|
||||
- **A rolling update:** a Site integrations page opened under the new version and saved against the old one
|
||||
stores `********` as the password. After the deploy send a test e-mail.
|
||||
- **Scripts that create staff accounts with a password under 12 characters** fail with a validation error.
|
||||
Existing accounts with short passwords keep logging in.
|
||||
- **A panel or front end on another domain that posts to `/api/verify-totp`:**
|
||||
`twoFactor: { …, sameOrigin: { origins: ['https://…'] } }`.
|
||||
- **Recommended, with the owner:** tick "Require encryption" in Site integrations → E-mail sending where the
|
||||
mail server supports STARTTLS (type the password again when asked), then send a test e-mail.
|
||||
- `pnpm payload generate:types`, `pnpm ipal:skills`.
|
||||
|
||||
### Known limitations
|
||||
- Write-only protects the API and the panel, not the database: the two secrets are stored in plain text there
|
||||
and in backups (encryption at rest is not part of this release). A secret equal to `********` or `[[clear]]`
|
||||
cannot be stored.
|
||||
cannot be stored. A session that may send e-mail can still use the mailbox through the site (send, not
|
||||
read). "Require encryption" is off by default: until it is ticked, a server (or someone in between) that
|
||||
offers no STARTTLS on a port other than 465 gets the password in clear text, as before.
|
||||
- The account rules for a staff collection with role values of its own do not enforce those roles: inside the
|
||||
collection every account may create, change and delete accounts, as before. `read` is not touched: a staff
|
||||
collection of your own without a `read` rule is readable by any logged-in account (Payload's default).
|
||||
- The panel role and the password rule need `access` (roles) resp. a staff collection with password login; a
|
||||
second staff collection without a `roles` field is not affected by `panelRole`.
|
||||
- The stored verify count uses Payload's `payload.kv`; on a Payload version without it the count is in memory
|
||||
@@ -98,7 +151,8 @@ once there are more than 20.
|
||||
- The own-origin check trusts `Host` / `X-Forwarded-Host` as the proxy sets them, and passes requests without
|
||||
`Origin` and `Sec-Fetch-Site` (non-browser clients).
|
||||
- `access-missing` and `csrf-empty` are text searches of the config file and can miss or misread unusual
|
||||
spellings; `open-signup` evaluates a `create` rule with an anonymous request and counts a rule that throws as closed.
|
||||
spellings; `open-signup` and `staff-accounts-open` call the access rules with a made-up request and count a
|
||||
rule that throws as closed.
|
||||
- **Not run for this release:** see the hand-over; in short, the panel checks ran in Chromium on MongoDB only.
|
||||
|
||||
## Unreleased
|
||||
|
||||
Reference in New Issue
Block a user