diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 15e820e..973d36e 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -9,7 +9,7 @@ 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.1 — security fixes from the IAWL review; the panel's sign-in look +## 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: > @@ -46,6 +46,17 @@ once there are more than 20. > **4. One line in each project:** the proxy matcher (`src/proxy.ts`) — > `'/((?!(?:api|admin|_next)(?:/|$)|.*\\..*).*)'`; `iapl-doctor` warns `proxy-matcher` until it is changed. Without it > pages whose names only start with `api` / `admin` / `_next` skip the proxy, as before. +> +> **5. E-mail — nothing to do, one thing to know.** "Sending method" in Site integrations → E-mail sending is a +> choice again: IWSN (built-in), Own SMTP server, Microsoft Graph (deprecated). **Upgrading writes nothing and +> loses no mail:** the field shows the method the site sends through today as selected (no SMTP server → IWSN; an +> SMTP server → Own SMTP server; `GRAPH_*` → Microsoft Graph), and the site keeps sending that way. **The first save +> of Site integrations stores that choice; from then on the site sends that way only.** If the chosen method cannot +> 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`. ### Security - **Write-only secrets cannot be named in a query** (point 1 above). `secretReadAccess`, the field read rule behind @@ -132,6 +143,16 @@ once there are more than 20. the e-mail — every account may change its own e-mail (security.md). ### Changed +- **E-mail: "Sending method" is an explicit choice again** — "IWSN (built-in)", "Own SMTP server", "Microsoft + Graph (deprecated)" — and what is chosen is what is used (point 5 above). Only the chosen method's fields are + 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` + 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 240 × 72 px (it was up to 420 × 120). diff --git a/docs/agent/AGENT.md b/docs/agent/AGENT.md index 84d8229..58d4beb 100644 --- a/docs/agent/AGENT.md +++ b/docs/agent/AGENT.md @@ -1257,7 +1257,7 @@ add missing hosts with flags / `extra`; (3) change `mode` to `'enforce'` in both | Sitemap split / CDN cache / memo | `sitemapOptions: { maxUrls: Infinity, cacheControl: false, memoSeconds: 0 }` | `sitemapEntries`, `createSitemapRouteHandler`, `buildSitemapIndexXml`, `buildSitemapEntries` | | Sitemap error = 503 + `Retry-After` | — (correct HTTP behaviour) | your own route with `buildSitemapXml` | | IndexNow silent with `IAPL_NOINDEX` | `indexNow` off by default | `submitToIndexNow` by hand | -| A site with no SMTP server in the panel sends through the Intecion mail service: it enrols by itself on its first send (an outbound call with its host and the plugin version) and gets its own token through the public route `POST /api/iapl/mail-relay/confirm` | `mail: { relay: false }` (no call, no routes, no state block) | `mail.relay: { url, host, enrol, token, senderName, kind, accountMail, confirmRateLimit, timeoutMs, retryBackoffMs, fetchImpl }`; `mailAdapter({ relay })`; §7.2 | +| A site sends through the Intecion mail service unless an admin chose another "Sending method" (SMTP, Graph): it enrols by itself on its first send (an outbound call with its host and the plugin version) and gets its own token through the public route `POST /api/iapl/mail-relay/confirm` | `mail: { relay: false }` (no call, no routes, no state block) | `mail.relay: { url, host, enrol, token, senderName, kind, accountMail, confirmRateLimit, timeoutMs, retryBackoffMs, fetchImpl }`; `mailAdapter({ relay })`; §7.2 | | The mail service's token is kept in `payload.kv` (never in a field, never readable over REST or GraphQL), bound to the site's server addresses, rotated every 90 days | "Disconnect" in the panel; `disconnectRelay` | `enrolRelay`, `rotateRelayToken`, `setRelayToken`, `getRelayStatus` | | Account e-mails through the mail service: at most 5 to one address and 10 asked for by one visitor an hour | `mail: { relay: { accountMail: false } }` | `accountMail: { perAddress, perVisitor, windowMinutes }` | | Every message says what it is (form notification, form confirmation, account, test, system) | — (other transports ignore the mark) | `withMailKind`, `runWithMailKind`, `expectMailTo`, `mail.relay.kind`, `buildFormMailKindHook` | @@ -1289,9 +1289,20 @@ No env variable, no key, no field to fill in, no import-map change (the tab's st banner that is already in every import map). **Do not** add `nodemailer`, `resend`, an `api/send` route or a `GRAPH_*` variable to a project. -**How a send is routed** (`resolveMailTransport`, type `MailTransport`): Microsoft Graph when the panel says so and -`GRAPH_*` is set (deprecated) → SMTP when server, user name and password are filled in → Graph when `GRAPH_*` is set → -the mail service → nothing (`mail: { relay: false }` and no SMTP). A site with SMTP filled in never contacts the service. +**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 +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 +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". **What the site needs for the mail service** — check each one: @@ -1324,8 +1335,8 @@ the mail service → nothing (`mail: { relay: false }` and no SMTP). A site with --deep --url ` reports no `mail-*` finding. On `localhost` the plugin refuses to enrol (nothing leaves the machine): test mail locally with SMTP (Mailpit) or `createFakeRelay()`. -**The client wants its own mail server:** fill in "Own SMTP server", user name, password and "Sender address" in the -panel, send a test. Nothing in code. **A site on `GRAPH_*`:** keeps working, warns once per start; move it when the +**The client wants its own mail server:** "Sending method" → "Own SMTP server", fill in server, user name, password +and "Sender address", save, send a test. Nothing in code. **A site on `GRAPH_*`:** keeps working, warns once per start; move it when the owner says so (email.md "Moving off Microsoft Graph"). **Your own mail** goes through `payload.sendEmail`. Say what it is when it is not a generic system message: diff --git a/docs/agent/reference-site/INDEX.md b/docs/agent/reference-site/INDEX.md index 901eb55..4b5895c 100644 --- a/docs/agent/reference-site/INDEX.md +++ b/docs/agent/reference-site/INDEX.md @@ -1244,7 +1244,7 @@ const payload = await getPayload({ config }) await payload.updateGlobal({ slug: 'site-integrations', context: { ipalIntegrationStatus: true }, - data: { emailStatus: { checkedAt: null, code: null, message: null, since: null, state: null }, emailTransport: 'smtp', smtpFromAddress: 'site@example-studio.test', smtpFromName: 'Example Studio', smtpHost: null, smtpPassword: null, smtpUser: null } as never, + data: { emailStatus: { checkedAt: null, code: null, message: null, since: null, state: null }, emailMethod: 'relay', emailTransport: 'smtp', smtpFromAddress: 'site@example-studio.test', smtpFromName: 'Example Studio', smtpHost: null, smtpPassword: null, smtpUser: null } as never, overrideAccess: true, }) for (const key of await payload.kv.keys()) { diff --git a/docs/agent/skills/iapl-debug/SKILL.md b/docs/agent/skills/iapl-debug/SKILL.md index 0ae5243..87d1d7f 100644 --- a/docs/agent/skills/iapl-debug/SKILL.md +++ b/docs/agent/skills/iapl-debug/SKILL.md @@ -100,6 +100,8 @@ through this procedure. Ask only when you are missing something you cannot get y | pixel before consent (consent-check) | script wired by hand (`