[docs] API: what errors may repeat, Idempotency-Key in progress and limits, where a minted URL is held
This commit is contained in:
+10
-4
@@ -16,8 +16,11 @@ Everything below was run end to end on loopback against `--dev` with a real edge
|
|||||||
- **Host header.** Only `127.0.0.1:<port>`, `localhost:<port>`, `[::1]:<port>` and the
|
- **Host header.** Only `127.0.0.1:<port>`, `localhost:<port>`, `[::1]:<port>` and the
|
||||||
configured `allowed_hosts` are answered (DNS rebinding). A browser write (`Origin` or
|
configured `allowed_hosts` are answered (DNS rebinding). A browser write (`Origin` or
|
||||||
`Sec-Fetch-Site` present) also needs `X-Ianitor-UI: 1` (CSRF).
|
`Sec-Fetch-Site` present) also needs `X-Ianitor-UI: 1` (CSRF).
|
||||||
- **Bodies** are JSON, at most 64 KiB, with no unknown fields. Error messages never repeat a
|
- **Bodies** are JSON, at most 64 KiB, with no unknown fields. Errors about the request
|
||||||
value you sent.
|
itself (bad JSON, a wrong type, an odd field name, a path that is no hostname) never repeat
|
||||||
|
what you sent. Errors about a host can repeat its values (hostname, upstream, header name)
|
||||||
|
in `params` and `detail`, but never a URL's user name and password (shown as `…@`), a secret
|
||||||
|
value or a token.
|
||||||
- **Errors** have one shape; `code` is stable, `message` is plain English, `field` points at
|
- **Errors** have one shape; `code` is stable, `message` is plain English, `field` points at
|
||||||
the form field, `params` holds the values in the message, `detail` is the technical text:
|
the form field, `params` holds the values in the message, `detail` is the technical text:
|
||||||
|
|
||||||
@@ -32,7 +35,9 @@ Everything below was run end to end on loopback against `--dev` with a real edge
|
|||||||
`202 {"apply": {...}}` at once; poll `GET /applies/{id}` (every second) until `state` is
|
`202 {"apply": {...}}` at once; poll `GET /applies/{id}` (every second) until `state` is
|
||||||
`kept`, `reverted`, `failed` or `needs_attention`. Applies run one at a time, in order;
|
`kept`, `reverted`, `failed` or `needs_attention`. Applies run one at a time, in order;
|
||||||
the others are `queued`.
|
the others are `queued`.
|
||||||
- **`Idempotency-Key`** on a write: a retry with the same key gets the same apply back.
|
- **`Idempotency-Key`** on a write: a retry with the same key gets the same apply back. While
|
||||||
|
the first request with a key is still being handled, a retry gets `409 request.in_progress`
|
||||||
|
(retry after 1 s). Keys are held in memory for 24 h (at most 2,000; then `429`).
|
||||||
- **`base_rev`** (from `GET /hosts/{h}` or the overview's `rev`): the change is refused with
|
- **`base_rev`** (from `GET /hosts/{h}` or the overview's `rev`): the change is refused with
|
||||||
`409 change.conflict` only if the same host file changed since.
|
`409 change.conflict` only if the same host file changed since.
|
||||||
|
|
||||||
@@ -194,7 +199,8 @@ curl -s -H "$H" -H 'Content-Type: application/json' -X POST "$API/hosts/wiki.dev
|
|||||||
"has_password": false, "url": "https://wiki.dev.test:18443/?share=ish1.…", "warning": null }
|
"has_password": false, "url": "https://wiki.dev.test:18443/?share=ish1.…", "warning": null }
|
||||||
```
|
```
|
||||||
|
|
||||||
The URL is shown once (control keeps no token). The first visit trades the token for a
|
The URL is shown once: control never stores the token on disk; only an `Idempotency-Key`
|
||||||
|
retry of this request gets the same answer again, from memory, for 24 h. The first visit trades the token for a
|
||||||
path-scoped `HttpOnly; Secure; SameSite=Lax` cookie and redirects to the same URL without it:
|
path-scoped `HttpOnly; Secure; SameSite=Lax` cookie and redirects to the same URL without it:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
|||||||
+10
-2
@@ -495,8 +495,16 @@ written above.
|
|||||||
- Health: one admin Unix socket (mode 0660) carries both the read-only `GET /v1/status` and
|
- Health: one admin Unix socket (mode 0660) carries both the read-only `GET /v1/status` and
|
||||||
control's reload/trial calls, instead of a separate read-only socket. Edge keeps the last 5
|
control's reload/trial calls, instead of a separate read-only socket. Edge keeps the last 5
|
||||||
results per upstream; `health.since` is tracked by control and restarts with it.
|
results per upstream; `health.since` is tracked by control and restarts with it.
|
||||||
- `Idempotency-Key`s are remembered in memory for 24 h; a control restart forgets them.
|
- `Idempotency-Key`s are remembered in memory for 24 h; a control restart forgets them. A
|
||||||
|
retry while the first request is still running gets `409 request.in_progress`; with 2,000
|
||||||
|
keys held, a new key gets `429 rate.limited`.
|
||||||
|
- Share links: at most 2,000 active links (`409 share.too_many`). A token in `?share=` on a
|
||||||
|
host without share links is removed before the request goes on.
|
||||||
|
- Wrong share passwords are also limited to 20 a minute per visitor network, whatever the
|
||||||
|
link; when the throttle's table is full, new visitors wait a minute rather than anyone's
|
||||||
|
count being forgotten.
|
||||||
- Extra error codes: `change.unchanged`, `host.hostname.mismatch`, `host.upstream.host_name`,
|
- Extra error codes: `change.unchanged`, `host.hostname.mismatch`, `host.upstream.host_name`,
|
||||||
`request.*`, `repo.unexpected_file`, `repo.no_remote`, `share.unavailable`,
|
`request.*`, `repo.unexpected_file`, `repo.no_remote`, `share.unavailable`,
|
||||||
`share.not_found`, `share.replaces`, `share.password_long`, `token.not_found`, `token.name`,
|
`share.not_found`, `share.replaces`, `share.password_long`, `share.too_many`,
|
||||||
|
`request.in_progress`, `control.files_unwritten`, `token.not_found`, `token.name`,
|
||||||
`token.expiry`, `file.*`, `site.*` (problems in `ianitor.toml`).
|
`token.expiry`, `file.*`, `site.*` (problems in `ianitor.toml`).
|
||||||
|
|||||||
Reference in New Issue
Block a user