Mail relay: development hosts are known by pattern, with no env - built in: *.dev.netscale.pl

The launch rule called a site non-public only when IAPL_NOINDEX was set (or the project named its hosts).
The owner's development sites set nothing, so production's database copied onto a development address
counted as a launch and would have mailed real people.

- iapl({ developmentHosts }): host patterns of development addresses. Default DEFAULT_DEVELOPMENT_HOSTS =
  ['*.dev.netscale.pl'], Intecion's own development domain; a project replaces the list or empties it.
  mail.relay.developmentHosts overrides it for the mail service.
- a site whose host matches is non-public exactly as with IAPL_NOINDEX=1; either signal is enough
- siteNonPublicSignal, matchDevelopmentHost, isDevelopmentHost, pluginDevelopmentHosts exported
- panel state: nonPublicBy, nonPublicPattern; doctor: mail-non-public (info) names the signal
- every case of the launch table runs with no env on the built-in pattern
- docs, AGENT.md, skills, changelog draft

Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-11-26 10:26:12 +01:00
co-authored by Claude Fable 5.2
parent 634908eb57
commit 14abf369da
26 changed files with 319 additions and 80 deletions
+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`, one entry per host (`iapl:mail-relay:site:<host>`). 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** | 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 stored under the host it was issued for: a copy on a staging domain neither uses nor touches production's entry (a read never deletes), and a copy that says it is not public (`IAPL_NOINDEX=1`, or a host in `mail.relay.developmentHosts`) **neither enrols nor sends by itself** — with production's data it would mail real people — until an admin presses "Connect again", also when it has a token of its own (production's data copied back onto a development address). A public site is never held (launch and a domain move must work unattended), so **a copy that does not say it is not public sends**; the doctor notes a public site whose database knows another host (`mail.relay.otherHosts`) |
| **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 stored under the host it was issued for: a copy on a staging domain neither uses nor touches production's entry (a read never deletes), and a non-public copy (a host that matches `developmentHosts` — built in: `*.dev.netscale.pl`, no env needed — or `IAPL_NOINDEX=1`) **neither enrols nor sends by itself** — with production's data it would mail real people — until an admin presses "Connect again", also when it has a token of its own (production's data copied back onto a development address). A public site is never held (launch and a domain move must work unattended), so **a copy on a host outside those patterns, without the variable, sends**; the doctor notes a public site whose database knows another host (`mail.relay.otherHosts`) |
| **A token of another site** (stored by a script, set as `relay.token`, or pasted into the access-key field — which is off unless the project sets `mail.relay.accessKeyField`) | 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 |