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
+2 -2
View File
@@ -174,14 +174,14 @@ describe.skipIf(!SERVICE || !local)('against the real service code, run locally'
const fresh = (await readRelayStore(payload)).token!
expect(fresh).not.toBe(old)
expect((await sendThroughRelay(payload, options, { ...MESSAGE, subject: 'After rotation' })).sent).toBe(true)
const again = await relayRequest({ method: 'POST', path: '/v1/rotate', token: old, url: SERVICE })
const again = await relayRequest({ method: 'POST', path: '/v1/rotate', site: HOST, token: old, url: SERVICE })
expect(again).toMatchObject({ code: 'already-rotated', ok: false, retryable: false })
})
test('"Disconnect" revokes: the token stops working at once; "Connect again" enrols anew', async () => {
const token = (await readRelayStore(payload)).token!
await disconnectRelay(payload, options)
expect(await relayRequest({ method: 'GET', path: '/v1/status', token, url: SERVICE })).toMatchObject({ code: 'invalid-token', ok: false })
expect(await relayRequest({ method: 'GET', path: '/v1/status', site: HOST, token, url: SERVICE })).toMatchObject({ code: 'invalid-token', ok: false })
expect(await sendThroughRelay(payload, options, MESSAGE)).toMatchObject({ code: 'relay-disconnected', sent: false })
expect(await enrolRelay(payload, options, { force: true })).toEqual({ ok: true, state: 'active' })
expect((await sendThroughRelay(payload, options, { ...MESSAGE, subject: 'Back' })).sent).toBe(true)