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
+6
View File
@@ -30,6 +30,11 @@ export type RelayCall = {
method: 'GET' | 'POST'
/** Relative to the base address: `/v1/send`. */
path: string
/**
* The site's own public host, sent as `X-Intecion-Site` with every request that carries a token: the service
* refuses a token used under another host's name (`403 host-mismatch`).
*/
site?: string
timeoutMs?: number
token?: string
/** Base address, host and path prefix together; joined with `path` as text. */
@@ -57,6 +62,7 @@ export async function relayRequest<T = Record<string, unknown>>(call: RelayCall)
'user-agent': `${RELAY_PRODUCT}/${PLUGIN_VERSION}`,
...(call.body ? { 'content-type': 'application/json' } : {}),
...(call.token ? { authorization: `Bearer ${call.token}` } : {}),
...(call.token && call.site ? { 'x-intecion-site': call.site } : {}),
...(call.idempotencyKey ? { 'idempotency-key': call.idempotencyKey } : {}),
},
method: call.method,