diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index f2eb3f1..080a8f0 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -8,7 +8,7 @@ versions at once, go through every "Requires project changes" section in order, version you have. A new release = a new section at the top; we remove the oldest ones only once there are more than 20. -## Unreleased — hardening (M1; version to be set at release) +## 1.16.7 — hardening > **Read before upgrading.** Several defaults get stricter. Most sites change nothing, but check > "Requires project changes". What can stop people: an account with only the role `user` can no longer open the @@ -16,8 +16,9 @@ once there are more than 20. > 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; a slug in `access.staffCollections` that -> is not an auth collection keeps Payload from starting (the old container keeps serving). No import-map change, **no schema change and no migration** on any -> database. +> is not an auth collection keeps Payload from starting (with a health check the old container keeps serving). +> Not a routine patch: agree the deploy with the owner and read the first start's log. No import-map change, +> **no schema change and no migration** on any database. ### Security - **A secret that is not text is refused** (`false`, `0`, a list, an object used to be stored as typed). @@ -73,13 +74,21 @@ once there are more than 20. - **`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. +### Fixes +- **Role checks in a client component: import `isAdmin`, `isEditor` and `hasMinimumRole` (and the type `Role`) from + `@intecion/ipal-kit/client`.** The advice since 1.16.4 led to importing them from `@intecion/ipal-kit`, which reaches + `server-only` modules: `next build --webpack` fails with `'server-only' cannot be imported from a Client Component + module`. The main entry keeps exporting them for server code; its Turbopack behaviour is unchanged. access.md also + says now what `useConfig()` carries: `admin.user` only, so accounts of `access.staffCollections` need + `{ staffCollections: [...] }`. + ### Added - Options: `accounts` (`panelRole`, `adminOnlyCreate`, `adminOnlyWrite`, `staffOnlyRead`, `firstUserRoute`, `password`), `secrets.writeOnly`, `secrets.reenterOnChange`, `forms.turnstileOnConfigError`, `twoFactor.sameOrigin`, `twoFactor.verifyLimit.store`, `dashboardAlerts`. - 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), `staff-accounts-open` (error; warning - for `read`: a staff collection an account of another collection may write to, read or unlock), + for `read` and `readVersions`: a staff collection an account of another collection may write to, read or unlock), `staff-own-roles` (warning: a staff collection with role values of its own and no rules), `turnstile-degraded` (warning, error after 24 hours), `turnstile-env-key`. The deep status gained `openSignUp`, `staffOnOwnRoles`, `staffOpenToOthers`, `turnstile`, @@ -97,7 +106,7 @@ once there are more than 20. `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 +### Requires project changes (what projects must update) - **No migration.** This release adds no field, column, table or collection of its own on any database. The stored 2FA attempt count uses Payload's own `payload-kv` collection, which every schema of a Payload version that has `payload.kv` already contains; where it cannot be reached the count stays in memory and the limit @@ -129,7 +138,8 @@ 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 `create` / `update` / `delete` / `unlock` / `read` rules** gets +- **A project's own staff collection without `create` / `update` / `delete` / `unlock` / `read` / `readVersions` + rules** gets them. With the plugin's roles (`access.authCollection`, or a `roles` select with only `user` / `editor` / `admin`): only an admin creates, deletes and unlocks accounts and changes roles; 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 @@ -152,6 +162,9 @@ once there are more than 20. 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://…'] } }`. +- **Only if a `'use client'` file imports `isAdmin`, `isEditor` or `hasMinimumRole` from `@intecion/ipal-kit`:** + change the import to `@intecion/ipal-kit/client` and keep the second argument (`isAdmin(user, config)`). + `grep -rlE "^['\"]use client" src | xargs grep -nE "from '@intecion/ipal-kit'"` lists the files; `import type` may stay. - `pnpm payload generate:types`, `pnpm ipal:skills`. ### Known limitations @@ -176,22 +189,13 @@ once there are more than 20. - `access-missing` and `csrf-empty` are text searches of the config file and can miss or misread unusual 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 - -### Fixes -- **Role checks in a client component: import `isAdmin`, `isEditor` and `hasMinimumRole` (and the type `Role`) from - `@intecion/ipal-kit/client`.** The advice since 1.16.4 led to importing them from `@intecion/ipal-kit`, which reaches - `server-only` modules: `next build --webpack` fails with `'server-only' cannot be imported from a Client Component - module`. The main entry keeps exporting them for server code; its Turbopack behaviour is unchanged. access.md also - says now what `useConfig()` carries: `admin.user` only, so accounts of `access.staffCollections` need - `{ staffCollections: [...] }`. - -### Requires project changes (what projects must update) -- **Only if a `'use client'` file imports `isAdmin`, `isEditor` or `hasMinimumRole` from `@intecion/ipal-kit`:** - change the import to `@intecion/ipal-kit/client` and keep the second argument (`isAdmin(user, config)`). - `grep -rlE "^['\"]use client" src | xargs grep -nE "from '@intecion/ipal-kit'"` lists the files; `import type` may stay. +- A plugin listed after ipalKit that **copies** a staff collection of the config under a new slug + (`{ ...staff, slug: 'copy' }`) copies the rules made for the original slug with it: accounts of other + collections are refused, but "the account itself" means an account of the original collection. Give such a + copy its own `access.update`. +- **Not run for this release:** the built site and the panel were checked in Chromium on MongoDB only (the access + rules over HTTP ran on SQLite, Postgres and MongoDB); no real mail server, no second instance, no third-party + plugin that adds an auth collection. ## 1.16.6 @@ -469,7 +473,7 @@ once there are more than 20. unless they are told which collections are staff: `isAdmin(user, config)` with the config from `useConfig()`, or `isAdmin(user, { staffCollections: ['users'] })`. A client component imports them from `@intecion/ipal-kit/client` (corrected later: the main entry, which this note implied, does not build there with webpack; `/client` has them - in the version after 1.16.6). On the server (`isAdmin(req.user)` in hooks, endpoints, access functions) nothing + since 1.16.7). On the server (`isAdmin(req.user)` in hooks, endpoints, access functions) nothing changes; `isAdmin(req.user, req.payload)` is the explicit form. - **A second staff collection (`access.staffCollections`) is not covered by 2FA** — the log says so at start. - **Own code that reads a plugin collection or global with `overrideAccess: false`** must pass a `user` from diff --git a/package.json b/package.json index b6b3ba3..92d6950 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@intecion/ipal-kit", - "version": "1.16.6", + "version": "1.16.7", "description": "Intecion Payload Advanced Library — a Payload CMS 3 plugin: i18n, SEO, forms, consent, analytics, blog/archives.", "license": "MIT", "repository": {