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:
Radosław Smoliński
2026-11-25 00:39:23 +01:00
co-authored by Claude Fable 5.2
parent 1141c749de
commit fd203de326
17 changed files with 349 additions and 116 deletions
+54 -9
View File
@@ -562,7 +562,16 @@ elsewhere — the `Origin` header, else `Sec-Fetch-Site` — **before it is coun
request came in on (`Host`, `X-Forwarded-Host`), `serverURL`, Payload's `csrf` and `cors` lists, and
`twoFactor: { …, sameOrigin: { origins: ['https://app.example.com'] } }` for a front end on another domain.
A request with neither header (a script, `curl`, a server) passes: it cannot ride on somebody's cookie.
`sameOrigin: false` turns it off. `ipal-doctor` warns (`csrf-empty`) when the config sets neither `serverURL` nor
A default port written out (`X-Forwarded-Host: site.example:443`) is the same host.
`sameOrigin: false` turns it off.
**Behind a reverse proxy that hides the site's address** — it rewrites `Host` and sends no `X-Forwarded-Host`
(nginx's plain `proxy_pass`; Traefik and Coolify keep `Host`) — and without `serverURL`, the server cannot know
its own address: the site's own verify page is refused, and **nobody can enter a code**. It is not silent: the
first refusal of every origin is logged, `[ipal] 2FA: a code from origin "https://…" was refused and not counted
— it is not one of this site's own origins (…)`, with the three ways out: set `serverURL` (the right fix, it
also fills Payload's `csrf` list), or `twoFactor: { sameOrigin: { origins: ['https://…'] } }`, or make the proxy
send `X-Forwarded-Host` (`proxy_set_header Host $host;` in nginx). `reportRefusedOrigin` is the building block. `ipal-doctor` warns (`csrf-empty`) when the config sets neither `serverURL` nor
`csrf` — Payload then accepts the login cookie from any origin.
**What is NOT covered — the complete list.** (1) Anonymous requests: the access function decides. (2) Accounts
@@ -917,7 +926,7 @@ size while reading, content signature, container and macro checks, an optional `
Emails tab (recipients, BCC) is readable only by `editor+`.
- Full table: [access.md](./access.md#what-the-plugin-locks-down-by-itself).
## Stored secrets (`secrets.writeOnly`)
## Stored secrets (`secrets.writeOnly`, `secrets.reenterOnChange`)
`smtpPassword` and `turnstileSecretKey` live in the Site integrations global: **the panel is their source**
(there is no env variable for the SMTP password, and the env fallback for the Turnstile secret is deprecated —
@@ -934,12 +943,39 @@ size while reading, content signature, container and macro checks, an optional `
| nothing for the field, an empty value, `null`, or `'********'` back | the stored value is kept |
| a new value | replaces it (the answer shows `'********'`) |
| `'[[clear]]'` (`SECRET_CLEAR`) | removes it |
| the server, the port, the user name, "Require encryption" **changed**, or the transport switched to SMTP, and **no** new password | **refused** (`400`, on the password field): "Enter the password again…" |
In the panel the field says "A value is set. It is not shown; type a new one to replace it." and offers "Remove
the stored value". A stolen admin session, or any way past the global's read rule, no longer yields a working
mailbox password. What it does **not** protect: the database and its backups hold the value in plain text
(encryption at rest is a separate, open question), and whoever can change the config or run server code can
read it.
the stored value".
**The SMTP password stays with the server it was saved for** (`secrets.reenterOnChange`). Hiding the value is
not enough on its own: an admin session could point `smtpHost` / `smtpPort` at a machine of its own, press
"Send test e-mail", and read the password off the connection. So a save **through access control** (the panel,
REST, GraphQL) that changes `smtpHost`, `smtpPort`, `smtpUser`, `smtpRequireTls`, or `emailTransport` to SMTP,
while a password is stored, must send the password again — or remove it (`'[[clear]]'`, "Remove the stored
value") for a server without one. Values are compared as trimmed, lower-case text, and a value never saved
counts as the field's default, so saving the form unchanged asks for nothing. Switching to Microsoft Graph asks
for nothing either (the password is not used there). Server code — a seed, a script with the Local API and
access control off — is not asked. `ipalKit({ secrets: { reenterOnChange: false } })` = the stored password
follows the new server, as before.
**"Require encryption"** (`smtpRequireTls`, Site integrations → E-mail sending, off by default). On port 465 the
connection is TLS from the start. On any other port the mail library upgrades with STARTTLS **when the server
offers it** — a server (or someone in between) that does not offer it gets the user name and password in clear
text. With the box ticked nothing is sent without encryption: no login, no e-mail, and the test e-mail says
"Error upgrading connection with STARTTLS". Tick it on every site whose server supports it (all the usual
providers on 587 do). It is a new field: **Postgres / SQLite need a migration** ([deployment.md](./deployment.md)).
A stolen admin session, or any way past the global's read rule, no longer yields a working mailbox password.
What it does **not** protect: the database and its backups hold the value in plain text (encryption at rest is
a separate, open question); whoever can change the config or run server code can read it; and a session that
knows nothing but may send e-mail can still **use** the mailbox through the site (send, not read).
**Versions.** The global has no versions by default. A project that turns them on
(`globalOverrides: { 'site-integrations': { versions: … } }`) stores the secret in every version — as in the
document itself — and reads of versions are masked like any read. A **restore** answers with the version
document, the fields under `version`, where field hooks do not run: the global's `afterRead` hook
`maskSecretsOnRestore` masks them there too. A restore brings back the password of that version.
- **What an existing site sees after the upgrade:** nothing to do. The stored values stay; the panel shows "a
value is set"; the API returns the mask. Code of your own that read the secret over REST / GraphQL as an admin
@@ -950,8 +986,15 @@ read it.
tabs / rows / groups; the hooks `maskSecretAfterRead` / `keepSecretBeforeValidate`, `SECRET_MASK`,
`SECRET_CLEAR`, `isSecretMask`, `INTEGRATION_SECRET_FIELDS` are exported. A real secret equal to `********` or
`[[clear]]` cannot be stored.
- Bound to other fields, like the SMTP password: `writeOnlySecret(field, { boundTo: ['apiUrl'] })`, or
`writeOnlySecrets(fields, ['apiToken'], { apiToken: { boundTo: ['apiUrl'], appliesWhen: (data) => … } })`
(`WriteOnlySecretOptions`; `buildKeepSecret(options)` is the hook; `SMTP_PASSWORD_BOUND_TO` is the plugin's
list). The fields must be siblings of the secret.
- With versions on your entity: add `hooks: { afterRead: [maskSecretsOnRestore] }` to the global or the
collection (`maskWriteOnlySecrets(data, fields)` is the walker it uses).
- **Check:** as a fully signed-in admin, `GET /api/globals/site-integrations` → `"smtpPassword":"********"`; save
the form without touching the field → a test e-mail still goes out.
the form without touching the field → a test e-mail still goes out; change the server without typing the
password → the save is refused with "Enter the password again…".
## Dashboard alerts by role (`dashboardAlerts`)
@@ -960,12 +1003,14 @@ so each decides who sees it. **Integration alerts** (Site integrations is admin-
failing and the link; an editor sees "An integration needs attention. Ask an administrator to look at it."; anyone
else sees nothing. **Cookie alerts** (crawl result, cookies waiting): editors and above. A session that still owes
its second factor sees none of them. `ipalKit({ dashboardAlerts: { integrations: 'editor' | 'all', cookies: 'all' } })`
loosens it (`'all'` = everyone who opens the dashboard, as before); the components take the same as props
loosens it. **`'all'` checks nothing** — no role and no second factor: whoever the dashboard is drawn for sees
the full text, as before. The components take the same as props
(`details`, `audience`).
## Turn off, override, extend
- **Stored secrets:** `secrets: { writeOnly: false }`; `writeOnlySecret` / `writeOnlySecrets` for your own fields.
- **Stored secrets:** `secrets: { writeOnly: false }`, `secrets: { reenterOnChange: false }`; `writeOnlySecret` /
`writeOnlySecrets` (with `boundTo`), `maskSecretsOnRestore` for your own fields.
- **2FA attempts from another origin:** `twoFactor.sameOrigin: false`, or `{ origins: [...] }`; `requestFromOwnOrigin`,
`ownOrigins` are exported. **Verify count:** `verifyLimit: { store: 'memory' }`; `buildVerifyLimit`,
`verifyLimitKey`, `clearVerifyLimits` (tests) are exported.