Security follow-ups to 1.16.7: changelog, access guide, skills, API table, release gate, reference index

Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-11-25 02:59:44 +01:00
co-authored by Claude Fable 5.2
parent be2e6d52d9
commit ccc6f85924
15 changed files with 183 additions and 21 deletions
+67
View File
@@ -8,6 +8,73 @@ 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 — security follow-ups to 1.16.7 (version to be set at release)
> **Read before upgrading.** No option, schema, migration or import-map change. Two points:
> **What can stop people:** on a project's own staff collection **without access rules of its own** whose
> accounts can hold `editor` or `admin` although its roles are not just the plugin's — a `roles` select such as
> `user, editor, admin, boss` or `viewer, editor`, or a `roles` field that is text or json — an account that is
> not an admin can no longer create, delete or unlock accounts there, change another account, or change
> anybody's roles. If **no** staff account holds `admin`, nobody can (the start log says so; the way out is
> below). And a site **built with Turbopack** (`next build` without `--webpack`): see Security.
### Security
- **A staff collection whose accounts can hold `editor` or `admin` gets the admin rules.** The plugin's checks go
by the value on the account: `admin` on an account of a staff collection makes a plugin admin, `editor` an
editor — whatever else the collection's `roles` field offers. But a project's own staff collection without
rules got the admin rules only when ALL its role values were the plugin's; otherwise "an account of this
collection" could create, change and delete accounts. So with roles `user, editor, admin, boss` an account
with the role `user` created an `admin` there (or set the admin's password) and then read Site integrations,
changed other staff collections' roles and listed the panel's accounts; with `viewer, editor` a `viewer` made
an `editor` who saves Site settings; the same with a `roles` field that is text or json. In 1.16.7 and, wider,
before it. Now such a collection — in the config or added by a later plugin — gets: create, delete, unlock —
an admin; update — an admin or the account itself; roles — only an admin. Not affected: `access.authCollection`,
collections with rules of their own, a `roles` select whose values hold neither `editor` nor `admin`. No known
site has such a collection ([access.md](./access.md) "Account rules").
- **A Turbopack build of a site published the plugin's `package.json`.** The plugin read its own version from
that file by a path relative to its module, and a bundler takes such a file for an asset: Turbopack copied it
to `/_next/static/media/package.<hash>.json`, where anyone could fetch it. It is the **plugin's** manifest, not
the project's: the plugin's name and version, its dependency lists with version ranges (also the development
ones), its script names, and the addresses of the package registry and the git repository it comes from. **No
secret, token or password**, and nothing of the project. The file name is a content hash and no page links to
it. A webpack build (`next build --webpack`, what the starter and the reference site use) kept the file on the
server side: not served. The version is now a constant in the code (`src/version.ts`); nothing is read from
disk at run time.
### Added
- A start-log warning when staff collections run on the admin rules and no staff account holds `admin`.
- `pnpm e2e:built` (plugin repository): builds the reference site with webpack and with Turbopack and checks,
on each, the account rules on a built site and that no package manifest is among the public files. Part of
the release gate (PROGRAMISTA §8.1). The reference site's Playwright runs reset the test admins first
(`e2e/global-setup.ts`), so a spec no longer fails because of what ran before it.
- Exports: `canHoldStaffRole`, `staffCollectionsNobodyManages`.
### Requires project changes
- **A staff collection of your own, without access rules, whose accounts can hold `editor` or `admin`** (a
`roles` select with one of them next to values of your own, or a text / json `roles` field): only an admin
creates, deletes and unlocks accounts there and changes roles; another account is changed by an admin or by
itself. If accounts with a role of your own (`boss`, `viewer`) managed accounts there, write that as the
collection's own rules (`access.create` / `update` / `delete`, field access on `roles`) — the plugin gives
your values no rights. In a collection where nobody can be an `admin` (`viewer, editor`), accounts are
managed by an admin of another staff collection (the panel's).
- **Read the start log after the upgrade.** `[ipal] No staff account holds the role "admin", so NOBODY can
create, delete or unlock accounts in "…"`: no account of any staff collection is an admin. Give one account
the role with a script (`payload.update({ collection, id, data: { roles: ['admin'] } })`, `pnpm payload run`),
or write the collection's own rules. To switch the default off for every staff collection: `accounts: {
adminOnlyCreate: false, adminOnlyWrite: false }` (that also takes the protection off).
- **A site built with Turbopack:** update and rebuild — the new build has no `package.<hash>.json` under
`/_next/static/media/`. Check: `find .next/static -name 'package*.json'` prints nothing. Nothing to do for a
webpack build.
- `pnpm ipal:skills`.
### Known limitations
- A staff collection **without a `roles` field** is unchanged: every account of it is an admin to the plugin.
- A `roles` select of your own whose values hold neither `editor` nor `admin` is unchanged: inside it every
account may create, change and delete accounts (`ipal-doctor --url` → `staff-own-roles`).
- The warning counts accounts whose `roles` hold `admin`; where a `roles` field cannot be queried it says nothing.
- **Not run for this change:** the starter built with Turbopack (it is generated from the reference site and uses
the same plugin code; the reference site was built with both bundlers).
## 1.16.7 — hardening
> **Read before upgrading.** Several defaults get stricter. Most sites change nothing, but check