E-mail: "Sending method" is an explicit choice - IWSN (built-in), Own SMTP server, Microsoft Graph (deprecated)
What is chosen is what is used. The choice is the stored field `emailMethod` of Site integrations (empty until
somebody chooses); `emailTransport` of 1.6 - 1.17.0 stays, hidden.
- no silent switch: a chosen method that cannot be used (SMTP incomplete, Graph without GRAPH_*) fails loudly
- status smtp-incomplete / graph-not-set-up, state block, doctor mail-method - and nothing is sent another way
- upgrade writes nothing and loses no mail: until somebody chooses, the order of 1.17.0 applies and the field
shows its result as selected; the first save of the panel's form stores the choice
- only the chosen method's fields are shown; the test e-mail names the method (Graph too)
- mail: { relay: false } does not offer "IWSN" (the stored values stay three: one SQL enum for every project)
- Postgres / SQLite: one migration (a column). Before it runs the plugin's readers read the global without the
field, mail goes the old way, one loud log line and the doctor say what to do
- getMailMethod, setMailMethod, resolveMailMethod, readMailSettings, mailMethodColumnMissing exported
- tests on SQLite, Postgres and MongoDB, with and without the migration; docs, AGENT.md, skills, changelog
Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5.2
parent
c6841a1674
commit
ee8ea42956
+16
-7
@@ -11,7 +11,8 @@ once there are more than 20.
|
||||
|
||||
## 1.17.1 — security fixes from the IAWL review; the panel's sign-in look; the sending method is chosen
|
||||
|
||||
> **Read before upgrading.** No schema change, no migration on any database. In this order:
|
||||
> **Read before upgrading.** **MongoDB: no migration. Postgres / SQLite: one migration** — a new column for the
|
||||
> sending method (point 5). In this order:
|
||||
>
|
||||
> **1. A write-only secret could be read back (fixed).** On 1.17.0 an **admin** could recover the SMTP password or
|
||||
> the Turnstile secret key character by character through a query that names the field
|
||||
@@ -55,8 +56,11 @@ once there are more than 20.
|
||||
> be used — "Own SMTP server" without server, user name and password, "Microsoft Graph" on a server without
|
||||
> `GRAPH_*` — e-mails **fail and the panel says so; they are not sent another way** (in 1.17.0 they would have gone
|
||||
> through SMTP or IWSN). So after the upgrade: open the tab, check that the method shown is the one meant, save.
|
||||
> No schema change: the choice is kept in `payload-kv`. A seed or script that set `emailTransport` keeps working
|
||||
> (it leaves the site on the old order); to choose, it writes `emailMethod`.
|
||||
> **Postgres / SQLite projects: create and apply one migration** (`pnpm payload migrate:create`; the new field
|
||||
> `emailMethod` is a column) in the same deploy. Without it the site still sends its mail the old way and one loud
|
||||
> log line says so, but the Site integrations page of the panel does not open. MongoDB: nothing.
|
||||
> A seed or script that set `emailTransport` keeps working (it leaves the site on the old order); to choose, it
|
||||
> writes `emailMethod`.
|
||||
|
||||
### Security
|
||||
- **Write-only secrets cannot be named in a query** (point 1 above). `secretReadAccess`, the field read rule behind
|
||||
@@ -148,10 +152,11 @@ once there are more than 20.
|
||||
shown; the state block and the test e-mail name it ("through IWSN" / "through your SMTP server" / "through
|
||||
Microsoft Graph"). A chosen method that cannot be used fails loudly — status `smtp-incomplete` /
|
||||
`graph-not-set-up`, doctor `mail-method` — and the mail is not sent another way; in 1.17.0 "Automatic" picked
|
||||
the transport from which fields were filled in. Stored without a schema change: the field `emailMethod` is
|
||||
virtual, the choice is in `payload-kv` (`MAIL_METHOD_KV_KEY`); `emailTransport` stays, hidden.
|
||||
New exports: `getMailMethod`, `setMailMethod`, `resolveMailMethod`, `isMailMethod`, `MAIL_METHODS`,
|
||||
`MAIL_METHOD_KV_KEY`, types `MailMethod`, `ResolvedMailMethod`, `MailMethodProblem`. `pnpm payload generate:types`
|
||||
the transport from which fields were filled in. Stored in a new field of Site integrations, `emailMethod`
|
||||
(`relay` / `smtp` / `graph`, empty until somebody chooses); `emailTransport` stays, hidden.
|
||||
New exports: `getMailMethod`, `setMailMethod`, `resolveMailMethod`, `readMailSettings`, `isMailMethod`,
|
||||
`MAIL_METHODS`, `STORED_MAIL_METHOD_CONTEXT`, `mailMethodColumnMissing`, types `MailMethod`, `ResolvedMailMethod`,
|
||||
`MailMethodProblem`. `pnpm payload generate:types`
|
||||
gives a diff (the new field): run it and commit.
|
||||
- `AdminLogo` prints the sign-in panel when the plugin gives it `signIn` (the default with `whiteLabel`); wired by
|
||||
hand without that prop it is the plain logo as before. The logo on the login screen is now shown inside
|
||||
@@ -164,6 +169,10 @@ once there are more than 20.
|
||||
- `truncate` (summaries, meta descriptions) never returns more than its limit.
|
||||
|
||||
### Requires project changes
|
||||
- **Postgres / SQLite projects: one migration**, in the same deploy — the new field `emailMethod` of Site
|
||||
integrations is a column (`pnpm payload migrate:create`, commit, apply at container start). MongoDB projects:
|
||||
nothing. Until it runs: mail keeps going the old way, the Site integrations page does not open,
|
||||
`iapl-doctor --deep` reports `mail-method` (point 5 above).
|
||||
- **The proxy matcher**, one line (point 4 above).
|
||||
- **A config value the plugin does not understand** stops the start (point 2): `pnpm build` before deploying.
|
||||
- **Recommended with `whiteLabel`:** `signIn: { allScreens: true }` + `pnpm payload generate:importmap`; look at a
|
||||
|
||||
+7
-4
@@ -1292,14 +1292,17 @@ banner that is already in every import map). **Do not** add `nodemailer`, `resen
|
||||
**How a send is routed** — by the admin's choice, Site integrations → E-mail sending → **"Sending method"**: "IWSN
|
||||
(built-in)" (the mail service), "Own SMTP server", "Microsoft Graph (deprecated)". What is chosen is what is used;
|
||||
a choice that cannot be used (SMTP incomplete, Graph without `GRAPH_*`) **fails loudly and nothing is sent another
|
||||
way** (state block, status `smtp-incomplete` / `graph-not-set-up`, doctor `mail-method`). The choice is kept in
|
||||
`payload-kv` (`MAIL_METHOD_KV_KEY`); the panel's field `emailMethod` is virtual, so **no schema change and no
|
||||
migration**. Until somebody chooses (an upgraded site, a new site) the order of 1.17.0 applies and the field shows
|
||||
way** (state block, status `smtp-incomplete` / `graph-not-set-up`, doctor `mail-method`). The choice is the stored field
|
||||
`emailMethod` (`relay` / `smtp` / `graph`; empty until somebody chooses) — **MongoDB: nothing to run; Postgres / SQLite:
|
||||
one migration** (`pnpm payload migrate:create`, applied at container start); before it runs the site keeps sending the
|
||||
old way, the Site integrations page does not open, and `iapl-doctor --deep` reports `mail-method` (error). Until somebody chooses (an upgraded site, a new site) the order of 1.17.0 applies and the field shows
|
||||
its result as selected (`resolveMailTransport`, type `MailTransport`): Graph when `emailTransport` is `graph` and
|
||||
`GRAPH_*` is set → SMTP when server, user name and password are filled in → Graph when `GRAPH_*` is set → the mail
|
||||
service → nothing. The first save of Site integrations stores the choice. From code: `getMailMethod`,
|
||||
`setMailMethod(payload, 'relay' | 'smtp' | 'graph' | null)`, `resolveMailMethod` (`ResolvedMailMethod`,
|
||||
`MailMethodProblem`), `MailMethod`, `MAIL_METHODS`, `isMailMethod`; or `updateGlobal` with `emailMethod`. Seeds that
|
||||
`MailMethodProblem`), `MailMethod`, `MAIL_METHODS`, `isMailMethod`, `readMailSettings` / `STORED_MAIL_METHOD_CONTEXT`
|
||||
(a read with the value as stored — an ordinary read shows the method in effect), `mailMethodColumnMissing`; or
|
||||
`updateGlobal` with `emailMethod`. Seeds that
|
||||
set up mail write `emailMethod`, not `emailTransport`. **Verify:** the state block names the method; **Send test
|
||||
e-mail** answers "through IWSN" / "through your SMTP server" / "through Microsoft Graph"; `iapl-doctor --deep`
|
||||
reports no `mail-method` finding after the first save. `mail: { relay: false }` removes the option "IWSN".
|
||||
|
||||
@@ -101,6 +101,7 @@ through this procedure. Ask only when you are missing something you cannot get y
|
||||
| banner without styles | Tailwind does not scan the plugin | `@source` on `node_modules/@intecion/ipal-kit/dist/**/*.js` (path relative to the CSS file, PROGRAMISTA §2.5) |
|
||||
| emails are not sent | no `email: mailAdapter()` / empty Emails tab of the form / the transport fails | Site integrations → E-mail sending: read the block "How e-mails are sent" and the banner's code, then **Send test e-mail**; rows below; email.md |
|
||||
| e-mails are not sent; state block: "Your SMTP server is chosen, but its settings are incomplete" / "Microsoft Graph is chosen, but it is not set up on this server" (status `smtp-incomplete` / `graph-not-set-up`, doctor `mail-method` error) | the chosen "Sending method" cannot be used, and since 1.17.1 nothing is sent another way | fill in server, user name and password / set the `GRAPH_*` variables — or choose another method (IWSN needs nothing) and save |
|
||||
| Site integrations does not open after the upgrade to 1.17.1 (Postgres / SQLite); log: "the column for \"emailMethod\" … is missing"; doctor `mail-method` error | the migration that adds the column has not run (mail still leaves the old way) | `pnpm payload migrate:create`, commit, apply at container start |
|
||||
| the site switched how it sends after a field or a variable changed | nobody has chosen the "Sending method" yet (doctor `mail-method` info): the site still picks by the order of 1.17.0 | Site integrations → E-mail sending: check the method shown, save |
|
||||
| state block: "Not connected yet" on the production domain | no e-mail was sent yet | **Send test e-mail** (the site enrols on its first send) or "Connect again" |
|
||||
| `relay-refused` / "The mail service could not reach this site at …" (cause `callback-failed`) | `unreachable` / `timeout`: firewall, private network, wrong public host in `serverURL`; `redirect`: `trailingSlash: true`, apex → `www`, a language redirect; `status`: route blocked, missing (`mail: { relay: false }`?) or another `routes.api`; `confirmation`: a proxy rewrites the answer | `curl -i -X POST https://<host>/api/iapl/mail-relay/confirm -d '{}' -H 'content-type: application/json'` must answer **404 with an empty body, no redirect**; fix `serverURL` / `mail.relay.host`, or ask Intecion to set the site's confirm address (path ending in `/confirm/` with trailing slashes); then "Connect again" (the site does not retry by itself for 15 min). email.md "When the site cannot be confirmed" |
|
||||
|
||||
@@ -39,7 +39,7 @@ description: Complete map of everything @intecion/ipal-kit provides — every ia
|
||||
| `accounts.firstUserRoute` | `'panel'` | which auth collections `POST /api/<slug>/first-register` answers for while they are empty: only the one the panel logs in with (the first account of a site → admin). Others get `403`, a second staff collection included, in any spelling of the URL (the plugin's own endpoint sits in front of Payload's); a collection whose own `create` allows an anonymous request keeps its route. With `access.firstUserAdmin: false` and a default role below the panel role, the default `panelRole` is not applied (logged) and an explicit one is refused at start | a list of slugs; `'all'` = Payload's behaviour |
|
||||
| `accounts.password` | `{ minLength: 12 }` | when a password is SET on a staff collection (create, first-user screen, change, reset by e-mail; panel, API and Local API): at least `minLength` characters, not the account's e-mail address. Existing passwords are never checked — a shorter one keeps logging in | `{ minLength }`; `false` = Payload's rule (3 characters) |
|
||||
| `secrets.writeOnly` | on | `smtpPassword` and `turnstileSecretKey` (Site integrations) are never returned: REST, GraphQL and the panel get `'********'` when a value is stored; a save with nothing / empty / the mask keeps it, a new value replaces it, `'[[clear]]'` removes it; the Local API with access control off reads the real value. The panel is the source of these secrets — no env variable. A restore of a version is masked too | `false` = returned to whoever may read the global, as before |
|
||||
| "Sending method" (`emailMethod`, virtual; `getMailMethod` / `setMailMethod`) | nobody has chosen: the order of 1.17.0, shown as selected | `relay` (IWSN), `smtp`, `graph` (deprecated): what is chosen is what is used, no fallback; kept in `payload-kv`, no schema change |
|
||||
| "Sending method" (`emailMethod`; `getMailMethod` / `setMailMethod`) | nobody has chosen: the order of 1.17.0, shown as selected | `relay` (IWSN), `smtp`, `graph` (deprecated): what is chosen is what is used, no fallback; a stored field (Postgres / SQLite: one migration) |
|
||||
| `secrets.reenterOnChange` | on | a save through access control that changes `smtpHost`, `smtpPort` or `smtpUser` while a password is stored must send the password again or remove it (`400` on the field otherwise), whatever `emailTransport` says — so an admin session cannot send the stored password to a server of its own. A change of the transport alone, and the Local API with access control off, are not asked | `false` = the stored password follows the new server |
|
||||
| `dashboardAlerts` | `{ integrations: 'admin', cookies: 'editor' }` | who sees the plugin's dashboard alerts: integration details (error text, link) for `integrations` and above, a neutral "ask an administrator" for editors below it, nothing for others; the cookie crawl / approval alert for `cookies` and above. With a role, a session that owes its second factor sees none | `integrations: 'editor' | 'all'`, `cookies: 'all'` (`'all'` = as before: no role and no second factor is checked) |
|
||||
| `adminRoute` | `'/admin'` | `config.routes.admin`; stats link and views, `IntegrationAlerts` | the project moves `app/(payload)/<route>/` itself and adds the route to the proxy matcher (security.md) |
|
||||
|
||||
@@ -673,8 +673,10 @@ PROGRAMISTA §6, items 73–75; email.md; AGENT.md §7.2) — nothing to run; re
|
||||
`https://webservices.intecion.net/mail`; while the service runs with enrolment "pending" (from its launch until Intecion switches to open enrolment), every new site waits for approval — keep SMTP until it is approved, or `relay: false`.**
|
||||
|
||||
**→ 1.17.1, e-mail (CHANGELOG 1.17.1 point 5; email.md "Which transport a send takes"; AGENT.md §7.2) — nothing to run, one check:**
|
||||
1. No schema change, no migration, no import-map change; `pnpm payload generate:types` gives a diff (the virtual field
|
||||
`emailMethod`): run it and commit.
|
||||
1. **MongoDB: no migration. Postgres / SQLite: `pnpm payload migrate:create`** (the new field `emailMethod` is a column),
|
||||
commit it, apply it when the new container starts — in the same deploy. Without it mail still leaves the old way, but
|
||||
the Site integrations page does not open and the log and `iapl-doctor --deep` (`mail-method`, error) say so. No
|
||||
import-map change; `pnpm payload generate:types` gives a diff (the field `emailMethod`): run it and commit.
|
||||
2. After the deploy open Site integrations → E-mail sending. "Sending method" shows the method the site sends through
|
||||
today as selected: **IWSN (built-in)** (no SMTP server), **Own SMTP server**, or **Microsoft Graph (deprecated)**
|
||||
(`GRAPH_*` on the server). Check it is the one meant, **save**, send a test e-mail: the answer names the method.
|
||||
|
||||
+1
-1
@@ -114,7 +114,7 @@ Turn off: `iapl({ doctor: false })`. Adapt: `iapl({ doctor: { tokenVar: 'MY_TOKE
|
||||
| | `turnstile-env-key` | warning | (deep) the Turnstile secret key is in the panel, not in the deprecated `TURNSTILE_SECRET_KEY` environment variable |
|
||||
| | `storage-names` | warning | the visitor cookie the layout sets (`<PageStats visitorCookie>`, default `ipal_vid`) is the one the config makes the cookie scanner declare (`storageNames`, stats.md) |
|
||||
| | `cookie-scanner` | error / warning / info | `cookieScanner` on (with `crawl`, else info); deep: nothing waits for approval (warning) |
|
||||
| mail | `mail-method` | error / info | (deep) the chosen "Sending method" can be used — "Own SMTP server" with server, user name and password, "Microsoft Graph" with the `GRAPH_*` variables; otherwise e-mails are not sent and nothing is sent another way (error). Nobody has chosen yet: the site picks a method from what is filled in until Site integrations is saved (info) |
|
||||
| mail | `mail-method` | error / info | (deep) the chosen "Sending method" can be used — "Own SMTP server" with server, user name and password, "Microsoft Graph" with the `GRAPH_*` variables; otherwise e-mails are not sent and nothing is sent another way (error). On Postgres / SQLite: the column of `emailMethod` exists — the 1.17.1 migration has run (error). Nobody has chosen yet: the site picks a method from what is filled in until Site integrations is saved (info) |
|
||||
| | `mail-transport` | error / warning | (deep) an e-mail transport is in effect (not: the mail service switched off and no SMTP server); the last sends worked — failing: warning, error once it has lasted 24 hours |
|
||||
| | `mail-non-public` | info | (deep) on the mail service: says which signal makes the site a non-public copy — its host matches a development pattern (`developmentHosts`, named in the finding) or `IAPL_NOINDEX` is set — and what to change if the site is in fact the public one |
|
||||
| | `mail-relay-state` | error / warning / info | (deep) on the Intecion mail service: not disconnected and not stopped (error), not waiting for approval, not refused at enrolment, not a non-public copy of another site's database that waits for "Connect again" (`client-other-host`), the sender name not replaced (warning); not enrolled yet, and a public site whose database also holds another host's connection — its own past after a launch or a move, or a copy that forgot `IAPL_NOINDEX=1` (info) |
|
||||
|
||||
+21
-10
@@ -54,16 +54,27 @@ SMTP server, port, user name and password under "Own SMTP server"; the service's
|
||||
panel's SMTP server when one is filled in ("Attachments" below).
|
||||
- `mail: { relay: false }` takes the option "IWSN" away; a choice of it stored earlier then counts as no choice.
|
||||
|
||||
**Where the choice is stored.** In Payload's key-value store (`payload-kv`, key `MAIL_METHOD_KV_KEY`), not in a
|
||||
column: the panel's field `emailMethod` is **virtual**. So **no SQL schema changes and no migration exists** —
|
||||
a third value in the stored select `emailTransport` (`smtp` / `graph` since 1.6) would have changed the Postgres
|
||||
enum, and could still not tell "SMTP was chosen" from the `smtp` every site has stored since before there was a
|
||||
choice. `emailTransport` stays, hidden in the panel, and follows the choice where it can say it (`graph`, else
|
||||
`smtp`). From code: `getMailMethod(payload)` (`'relay' | 'smtp' | 'graph' | null`), `setMailMethod(payload, method)`
|
||||
(a seed or a deploy script; `null` = nobody has chosen), `payload.updateGlobal({ slug: 'site-integrations', data: {
|
||||
emailMethod: 'smtp' } })`, `resolveMailMethod(settings, { chosen, graphEnv, relay })` →
|
||||
`{ method, explicit, problem? }` (types `MailMethod`, `ResolvedMailMethod`, `MailMethodProblem`; `MAIL_METHODS`,
|
||||
`isMailMethod`).
|
||||
**Where the choice is stored.** In the global's own field **`emailMethod`** (a select: `relay` = IWSN, `smtp`,
|
||||
`graph`), new in 1.17.1 and **empty until somebody chooses**. The field of 1.6 – 1.17.0, `emailTransport`
|
||||
(`smtp` / `graph`), stays, hidden in the panel, and follows the choice where it can say it (`graph`, else `smtp`).
|
||||
A field of its own, not a third value there: every site has `smtp` stored in `emailTransport` from before there was
|
||||
a choice, so "SMTP was chosen" could not be told from "nothing was chosen". From code: `getMailMethod(payload)`
|
||||
(`'relay' | 'smtp' | 'graph' | null`), `setMailMethod(payload, method)` (a seed or a deploy script; `null` = nobody
|
||||
has chosen), `payload.updateGlobal({ slug: 'site-integrations', data: { emailMethod: 'smtp' } })`,
|
||||
`resolveMailMethod(settings, { chosen, graphEnv, relay })` → `{ method, explicit, problem? }` (types `MailMethod`,
|
||||
`ResolvedMailMethod`, `MailMethodProblem`; `MAIL_METHODS`, `isMailMethod`). **A read shows the method in effect**
|
||||
in `emailMethod` (that is what the panel selects); the stored value itself — empty when nobody chose — comes from
|
||||
`getMailMethod`, or from `readMailSettings(payload)` / a read with `context: { [STORED_MAIL_METHOD_CONTEXT]: true }`.
|
||||
|
||||
**Postgres and SQLite: one migration. MongoDB: nothing.** The field is a new column (`email_method`, with its
|
||||
enum on Postgres): `pnpm payload migrate:create`, commit the migration, and have it applied when the new container
|
||||
starts ([deployment.md](./deployment.md) §4.3). **Before it has run** the site does not go down: the plugin's own
|
||||
readers (`getSiteIntegrations`, the mail adapter, Turnstile, analytics) notice the missing column, read the global
|
||||
without that field, and one loud line in the server log says what to do; e-mails go the way they did before the
|
||||
upgrade. What does not work until the migration: the **Site integrations page of the panel** (Payload's own read
|
||||
fails), every write to the global — the sending status is not recorded — and choosing the method.
|
||||
`mailMethodColumnMissing()` and the doctor's deep run (`mail-method`, error) report it. A running process looks for
|
||||
the column again within a minute.
|
||||
|
||||
**Until somebody chooses — a site upgraded from 1.17.0 or older, and a new site.** Nothing is written on upgrade.
|
||||
The method follows the order of 1.17.0, the field shows it **as selected**, and mail keeps leaving the way it did
|
||||
|
||||
@@ -14,7 +14,7 @@ Currently always added by the plugin. Tabs (unnamed — flat data, e.g. `ga4Meas
|
||||
|---|---|
|
||||
| Analytics | `ga4MeasurementId`, `gtmContainerId`, `metaPixelId`, `clarityProjectId`, `linkedInPartnerId`, `tiktokPixelId` |
|
||||
| Spam protection | `turnstileSiteKey`, `turnstileSecretKey`, hidden `turnstileStatus` + banner |
|
||||
| E-mail sending | the state block "How e-mails are sent" (part of the tab's status banner — nothing stored; absent with `mail: { relay: false }`), "Sending method" `emailMethod` (virtual: `relay` = IWSN / `smtp` / `graph` = deprecated; the choice is kept in `payload-kv`), `emailTransport` (hidden; the stored field of 1.6 – 1.17.0), `smtpHost`, `smtpPort`, `smtpUser`, `smtpPassword`, `smtpFromAddress`, `smtpFromName`, test button, hidden `emailStatus` + banner |
|
||||
| E-mail sending | the state block "How e-mails are sent" (part of the tab's status banner — nothing stored; absent with `mail: { relay: false }`), "Sending method" `emailMethod` (`relay` = IWSN / `smtp` / `graph` = deprecated; empty until somebody chooses, a read shows the method in effect; new in 1.17.1 — a column on Postgres / SQLite), `emailTransport` (hidden; the stored field of 1.6 – 1.17.0), `smtpHost`, `smtpPort`, `smtpUser`, `smtpPassword`, `smtpFromAddress`, `smtpFromName`, test button, hidden `emailStatus` + banner |
|
||||
| IndexNow | `indexNowKey` (generated on first save) |
|
||||
| More | fields from the `integrationsFields` option — only when given |
|
||||
|
||||
|
||||
Reference in New Issue
Block a user