Consent log endpoint: body capped at 4 KiB (413), version bounded by the policy version; consent-log-migration a warning
Review C-1: the endpoint, on on every site, parsed a 20 MB body. It now refuses a content-length over CONSENT_LOG_MAX_BYTES (4096) before reading and reads the stream only up to the cap (readCappedBody), so a missing or false length cannot make it hold more. A version above Cookie settings' policy version is 400 (the cached version is read again once, for an editor's fresh raise); versions from 1 up are accepted (pages rendered before a raise). Review C-2: consent-log-migration is a warning, like every consent check of 1.17.0 (the owner's decision). Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
9a448ba5df
commit
963464d6cb
+3
-3
@@ -578,8 +578,8 @@ to add the hook to a config. Nothing to migrate.
|
||||
| Collection access | `read` / `delete` — admin (without `access`, i.e. no roles: any logged-in account — narrow it with `collectionOverrides`); `create` / `update` — nobody through the API (written only by the endpoint, `overrideAccess`) |
|
||||
| Endpoint | `POST /api/ipal/consent`, public (no login) |
|
||||
| Default | on (since 1.17.0); `consentLog: false` = no collection, no endpoint, `shell.consentLogEndpoint` null |
|
||||
| Body | `{ id: string (hex 16–64), version: int ≥ 1, state: { necessary, functional, analytics, marketing: boolean }, gpc?: boolean }` (`gpc` is accepted and not stored) |
|
||||
| Responses | `201 { ok: true }`, `400` (bad JSON/validation), `429` (limit 20 requests/min per IP, scope `consent`), `503` (the table does not exist: one log line per server start), `500` |
|
||||
| Body | `{ id: string (hex 16–64), version: int from 1 to the site's policy version, state: { necessary, functional, analytics, marketing: boolean }, gpc?: boolean }` (`gpc` is accepted and not stored); at most 4 KiB (`CONSENT_LOG_MAX_BYTES`) |
|
||||
| Responses | `201 { ok: true }`, `400` (bad JSON/validation, a version above the policy version), `413` (body over 4 KiB: refused by `content-length` before reading, or when the stream passes the cap), `429` (limit 20 requests/min per IP, scope `consent`), `503` (the table does not exist: one log line per server start), `500` |
|
||||
| Cleanup | on a write, at most once per 24 h per process: one `db.deleteMany` for records older than `retentionDays`, **in the background** (the consent write does not wait; an error is logged and the cleanup is retried on the next write) |
|
||||
|
||||
The provider sends a record after every decision (`fetch` with `keepalive`, errors ignored —
|
||||
@@ -601,7 +601,7 @@ pnpm payload migrate # applied at container start (prodMi
|
||||
|
||||
Or `iapl({ consentLog: false })` when the project does not want the log. Without the table nothing breaks: the page
|
||||
and the banner work, each choice answers `503` and the server logs once *"the consent-records table does not
|
||||
exist — create and apply a migration…"*; `iapl-doctor` reports `consent-log-migration` as an error while no
|
||||
exist — create and apply a migration…"*; `iapl-doctor` reports `consent-log-migration` (a warning) while no
|
||||
migration in `src/migrations` creates `consent_records`.
|
||||
|
||||
Narrow who reads the records (e.g. a project without roles, only the data protection officer):
|
||||
|
||||
Reference in New Issue
Block a user