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:
Radosław Smoliński
2026-11-26 14:10:44 +01:00
co-authored by Claude Opus 5.5
parent 9a448ba5df
commit 963464d6cb
10 changed files with 147 additions and 21 deletions
@@ -187,6 +187,7 @@ Fifteen ready blocks and ten page templates. **Use a library block (or a variant
| `REJECT_ALL_CONSENT` | `@intecion/ipal-kit` | Only `necessary: true` (a copy of `DEFAULT_CONSENT`). |
| `CONSENT_LOG_SLUG` | `@intecion/ipal-kit` | Consent log collection slug: `'consent-records'`. |
| `CONSENT_LOG_PATH` | `@intecion/ipal-kit` | The consent log endpoint's path under the API route: `'/ipal/consent'` (`/api/ipal/consent`). |
| `CONSENT_LOG_MAX_BYTES`, `readCappedBody(request, max?)` | `@intecion/ipal-kit` | The consent log endpoint's body cap (4096 bytes) and the reader it uses: `null` when a declared `content-length` or the stream itself passes the cap (read only up to it), else the text — for your own public JSON endpoint. |
| `resolveConsent(record, signal, mode?)` | `@intecion/ipal-kit` | Pure: what is in effect for a stored record (or `null`), the Global Privacy Control signal and the mode (`'honour'` default / `'ask'` / `false`) → `{ decided, gpc, stale, state }` (type `ResolvedConsent`; mode type `GpcMode`). The table in consent.md → "Global Privacy Control". |
| `gpcFromNavigator()` / `gpcFromHeaders(headers)` | `@intecion/ipal-kit` | The signal: `navigator.globalPrivacyControl === true` (false on the server) / `Sec-GPC: 1` exactly. Read the header only where a response is per visitor (endpoints) — never while rendering a static page. |
| `GPC_CATEGORIES`, `GPC_HEADER` | `@intecion/ipal-kit` | `['analytics', 'marketing']` (what the signal refuses) and `'sec-gpc'`. |
+1 -1
View File
@@ -588,7 +588,7 @@ tracker request. Every decision is now recorded in *Privacy → Consent records*
1. **Postgres / SQLite and the project never had `consentLog` on:** the consent log is now on by default and is a new
table. In the same deploy: `pnpm payload migrate:create consent-log`, commit it, apply it at container start
(`prodMigrations` or `pnpm payload migrate && pnpm start`). Or `iapl({ consentLog: false })`. Without either the site
works, but every choice answers 503 and is not recorded (one log line; `iapl-doctor` error `consent-log-migration`).
works, but every choice answers 503 and is not recorded (one log line; `iapl-doctor` warning `consent-log-migration`).
MongoDB: the collection appears by itself.
2. Every site: `pnpm payload generate:types` adds the `consent-records` collection's types (where it was off) — run it and
commit. No import-map change.