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:
co-authored by
Claude Fable 5.2
parent
a2b07b1dc1
commit
fef2c51bae
@@ -1,6 +1,19 @@
|
||||
# Changelog of the wire contract
|
||||
|
||||
## 1.6.0 — 2026-11-25 (not released; no tag yet)
|
||||
## 1.7.0 — 2026-11-25 (not released; no tag yet)
|
||||
|
||||
From the independent review of the first client. What a client built against 1.6.0 has to change is marked.
|
||||
|
||||
- **New, required: the header `X-Intecion-Site: <own host>` on every request that carries a token.** Missing:
|
||||
`400 invalid-request`. Not the token's host: the new code **`403 host-mismatch`** (forget the token, enrol as
|
||||
yourself). **Client: send the header; handle the code.** All examples with a token carry it; two new
|
||||
examples (`send-host-mismatch`, `status-no-site-header`).
|
||||
- **A client stores the host with the token and compares it with its own before use**, and compares the `host`
|
||||
of `/v1/status` (§8, checklist 3). **Client: add the check.**
|
||||
- **The confirm endpoint's limiter counts only refused calls**, after the nonce was looked up; never by the
|
||||
caller's address first (§2). **Client: check the order.**
|
||||
|
||||
## 1.6.0 — 2026-11-25 (never released)
|
||||
|
||||
From the first client built against the contract (IAPL's). **The service did not change**; these are the
|
||||
contract's words. What a client built against 1.5.0 has to change is marked.
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
a5cc857363323400a6d24b45804c8fd964392cd0e61e99a8b120b354ac803e33 README.md
|
||||
05d026ddc45ee9824534ce13f5b8f14bd1475688fe98949e3297f90548e3abb0 CHANGELOG.md
|
||||
cb1d9a30bc4ab8a397f39b7d786bb82aca0b816077eefc35d7c822017d75f6a5 VERSION
|
||||
275ee643112eac77430dba9ea3f93c8f53dc1676b8d56ba95a25dd3f35a8746f schema.json
|
||||
913d3776b27076bf1d89639ef903f80c1c1b9bcd702851e9913def2588d73d83 runner.mjs
|
||||
9b254d1aebe0e3e11539f95bb9eabba8984a77f27ea1a12ab9c259f3a3f2df94 README.md
|
||||
cf9e7137ac9190773856b5d284544d04c188c852a3f3a92f6f68f561060c8626 CHANGELOG.md
|
||||
bb7320d831e7a151aa901c35e7326c752fa2ef5024f30768c42319b8bed171ed VERSION
|
||||
2ff0ad5b6a245365c0fa8733fa17b7bbd3ab91d4825981709d0fd02b762b939f schema.json
|
||||
766fe0ed81037c230ab64e9fea2f9e6e5e828c5744bd90c61d9a2ad374a83100 runner.mjs
|
||||
7c46860adee597e570832c72bcdb418752a20b9f7d1b2d7a656ed065f9632b2a checksums.mjs
|
||||
df6015faf02a7cf7e9b5816b9e22b2e82968678ddd72a61c1f9665a8c0897ddf examples/callback-confirm-wordpress.json
|
||||
f5018ca4fb7d25794ee92168d715aaf47feeba3d907c0550651b16c10a691ceb examples/callback-confirm.json
|
||||
@@ -21,42 +21,44 @@ e86e6ab23088c1c985ba18f287f66b49c50f51a584a7ca679b8b768597130efd examples/enrol
|
||||
fe38f1fd1394a7fd42b1a1b0b74aa604578f17ab52590bf95a462a0c0f7d6087 examples/enrol-unlisted-pending.json
|
||||
b9f71fe993dc39bdbc07e775e925a37175e18e1682fd8bffcc72b3581919be17 examples/health.json
|
||||
5dff4194764f6f61b01a3f7f504907e578306a486d214e22d1a70b1a207e5ca3 examples/not-found.json
|
||||
7df29aaf11934bb3a73f6899c66c4f73cfcc048c804ca52871b60376323cb222 examples/revoke-ok.json
|
||||
148ae206781250f5de72d8d8f024fb1a0ba9c61c3f14c2866cdbda5244940097 examples/rotate-ok.json
|
||||
81b6eeec98cdc35860241b1a958ab35cf6de2872bf1ffcdb24629156f5308996 examples/rotate-previous-token.json
|
||||
2e9b2d088310ed1965639ad48e3aa4753ca277bb4c7119b8b58b082d25a5f46c examples/send-attachments-too-large.json
|
||||
3585fde1439db56351a99c40e8262f606a3884eb4035546c76591279adbba0e8 examples/send-backend-failed.json
|
||||
938761bbe576ca2da017cff8a42c4586bee971b9f5ce27a2fa024f7643fa1d3e examples/send-bearer-any-case.json
|
||||
dbfdf96f791057e7a228330dba706cdcdf07f87d46d37734e2f4a3a49d557db0 examples/send-day-quota.json
|
||||
93455791565a0b2f8d464aed858cc470a014bf16c943d3883383a145e43424f9 examples/send-display-name-recipient.json
|
||||
01d7927fa99572fee0adf73c9d079ca7a544c3bf90d90c068e4b85137b59b53d examples/send-executable-attachment.json
|
||||
54db430c75ae132fda615f5a27a2e8d0f53157acdceedaba2c035edd1938f0e9 examples/send-from-browser.json
|
||||
650c8a79f38901e0027d3e105ad8e8edaab776f091011930093b7b1bc96bad66 examples/send-from-field.json
|
||||
f9db7bdf34887406fdf80e037c83212e9523c553a2566fe7d1a9411a491cd85c examples/send-headers-field.json
|
||||
5679e08b88d2206dc6810f73bb2139a8f7f46b7fd0470420081f8543e4466889 examples/send-hour-quota-account.json
|
||||
40828edcba271529de9d452239fb218afc63a1dd6606c5e201ad622f2748ba09 examples/send-hour-quota.json
|
||||
60e2eb9841a379c3985ae53e0c821a9e8a6f1de1cffc41f55f63a2bf91ffb315 examples/send-key-reused.json
|
||||
6b10a5fce8dc51188cad654804bf742d9221e3825f04c688d724c2c8893bc2af examples/send-no-sender-name.json
|
||||
1c37294029f41bb3953245950bde50ef6f550f9459aa16df525d4f8897f6f610 examples/send-no-token.json
|
||||
3408947e979677ab07bdac2939c716083c78bdf75ac0e06993cc68fcdbae071f examples/send-ok.json
|
||||
3660c55e7a359183793fd06c73a8c8c1529670e720cd9aa933a0a915b7f18a9f examples/send-pending.json
|
||||
cec3126afeffbc18ee02a23556c184dc9195f05a0fc9cff8a31be7bbd444a557 examples/send-previous-token.json
|
||||
b3b8ca0aae457e1d7afaa557b73ba1ab9c6c6427727c5d159e5290427f05ad8c examples/send-recipient-quota-other-kinds.json
|
||||
9ac1a9cccea648f5a54c55abd7d2271ac8b1916d789138f09bbacff1960c45eb examples/send-recipient-quota.json
|
||||
84d37df95af790ade19255736868fc38295e2674082dfec1c13f64031f88571c examples/send-recipient-suppressed.json
|
||||
5243b6a33a200c4e57f1f32bf285bd7a1499663e3073462e057548c2e1201d9f examples/send-replay.json
|
||||
40b86320ccfbe321b2831672035df618b4f5a6b3a70e398260698b4690b9c9a8 examples/send-security-alert.json
|
||||
af073fb884954c55f606fd2c6f7dc0bbedc29ec6b0daff4c77e91c16c129ac6d examples/send-sender-name-replaced.json
|
||||
bf0ce766240ad5df96176a8a6e0f54e7eaa533262657c8105ce342f957f156fb examples/send-subject-direction-mark.json
|
||||
47824ad6a90c27da507a98fef4e31486f8fac445d4f0657c6f98312752884da0 examples/send-subject-imitates-service.json
|
||||
85d43f2c6855accbece8bf09c281544355421de308850846fe28b7aa457fab21 examples/send-subject-line-break.json
|
||||
be98bd6277fadc03eacfa901ac15c9f69895ddfb3b01fbf40d849e9eeded61fe examples/send-subject-visitor-text.json
|
||||
a5dddf15899dfb6d7212b63f5bc32819d7f35a14872daae4f46324555bffa0e1 examples/send-suspended.json
|
||||
bcf24c613cfb4eb223667ab2eee8ca6ebe91a6f97b86e6545b9d9316c63ca728 examples/send-text-plain.json
|
||||
725fc1f4b059dc192f49955f67df4263f4a67f618b7314ca87ddfd7647e4514e examples/send-to-intecion-marked.json
|
||||
aac0a3d17fe69e8d6c0adbcd3513650c2802b7f43c2103d5cd3de5a0346456c0 examples/send-too-many-recipients.json
|
||||
4833a6b7cf81eba320f20c33fd44cb990681144186218332c2fb97a043b774cf examples/send-unknown-address.json
|
||||
1ad0d24c691ab35b5603d63f5b29c5a3a3e50265aea9524fd26d314c0b7c1437 examples/send-unknown-token.json
|
||||
cd2812d7b33698851116dd96fc1019e7ddfcc7f0b14511c6fa8f1b94acbfdb7e examples/status-active.json
|
||||
e1bbb759fc3f7084d4bc027fa7d490cf0d24bc8ca124bd9a82e5dde372eb7bcd examples/status-pending.json
|
||||
daaf53c17b92e61049b230e6a91edf9450967d920c05d23b3da67959e27474e4 examples/status-unknown-address.json
|
||||
94943f85503cd891f1fb6f0258ab97b2eb48ec10e5f7ea233d349d4da97b8a1b examples/revoke-ok.json
|
||||
1b467eac1040d56369276e5b8c12540a84942c8b7e3c2e458fc8da5b4f027c86 examples/rotate-ok.json
|
||||
348f96a160c168797ab27ff0739b17df1762cc2ffdd72cb0a2b3ec2c695093bc examples/rotate-previous-token.json
|
||||
39774a2ce0434dc791d79f9efb4b14f23203b7e8d58138acc7654265a875609b examples/send-attachments-too-large.json
|
||||
75ec4de22780b36b41f198f065e38937beb4a50879fd204e080bdb935c2b5e8f examples/send-backend-failed.json
|
||||
e3331a33604c2239c91c889d3dd338e473fd9b5d80fccb84a39491810bcceac0 examples/send-bearer-any-case.json
|
||||
26f4f8a2929d132598bcb87e813616cef7b6277249c657cc618f4ede4cb4d906 examples/send-day-quota.json
|
||||
660dbe2a747686077788f46fe45f269c3eb57e4579225979f91841e9f00fae7b examples/send-display-name-recipient.json
|
||||
1c6bd0ed454f51acf545f0213fe6108f3639af975fb0751ef8d23bd92da9d4c7 examples/send-executable-attachment.json
|
||||
ed6869754e418cc5e2a809e52a0242680d79f1bbc2eedd391de04375f29f7b9a examples/send-from-browser.json
|
||||
e39d197f857b56103726b0f165c67a3476a06207961a59c6f6a1cf333bc3e7e9 examples/send-from-field.json
|
||||
5c826cd0c297c773510ce37b66a0f6a6425e6282abc1ad30094fd5b545ae9193 examples/send-headers-field.json
|
||||
3918635b33b32783db96ae17ebbd4296d2deca05d092b55573c574be172601ec examples/send-host-mismatch.json
|
||||
a6809a8d475106f8e31ba432e56b46e9bf8683a0eca9d62378b1392cd6c44305 examples/send-hour-quota-account.json
|
||||
c46852c9d9fc7eb83ac6bc3ca2a7c5b79100d2cae93a5cee6720b702b4c22490 examples/send-hour-quota.json
|
||||
dc0f9c1c946d256aded0de70588c1d1f95740d333b234127f9bce8a4ed8beefb examples/send-key-reused.json
|
||||
69edbf23c9723337f6327484e587b8cb7603c23e4b4954ebd275a0a794171325 examples/send-no-sender-name.json
|
||||
bcbf5adcd0c224edb81c3b4188f261252835f715f541030db10432fa7ebd71a4 examples/send-no-token.json
|
||||
32125ac9ff5460991633cce55febcb310247ca518eae7c650ef634e3f86376e0 examples/send-ok.json
|
||||
7d8b14d372730f013ee7192021dda68859f779337b8d535bc564ac955a00e325 examples/send-pending.json
|
||||
e3bbb041217d0a4f378285c06584a093d5e808d223d564e735c559f461fae8b8 examples/send-previous-token.json
|
||||
53132e3e2177937dc2a35f7fe87f2f383f45ab001fc0306490941b44bb466e3c examples/send-recipient-quota-other-kinds.json
|
||||
aff454882faab57d4a697be7250fdbac0272bcc2e0c099a6a27c50e0a980ac70 examples/send-recipient-quota.json
|
||||
d514bc65a75f522389c90f1239d9afa43d96c7c2e7bd31fe0e85dd4c9d543ebd examples/send-recipient-suppressed.json
|
||||
eb68d83a8d582a3722bf99330246d3d641e49a53e08bbe48e04e09a970cbb866 examples/send-replay.json
|
||||
189dbdb3df1f0da0b6a1e8fdd0e90babf9dbfe9cfcaeb423ba24e2d59802b663 examples/send-security-alert.json
|
||||
f299bc4f5193de0619d78551653a0b133a4ae5774dba93b23812b689a074a87d examples/send-sender-name-replaced.json
|
||||
39a09b2bd01fc12d0e8cb2f93b71b24f31a4f2d0f639fe93b6bf37a7357be0ae examples/send-subject-direction-mark.json
|
||||
ce4cbea2306f73bd5905249c10ab451a2599cb779e2386828971f40c97b8c591 examples/send-subject-imitates-service.json
|
||||
247619f5575e898bd558ff7f7674f241c39f3a1e0ae51f589eb6a6dc2fe21e2b examples/send-subject-line-break.json
|
||||
59175981e46a6f782ce3b4ed9c885699d7766823d660e5a524e89a4f2c6c459a examples/send-subject-visitor-text.json
|
||||
987a2b4433161b4f2a6502d0487bf18f512f7a630a930ac66b1038cd6e000dc3 examples/send-suspended.json
|
||||
91cd894526eef28e4dfb2456e476ba0be381e6d621ea833761cc9c63fe247e03 examples/send-text-plain.json
|
||||
9c6278fcb13d7e06e0dd38ef34eba1abfbcb9c75100994b93c1c5a5444c35f85 examples/send-to-intecion-marked.json
|
||||
1a1faf5a451220a35f2f0d66bb906e0d9944ed0a71c8209e07da419734a82567 examples/send-too-many-recipients.json
|
||||
43d04c99549a4fe3c64af6f68b598299e92486af5a52432a2c93c3f9564f7959 examples/send-unknown-address.json
|
||||
28e05f3c53cab6433b6af4d425511fa6655d0673df2e840af1fed9d25294a123 examples/send-unknown-token.json
|
||||
f105c38ab11ab5fc508ba0ed3f23f69108c318765c2670029b230b5b9a83912a examples/status-active.json
|
||||
89009ee9ab8f38e9ec290fb5412f206e1be28ad10fce6a7071d4406ac52dd4f0 examples/status-no-site-header.json
|
||||
c9f49fa0dae1f0beacaacfe01660b467d06f990228c35a653307c8793f3c97a5 examples/status-pending.json
|
||||
afdb07ba8279479b6bbfdc4289efda657d4e5a9eccd94b8de165ec728b4a2386 examples/status-unknown-address.json
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Intecion Notifications Webservice — wire contract
|
||||
|
||||
Version: see [`VERSION`](VERSION) (this text describes **1.6.0**). Path prefix of this major version: `/v1`.
|
||||
Version: see [`VERSION`](VERSION) (this text describes **1.7.0**). Path prefix of this major version: `/v1`.
|
||||
|
||||
This is the whole agreement between the Intecion Notifications Webservice ("the service" below) and a client (the mail transport built into a
|
||||
site's plugin). It names no product: nothing here says Payload, WordPress, IAPL or IAWL except the values of
|
||||
@@ -67,6 +67,7 @@ Every refusal has the same body ([`Error`](schema.json)) — with one exception:
|
||||
| 403 | `site-suspended` | Stopped by Intecion | no | Keep the token; show it; do not enrol again | `relay-suspended` |
|
||||
| 403 | `host-not-allowed` | Enrolment: the host is not a public DNS name | no | Show it (a local or private site cannot use the service) | `relay-refused` |
|
||||
| 403 | `enrolment-closed` | Enrolment is closed for this product, or altogether | no | Show it | `relay-refused` |
|
||||
| 403 | `host-mismatch` | The token is good and comes from a known address, but the request's `X-Intecion-Site` names another site than the token's | no | Forget the token (it is another site's — a copied database, a token pasted into the wrong site), enrol as your own host, then send once more | — |
|
||||
| 403 | `browser-not-allowed` | The request came from a browser | no | — | — |
|
||||
| 404 | `not-found` | No such route | no | Report a bug | — |
|
||||
| 405 | `method-not-allowed` | Wrong method | no | Report a bug | — |
|
||||
@@ -161,7 +162,15 @@ A site gets its token by proving that it is served at its host. No authenticatio
|
||||
{ "confirmation": "<lowercase hex SHA-256 of nonce + \".\" + token>" }
|
||||
```
|
||||
|
||||
In every other case it answers `404` and changes nothing. It is a public route: rate-limit it.
|
||||
In every other case it answers `404` and changes nothing.
|
||||
|
||||
**It is a public route: limit it — but only the calls it refuses.** Look the nonce up **first**. A call that
|
||||
carries the nonce the site holds is the service's and is always answered; only calls that do **not** match
|
||||
a held nonce count towards a limit. Do not limit by the caller's address before that look-up: the service's
|
||||
calls come from addresses that every Worker on Cloudflare shares, so a stranger who sends a few requests
|
||||
from a Worker of their own would use up "the service's" allowance and block the site's enrolment. (When the
|
||||
site holds no nonce at all — it started no enrolment in the last five minutes — every call is a refused one
|
||||
and can be answered `404` without any work.)
|
||||
|
||||
**Exactly this answer and nothing else.** Status `200` (not 201, not 204). The body is the JSON object alone,
|
||||
UTF-8, at most 1024 bytes, the hex in lower case. Anything printed before or after it — a PHP notice, a
|
||||
@@ -237,6 +246,7 @@ Headers (`Bearer` in any case; one space; then the token exactly):
|
||||
|
||||
```
|
||||
Authorization: Bearer ims_…
|
||||
X-Intecion-Site: example.com
|
||||
Idempotency-Key: <16 to 128 characters of A–Z a–z 0–9 _ ->
|
||||
Content-Type: application/json
|
||||
```
|
||||
@@ -350,7 +360,7 @@ not go out ([`StatusResponse`](schema.json)):
|
||||
|
||||
```json
|
||||
{ "ok": true, "state": "active", "host": "example.com", "product": "iapl",
|
||||
"service": { "name": "Intecion Notifications Webservice", "version": "1.0.0", "contract": "1.6.0" },
|
||||
"service": { "name": "Intecion Notifications Webservice", "version": "1.0.0", "contract": "1.7.0" },
|
||||
"sender": { "address": "[email protected]" },
|
||||
"limits": { "messagesPerHour": 30, "messagesPerDay": 200, "recipientsPerMessage": 10,
|
||||
"perRecipientPerDay": 10, "newRecipientsPerDay": 50,
|
||||
@@ -393,7 +403,20 @@ No authentication. `200 { "ok": true }` or `503 { "ok": false }`, nothing else.
|
||||
- Every route except `/v1/enrol` and `/health` needs it, **and** needs the request to come from a server
|
||||
address the site enrolled from (IPv6: the same `/64`). A good token from another address gets `401 reverify`
|
||||
and nothing else — not even the site's state.
|
||||
- A token belongs to one host and cannot act for another.
|
||||
- **A token belongs to one host and cannot act for another — and both sides hold it to that.**
|
||||
- **Every request with a token carries `X-Intecion-Site: <the site's own public host>`** (the host it
|
||||
enrolled as, lower case). Without the header: `400 invalid-request`. With a host that is not the token's:
|
||||
`403 host-mismatch` — nothing is sent, read, rotated or revoked.
|
||||
- **A client stores the host together with the token** (at the confirm endpoint: the host it is enrolling
|
||||
as) and, before it uses a token, compares that stored host with its own public host of this moment. When
|
||||
they differ the token is not its own — the database was copied from another site (staging from
|
||||
production, a restored backup of another project), or somebody pasted a foreign token: the client does not
|
||||
use it, forgets it, and enrols as itself.
|
||||
- A client that reads `/v1/status` compares the `host` in the answer with its own the same way.
|
||||
|
||||
This is a guard against an honest mistake, not against a thief — whoever steals a token can name its host;
|
||||
the address binding is what stops them. Without the guard, a copy of a site running on the same server as
|
||||
the original would send mail as the original, on the original's limits.
|
||||
|
||||
## 9. Versions
|
||||
|
||||
@@ -492,9 +515,12 @@ hand-edited copy fails. The copy's `VERSION` says which contract the client spea
|
||||
Checklist for a client:
|
||||
|
||||
1. Constants: the base address, the contract version. No secret.
|
||||
2. A confirm endpoint (public, rate-limited, `404` unless it holds the nonce, constant-time compare, single
|
||||
use, answers the confirmation as the only output, keeps the earlier token until the new one is accepted).
|
||||
3. A token store that is never readable from outside and never printed.
|
||||
2. A confirm endpoint (public; `404` unless it holds the nonce; the nonce looked up before any limiter, and
|
||||
only refused calls counted by it; constant-time compare, single use, answers the confirmation as the only output, keeps the earlier token until the new one is accepted).
|
||||
3. A token store that is never readable from outside and never printed — holding the token **and the host it
|
||||
was issued to**. Before every use: is that host still this site's own public host? If not, do not use the
|
||||
token; enrol as this site. Send `X-Intecion-Site` with every request that carries a token; on
|
||||
`403 host-mismatch` forget the token and enrol.
|
||||
4. Enrol on the first send without a token, after `invalid-token` and after `reverify` — unless the token was
|
||||
issued by hand: then stop and report (§2). Guard against two processes enrolling at once
|
||||
(`enrolment-in-progress`).
|
||||
|
||||
@@ -1 +1 @@
|
||||
1.6.0
|
||||
1.7.0
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
"method": "POST",
|
||||
"path": "/v1/revoke",
|
||||
"headers": {
|
||||
"authorization": "Bearer {{token}}"
|
||||
"authorization": "Bearer {{token}}",
|
||||
"x-intecion-site": "{{host}}"
|
||||
}
|
||||
},
|
||||
"response": {
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
"method": "POST",
|
||||
"path": "/v1/rotate",
|
||||
"headers": {
|
||||
"authorization": "Bearer {{token}}"
|
||||
"authorization": "Bearer {{token}}",
|
||||
"x-intecion-site": "{{host}}"
|
||||
}
|
||||
},
|
||||
"response": {
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
"method": "POST",
|
||||
"path": "/v1/rotate",
|
||||
"headers": {
|
||||
"authorization": "Bearer {{token}}"
|
||||
"authorization": "Bearer {{token}}",
|
||||
"x-intecion-site": "{{host}}"
|
||||
}
|
||||
},
|
||||
"response": {
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
"headers": {
|
||||
"authorization": "Bearer {{token}}",
|
||||
"idempotency-key": "{{idempotencyKey}}",
|
||||
"content-type": "application/json"
|
||||
"content-type": "application/json",
|
||||
"x-intecion-site": "{{host}}"
|
||||
},
|
||||
"schema": "SendRequest",
|
||||
"body": {
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
"headers": {
|
||||
"authorization": "Bearer {{token}}",
|
||||
"idempotency-key": "{{idempotencyKey}}",
|
||||
"content-type": "application/json"
|
||||
"content-type": "application/json",
|
||||
"x-intecion-site": "{{host}}"
|
||||
},
|
||||
"schema": "SendRequest",
|
||||
"body": {
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
"headers": {
|
||||
"authorization": "bearer {{token}}",
|
||||
"idempotency-key": "{{idempotencyKey}}",
|
||||
"content-type": "application/json"
|
||||
"content-type": "application/json",
|
||||
"x-intecion-site": "{{host}}"
|
||||
},
|
||||
"schema": "SendRequest",
|
||||
"body": {
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
"headers": {
|
||||
"authorization": "Bearer {{token}}",
|
||||
"idempotency-key": "{{idempotencyKey}}",
|
||||
"content-type": "application/json"
|
||||
"content-type": "application/json",
|
||||
"x-intecion-site": "{{host}}"
|
||||
},
|
||||
"schema": "SendRequest",
|
||||
"body": {
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
"headers": {
|
||||
"authorization": "Bearer {{token}}",
|
||||
"idempotency-key": "{{idempotencyKey}}",
|
||||
"content-type": "application/json"
|
||||
"content-type": "application/json",
|
||||
"x-intecion-site": "{{host}}"
|
||||
},
|
||||
"body": {
|
||||
"product": "iapl",
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
"headers": {
|
||||
"authorization": "Bearer {{token}}",
|
||||
"idempotency-key": "{{idempotencyKey}}",
|
||||
"content-type": "application/json"
|
||||
"content-type": "application/json",
|
||||
"x-intecion-site": "{{host}}"
|
||||
},
|
||||
"schema": "SendRequest",
|
||||
"body": {
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
"authorization": "Bearer {{token}}",
|
||||
"idempotency-key": "{{idempotencyKey}}",
|
||||
"content-type": "application/json",
|
||||
"origin": "https://evil.example.net"
|
||||
"origin": "https://evil.example.net",
|
||||
"x-intecion-site": "{{host}}"
|
||||
},
|
||||
"schema": "SendRequest",
|
||||
"body": {
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
"headers": {
|
||||
"authorization": "Bearer {{token}}",
|
||||
"idempotency-key": "{{idempotencyKey}}",
|
||||
"content-type": "application/json"
|
||||
"content-type": "application/json",
|
||||
"x-intecion-site": "{{host}}"
|
||||
},
|
||||
"body": {
|
||||
"product": "iapl",
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
"headers": {
|
||||
"authorization": "Bearer {{token}}",
|
||||
"idempotency-key": "{{idempotencyKey}}",
|
||||
"content-type": "application/json"
|
||||
"content-type": "application/json",
|
||||
"x-intecion-site": "{{host}}"
|
||||
},
|
||||
"body": {
|
||||
"product": "iapl",
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"id": "send-host-mismatch",
|
||||
"title": "A token used by a site that names another host (a copy of the site's database, a token pasted into the wrong site) is refused",
|
||||
"given": {
|
||||
"site": "active"
|
||||
},
|
||||
"request": {
|
||||
"method": "POST",
|
||||
"path": "/v1/send",
|
||||
"headers": {
|
||||
"authorization": "Bearer {{token}}",
|
||||
"idempotency-key": "{{idempotencyKey}}",
|
||||
"content-type": "application/json",
|
||||
"x-intecion-site": "copy-of-{{host}}"
|
||||
},
|
||||
"schema": "SendRequest",
|
||||
"body": {
|
||||
"product": "iapl",
|
||||
"productVersion": "1.17.0",
|
||||
"kind": "form-notification",
|
||||
"to": [
|
||||
"{{recipient}}"
|
||||
],
|
||||
"replyTo": "[email protected]",
|
||||
"senderName": "Kancelaria Example",
|
||||
"subject": "New enquiry",
|
||||
"text": "Hello."
|
||||
}
|
||||
},
|
||||
"response": {
|
||||
"status": 403,
|
||||
"schema": "Error",
|
||||
"body": {
|
||||
"ok": false,
|
||||
"code": "host-mismatch",
|
||||
"retryable": false
|
||||
}
|
||||
},
|
||||
"then": {
|
||||
"mails": 0
|
||||
},
|
||||
"client": {
|
||||
"retry": false,
|
||||
"reEnrol": true,
|
||||
"status": null
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,8 @@
|
||||
"headers": {
|
||||
"authorization": "Bearer {{token}}",
|
||||
"idempotency-key": "{{idempotencyKey}}",
|
||||
"content-type": "application/json"
|
||||
"content-type": "application/json",
|
||||
"x-intecion-site": "{{host}}"
|
||||
},
|
||||
"schema": "SendRequest",
|
||||
"body": {
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
"headers": {
|
||||
"authorization": "Bearer {{token}}",
|
||||
"idempotency-key": "{{idempotencyKey}}",
|
||||
"content-type": "application/json"
|
||||
"content-type": "application/json",
|
||||
"x-intecion-site": "{{host}}"
|
||||
},
|
||||
"schema": "SendRequest",
|
||||
"body": {
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
"headers": {
|
||||
"authorization": "Bearer {{token}}",
|
||||
"idempotency-key": "{{idempotencyKey}}",
|
||||
"content-type": "application/json"
|
||||
"content-type": "application/json",
|
||||
"x-intecion-site": "{{host}}"
|
||||
},
|
||||
"schema": "SendRequest",
|
||||
"body": {
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
"headers": {
|
||||
"authorization": "Bearer {{token}}",
|
||||
"idempotency-key": "{{idempotencyKey}}",
|
||||
"content-type": "application/json"
|
||||
"content-type": "application/json",
|
||||
"x-intecion-site": "{{host}}"
|
||||
},
|
||||
"schema": "SendRequest",
|
||||
"body": {
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
"headers": {
|
||||
"authorization": "Bearer {{token}}",
|
||||
"idempotency-key": "{{idempotencyKey}}",
|
||||
"content-type": "application/json"
|
||||
"content-type": "application/json",
|
||||
"x-intecion-site": "{{host}}"
|
||||
},
|
||||
"schema": "SendRequest",
|
||||
"body": {
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
"headers": {
|
||||
"authorization": "Bearer {{token}}",
|
||||
"idempotency-key": "{{idempotencyKey}}",
|
||||
"content-type": "application/json"
|
||||
"content-type": "application/json",
|
||||
"x-intecion-site": "{{host}}"
|
||||
},
|
||||
"schema": "SendRequest",
|
||||
"body": {
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
"headers": {
|
||||
"authorization": "Bearer {{token}}",
|
||||
"idempotency-key": "{{idempotencyKey}}",
|
||||
"content-type": "application/json"
|
||||
"content-type": "application/json",
|
||||
"x-intecion-site": "{{host}}"
|
||||
},
|
||||
"schema": "SendRequest",
|
||||
"body": {
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
"headers": {
|
||||
"authorization": "Bearer {{token}}",
|
||||
"idempotency-key": "{{idempotencyKey}}",
|
||||
"content-type": "application/json"
|
||||
"content-type": "application/json",
|
||||
"x-intecion-site": "{{host}}"
|
||||
},
|
||||
"schema": "SendRequest",
|
||||
"body": {
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
"headers": {
|
||||
"authorization": "Bearer {{token}}",
|
||||
"idempotency-key": "{{idempotencyKey}}",
|
||||
"content-type": "application/json"
|
||||
"content-type": "application/json",
|
||||
"x-intecion-site": "{{host}}"
|
||||
},
|
||||
"schema": "SendRequest",
|
||||
"body": {
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
"headers": {
|
||||
"authorization": "Bearer {{token}}",
|
||||
"idempotency-key": "{{idempotencyKey}}",
|
||||
"content-type": "application/json"
|
||||
"content-type": "application/json",
|
||||
"x-intecion-site": "{{host}}"
|
||||
},
|
||||
"schema": "SendRequest",
|
||||
"body": {
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
"headers": {
|
||||
"authorization": "Bearer {{token}}",
|
||||
"idempotency-key": "{{idempotencyKey}}",
|
||||
"content-type": "application/json"
|
||||
"content-type": "application/json",
|
||||
"x-intecion-site": "{{host}}"
|
||||
},
|
||||
"schema": "SendRequest",
|
||||
"body": {
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
"headers": {
|
||||
"authorization": "Bearer {{token}}",
|
||||
"idempotency-key": "{{idempotencyKey}}",
|
||||
"content-type": "application/json"
|
||||
"content-type": "application/json",
|
||||
"x-intecion-site": "{{host}}"
|
||||
},
|
||||
"schema": "SendRequest",
|
||||
"body": {
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
"headers": {
|
||||
"authorization": "Bearer {{token}}",
|
||||
"idempotency-key": "{{idempotencyKey}}",
|
||||
"content-type": "application/json"
|
||||
"content-type": "application/json",
|
||||
"x-intecion-site": "{{host}}"
|
||||
},
|
||||
"schema": "SendRequest",
|
||||
"body": {
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
"headers": {
|
||||
"authorization": "Bearer {{token}}",
|
||||
"idempotency-key": "{{idempotencyKey}}",
|
||||
"content-type": "application/json"
|
||||
"content-type": "application/json",
|
||||
"x-intecion-site": "{{host}}"
|
||||
},
|
||||
"schema": "SendRequest",
|
||||
"body": {
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
"headers": {
|
||||
"authorization": "Bearer {{token}}",
|
||||
"idempotency-key": "{{idempotencyKey}}",
|
||||
"content-type": "application/json"
|
||||
"content-type": "application/json",
|
||||
"x-intecion-site": "{{host}}"
|
||||
},
|
||||
"schema": "SendRequest",
|
||||
"body": {
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
"headers": {
|
||||
"authorization": "Bearer {{token}}",
|
||||
"idempotency-key": "{{idempotencyKey}}",
|
||||
"content-type": "application/json"
|
||||
"content-type": "application/json",
|
||||
"x-intecion-site": "{{host}}"
|
||||
},
|
||||
"schema": "SendRequest",
|
||||
"body": {
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
"headers": {
|
||||
"authorization": "Bearer {{token}}",
|
||||
"idempotency-key": "{{idempotencyKey}}",
|
||||
"content-type": "application/json"
|
||||
"content-type": "application/json",
|
||||
"x-intecion-site": "{{host}}"
|
||||
},
|
||||
"schema": "SendRequest",
|
||||
"body": {
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
"headers": {
|
||||
"authorization": "Bearer {{token}}",
|
||||
"idempotency-key": "{{idempotencyKey}}",
|
||||
"content-type": "application/json"
|
||||
"content-type": "application/json",
|
||||
"x-intecion-site": "{{host}}"
|
||||
},
|
||||
"schema": "SendRequest",
|
||||
"body": {
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
"headers": {
|
||||
"authorization": "Bearer {{token}}",
|
||||
"idempotency-key": "{{idempotencyKey}}",
|
||||
"content-type": "application/json"
|
||||
"content-type": "application/json",
|
||||
"x-intecion-site": "{{host}}"
|
||||
},
|
||||
"schema": "SendRequest",
|
||||
"body": {
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
"headers": {
|
||||
"authorization": "Bearer {{token}}",
|
||||
"idempotency-key": "{{idempotencyKey}}",
|
||||
"content-type": "text/plain"
|
||||
"content-type": "text/plain",
|
||||
"x-intecion-site": "{{host}}"
|
||||
},
|
||||
"schema": "SendRequest",
|
||||
"body": {
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
"headers": {
|
||||
"authorization": "Bearer {{token}}",
|
||||
"idempotency-key": "{{idempotencyKey}}",
|
||||
"content-type": "application/json"
|
||||
"content-type": "application/json",
|
||||
"x-intecion-site": "{{host}}"
|
||||
},
|
||||
"schema": "SendRequest",
|
||||
"body": {
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
"headers": {
|
||||
"authorization": "Bearer {{token}}",
|
||||
"idempotency-key": "{{idempotencyKey}}",
|
||||
"content-type": "application/json"
|
||||
"content-type": "application/json",
|
||||
"x-intecion-site": "{{host}}"
|
||||
},
|
||||
"schema": "SendRequest",
|
||||
"body": {
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
"headers": {
|
||||
"authorization": "Bearer {{token}}",
|
||||
"idempotency-key": "{{idempotencyKey}}",
|
||||
"content-type": "application/json"
|
||||
"content-type": "application/json",
|
||||
"x-intecion-site": "{{host}}"
|
||||
},
|
||||
"schema": "SendRequest",
|
||||
"body": {
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
"headers": {
|
||||
"authorization": "Bearer {{token}}",
|
||||
"idempotency-key": "{{idempotencyKey}}",
|
||||
"content-type": "application/json"
|
||||
"content-type": "application/json",
|
||||
"x-intecion-site": "{{host}}"
|
||||
},
|
||||
"schema": "SendRequest",
|
||||
"body": {
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
"method": "GET",
|
||||
"path": "/v1/status",
|
||||
"headers": {
|
||||
"authorization": "Bearer {{token}}"
|
||||
"authorization": "Bearer {{token}}",
|
||||
"x-intecion-site": "{{host}}"
|
||||
}
|
||||
},
|
||||
"response": {
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"id": "status-no-site-header",
|
||||
"title": "Every request with a token names its site",
|
||||
"given": {
|
||||
"site": "active"
|
||||
},
|
||||
"request": {
|
||||
"method": "GET",
|
||||
"path": "/v1/status",
|
||||
"headers": {
|
||||
"authorization": "Bearer {{token}}"
|
||||
}
|
||||
},
|
||||
"response": {
|
||||
"status": 400,
|
||||
"schema": "Error",
|
||||
"body": {
|
||||
"ok": false,
|
||||
"code": "invalid-request",
|
||||
"field": "X-Intecion-Site"
|
||||
}
|
||||
},
|
||||
"client": {
|
||||
"retry": false,
|
||||
"reEnrol": false,
|
||||
"status": null
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,8 @@
|
||||
"method": "GET",
|
||||
"path": "/v1/status",
|
||||
"headers": {
|
||||
"authorization": "Bearer {{token}}"
|
||||
"authorization": "Bearer {{token}}",
|
||||
"x-intecion-site": "{{host}}"
|
||||
}
|
||||
},
|
||||
"response": {
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
"method": "GET",
|
||||
"path": "/v1/status",
|
||||
"headers": {
|
||||
"authorization": "Bearer {{token}}"
|
||||
"authorization": "Bearer {{token}}",
|
||||
"x-intecion-site": "{{host}}"
|
||||
}
|
||||
},
|
||||
"response": {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// No dependency. Works in Node 20+ and in the Workers runtime (uses only WebCrypto, btoa and TextEncoder).
|
||||
// How to use it: README.md, "The examples and the runner".
|
||||
|
||||
export const CONTRACT_VERSION = '1.6.0'
|
||||
export const CONTRACT_VERSION = '1.7.0'
|
||||
|
||||
export class ContractError extends Error {
|
||||
constructor(exampleId, message) {
|
||||
|
||||
@@ -556,6 +556,7 @@
|
||||
"enrolment-closed",
|
||||
"enrolment-in-progress",
|
||||
"callback-failed",
|
||||
"host-mismatch",
|
||||
"browser-not-allowed",
|
||||
"not-found",
|
||||
"method-not-allowed",
|
||||
|
||||
Reference in New Issue
Block a user