Mail relay: contract 1.7.0 — X-Intecion-Site on every request with a token, host-mismatch

contracts/mail-relay refreshed from IWDL 6cd99f7 (64 files). A token the service knows as another
site's is forgotten without revoking and the site enrols as itself; a hand-issued one is refused.
The fake requires the header and answers host-mismatch.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-11-25 22:13:58 +01:00
co-authored by Claude Fable 5.2
parent a2b07b1dc1
commit fef2c51bae
60 changed files with 326 additions and 118 deletions
+1 -1
View File
@@ -116,7 +116,7 @@ once there are more than 20.
`withMailKind`, `runWithMailKind`, `mailKindOf`, `expectMailTo`, `buildFormMailKindHook`, `createFakeRelay` (the
service in memory, for tests), the constants `RELAY_*`, `MAIL_KINDS`, `MAIL_KIND`, `GRAPH_DEPRECATION_NOTICE`, and
their types; `MailRelayStatus` from `/admin`.
- The wire contract of the service (version 1.6.0) is copied in the repository (`contracts/mail-relay/`) with a
- The wire contract of the service (version 1.7.0) is copied in the repository (`contracts/mail-relay/`) with a
checksum test; every example of it runs against the plugin's fake service and against the plugin's client.
- **`iapl-doctor` rule `legacy-names`** (info): lists the old names a project still uses, each with the new one.
Information, not a defect. A warning only for `iapl-doctor.json` and `ipal-doctor.json` side by side, or one variable
+2
View File
@@ -91,6 +91,8 @@ catcher such as Mailpit) or the fake service ("Testing").
- With every message: recipients, subject, text and HTML, attachments, the sender name, the reply address, the
kind of the message, and an idempotency key. The service keeps a log of metadata only (no subject, body,
attachment, reply address or recipient address) for 30 days.
- Every request that carries the token also names the site (`X-Intecion-Site: <host>`): the service refuses a token
used under another host's name (`403 host-mismatch` — the site then forgets that token and enrols as itself).
- The service adds `X-Intecion-Site: <host>` and `X-Intecion-Product: iapl` to every mail.
- Recipients' addresses and message bodies pass through Cloudflare (the service's mail back end). Name it in the
client's processing agreement before a client site sends through the service.
+1 -1
View File
@@ -1005,7 +1005,7 @@ token. What protects it, and what the new public route can and cannot do:
|---|---|
| **No key in the package** | The plugin carries the service's address and nothing else. A site gets its token by proving it is served at its host: it makes a nonce, the service calls `POST https://<host>/api/iapl/mail-relay/confirm` with the nonce and a token, and only an answer that hashes both makes the token valid |
| **Where the token is** | `payload-kv`, key `iapl:mail-relay`. The collection refuses every operation through access control (`read`, `create`, `update`, `delete` are `false`) and is hidden: REST, GraphQL and the panel cannot reach it — an admin included (test: `test/mailRelayHttp.test.ts`). Server code with the Local API can, like `smtpPassword`. It is stored as it is (no encryption at rest), never logged, never sent to a browser, never part of a route's answer |
| **A database copied to another host** | the token is tied to the host it was issued for: a copy on a staging domain does not use production's token — it forgets it, without revoking it, and enrols as itself |
| **A database copied to another host** | both sides hold a token to its host: every request names the site (`X-Intecion-Site`) and the service refuses another host's token (`host-mismatch`); and on the site the token is tied to the host it was issued for: a copy on a staging domain does not use production's token — it forgets it, without revoking it, and enrols as itself |
| **A token of another site** (pasted into the access-key field, stored by a script) | refused: the service is asked which host the token is for before it is stored or used; a foreign one is not saved, not used, not revoked |
| **A token read from a database dump** | **works from the same server** (a staging site on the machine production runs on shares its outgoing address) — which is why the store is tied to its host, above. From another server it does not work: the service accepts a token only from the addresses the site enrolled from (IPv6: the same `/64`) and answers anything else "enrol again" — which needs the call-back to the real site. It cannot send as another site, and the limits below apply |
| **What a token can do at most** | send within the site's limits (30 an hour, 200 a day, 10 recipients, 10 MB by default) from the service's fixed address, under a sender name the service checks, with `X-Intecion-Site: <host>` on every mail. It cannot set `From`, `Return-Path` or any header, and cannot address a security alert |