L-1 and one changelog entry for the release: what gets narrower on a copy, the collection that becomes staff later
Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5.2
parent
20809ba933
commit
a19fa0d17b
+59
-50
@@ -8,56 +8,21 @@ 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 — copied staff collections (version to be set at release; after the security follow-ups below)
|
||||
|
||||
> No option, schema, migration or import-map change. Matters only to a project in which a plugin listed after
|
||||
> ipalKit **copies a staff collection** under a new slug or reuses its `access` object. No known site does.
|
||||
|
||||
### Security
|
||||
- **A copy of a staff collection kept rules written for the original.** A plugin listed after ipalKit that
|
||||
spreads a staff collection into another slug (`{ ...staff, slug: 'copy' }`) carried the "already handled" marker
|
||||
and the plugin's rules along. "An admin, or the account itself" then meant the ORIGINAL's accounts: with
|
||||
numeric ids (Postgres, SQLite) an account of the original could change the password of the account with the
|
||||
same id in the copy. Now the plugin puts its rule for the copy's own slug **in front of** every rule it wrote
|
||||
for the original, and both must allow; on a copy named as staff, in front of every rule. Nothing is replaced
|
||||
or rewritten, so a copy is never opened wider than it was and never wider than the plugin's rule — whatever
|
||||
role values it has and however it uses or wraps the copied rules. Its `roles` field is guarded on every copy.
|
||||
The marker `custom.ipalAccounts` names the slug and the staff status (`{ slug, staff }`).
|
||||
|
||||
### Fixed
|
||||
- `next dev`: a collection that becomes a staff collection in an edit (named in `access.staffCollections` for
|
||||
the first time) gets its rules on the reload; it needed a restart when its config object outlived the reload.
|
||||
- A plain 2FA config guards nothing twice at start (the plugin's rules are marked before its 2FA guard).
|
||||
|
||||
### Added
|
||||
- Exports: `staffRuleOf`, `isPasswordRuleHook`; types `StaffRuleMark`, `AccountsMarker`.
|
||||
`markSeenAuthCollections(config, staffSlugs)` takes the staff slugs.
|
||||
- `pnpm e2e:built` covers copied staff collections on the built site (both bundlers).
|
||||
|
||||
### Requires project changes
|
||||
- **Only if a plugin of yours copies a staff collection:** in the copy, the copied rule "an admin, or the account
|
||||
itself" lets only an admin through (it still speaks of the original's accounts). If the copy's own accounts
|
||||
should edit themselves, give the copy its own rule — one line:
|
||||
`access: { ...staff.access, update: adminOrSelfIn('copy') }` ([access.md](./access.md) "Account rules").
|
||||
Before this change those accounts could not edit themselves either.
|
||||
- `pnpm ipal:skills`.
|
||||
|
||||
### Known limitations
|
||||
- `next dev`: a collection that STOPS being a staff collection in an edit keeps the rules until a restart; after
|
||||
a reload the adoption still runs with the options the site started with.
|
||||
- A marker or a function mark written by hand in the project's own config is taken at its word ("handled" for a
|
||||
marker of the collection's own slug); a hand-made function mark only ever adds the plugin's rule in front.
|
||||
|
||||
## 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:
|
||||
> **Read before upgrading.** No option, schema, migration or import-map change. Three points:
|
||||
> **A site built with Turbopack** (`next build` without `--webpack`) published the plugin's `package.json`:
|
||||
> update and rebuild (see Security).
|
||||
> **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, json or a relationship (all
|
||||
> with `hasMany`, i.e. holding a list; a single-valued field is not affected) — 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.
|
||||
> below).
|
||||
> **Only where a plugin listed after ipalKit copies a staff collection, or makes a collection of your config the
|
||||
> panel's** (`admin.user`): some answers get narrower there — see "Requires project changes". No known site does
|
||||
> either.
|
||||
|
||||
### Security
|
||||
- **A staff collection whose accounts can hold `editor` or `admin` gets the admin rules.** The plugin's checks go
|
||||
@@ -73,6 +38,21 @@ once there are more than 20.
|
||||
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 copy of a staff collection kept rules written for the original.** A plugin listed after ipalKit that
|
||||
spreads a staff collection into another slug (`{ ...staff, slug: 'copy' }`) carried the "already handled" marker
|
||||
and the plugin's rules along. "An admin, or the account itself" then meant the ORIGINAL's accounts: with
|
||||
numeric ids (Postgres, SQLite) an account of the original could change the password of the account with the
|
||||
same id in the copy. Now the plugin puts its rule for the copy's own slug **in front of** every rule it wrote
|
||||
for the original, and both must allow; on a copy named as staff, in front of every rule. Nothing is replaced
|
||||
or rewritten, so a copy is never opened wider than it was and never wider than the plugin's rule — whatever
|
||||
role values it has and however it uses or wraps the copied rules. Its `roles` field is guarded on every copy.
|
||||
The marker `custom.ipalAccounts` names the slug and the staff status (`{ slug, staff, own? }`).
|
||||
- **A collection of the config that a later plugin makes the panel's had no account rules.** A collection that is
|
||||
in your config, is not named as staff, and becomes the login collection because a plugin listed after ipalKit
|
||||
sets `admin.user` to it counted as "already handled": where it had no rules of its own, Payload's defaults
|
||||
stood — an account of any auth collection (a customer) could create, change and delete panel accounts there.
|
||||
Now it gets the plugin's rules when the config goes live, for every operation that had **no** rule in your
|
||||
config; an operation you wrote a rule for keeps it exactly as written (`AccountsMarker.own`).
|
||||
- **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
|
||||
@@ -83,14 +63,24 @@ once there are more than 20.
|
||||
server side: not served. The version is now a constant in the code (`src/version.ts`); nothing is read from
|
||||
disk at run time.
|
||||
|
||||
|
||||
### Fixed
|
||||
- `next dev`: a collection that becomes a staff collection in an edit (named in `access.staffCollections` for
|
||||
the first time) gets its rules on the reload; it needed a restart when its config object outlived the reload.
|
||||
- A plain 2FA config guards nothing twice at start (the plugin's rules are marked before its 2FA guard).
|
||||
|
||||
### Added
|
||||
- A start-log warning when staff collections run on the admin rules and no staff account holds `admin`
|
||||
(checked collection by collection; "could not check" where it cannot tell).
|
||||
- `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`, `rolesAreAList`, `staffCollectionsNobodyManages`.
|
||||
on each, the account rules on a built site (copied staff collections included) 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`, `rolesAreAList`, `staffCollectionsNobodyManages`, `staffRuleOf`,
|
||||
`isPasswordRuleHook`; types `StaffRuleMark`, `AccountsMarker`. `markSeenAuthCollections(config, staffSlugs)`
|
||||
takes the staff slugs; `LateAdoption` has `kept` and `known`.
|
||||
- The start log tells a collection that became staff after ipalKit ran from one a later plugin added, and names
|
||||
the rules of its own that were kept.
|
||||
|
||||
### Requires project changes
|
||||
- **A staff collection of your own, without access rules, whose accounts can hold `editor` or `admin`** (a
|
||||
@@ -109,6 +99,25 @@ once there are more than 20.
|
||||
- **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.
|
||||
- **Only if a plugin of yours copies a staff collection** (`{ ...staff, slug: 'copy' }`, or a new collection that
|
||||
reuses a staff collection's `access` object) — three answers get narrower:
|
||||
- **The copy's own accounts and "the account itself".** In the copy, the copied rule "an admin, or the account
|
||||
itself" lets only an admin through (it still speaks of the original's accounts). If the copy's own accounts
|
||||
should edit themselves, give the copy its own rule — one line:
|
||||
`access: { ...staff.access, update: adminOrSelfIn('copy') }` ([access.md](./access.md) "Account rules").
|
||||
Before this change those accounts could not edit themselves either.
|
||||
- **A copy named as staff whose own rules were wider than the plugin's** — a public `read`, an open `create`,
|
||||
a rule that returns a query, Payload's defaults where it dropped a rule: in 1.16.7 a copy counted as handled
|
||||
and kept them; now the plugin's rule goes in front, so a customer or an anonymous request no longer passes.
|
||||
To keep the copy's rules exactly as they are: `custom: { ipal: { accountRules: false } }` on the copy.
|
||||
- **Where the original has roles of its own** (`lead, member`): its accounts could manage the copy's accounts
|
||||
(create, change, delete) through the copied rule "an account of the original". They no longer can: only a
|
||||
plugin admin manages the copy's accounts (the copy's own accounts could not before and cannot now), until
|
||||
the copy writes rules of its own (`access.create` / `update` / `delete`).
|
||||
- **Only if a plugin listed after ipalKit sets `admin.user` to a collection of your config that you did not name
|
||||
as staff:** the operations that collection has no rule for get the plugin's (an admin; update — an admin or
|
||||
the account itself; read — staff). Rules you wrote on it stay. Better: name it in `access.staffCollections`
|
||||
(or list that plugin before ipalKit) — then it is handled at config time like any staff collection.
|
||||
- `pnpm ipal:skills`.
|
||||
|
||||
### Changed
|
||||
@@ -121,10 +130,6 @@ once there are more than 20.
|
||||
the value still grants nothing.
|
||||
|
||||
### Known limitations
|
||||
- **Copied staff collections behave as in 1.16.7**: a plugin listed after ipalKit that spreads a staff collection
|
||||
into a new slug (`{ ...staff, slug: 'copy' }`) keeps the rules written for the original, so with numeric ids
|
||||
(Postgres, SQLite) the original's account with the same id can change the copy's account. Not changed in this
|
||||
release; no known site copies a staff collection.
|
||||
- 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`).
|
||||
@@ -136,6 +141,10 @@ once there are more than 20.
|
||||
they do. The admin rules apply to the collection either way.
|
||||
- The start-log check reads up to 1000 accounts of a collection whose `roles` field the database cannot be asked
|
||||
about; with more it says "could not check" for that collection.
|
||||
- `next dev`: a collection that STOPS being a staff collection in an edit keeps the rules until a restart; after
|
||||
a reload the adoption still runs with the options the site started with.
|
||||
- A marker or a function mark written by hand in the project's own config is taken at its word ("handled" for a
|
||||
marker of the collection's own slug); a hand-made function mark only ever adds the plugin's rule in front.
|
||||
|
||||
## 1.16.7 — hardening
|
||||
|
||||
|
||||
Reference in New Issue
Block a user