co-authored by
Claude Opus 5.5
parent
536e219f57
commit
3bfe377f1b
+163
-157
@@ -9,12 +9,26 @@ 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.
|
||||
|
||||
## 1.17.0 — the plugin is called IAPL; mail works with no setup (draft)
|
||||
## 1.17.0 — the plugin is called IAPL; mail works with no setup
|
||||
|
||||
> **Read before upgrading.** Nothing has to change in a project. The plugin's name is now **IAPL** (Intecion
|
||||
> Advanced Payload Library); it was ipal-kit. **The package is still `@intecion/ipal-kit`**, and every name a
|
||||
> project uses keeps working. No schema, migration or import-map change. This release also carries the
|
||||
> security follow-ups listed under 1.16.8 below (prepared, not released on their own).
|
||||
> **Read before upgrading.** Three parts, in this order: the security follow-ups prepared as 1.16.8 (never released
|
||||
> on their own), e-mail, and the new name. Then Postgres (nothing to do). No schema or migration on any database.
|
||||
>
|
||||
> **Security first — prepared as 1.16.8, released here.** 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` (registry
|
||||
> and repository addresses, no secret): update, rebuild, check that `find .next/static -name 'package*.json'` prints
|
||||
> nothing, and purge a CDN or cache that may still hold the file. A webpack build (the starter's script): nothing.
|
||||
> **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 the other way round: in a staff collection whose `roles` is a **single** select with only
|
||||
> `user` / `editor` / `admin`, accounts manage each other again (see Changed).
|
||||
> **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.
|
||||
>
|
||||
> **E-mail — read which of three cases the site is.** A site with **no SMTP server in Site integrations and no
|
||||
> `GRAPH_*` variables** (its mail failed with "not configured" until now) starts sending through the **Intecion
|
||||
@@ -23,8 +37,148 @@ once there are more than 20.
|
||||
> `[email protected]` under the panel's "Sender name". **A site with SMTP filled in is not
|
||||
> affected and contacts nothing. A site on Microsoft Graph keeps working and prints one deprecation warning at
|
||||
> start.** Each new behaviour has its opt-out (table below).
|
||||
> **The service must be live for the first case: until Intecion announces it, such a site reports
|
||||
> `relay-unreachable` and sends nothing, as it sent nothing before.**
|
||||
> **The service is live** at `https://webservices.intecion.net/mail`. It starts with enrolment **"pending"**: a site
|
||||
> that enrols waits until Intecion approves it (the panel says "waiting for approval"; nothing is sent until then).
|
||||
> Switching the service to open enrolment, where a site is active as soon as it enrols, is a later, separate step.
|
||||
>
|
||||
> **The name.** Nothing has to change in a project. The plugin's name is now **IAPL** (Intecion
|
||||
> Advanced Payload Library); it was ipal-kit. **The package is still `@intecion/ipal-kit`**, and every name a
|
||||
> project uses keeps working. No schema, migration or import-map change.
|
||||
>
|
||||
> **Postgres** (nothing to do): many form submissions or "forgot password" requests at the same moment no longer stop
|
||||
> the site; form and account mail go out right after the commit. Details under "Fixed — Postgres".
|
||||
|
||||
### Security — prepared as 1.16.8, released in 1.17.0
|
||||
|
||||
#### Security
|
||||
- **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.
|
||||
- **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 a relationship with
|
||||
`hasMany`, or json (a relationship to documents with text ids holds those ids). 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 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`).
|
||||
|
||||
#### Changed
|
||||
- **A single-valued `roles` field no longer brings the admin rules.** The plugin counts roles only from an array,
|
||||
so an account whose `roles` is one value (`'admin'` in a select without `hasMany`, a radio) was never a plugin
|
||||
admin. Yet in 1.16.7 a project's own staff collection whose single select offered only `user` / `editor` /
|
||||
`admin` got the admin rules — and then nobody in it could create, delete or unlock accounts, unless a plugin
|
||||
admin existed in another staff collection. Such a collection now gets "an account of this collection", like any
|
||||
collection whose roles are not the plugin's: its accounts manage each other again. Nothing of the plugin's opens:
|
||||
the value still grants
|
||||
nothing of the plugin's. But inside such a second staff collection this is wider than 1.16.7: an account with the
|
||||
value `user` can create, change or delete the account with the value `admin`. **If your own code gives rights by
|
||||
this value, write the collection's own rules** (`ipal-doctor --url` → `staff-own-roles` names it).
|
||||
|
||||
#### 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 (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 (what projects must update)
|
||||
- **A staff collection of your own, without access rules, whose accounts can hold `editor` or `admin`** (a
|
||||
`roles` select with `hasMany` and one of them next to values of your own, or a `roles` field that is text or a
|
||||
relationship with `hasMany`, or json): 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. Purge a CDN or cache in
|
||||
front of the site. Nothing to do for a webpack build.
|
||||
- **A staff collection of your own whose `roles` is one value** (a select without `hasMany`) with only `user` /
|
||||
`editor` / `admin`, and no access rules: its accounts manage each other again (see Changed). If your own code
|
||||
gives rights by that value, write the collection's rules.
|
||||
- **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`.
|
||||
|
||||
#### 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 plugin judges a collection by its declared `roles` field. A value that a hook of the project's own puts
|
||||
into `roles` is not seen, and a rule of the project's own (`access.create`, field access on `roles`) replaces
|
||||
the protection for that operation.
|
||||
- A relationship `roles` field makes a plugin admin only where the related documents' ids are the role names; over
|
||||
REST such an account's roles arrive as documents and do not count, over GraphQL and the Local API at depth 0
|
||||
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.
|
||||
- **Not run for this release:** a built site on Postgres or SQLite (the account rules ran over HTTP on SQLite, Postgres
|
||||
and MongoDB; the built site, webpack and Turbopack, on MongoDB); a real plugin that copies a staff collection; a
|
||||
real tracing library around access rules.
|
||||
|
||||
### Requires project changes
|
||||
- **A CI that compares generated types:** `payload generate:types` gives a diff on upgrade — four field descriptions
|
||||
@@ -39,7 +193,7 @@ once there are more than 20.
|
||||
| SMTP filled in (server, user name, password) | Nothing. No call to Intecion | — |
|
||||
| `GRAPH_*` set and "Microsoft Graph" chosen | Mail as before. One deprecation warning in the start log, one doctor warning (`mail-graph-deprecated`) | `mail: { graphDeprecationWarning: false }` (the log line) |
|
||||
| `GRAPH_*` set, "Sending method" on SMTP, no SMTP server (mail failed until now) | Mail goes through Graph | fill in SMTP, or remove the variables |
|
||||
| Neither (mail failed until now with "not configured") | **An outbound call:** on the next e-mail the site enrols with the service — `POST https://webservices.intecion.net/mail/v1/enrol` with its host and the plugin version — and then sends through it, from `[email protected]`. The site is active as soon as it enrols (the service holds a site for approval only as an exception) | `iapl({ mail: { relay: false } })` |
|
||||
| Neither (mail failed until now with "not configured") | **An outbound call:** on the next e-mail the site enrols with the service — `POST https://webservices.intecion.net/mail/v1/enrol` with its host and the plugin version — and then sends through it, from `notification@webservices.intecion.net`. At the start the service holds every new site for Intecion's approval (enrolment "pending"; the panel says so); once the service switches to open enrolment, a site is active as soon as it enrols | `iapl({ mail: { relay: false } })` |
|
||||
| Any site with the mail service enabled (the default) | **A new public route:** `POST /api/iapl/mail-relay/confirm` — answers `404` and changes nothing unless the site itself started an enrolment in the last 5 minutes; rate-limited. Three admin-only routes beside it (`…/status`, `…/connect`, `…/disconnect`) | `mail: { relay: false }` removes all four |
|
||||
| **A copy** of a site's database on a non-public site — a host that matches `developmentHosts` (built in: `*.dev.netscale.pl`, Intecion's development domain; no env needed) or one with `IAPL_NOINDEX=1` (staging made from production; production's data copied back onto the development address), with no SMTP there | It does **not** enrol or send by itself — its data is production's, and it would mail real people: sends report `relay-refused`, the panel and the doctor say why. "Connect again" lets it send; `mail: { relay: false }` or SMTP to a catcher keeps it silent for good. **A copy on another host without the variable sends** (it looks like launch day); a production site that kept `IAPL_NOINDEX=1` sends nothing | `mail: { relay: { otherHosts: 'enrol' } }` |
|
||||
| A site launched on its real domain after it was built on a development address; a moved domain | Nothing to do: it enrols by itself on its first e-mail | `mail: { relay: { otherHosts: 'wait' } }` makes it wait for "Connect again" |
|
||||
@@ -141,7 +295,7 @@ once there are more than 20.
|
||||
Not a switch for a live site: it would start visitors' histories and the running 2FA counts again.
|
||||
- `EnvRule.aliases` for `assertEnv`: older names of a variable, read when the main one is missing.
|
||||
|
||||
### Fixed — Postgres: many requests at once no longer stop the site (draft; release decided by the owner)
|
||||
### Fixed — Postgres: many requests at once no longer stop the site
|
||||
- **Ten or more form submissions at the same moment, or ten "forgot password" requests, stopped the whole site on
|
||||
Postgres** — every request, also pages that only read, waited for good (older than 1.17.0; MongoDB sites were not
|
||||
affected). Each transaction holds a pool connection, and code inside it that runs without its `req` (Payload's own
|
||||
@@ -180,154 +334,6 @@ once there are more than 20.
|
||||
is removed in 2.0. A site on it prints one warning per start (silence: `mail: { graphDeprecationWarning: false }`);
|
||||
the starter and `iapl-setup` no longer offer it.
|
||||
|
||||
## 1.16.8 — security follow-ups to 1.16.7
|
||||
|
||||
> **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` (registry
|
||||
> and repository addresses, no secret): update, rebuild, check that `find .next/static -name 'package*.json'` prints
|
||||
> nothing, and purge a CDN or cache that may still hold the file. A webpack build (the starter's script): nothing.
|
||||
> **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 the other way round: in a staff collection whose `roles` is a **single** select with only
|
||||
> `user` / `editor` / `admin`, accounts manage each other again (see Changed).
|
||||
> **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 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.
|
||||
- **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 a relationship with
|
||||
`hasMany`, or json (a relationship to documents with text ids holds those ids). 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 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`).
|
||||
|
||||
### Changed
|
||||
- **A single-valued `roles` field no longer brings the admin rules.** The plugin counts roles only from an array,
|
||||
so an account whose `roles` is one value (`'admin'` in a select without `hasMany`, a radio) was never a plugin
|
||||
admin. Yet in 1.16.7 a project's own staff collection whose single select offered only `user` / `editor` /
|
||||
`admin` got the admin rules — and then nobody in it could create, delete or unlock accounts, unless a plugin
|
||||
admin existed in another staff collection. Such a collection now gets "an account of this collection", like any
|
||||
collection whose roles are not the plugin's: its accounts manage each other again. Nothing of the plugin's opens:
|
||||
the value still grants
|
||||
nothing of the plugin's. But inside such a second staff collection this is wider than 1.16.7: an account with the
|
||||
value `user` can create, change or delete the account with the value `admin`. **If your own code gives rights by
|
||||
this value, write the collection's own rules** (`ipal-doctor --url` → `staff-own-roles` names it).
|
||||
|
||||
### 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 (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 (what projects must update)
|
||||
- **A staff collection of your own, without access rules, whose accounts can hold `editor` or `admin`** (a
|
||||
`roles` select with `hasMany` and one of them next to values of your own, or a `roles` field that is text or a
|
||||
relationship with `hasMany`, or json): 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. Purge a CDN or cache in
|
||||
front of the site. Nothing to do for a webpack build.
|
||||
- **A staff collection of your own whose `roles` is one value** (a select without `hasMany`) with only `user` /
|
||||
`editor` / `admin`, and no access rules: its accounts manage each other again (see Changed). If your own code
|
||||
gives rights by that value, write the collection's rules.
|
||||
- **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`.
|
||||
|
||||
### 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 plugin judges a collection by its declared `roles` field. A value that a hook of the project's own puts
|
||||
into `roles` is not seen, and a rule of the project's own (`access.create`, field access on `roles`) replaces
|
||||
the protection for that operation.
|
||||
- A relationship `roles` field makes a plugin admin only where the related documents' ids are the role names; over
|
||||
REST such an account's roles arrive as documents and do not count, over GraphQL and the Local API at depth 0
|
||||
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.
|
||||
- **Not run for this release:** a built site on Postgres or SQLite (the account rules ran over HTTP on SQLite, Postgres
|
||||
and MongoDB; the built site, webpack and Turbopack, on MongoDB); a real plugin that copies a staff collection; a
|
||||
real tracing library around access rules.
|
||||
|
||||
## 1.16.7 — hardening
|
||||
|
||||
> **Read before upgrading.** Several defaults get stricter. Most sites change nothing, but check
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@intecion/ipal-kit",
|
||||
"version": "1.16.8",
|
||||
"version": "1.17.0",
|
||||
"description": "Intecion Advanced Payload Library — a Payload CMS 3 plugin: i18n, SEO, forms, consent, analytics, blog/archives.",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
|
||||
+1
-1
@@ -7,4 +7,4 @@
|
||||
* `/_next/static/media/`. Written by `node scripts/write-version.mjs` (the `version` script of
|
||||
* package.json runs it on `pnpm version …`); test/version.test.ts fails when the two differ.
|
||||
*/
|
||||
export const PLUGIN_VERSION = '1.16.8'
|
||||
export const PLUGIN_VERSION = '1.17.0'
|
||||
|
||||
Reference in New Issue
Block a user