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
@@ -135,7 +135,7 @@ describe('the fake service speaks the contract (the contract\'s runner, every ex
token = fake.setSite(HOST, given.site as 'active')
if (given.token === 'previous') {
// the token in {{token}} was replaced a moment ago
const rotated = await fake.handle(new Request(`${fake.url}/v1/rotate`, { headers: { authorization: `Bearer ${token}` }, method: 'POST' }))
const rotated = await fake.handle(new Request(`${fake.url}/v1/rotate`, { headers: { authorization: `Bearer ${token}`, 'x-intecion-site': HOST }, method: 'POST' }))
expect(rotated.status).toBe(200)
}
if (given.token === 'unknown') {token = `ims_${'u'.repeat(43)}`}
@@ -151,7 +151,7 @@ describe('the fake service speaks the contract (the contract\'s runner, every ex
const body = expand(example.request.body, vars, example.id) as Record<string, unknown>
const first = await fake.handle(new Request(`${fake.url}/v1/send`, {
body: JSON.stringify(given.idempotency === 'sent-same' ? body : { ...body, subject: 'Another message' }),
headers: { authorization: `Bearer ${token}`, 'content-type': 'application/json', 'idempotency-key': vars.idempotencyKey },
headers: { authorization: `Bearer ${token}`, 'content-type': 'application/json', 'idempotency-key': vars.idempotencyKey, 'x-intecion-site': HOST },
method: 'POST',
}))
expect(first.status).toBe(200)