diff --git a/docs/access.md b/docs/access.md index e4943c2..e8408c3 100644 --- a/docs/access.md +++ b/docs/access.md @@ -195,7 +195,7 @@ access: { update: requireRole('editor') } // a collection with drafts: editors (or the role you name) read everything; visitors, plain `user` accounts and a // session that still owes its second factor read published documents only — by id, in lists, with ?draft=true and // over GraphQL. Payload's open `read: () => true` answers ?draft=true with the draft itself (1.17.1). -// Version history asks for the status at another path: readPublishedVersions() goes on readVersions (1.17.2). +// Version history asks for the status at another path: readPublishedVersions() goes on readVersions (1.18.0). access: { read: readPublished(), readVersions: readPublishedVersions() } access: { read: readPublished('admin'), readVersions: readPublishedVersions('admin') } ``` @@ -209,7 +209,7 @@ access: { read: readPublished('admin'), readVersions: readPublishedVersions('adm The two answer with different paths: a document has `_status`, a version has `version._status`. In 1.17.1, `readVersions: readPublished()` (the form these docs showed) answered every version read with **500** on MongoDB, -Postgres and SQLite. Since 1.17.2, iapl() swaps a `readPublished()` it finds on `readVersions` of a collection or +Postgres and SQLite. Since 1.18.0, iapl() swaps a `readPublished()` it finds on `readVersions` of a collection or global for `readPublishedVersions()` with the same role, so that form works too. A collection added by a plugin listed **after** iapl() is not seen: use `readPublishedVersions()` there, or `withVersionReadRules(collections)`. Neither rule belongs on a collection without drafts (no `_status`: every read would fail). Check: without a session, @@ -497,7 +497,7 @@ characters."; texts `passwordTooShort`, `passwordIsEmail` in `i18n.translations. `DEFAULT_PASSWORD_MIN_LENGTH`. - **Check:** create an account with an 11-character password → "The password must have at least 12 characters.". -### A locked staff account answers like a wrong password (`accounts.lockedAnswer`, 1.17.2) +### A locked staff account answers like a wrong password (`accounts.lockedAnswer`, 1.18.0) Payload locks an account after `maxLoginAttempts` wrong passwords (5 by default; on staff collections 50 for an hour since 1.18.0, `signInLimit` below) for `lockTime` (10 minutes by default), and diff --git a/docs/agent/AGENT.md b/docs/agent/AGENT.md index 51a0d36..6a9e496 100644 --- a/docs/agent/AGENT.md +++ b/docs/agent/AGENT.md @@ -661,7 +661,7 @@ for visitors. Then, all four: 3. In every auth collection use `adminOrSelfIn('')`, not `adminOrSelf`, for "only my own record". 4. Payload's default for a collection or global without `access` is "any logged-in account" — a customer too. Give every collection and global explicit `access` (writes: `adminOrEditor`, as the reference site's collections - and globals do since 1.17.2). Verify with `iapl-doctor --url …` (deep): no `visitor-writes` finding. 2FA covers + and globals do since 1.18.0). Verify with `iapl-doctor --url …` (deep): no `visitor-writes` finding. 2FA covers the panel's collection only. Payload's document locks (`payload-locked-documents`) are staff only since 1.18.0 (`lockedDocuments`), and lists from outside are capped at 100 for non-staff (`listLimit`) — security.md "Lists and sorting". @@ -671,7 +671,7 @@ for visitors. Then, all four: `GET /api/form-submissions` and `GET /api/users` with its token must answer `403`, and so must `POST /api/setup-totp`, `POST /api/form-submissions` and (a site with Payload jobs) `GET /api/payload-jobs/run` (`401`). -7. Payload jobs run over HTTP: since 1.17.2 only an admin or `Authorization: Bearer ` (when the project +7. Payload jobs run over HTTP: since 1.18.0 only an admin or `Authorization: Bearer ` (when the project writes no `jobs.access.run`). A Coolify scheduled task that calls `/api/payload-jobs/run` sends that header; `CRON_SECRET` goes into the app's environment (security.md "Payload's job queue"). @@ -1144,7 +1144,7 @@ project → **plugin gap**, not a copy. | ISR after save, old slug → 308, images across languages | `buildRevalidateHook`, `trackSlugHistoryHook`, `buildCrossLocaleFieldSync` | hooks.md | | ISR after a global is saved | plugin globals: `iapl({ revalidatePath })`; your own globals: `buildGlobalRevalidateHook({ revalidatePath })` | hooks.md | | Change a plugin global (access, hooks, fields) | `iapl({ globalOverrides })` | access.md | -| Roles and access | `adminOnly`, `adminOrEditor`, `adminOrSelf`, `adminOrSelfIn(slug)` (several auth collections), `authenticated`, `requireRole`, `hasMinimumRole` (+ `…Field`); a collection or global with drafts: `access: { read: readPublished(), readVersions: readPublishedVersions() }` (editors read drafts and every version, everybody else published only — Payload's open `read: () => true` answers `?draft=true` with the draft; `readPublished` is for `read` only, `readPublishedVersions` for `readVersions` only — `readVersions: readPublished()` answered 500 in 1.17.1 and is swapped for you since 1.17.2 on entities iapl() sees, `withVersionReadRules(entities)` for a plugin listed after it, `READ_PUBLISHED` marks the rule; neither on a collection without drafts; verify: without a session `GET /api//?draft=true` → 404 and `GET /api//versions?limit=10` → 200, published only); an unknown role name throws where the rule is written; staff checks: `userMeetsRole(req, role)`, `isAdmin(req.user, req.payload)` (roles count only for accounts of a staff collection; in a client component `isAdmin(user, config)` with `useConfig()`, imported from **`@intecion/ipal-kit/client`** (the main entry does not build there with webpack), in middleware `isAdmin(user, { staffCollections: ['users'] })` — without the last argument there it is always `false`), `staffCollectionSlugs(payload)`, `access.staffCollections`; second factor in your own code: `secondFactorPassed(req)`, `requireSecondFactor(access)`; injected `users`: `access.authAccess`, first user = admin (`access.firstUserAdmin`) | access.md, security.md | +| Roles and access | `adminOnly`, `adminOrEditor`, `adminOrSelf`, `adminOrSelfIn(slug)` (several auth collections), `authenticated`, `requireRole`, `hasMinimumRole` (+ `…Field`); a collection or global with drafts: `access: { read: readPublished(), readVersions: readPublishedVersions() }` (editors read drafts and every version, everybody else published only — Payload's open `read: () => true` answers `?draft=true` with the draft; `readPublished` is for `read` only, `readPublishedVersions` for `readVersions` only — `readVersions: readPublished()` answered 500 in 1.17.1 and is swapped for you since 1.18.0 on entities iapl() sees, `withVersionReadRules(entities)` for a plugin listed after it, `READ_PUBLISHED` marks the rule; neither on a collection without drafts; verify: without a session `GET /api//?draft=true` → 404 and `GET /api//versions?limit=10` → 200, published only); an unknown role name throws where the rule is written; staff checks: `userMeetsRole(req, role)`, `isAdmin(req.user, req.payload)` (roles count only for accounts of a staff collection; in a client component `isAdmin(user, config)` with `useConfig()`, imported from **`@intecion/ipal-kit/client`** (the main entry does not build there with webpack), in middleware `isAdmin(user, { staffCollections: ['users'] })` — without the last argument there it is always `false`), `staffCollectionSlugs(payload)`, `access.staffCollections`; second factor in your own code: `secondFactorPassed(req)`, `requireSecondFactor(access)`; injected `users`: `access.authAccess`, first user = admin (`access.firstUserAdmin`) | access.md, security.md | | Data from globals | `getGlobal`, `getSiteSettings`, `getSiteIntegrations` | payload-helpers.md | **Links and navigation** @@ -1204,7 +1204,7 @@ project → **plugin gap**, not a copy. |---|---|---| | Banner, settings, cookie button | `}>`, `CookieButton`, `useConsent` | consent.md | | Compliance defaults (1.17.0): Global Privacy Control honoured (no banner, no tracker request, opt-in from the cookie button wins), "Reject" like "Accept all", consent log on, withdrawal tells Meta / TikTok / Clarity and clears listed storage keys | built in; opt-outs: `SiteProviders gpc="ask"` / `gpc={false}`, `CookieBanner equalChoice={false}`, `iapl({ consentLog: false })` / `logEndpoint={false}`, `maxAgeDays` (re-ask, default 180); building blocks `resolveConsent`, `gpcFromHeaders`, `gpcFromNavigator`, `GPC_CATEGORIES`, `GPC_HEADER`, `CONSENT_LOG_PATH`, `gpcWellKnown` (`/.well-known/gpc.json`), `readEffectiveConsent`, `signalVendors`, `clarityConsent` (`/client`). Check: `iapl-consent-check` (5 runs incl. GPC, equal prominence, withdrawal), `iapl-doctor` (`consent-banner`, `consent-log-migration`) | consent.md → "Compliance defaults", consent-behaviour-spec.md | -| Cookie button placement | built in: bottom corner of the window on every page, never moves, never in or above the footer; the footer gets room under its last row while the button is shown, so nothing is covered at the page end. `CookieButton side` / `reserve` (`false` = no room) / `avoid` (`avoid={COOKIE_BUTTON_AVOID}` = above the footer, as before 1.17.2), tokens `--ipal-cookie-button-offset` / `-inset`, amount by hand `--ipal-cookie-button-space` on the footer. Do not render the button inside the footer, write a scroll handler for it, or add bottom padding for it by hand | consent.md → "Where the cookie button sits" | +| Cookie button placement | built in: bottom corner of the window on every page, never moves, never in or above the footer; the footer gets room under its last row while the button is shown, so nothing is covered at the page end. `CookieButton side` / `reserve` (`false` = no room) / `avoid` (`avoid={COOKIE_BUTTON_AVOID}` = above the footer, as before 1.18.0), tokens `--ipal-cookie-button-offset` / `-inset`, amount by hand `--ipal-cookie-button-space` on the footer. Do not render the button inside the footer, write a scroll handler for it, or add bottom padding for it by hand | consent.md → "Where the cookie button sits" | | Banner at first paint (not after hydration; LCP) | built in: `CookieBanner firstPaint` (default on), `SiteProviders nonce` under a nonce CSP; off: `firstPaint={false}`; server-exact HTML on a dynamic site: `SiteProviders consentCookie` / `ConsentProvider cookieValue`; your own banner: `consentBannerScript`. Check: `curl -s \| grep -c 'data-ipal="banner-script"'` → 1 and the response still has `s-maxage` | consent.md → "First paint" | | Settings window: in the bar / small / large with cookie details | `` — do not build your own window or cookie list | consent.md → "Large window with details" | | A consent-dependent script | `ConsentScript` | consent.md | @@ -1261,7 +1261,7 @@ add missing hosts with flags / `extra`; (3) change `mode` to `'enforce'` in both | Rich-text links: one rule for every stored URL — `link`, `autolink` (also marked internal) and the Markdown output (`lexicalToMarkdown`) drop `javascript:` / `data:` targets | `safeLinks={false}` (trusted content only) | `sanitizeRichTextLinks`, `safeHref` | | Locales: no stand-in — `resolveRoute` (page route, `/md/…`, MCP `get_page`) answers `null` for a locale the site does not have (`xx`, `all`); a 404 page that is a draft is not shown (built-in view instead) | — | `isSiteLocale(payload, locale)`; verify: `curl -i /md/xx` → 404 | | Site integrations versions (when a project turns them on) are read by admins only (`readVersions`) | — | `globalOverrides: { 'site-integrations': { access: { readVersions } } }` | -| Consent version only goes up (1.17.2): a save through access control with a lower Cookies → *Consent version* is refused with a message (old consent would count again); the Local API with `overrideAccess` may still | `iapl({ cookieSettings: { allowLowerPolicyVersion: true } })` | `policyVersionNeverDown`, `buildCookieSettingsFields` (type `CookieSettingsFieldOptions`), `buildCookieSettings(options)`; verify: lower it in the panel → the error under the field | +| Consent version only goes up (1.18.0): a save through access control with a lower Cookies → *Consent version* is refused with a message (old consent would count again); the Local API with `overrideAccess` may still | `iapl({ cookieSettings: { allowLowerPolicyVersion: true } })` | `policyVersionNeverDown`, `buildCookieSettingsFields` (type `CookieSettingsFieldOptions`), `buildCookieSettings(options)`; verify: lower it in the panel → the error under the field | | Drafts as related documents are left out (1.18.0): a block, menu or System pages link pointing at a page never published no longer brings its title, slug or text into the helpers' answers (`null` alone, removed from a list, `value: null` in a polymorphic one) — pages, Site settings, archive entries, the 404 page, Markdown, MCP, llms-full; a preview keeps them | `createContentHelpers({ draftRelations: 'keep' })`; `draftRelations: 'keep'` on `resolveRoute` / `getArchiveEntries` / `resolveNotFoundPage` / `collectSiteIndex` / `buildLlmsTxt` | `withoutDraftRelations`, `applyDraftRelations`, type `DraftRelations`; content.md "Drafts as related documents"; verify: a menu link to an unpublished page is gone on the site | | Integration status written alone (1.18.0): `emailStatus` / `turnstileStatus` go through the database adapter on their own, so a visitor's form submit can no longer put back an admin's SMTP or Turnstile change saved at the same moment; the cookie list is checked again right before the scanner writes it (a row an editor saved in between stays) | — | `writeGlobalFields(payload, slug, data)` for your own bookkeeping fields (no hooks, no version); `addToCookieList` | | Access callbacks (`cookieScanner.access`, the doctor's `access`): **only a literal `true` allows (1.18.0)** — a callback returning `req.user` (an object), `1`, a string or an un-awaited Promise refuses; an answer that is not a boolean is reported once per option in the server log with the fix. **Verify:** a callback returning `req.user` → `403` and one `[iapl] … returned an object` line | `strictAccessAnswers: false` (any truthy answer allows, as before 1.18.0) | return a boolean (`({ req }) => Boolean(req.user)`); `accessAllowed(option, answer, { strict })`, `strictAccessAnswers(req)`, type `AccessAnswerOptions`; security.md "Access callbacks" | @@ -1275,7 +1275,7 @@ add missing hosts with flags / `extra`; (3) change `mode` to `'enforce'` in both | 2FA setup required: an account without TOTP reaches only the setup screen; 72 h window from creation / admin reset, then blocked; status and "Reopen setup" on the account page, notice on the dashboard, `POST /api/ipal/two-factor/reset` | `twoFactor.requireSetup: false`; parts: `requireSetup: { dashboardNotice: false, statusField: false, setupNotice: false }` | `requireSetup: { windowHours, exempt }` (`exempt` returns exactly `true`, never `async`; decide it from a field only admins write, e.g. a `serviceAccount` checkbox with `adminOnlyField` — never from the e-mail, which every account may change itself; security.md "Decide `exempt` from a field only an administrator can write"), `twoFactor.resetAccess` (default: an admin who entered its own code; the reset ends the account's sessions), texts `twoFactor*`; `twoFactorSetupState(req)`, `buildSetupFields`, `backfillSetupFrom`, `buildTwoFactorResetEndpoint`. **Postgres/SQLite: migration for `totp_setup_from` applied when the new container starts (`prodMigrations` or `pnpm payload migrate && pnpm start`; never a pre-deployment command — deployment.md §4.3), or every login answers 500** | | The second factor on every collection and global, whichever plugin added it, and on the plugin's endpoints; an unrecognised 2FA package = startup error | per entity: `custom.ipal.secondFactor: false` or `{ read: false }` (or the package's `custom.totp.disableAccessWrapper`); everywhere: `twoFactor.guard: false` (not recommended) | `requireSecondFactor` / `secondFactorPassed` in your own access functions and endpoints | | At most 5 **wrong** verify codes per account in 10 minutes (`POST /api/verify-totp` → `429`); a right code gives its place back (1.17.1), so correct logins are never refused; an attempt held out only by others still being checked gets `429` + `Retry-After: 2` ("try again in a moment"); the count is kept in memory and in the database (`payload.kv`), so a restart or a second instance does not reset it. **Verify:** log in correctly 7 times in a row → all in; 5 wrong codes → the next gets `429` with a long `Retry-After` | `twoFactor.verifyLimit: false` | `verifyLimit: { max, windowMinutes, store: 'memory' }`; own wiring: `buildVerifyLimit(...)` + `limit.settle(req, correct)` | -| The plugin's panel actions (`POST` mail service connect / disconnect, test e-mail, cookie scan / approval / crawl) refuse a request a browser marks as coming from another origin (`403`, before anything is read; 1.17.2). The panel's buttons are not affected; set `serverURL` (doctor `csrf-empty` warns without it). **Verify:** `curl -X POST /api/ipal/test-email -H 'Origin: https://other.example' -H 'Content-Type: text/plain' -b -d '{}'` → `403` | `adminSameOrigin: false` | `adminSameOrigin: { origins: [...] }`; `requireOwnOrigin(endpoint, origins?)` for your own endpoints | +| The plugin's panel actions (`POST` mail service connect / disconnect, test e-mail, cookie scan / approval / crawl) refuse a request a browser marks as coming from another origin (`403`, before anything is read; 1.18.0). The panel's buttons are not affected; set `serverURL` (doctor `csrf-empty` warns without it). **Verify:** `curl -X POST /api/ipal/test-email -H 'Origin: https://other.example' -H 'Content-Type: text/plain' -b -d '{}'` → `403` | `adminSameOrigin: false` | `adminSameOrigin: { origins: [...] }`; `requireOwnOrigin(endpoint, origins?)` for your own endpoints | | Public lists capped (1.18.0, audit F4): a REST / GraphQL list from a caller that is not staff gets at most 100 documents; `pagination=false` / `limit=0` become one page of 100; staff, the Local API and server reads with `overrideAccess: true` that pass a request on untouched. **Verify:** `curl -s '/api/pages?limit=100000' \| jq .limit` → `100` | `listLimit: false` | `listLimit: { max, staff, exclude }`; `buildQueryGuardHook` for a collection a plugin adds after iapl; `capListLimit` | | Operator names in `sort` refused (1.18.0, audit F5): `?sort=$where`, `-$natural`, `a.$ne` → `400` for everyone (logged as one `info` line, `RefusedSortError`) instead of a database error. **Verify:** `curl -s -o /dev/null -w '%{http_code}' '/api/pages?sort=%24where'` → `400` | `refuseOperatorSort: false` | `loggingLevels: { RefusedSortError: false }`; `isOperatorSort` | | Payload's document locks (`payload-locked-documents`) for staff accounts only, with the second factor (1.18.0); Payload's default was any signed-in account, a customer too. **Verify:** a visitor account gets `403` on `/api/payload-locked-documents`; the panel still shows who edits a document | `lockedDocuments: false` | `lockedDocuments: { access: { read, create, update, delete } }`; `staffOnlyLocks`, `applyLockedDocumentsAccess` | @@ -1287,7 +1287,7 @@ add missing hosts with flags / `extra`; (3) change `mode` to `'enforce'` in both | The SMTP password stays with its server: a save in the panel or over the API that changes the server, port or user name without the password is refused (`400` "Enter the password again…"), whatever the transport says — otherwise an admin session points the server at its own machine and a test e-mail hands the password over. A change of the transport alone asks for nothing. Seeds and scripts (Local API, access control off) are not asked | `secrets: { reenterOnChange: false }` | `writeOnlySecret(field, { boundTo: [...] })`, `buildKeepSecret`, `SMTP_PASSWORD_BOUND_TO` | | The admin panel opens for `editor` and above; an account with only `user` sees "Unauthorized" (the API is not touched). First start logs how many accounts are below the role | `accounts: { panelRole: 'user' }` (or `false`) | `panelRole: 'admin'`; your own `access.admin`; `panelAccess(role)` | | Nobody creates an account for themselves, or takes one over. A staff collection (also the project's own, also one a later plugin adds) without a `create` / `update` / `delete` / `unlock` / `read` / `readVersions` rule gets one (on a collection a later plugin adds the plugin's rule is put in front of its own and both must allow; `custom: { ipal: { accountRules: false } }` on it keeps its own): with the plugin's roles, or wherever an account of it can hold `editor` or `admin` (`user, editor, admin, boss`; `viewer, editor`; a `roles` field that is text, json or a relationship holding a list — the value in the account's `roles` array makes a plugin admin or editor; a single-valued `roles` field is not affected: its value never counts) — create, delete, unlock: an admin; update: an admin or the account itself; the `roles` field: only an admin. With roles of its own that hold neither `editor` nor `admin`, or none: an account of that same collection, or a plugin admin, and an account never changes its own roles — **the plugin cannot rank a project's own roles: write that collection's rules** (`iapl-doctor` → `staff-own-roles`). `read`: a staff account. Payload's first-user route answers only for the panel's login collection (the first account, which becomes admin), in any spelling of the URL. `access.firstUserAdmin: false` with a default role below the panel role: the default panel role is not applied (logged), an explicit one is refused at start. With a slug in `access.staffCollections` that is not an auth collection Payload does not start (`/api/health` 503) | `accounts: { adminOnlyCreate: false, adminOnlyWrite: false, staffOnlyRead: false, firstUserRoute: 'all' }` | your own rule wins; `firstUserRoute: ['users', 'partners']`; a collection with open sign-up keeps its routes; `staffCreateAccess`, `staffUpdateAccess(slug)`, `staffReadAccess`, `sameStaffCollectionAccess(slug)`, `rolesByAdminOnly`, `rolesNotOwn(slug)`, `hasPluginRoles`, `applyStaffAccountAccess`, `adoptLateAuthCollections`, `buildFirstUserEndpoint` | -| A locked staff account (Payload's `maxLoginAttempts`) answers its login exactly like a wrong password — REST body and status, GraphQL `extensions.name: AuthenticationError`, the panel's sign-in (1.17.2); visitor collections keep Payload's answer. **Verify:** 5 wrong passwords for an admin, then the right one → the same `401` body as for an unknown address | `accounts: { lockedAnswer: 'payload' }` | `lockedLooksWrong`, `withLockedAnswer(config)`, `graphqlLoginName` | +| A locked staff account (Payload's `maxLoginAttempts`) answers its login exactly like a wrong password — REST body and status, GraphQL `extensions.name: AuthenticationError`, the panel's sign-in (1.18.0); visitor collections keep Payload's answer. **Verify:** 5 wrong passwords for an admin, then the right one → the same `401` body as for an unknown address | `accounts: { lockedAnswer: 'payload' }` | `lockedLooksWrong`, `withLockedAnswer(config)`, `graphqlLoginName` | | Failed staff sign-ins counted per client IP and typed address (folded: case, width, NFKC): 5 in 15 min, then `429` for that IP and address; only failures count; Payload's per-account lock raised to 50 failures / 1 hour where the project did not set `maxLoginAttempts` / `lockTime` (1.18.0). Pin `IAPL_IP_HEADER`. **Verify:** 5 wrong passwords with `X-Forwarded-For: 198.51.100.1`, then the right one from there → `429`, from another address → `200` | `accounts: { signInLimit: false }` | `signInLimit: { perAddress, windowMinutes, accountLock: { maxLoginAttempts, lockTime } \| false }`; `applySignInRules`, `releaseRateLimit` | | Staff login, forgot password and reset password refuse a request a browser marks as coming from another origin (`403`, REST and GraphQL; 1.18.0); visitor collections untouched. **Verify:** `curl -X POST /api/users/login -H 'Origin: https://other.example' …` → `403` | `accounts: { signInSameOrigin: false }` | `signInSameOrigin: { origins: [...] }` | | Changing one's OWN e-mail, username or password needs the current password: panel field "Current password" on the account page (`MaskedField`, no import-map change), `currentPassword` over REST / GraphQL; admins changing others, server code and API keys are not asked; wrong ones count like failed sign-ins (1.18.0). **Verify:** `PATCH /api/users/ {"email":"…"}` → `400`, with `"currentPassword"` → `200` | `accounts: { confirmOwnChanges: false }` | `buildCurrentPasswordField`, `passwordMatches`, `CURRENT_PASSWORD_FIELD` (access.md) | @@ -1299,7 +1299,7 @@ add missing hosts with flags / `extra`; (3) change `mode` to `'enforce'` in both | Roles count only for accounts of a staff collection, in every predicate and access function | — | `access.staffCollections` | | `enabled: false` keeps the schema | — | — (no endpoints, `onInit` or admin components; no DROP TABLE in `migrate:create`) | | No client IP = one shared `unknown-ip` bucket at 20× the limit | `setUnknownIpFactor(0)` (only with a limiter in front) | `setUnknownIpFactor(n)`; `UNKNOWN_IP_FACTOR` | -| IPv6 counted per /64 in every plugin limiter (1.17.2): one /64 = one client, `::ffff:a.b.c.d` = its IPv4; no /48 counter by default. **Verify:** 50 requests with `X-Real-IP: 2001:db8:1:1::` → `429` after the limit | `setIpv6Grouping({ prefix: 128 })` (per address, as before) | `setIpv6Grouping({ prefix, wide: 48, wideFactor })`; `ipRateKey(ip)` for your own limiter (forms.md "IPv6 is counted per network") | +| IPv6 counted per /64 in every plugin limiter (1.18.0): one /64 = one client, `::ffff:a.b.c.d` = its IPv4; no /48 counter by default. **Verify:** 50 requests with `X-Real-IP: 2001:db8:1:1::` → `429` after the limit | `setIpv6Grouping({ prefix: 128 })` (per address, as before) | `setIpv6Grouping({ prefix, wide: 48, wideFactor })`; `ipRateKey(ip)` for your own limiter (forms.md "IPv6 is counted per network") | | Turnstile token domain not checked | (default) | `createSubmitAction({ turnstileHostnames })`, `verifyTurnstile({ hostnames })` — leave empty in dev | | Consent Mode `advanced` | `consentMode: 'basic'` | your own `` props (`SiteProviders analytics={false}`) | | Locale cookie: consent read under its own stored version | — | `createProxy(config, { policyVersion })` / `createLocaleMiddleware({ policyVersion })` | diff --git a/docs/agent/reference-site/INDEX.md b/docs/agent/reference-site/INDEX.md index efadd7c..048908c 100644 --- a/docs/agent/reference-site/INDEX.md +++ b/docs/agent/reference-site/INDEX.md @@ -2,7 +2,7 @@ -The reference site is one complete client site on IAPL 1.17.2 ("Example Studio", made up) that uses +The reference site is one complete client site on IAPL 1.18.0 ("Example Studio", made up) that uses every convention in AGENT.md. It lives in the plugin repo (`reference/`, not in the npm package). Copy the PATTERN of the file you need; change only the project's content. Files up to 40 lines are below in full; open the rest in the repo at the tag of your plugin version: @@ -1148,7 +1148,7 @@ Rules: AGENT.md §8a. | `e2e/performance.spec.ts` | the performance budgets (run by `pnpm e2e:built` in both bundlers): every page type on a throttled phone and a desktop — LCP, CLS, TBT, the response to a tap, JS / CSS / font bytes, requests, render-blocking, third parties before consent — and the MongoDB queries of one render (docs/performance.md) | | `e2e/routes.snapshot.json` | every public route of the site (REST, GraphQL, Next route files) with one line saying who may use it and why — the judged list `routes:check` compares with | | `e2e/routes.ts` | `routes:check`: the site's public routes against e2e/routes.snapshot.json (`pnpm payload run e2e/routes.ts [update]`; from the repository `pnpm routes:check`) (below) | -| `e2e/sign-in-answers.spec.ts` | built-site test (pnpm e2e:built, 1.17.2): a locked staff account gets the wrong-password answer over REST and GraphQL (accounts.lockedAnswer); the plugin's panel actions refuse another origin and take the site's own (adminSameOrigin) | +| `e2e/sign-in-answers.spec.ts` | built-site test (pnpm e2e:built, 1.18.0): a locked staff account gets the wrong-password answer over REST and GraphQL (accounts.lockedAnswer); the plugin's panel actions refuse another origin and take the site's own (adminSameOrigin) | | `e2e/sign-in-look.spec.ts` | browser test of the sign-in look (whiteLabel.signIn): the panel comes with the form, sits above it on a phone in both themes, is on forgot / reset / logout too, the language links work, the 2FA code screen keeps its boxes (now named) | | `e2e/smoke.spec.ts` | the smoke tests every release must pass: pages, showcase, forms (also a file sent by e-mail), sitemap, SEO/GEO, headers, consent, 2FA | | `e2e/smtp-sink.ts` | a local mail sink for the smoke tests: reads what the site really sent (recipients, attachments) | diff --git a/docs/agent/skills/iapl-audit/resources/closed-doors.spec.template.ts b/docs/agent/skills/iapl-audit/resources/closed-doors.spec.template.ts index f2e8d4c..a48cec0 100644 --- a/docs/agent/skills/iapl-audit/resources/closed-doors.spec.template.ts +++ b/docs/agent/skills/iapl-audit/resources/closed-doors.spec.template.ts @@ -46,14 +46,14 @@ const DOORS: Door[] = [ { closedFor: ALL, method: 'POST', name: 'the crawler\'s call-back without its token', path: '/api/ipal/cookie-crawl/results', body: { jobId: 'x', ok: true } }, { closedFor: OUTSIDERS, method: 'POST', name: 'a crawl without the schedule\'s token', path: '/api/ipal/cookie-crawl' }, { closedFor: OUTSIDERS, name: 'form submissions', path: '/api/form-submissions' }, - // IAPL 1.17.2: a staff account only; an open door answers 400 (validation) instead of 403 + // IAPL 1.18.0: a staff account only; an open door answers 400 (validation) instead of 403 { body: { form: NO_ID, submissionData: [] }, closedFor: OUTSIDERS, method: 'POST', name: 'a submission past submitForm', path: '/api/form-submissions', closed: status(403) }, { body: { email: 'door@example.com', password: 'Door-Password-1234', roles: ['admin'] }, closedFor: ALL, method: 'POST', name: 'nobody creates a staff account', path: '/api/users', closed: status(403) }, { body: { email: 'first@example.com', password: 'Door-Password-1234' }, closedFor: ALL, method: 'POST', name: 'the first-user route once an account exists', path: '/api/users/first-register', closed: status(403) }, { body: {}, closedFor: OUTSIDERS, method: 'POST', name: 'Site settings cannot be saved', path: '/api/globals/site-settings', closed: status(403) }, { closedFor: ALL, name: 'the GraphQL playground (production)', path: '/api/graphql-playground', closed: status(404) }, { closedFor: ALL, graphql: '{ __schema { queryType { name } } }', closed: ({ body }) => Boolean((body as { errors?: unknown[] })?.errors?.length), name: 'GraphQL introspection (production)' }, - // a site without jobs: 404. A site WITH jobs (IAPL 1.17.2): refused (401) for everybody but an admin and + // a site without jobs: 404. A site WITH jobs (IAPL 1.18.0): refused (401) for everybody but an admin and // `Authorization: Bearer ` — drop `closed: status(404)` there { closedFor: ALL, name: 'Payload\'s job queue', path: '/api/payload-jobs/run', closed: status(404) }, // the project's own doors: add them here diff --git a/docs/agent/skills/iapl-consent-check/SKILL.md b/docs/agent/skills/iapl-consent-check/SKILL.md index 71dcc81..44eb28e 100644 --- a/docs/agent/skills/iapl-consent-check/SKILL.md +++ b/docs/agent/skills/iapl-consent-check/SKILL.md @@ -55,7 +55,7 @@ before analytics or marketing consent — check the project's choice in "Project `nonce` to ``. A visitor who decided must never see the banner on reload; one whose decision is from an older Policy version must see it at once. A click on a button before hydration counts (the checks above click as soon as the button is visible). -7. Cookie button (1.17.2, consent.md → "Where the cookie button sits"): after a decision, on a long page, a short +7. Cookie button (1.18.0, consent.md → "Where the cookie button sits"): after a decision, on a long page, a short page and a page with a form, desktop and phone width (also 360 px) — the button is in the bottom corner of the window at the top, in the middle, with the footer in view and at the very end: it must not move at all. At the very end nothing of the footer is under it and the last footer link can be tapped (the footer has grown a little: diff --git a/docs/agent/skills/iapl-debug/SKILL.md b/docs/agent/skills/iapl-debug/SKILL.md index 4800773..abf6769 100644 --- a/docs/agent/skills/iapl-debug/SKILL.md +++ b/docs/agent/skills/iapl-debug/SKILL.md @@ -34,8 +34,8 @@ through this procedure. Ask only when you are missing something you cannot get y ### Build / TypeScript | Symptom | Cause | Fix | |---|---|---| -| a panel button (mail service Connect / Disconnect, Send test e-mail, cookie scan / approve / check site) answers `403` "Not allowed from this origin."; log `[iapl] a panel action from origin "…" was refused` | the request's origin is not one the site knows (1.17.2, `adminSameOrigin`): a reverse proxy that rewrites `Host` and sends no `X-Forwarded-Host`, and no `serverURL` | set `serverURL: process.env.NEXT_PUBLIC_SERVER_URL` in the Payload config, or make the proxy send `X-Forwarded-Host`, or `adminSameOrigin: { origins: ['https://…'] }`; `iapl-doctor` `csrf-empty` | -| a staff account's correct password gets "The email or password provided is incorrect." | the account is locked by Payload after `maxLoginAttempts` wrong passwords (5, for `lockTime`, 10 min); since 1.17.2 a locked staff account gets the wrong-password answer (`accounts.lockedAnswer`) | wait for the lock to end, or an admin unlocks it (the account in the panel, or `POST /api/users/unlock`); `lockUntil` on the account shows it. Payload's own message back: `accounts: { lockedAnswer: 'payload' }` | +| a panel button (mail service Connect / Disconnect, Send test e-mail, cookie scan / approve / check site) answers `403` "Not allowed from this origin."; log `[iapl] a panel action from origin "…" was refused` | the request's origin is not one the site knows (1.18.0, `adminSameOrigin`): a reverse proxy that rewrites `Host` and sends no `X-Forwarded-Host`, and no `serverURL` | set `serverURL: process.env.NEXT_PUBLIC_SERVER_URL` in the Payload config, or make the proxy send `X-Forwarded-Host`, or `adminSameOrigin: { origins: ['https://…'] }`; `iapl-doctor` `csrf-empty` | +| a staff account's correct password gets "The email or password provided is incorrect." | the account is locked by Payload after `maxLoginAttempts` wrong passwords (5, for `lockTime`, 10 min); since 1.18.0 a locked staff account gets the wrong-password answer (`accounts.lockedAnswer`) | wait for the lock to end, or an admin unlocks it (the account in the panel, or `POST /api/users/unlock`); `lockUntil` on the account shows it. Payload's own message back: `accounts: { lockedAnswer: 'payload' }` | | a sign-in answers `429` "Too many failed sign-ins to this address from here" | 5 failed sign-ins for that address from that client IP in 15 minutes (`accounts.signInLimit`, 1.18.0); everybody behind one IP shares it (an office NAT); without `IAPL_IP_HEADER` everybody may share the no-IP bucket | wait the minutes it names, or sign in from elsewhere; pin `IAPL_IP_HEADER`; more room: `signInLimit: { perAddress: 10 }` | | staff login / "forgot password" answers `403` and the log says `[iapl] a staff sign-in from origin "…" was refused` | the request came from another origin (`accounts.signInSameOrigin`, 1.18.0): a front end on another domain, or a proxy that rewrites `Host` without `serverURL` | set `serverURL`, or `signInSameOrigin: { origins: ['https://…'] }` | | saving one's own account answers "Enter your current password to change your e-mail address or password." | `accounts.confirmOwnChanges` (1.18.0): own e-mail / username / password changes need the current password | type it in "Current password" on the account page; scripts send `currentPassword`; off: `confirmOwnChanges: false` | diff --git a/docs/agent/skills/iapl-reference/SKILL.md b/docs/agent/skills/iapl-reference/SKILL.md index d85fd5b..501d517 100644 --- a/docs/agent/skills/iapl-reference/SKILL.md +++ b/docs/agent/skills/iapl-reference/SKILL.md @@ -38,7 +38,7 @@ description: Complete map of everything @intecion/ipal-kit provides — every ia | `accounts.staffOnlyRead` | on | `read` and `readVersions` on a staff collection without those rules: a fully signed-in account of a staff collection (Payload's default let a visitor account list the staff accounts) | `false` = Payload's default; a `read` rule you wrote wins | | `accounts.firstUserRoute` | `'panel'` | which auth collections `POST /api//first-register` answers for while they are empty: only the one the panel logs in with (the first account of a site → admin). Others get `403`, a second staff collection included, in any spelling of the URL (the plugin's own endpoint sits in front of Payload's); a collection whose own `create` allows an anonymous request keeps its route. With `access.firstUserAdmin: false` and a default role below the panel role, the default `panelRole` is not applied (logged) and an explicit one is refused at start | a list of slugs; `'all'` = Payload's behaviour | | `accounts.password` | `{ minLength: 12 }` | when a password is SET on a staff collection (create, first-user screen, change, reset by e-mail; panel, API and Local API): at least `minLength` characters, not the account's e-mail address. Existing passwords are never checked — a shorter one keeps logging in | `{ minLength }`; `false` = Payload's rule (3 characters) | -| `accounts.lockedAnswer` | `'wrong'` (1.17.2) | a staff account Payload has locked (too many wrong passwords) gets exactly the wrong-password answer on login (REST, GraphQL, the panel): nobody tells which addresses have an account; the lock itself is unchanged | `'payload'` = Payload's "This user is locked…"; any other value stops the start | +| `accounts.lockedAnswer` | `'wrong'` (1.18.0) | a staff account Payload has locked (too many wrong passwords) gets exactly the wrong-password answer on login (REST, GraphQL, the panel): nobody tells which addresses have an account; the lock itself is unchanged | `'payload'` = Payload's "This user is locked…"; any other value stops the start | | `accounts.signInLimit` | `{ perAddress: 5, windowMinutes: 15, accountLock: { maxLoginAttempts: 50, lockTime: 3_600_000 } }` (1.18.0) | failed staff sign-ins per client IP + typed address (folded): over the limit `429` for that IP and address only; only failures count; Payload's per-account lock raised where the project set none | `{ perAddress, windowMinutes, accountLock }`; `accountLock: false` = Payload's lock; `false` = as before 1.18 | | `accounts.signInSameOrigin` | on (1.18.0) | staff login / forgot / reset password: `403` for a request a browser marks as coming from another origin | `{ origins: [...] }`; `false` | | `accounts.confirmOwnChanges` | on (1.18.0) | own e-mail / username / password change needs `currentPassword` (panel field, REST, GraphQL) | `false` | @@ -50,7 +50,7 @@ description: Complete map of everything @intecion/ipal-kit provides — every ia | `listLimit` | `{ max: 100, staff: false }` (1.18.0, audit F4) | a REST / GraphQL list (`find`, versions, distinct) from a caller that is not staff gets at most `max` documents; `pagination=false` / `limit=0` become one page; staff, the Local API and server reads with `overrideAccess: true` that pass a request on untouched | `false` (Payload's behaviour); `{ max, staff: true, exclude: ['slug'] }`; `buildQueryGuardHook` for a collection added after iapl | | `refuseOperatorSort` | `true` (1.18.0, audit F5) | a `sort` naming a database operator (`$where`, `-$natural`, `a.$ne`) → `400` for everyone, logged as one `info` line (`RefusedSortError`) | `false`; `loggingLevels: { RefusedSortError: false }` hides the log line | | `lockedDocuments` | staff only (1.18.0) | Payload's document locks (`payload-locked-documents`) for staff accounts with the second factor; Payload's default was any signed-in account | `false` (Payload's default); `{ access: { read, create, update, delete } }` | -| `adminSameOrigin` | on (1.17.2) | `POST` mail service connect / disconnect, test e-mail, cookie scan / approval / crawl refuse (`403`) a request a browser marks as coming from another origin; own origins: the request's host, `serverURL`, `csrf`, `cors`, `origins` | `{ origins: [...] }` adds origins; `false` = no check; any other value stops the start | +| `adminSameOrigin` | on (1.18.0) | `POST` mail service connect / disconnect, test e-mail, cookie scan / approval / crawl refuse (`403`) a request a browser marks as coming from another origin; own origins: the request's host, `serverURL`, `csrf`, `cors`, `origins` | `{ origins: [...] }` adds origins; `false` = no check; any other value stops the start | | `adminRoute` | `'/admin'` | `config.routes.admin`; stats link and views, `IntegrationAlerts` | the project moves `app/(payload)//` itself and adds the route to the proxy matcher (security.md) | | `twoFactor` | **none = error** | `@clocklimited/payload-2fa` with `forceSetup: true` (TOTP enforced, also checked in the API) | `twoFactor: false` (discouraged); omitting the option throws `[iapl] twoFactor.issuer is required` | | `twoFactor.issuer` | — (required) | name in the authenticator app | — | @@ -102,7 +102,7 @@ description: Complete map of everything @intecion/ipal-kit provides — every ia | `forms.adminGroup` | `'Forms'` | sidebar group | `false` = Payload default; `admin.group` in overrides wins | | `forms.fields.*` | on: `checkbox`, `checkboxGroup`, `country`, `date`, `email`, `message`, `number`, `radio`, `select`, `state`, `step`, `text`, `textarea`, `time`; off: `payment` | block types in the builder (all with "Show only when") | `: false`; a block object replaces it; `payment: true` **does nothing** (filtered out) — pass a block object | | `forms.formOverrides` | Form/Forms labels, `emails` readable by logged-in users only | overrides the `forms` collection (`fields: ({ defaultFields }) => …`, `slug`, `admin`, `access`…) | any `CollectionConfig` | -| `forms.formSubmissionOverrides` | create: a staff account with its second factor (since 1.17.2; before: any signed-in account), read: editor+, delete: admin | overrides `form-submissions` | `access.create` etc. wins | +| `forms.formSubmissionOverrides` | create: a staff account with its second factor (since 1.18.0; before: any signed-in account), read: editor+, delete: admin | overrides `form-submissions` | `access.create` etc. wins | | `forms.redirectRelationships` | none | collections a form can redirect to | `['pages']` | | `forms.emailLayout` | `false` | `beforeEmail` with a layout (logo, colour, footer) + Site settings → **Emails** tab; `{{*:table}}` readable | `true` | | `forms.beforeEmail` | none | your own e-mail changes (after the layout) | form-builder function | @@ -112,7 +112,7 @@ description: Complete map of everything @intecion/ipal-kit provides — every ia | `consentLog` | **on** (since 1.17.0) | `consent-records` collection + `POST /api/ipal/consent` (rate limit 20/min); Postgres / SQLite: a table, migration in the same deploy; MongoDB: a TTL index deletes records older than the retention (1.18.0) | `false` / `{ retentionDays }` (default 1095) / `{ ttlIndex: false }` | | `unusedMedia` | off | 1.18.0: a notice above upload lists with a link to the files nothing uses (manual delete); then `pnpm generate:importmap` | `true` / `{ collections: ['media'] }` | | `consentLog.collectionOverrides` | none | changes `consent-records`: an object merges `access` / `admin` / `hooks` key by key (your keys win), a function `(collection) => collection` takes over (keep the slug) | e.g. `{ access: { read: ({ req }) => req.user?.email === 'dpo@acme.pl' } }` — narrows who reads records in a project without roles | -| `jobsRunAccess` | on (since 1.17.2), only when the project writes no `jobs.access.run` | Payload's job queue over HTTP (`/api/payload-jobs/run`, `/handle-schedules`): an admin with the second factor (an admin API key counts) or `Authorization: Bearer ` (16+ chars); before: any signed-in account of any auth collection. In-process runs (`jobs.autoRun`, `payload jobs:run`) unaffected | `false` = Payload's default; `{ secretVar }` = another variable; your own `jobs.access.run` wins. Check: `curl -H "Authorization: Bearer $CRON_SECRET" $URL/api/payload-jobs/run` → 200, without it 401 (security.md "Payload's job queue") | +| `jobsRunAccess` | on (since 1.18.0), only when the project writes no `jobs.access.run` | Payload's job queue over HTTP (`/api/payload-jobs/run`, `/handle-schedules`): an admin with the second factor (an admin API key counts) or `Authorization: Bearer ` (16+ chars); before: any signed-in account of any auth collection. In-process runs (`jobs.autoRun`, `payload jobs:run`) unaffected | `false` = Payload's default; `{ secretVar }` = another variable; your own `jobs.access.run` wins. Check: `curl -H "Authorization: Bearer $CRON_SECRET" $URL/api/payload-jobs/run` → 200, without it 401 (security.md "Payload's job queue") | | `doctor` | on (404 until `IAPL_DOCTOR_TOKEN` is set) | `GET /api/ipal/doctor` — read-only counts for `iapl-doctor --url` (users without TOTP, cookies waiting for approval, versions); Bearer token ≥ 32 characters, rate-limited, never names or values | `false` = no endpoint; `{ tokenVar, access }` (doctor.md) | | `cookieScanner` | off | `cookie-review` collection, "Scan cookies" box above its list (`CookieScanButton`), `GET`/`POST /api/ipal/cookie-scan`, and (unless `approval: false`) the *Approve cookies* view `/admin/cookie-approval` (`CookieApprovalView`) + `GET`/`POST /api/ipal/cookie-approval` + the dashboard reminder; a scan lists the cookies of the integrations switched on + names looked up in the bundled Open Cookie Database; one **Approve and add** puts the ticked cookies into Cookies → Cookie list (so `` and the detailed window); never deletes, never overwrites edited text, never duplicates, nothing reaches the banner before approval | `true` / object; after switching on: `pnpm generate:importmap` + `migrate:create`. Check: *Privacy → Cookie review* → **Scan cookies** → "Waiting for approval: N" → **Review and approve** → **Approve and add** → the cookies are in Cookies → Cookie list (cookie-scanner.md) | | `cookieScanner.adminLayout` | `'combined'` | one *Cookies* entry: *Review and approve* and (with `crawl`) *Site check* tabs on the `cookie-settings` global (`ui` fields, `CookieReviewTab` / `CookieSiteCheckTab`); `cookie-review` and `cookie-crawl` get `admin.group: false` (out of the nav, pages and API kept) | `'separate'`; no migration, `generate:importmap` | diff --git a/docs/agent/skills/iapl-reference/resources/api.md b/docs/agent/skills/iapl-reference/resources/api.md index fa691e3..c8d48ff 100644 --- a/docs/agent/skills/iapl-reference/resources/api.md +++ b/docs/agent/skills/iapl-reference/resources/api.md @@ -85,8 +85,8 @@ Admin panel components from `@intecion/ipal-kit/admin` — the project does NOT | `buildRolesField(defaultRole?, { firstUserAdmin? })` | `@intecion/ipal-kit` | The `roles` select field the plugin injects (only admins set roles; `firstUserAdmin` default `true` = the account made on "Create first user" gets `admin`). The plugin wires it itself — use it only for an auth collection the plugin does not manage. | | `injectRoles(config, accessOption)` | `@intecion/ipal-kit` | Adds `roles` to `accessOption.authCollection` in a config. The plugin calls it itself with `access` — do not call. | -| `requireOwnOrigin(endpoint, origins?)`, `guardAdminEndpoints(config, projectEndpoints, option)`, `ADMIN_POST_ENDPOINTS`, type `AdminSameOriginOption` | `@intecion/ipal-kit` | `adminSameOrigin` (1.17.2): wraps an endpoint so a request a browser marks as coming from another origin gets `403` (logged once per origin); applies it to the plugin's panel actions it added; the list of `[method, path]` covered. `reportRefusedOrigin(req, origins?, { what, option, docs }?)` names your option in the log line. | -| `lockedLooksWrong`, `withLockedAnswer(config)`, `graphqlLoginName(collection)` | `@intecion/ipal-kit` | `accounts.lockedAnswer` (1.17.2): the config-level `afterError` hook that answers Payload's `LockedAuth` on a staff collection's login (REST, GraphQL) exactly like `AuthenticationError`; adding it to a config (idempotent); the GraphQL login mutation's name of a collection. | +| `requireOwnOrigin(endpoint, origins?)`, `guardAdminEndpoints(config, projectEndpoints, option)`, `ADMIN_POST_ENDPOINTS`, type `AdminSameOriginOption` | `@intecion/ipal-kit` | `adminSameOrigin` (1.18.0): wraps an endpoint so a request a browser marks as coming from another origin gets `403` (logged once per origin); applies it to the plugin's panel actions it added; the list of `[method, path]` covered. `reportRefusedOrigin(req, origins?, { what, option, docs }?)` names your option in the log line. | +| `lockedLooksWrong`, `withLockedAnswer(config)`, `graphqlLoginName(collection)` | `@intecion/ipal-kit` | `accounts.lockedAnswer` (1.18.0): the config-level `afterError` hook that answers Payload's `LockedAuth` on a staff collection's login (REST, GraphQL) exactly like `AuthenticationError`; adding it to a config (idempotent); the GraphQL login mutation's name of a collection. | | `applySignInRules(collection, accounts?)`, `buildSignInBeforeOperation(slug, rules)`, `releaseSignInPlace`, `settleFailedSignIn`, `buildCurrentPasswordField()`, `resolveSignInRules(accounts?)`, `foldSignInName(value)`, `passwordMatches({ hash, salt }, password)`, `CURRENT_PASSWORD_FIELD`, `SIGN_IN_RULES_MARK` (the mark on the `beforeOperation` hook); types `SignInRulesOptions`, `SignInLimitOptions`, `SignInSameOriginOptions` | `@intecion/ipal-kit` | 1.18.0, `accounts.signInLimit` / `signInSameOrigin` / `confirmOwnChanges`: the three rules on one staff collection (hooks, field, Payload lock defaults); the `beforeOperation` hook; the `afterLogin` hook that gives a sign-in's place back; the config `afterError` hook that ends a failed one; the virtual "Current password" field; the options with defaults; the address folding (NFKC, lower case, trim); Payload's stored-hash check (unknown formats refused). | | `releaseRateLimit({ key, scope, max?, windowMs?, cost? })` | `@intecion/ipal-kit` | Gives back a place `consumeRateLimit` took (memory: never below 0; a store: `hit(id, -cost)`) — for a limiter that counts failures only. | @@ -170,8 +170,8 @@ Fifteen ready blocks and ten page templates. **Use a library block (or a variant |---|---|---| | `ConsentProvider` | `@intecion/ipal-kit/client` | Consent provider: `{ texts, cookieMap?, logEndpoint?, nonce?, cookieValue?, gpc?, maxAgeDays? }` (`gpc`: Global Privacy Control `'honour'` default / `'ask'` / `false`; `maxAgeDays`: re-ask period, default 180; withdrawal also removes the panel's listed storage keys and tells Meta / TikTok / Clarity) (`nonce`: CSP nonce for the banner's first-paint script; `cookieValue`: optional server-read consent cookie → exact HTML, dynamic pages) — consent state, cookie, Consent Mode, deleting cookies after consent is withdrawn, optional POST of the decision to the log (`'/api/ipal/consent'`). Wrap the layout once; required by the banner, `Analytics`, `ConsentScript`. | | `CookieBanner` | `@intecion/ipal-kit/client` | Consent banner + category settings: `settings: 'inline' \| 'modal' \| 'detailed'`, `controls`, `equalChoice` (recommended `true`), `order`, `settingsActions`, `icon`, `classNames`, `firstPaint` (default `true`: in the server HTML, decided before the first paint by an inline script; pages stay static), `nonce`; colours from `--ipal-*` CSS vars. Do not write your own banner. | -| `CookieButton` | `@intecion/ipal-kit/client` | Floating button that reopens the cookie settings (withdrawing consent); hidden while the banner is visible. Fixed in the bottom corner of the window on every page and never moves (1.17.2: it no longer climbs above the footer). While it is shown the footer gets just enough bottom padding for its last row to end above the button (measured; the footer's own padding counts; nothing where the corner is empty; made before the first paint for a returning visitor). Props `className`, `side` (`'left' \| 'right'`), `reserve` (selector of the block that gets the room, default `COOKIE_BUTTON_RESERVE` = footer; `false` = none), `avoid` (placement before 1.17.2: selector it lifts above — `COOKIE_BUTTON_AVOID`). Amount by hand: `--ipal-cookie-button-space` on the footer (`0` = none). Tokens `--ipal-cookie-button-offset`, `--ipal-cookie-button-inset`. Type `CookieButtonProps`. | -| `COOKIE_BUTTON_AVOID`, `bottomOverlap(tops, viewportHeight)` | `@intecion/ipal-kit/client` | Footer selector for the placement before 1.17.2 (``); pixels the footer covers at the bottom of the screen (how far the button moves up then) | +| `CookieButton` | `@intecion/ipal-kit/client` | Floating button that reopens the cookie settings (withdrawing consent); hidden while the banner is visible. Fixed in the bottom corner of the window on every page and never moves (1.18.0: it no longer climbs above the footer). While it is shown the footer gets just enough bottom padding for its last row to end above the button (measured; the footer's own padding counts; nothing where the corner is empty; made before the first paint for a returning visitor). Props `className`, `side` (`'left' \| 'right'`), `reserve` (selector of the block that gets the room, default `COOKIE_BUTTON_RESERVE` = footer; `false` = none), `avoid` (placement before 1.18.0: selector it lifts above — `COOKIE_BUTTON_AVOID`). Amount by hand: `--ipal-cookie-button-space` on the footer (`0` = none). Tokens `--ipal-cookie-button-offset`, `--ipal-cookie-button-inset`. Type `CookieButtonProps`. | +| `COOKIE_BUTTON_AVOID`, `bottomOverlap(tops, viewportHeight)` | `@intecion/ipal-kit/client` | Footer selector for the placement before 1.18.0 (``); pixels the footer covers at the bottom of the screen (how far the button moves up then) | | `COOKIE_BUTTON_RESERVE`, `COOKIE_BUTTON_SPACE_ATTRIBUTE`, `reserveCookieButtonSpace(options)` | `@intecion/ipal-kit/client` | Default selector of the block that gets room for the cookie button (the footer); the attribute that marks it while the room is there; the function that measures and applies (or, with `release: true`, removes) it — options type `CookieButtonSpaceOptions` (`selector`, `side`, `button?`, `release?`, `sheet?`). For a button of your own | | `consentDecidedScript({ version?, gpc?, cookieName? })` | `@intecion/ipal-kit` | JavaScript statements for an inline script: leave `true` in `d` when the browser holds a current consent decision (as `readConsentRecord` decides). The shared start of the plugin's pre-paint scripts | | `TOTP_TEXTS`, `TOTP_VIEW_TITLE` | `@intecion/ipal-kit` | en/pl texts of the 2FA screens (`totpPlugin:*`, merged by `twoFactor`) and their tab title | @@ -763,7 +763,7 @@ Most routes and metadata are already ready in `createContentHelpers` (`generateP | `setRateLimitStore(store \| null)` | `@intecion/ipal-kit` | Shared store (e.g. Redis) for all plugin limiters (forms, consents, MCP…); `null` = process memory. Call once at startup when several instances run. | | `setUnknownIpFactor(n)` | `@intecion/ipal-kit` | Requests with no client IP share one `unknown-ip` bucket with `n` × the limit (every plugin limiter). Call once at startup; `0` = unlimited (only with a limiter in front, e.g. Cloudflare). | | `UNKNOWN_IP_FACTOR` | `@intecion/ipal-kit` | `20` — the default factor of the no-IP bucket. | -| `setIpv6Grouping({ prefix?, wide?, wideFactor? })`, `ipRateKey(ip)`, type `Ipv6Grouping` | `@intecion/ipal-kit` | 1.17.2: how every plugin limiter counts IPv6 — default one client per /64 (`prefix: 64`), no wide counter; `wide: 48` adds a counter per /48 at `wideFactor` (10) × the limit; `prefix: 128` = per address. Out-of-range values throw. `ipRateKey`: an IPv4 as it is, `::ffff:a.b.c.d` as the IPv4, an IPv6 as its network (`2001:db8:1:2:0:0:0:0/64`), anything else unchanged. | +| `setIpv6Grouping({ prefix?, wide?, wideFactor? })`, `ipRateKey(ip)`, type `Ipv6Grouping` | `@intecion/ipal-kit` | 1.18.0: how every plugin limiter counts IPv6 — default one client per /64 (`prefix: 64`), no wide counter; `wide: 48` adds a counter per /48 at `wideFactor` (10) × the limit; `prefix: 128` = per address. Out-of-range values throw. `ipRateKey`: an IPv4 as it is, `::ffff:a.b.c.d` as the IPv4, an IPv6 as its network (`2001:db8:1:2:0:0:0:0/64`), anything else unchanged. | **Types:** `ClientIpOptions` — `clientIp` options; `RateLimitStore` — store contract (`hit(id, cost, windowMs)` → `{ count, resetAt }`). diff --git a/docs/agent/skills/iapl-upgrade/SKILL.md b/docs/agent/skills/iapl-upgrade/SKILL.md index d752c95..c9fbb6a 100644 --- a/docs/agent/skills/iapl-upgrade/SKILL.md +++ b/docs/agent/skills/iapl-upgrade/SKILL.md @@ -25,7 +25,7 @@ the MANDATORY SET (GEO: llms-full, Markdown, MCP; R2; Turnstile through `getTurnstileConfig`…). Wire each one according to PROGRAMISTA §2 — it is part of the update, not an extra. Skip one only with a client decision in `AGENTS.md` (`iapl-audit-skip:`). -**→ 1.18.0, sign-in (CHANGELOG 1.18.0; access.md "A stranger cannot lock a staff account out", "Staff sign-in only +**→ 1.18.0, sign-in (CHANGELOG 1.18.0 "Staff sign-in"; PROGRAMISTA §6, item 89; access.md "A stranger cannot lock a staff account out", "Staff sign-in only from the site's own origin", "Changing one's own e-mail or password asks for the current password") — no schema change, no migration, no import-map change; read before deploying:** 1. `IAPL_IP_HEADER` must be pinned in production (`x-forwarded-for` behind Coolify/Traefik): failed staff sign-ins are @@ -39,7 +39,7 @@ no migration, no import-map change; read before deploying:** **Check:** five wrong passwords for an editor from one address → `429` there, `200` from another; the account page shows "Current password"; `curl -X POST /api/users/login -H 'Origin: https://other.example' …` → `403`. -**→ 1.18.0, two-step verification confirmed by e-mail (CHANGELOG 1.18.0; security.md "Set-up confirmed by e-mail") — +**→ 1.18.0, two-step verification confirmed by e-mail (CHANGELOG 1.18.0; PROGRAMISTA §6, item 88; security.md "Set-up confirmed by e-mail") — check before deploying:** (1) e-mail works on the site (Site integrations → E-mail sending → "Send a test e-mail"); (2) `serverURL` is set (`NEXT_PUBLIC_SERVER_URL`); (3) tell the staff: whoever sets two-step verification up for the first time gets a link by e-mail and opens it in the same browser, then signs in again. Accounts that already have it @@ -65,14 +65,34 @@ correct place `// iapl-security-ok: `. **Check:** `curl -s '/api/page `curl -s -o /dev/null -w '%{http_code}' '/api/pages?sort=%24where'` → `400`; `pnpm exec iapl-doctor --url --only live-probes` → no finding. -**→ 1.17.2, security (CHANGELOG 1.17.2; PROGRAMISTA §6, items 84–87) — nothing required, check:** `readVersions: +**→ 1.18.0, speed and growth (CHANGELOG 1.18.0 "Speed and growth"; PROGRAMISTA §6, items 91, 94; performance.md) — +no migration; MongoDB gets a hidden date on two logs; check before deploying:** (1) `pnpm exec iapl-doctor` — the +`perf-*` rules are **errors** now: fix what they name or lower / silence a rule with a reason in `iapl-doctor.json`; +a site with Playwright and no budget test gets `perf-budgets` (copy the `iapl-performance` template); (2) JPEG / PNG +uploads lose their metadata (`buildOptimizeUploadHook({ stripMetadata: false })` keeps it); (3) MongoDB: old consent +records (1095 days) and statistics (90 days) are deleted by a TTL index within a minute of the first start +(`ttlIndex: false` on `consentLog` / `stats`); (4) a plugin collection or global whose versions you turned on keeps 20 +per document unless you set `max` / `maxPerDoc`; (5) `BuilderForm` and `Turnstile` from `/client` are lazy (same +props, the HTML is complete); the eager ones: `@intecion/ipal-kit/client/eager`; (6) a helper without its own +`'use client'` imported from `/client` into a server component is the plain function now (do not pass it to a client +component as a prop); (7) `pnpm exec iapl-skills` installs `iapl-performance`; `unusedMedia: true` needs +`pnpm generate:importmap`. **Check:** `pnpm exec iapl-doctor --only performance` → no error; the site's forms still +send. + +**→ 1.18.0, drafts left out of related documents (CHANGELOG 1.18.0 "Content and plugin writes"; PROGRAMISTA §6, +item 93; content.md "Drafts as related documents") — nothing to run:** a menu link, a block or a System pages link that +points at a page never published no longer shows on the site (its title, slug and text are left out); a preview keeps +it. The old behaviour: `createContentHelpers({ draftRelations: 'keep' })`. **Check:** a menu link to an unpublished +page is gone on the live site and back after publishing. + +**→ 1.18.0 (from 1.17.2, never released alone), security (CHANGELOG 1.18.0 "From 1.17.2"; PROGRAMISTA §6, items 84–87) — nothing required, check:** `readVersions: readPublished()` now works (a wrapper of your own around it: use `readPublishedVersions()` inside); behind a proxy that rewrites `Host` without `X-Forwarded-Host`, set `serverURL` or the panel's mail / cookie buttons answer 403 (`iapl-doctor` warns); a locked editor sees "incorrect" until the lock ends (`accounts.lockedAnswer: 'payload'` for Payload's text); saving Cookies with a lower consent version is refused (`cookieSettings.allowLowerPolicyVersion`). **Check:** `curl -s /api/pages/versions` as a visitor → 200 (published only), not 500. -**→ 1.17.2:** (1) Payload jobs: if the project has tasks or workflows and a cron calls `/api/payload-jobs/run` (or +**→ 1.18.0 (from 1.17.2):** (1) Payload jobs: if the project has tasks or workflows and a cron calls `/api/payload-jobs/run` (or `/handle-schedules`) without its own `jobs.access.run`, set `CRON_SECRET` (16+ characters) in the app's environment and send `Authorization: Bearer ` from the cron; in-process runs (`jobs.autoRun`, `payload jobs:run`) and an admin's API key need nothing (security.md "Payload's job queue"). Verify: the run route answers 401 without @@ -81,7 +101,7 @@ the header, 200 with it. (2) A front end that posted to `/api/form-submissions` (3) A site with a visitor login collection: `iapl-doctor --url …` lists `visitor-writes`; give each listed collection and global its own write rule (`adminOrEditor`). (4) If the project has `tests/routes.ts`: `update`, judge, commit. -**→ 1.17.2, cookie button (CHANGELOG 1.17.2; PROGRAMISTA §6, item 83; consent.md "Where the cookie button sits") — nothing is required:** +**→ 1.18.0 (from 1.17.2), cookie button (CHANGELOG 1.18.0 "From 1.17.2"; PROGRAMISTA §6, item 83; consent.md "Where the cookie button sits") — nothing is required:** visitors now see the "cookie settings" button in the bottom corner of the window on every page; it never moves and no longer rides up above the footer. While it is shown the footer is a little taller (about 40 px on the reference site), so its last row ends above the button. Check the end of a page on a phone and on desktop: nothing under the @@ -322,7 +342,7 @@ and the browser tab shows the same separator. cookie banner only through `--ipal-*-dark`: check the banner in the dark theme. 4. Optional: the block library, block by block (block-library.md); after turning blocks on: `pnpm generate:types`, `pnpm payload generate:importmap`, Postgres/SQLite `migrate:create`. -5. **CookieButton** lifts above the footer — check a site with its own fixed footer bar; `avoid={false}` keeps it fixed. (Since 1.17.2 it stays in the bottom corner by default; the lift is `avoid={COOKIE_BUTTON_AVOID}`.) +5. **CookieButton** lifts above the footer — check a site with its own fixed footer bar; `avoid={false}` keeps it fixed. (Since 1.18.0 it stays in the bottom corner by default; the lift is `avoid={COOKIE_BUTTON_AVOID}`.) 6. `pnpm exec iapl-skills` (new **iapl-doctor**; updated iapl-reference, iapl-setup, iapl-site, iapl-audit). 7. Run `pnpm exec iapl-doctor` (and `--url https://`), fix or silence each finding with a reason in `iapl-doctor.json`. `IAPL_DOCTOR_TOKEN` (≥ 32 characters) only if the deep check runs against production. @@ -742,7 +762,7 @@ PROGRAMISTA §6, items 73–75; email.md; AGENT.md §7.2) — nothing to run; re **Send test e-mail** names the transport you expect; a form submission arrives. **The service is live at `https://webservices.intecion.net/mail`; a new site waits until a person of Intecion confirms it ("Połącz z IWSN") — keep SMTP until then, or `relay: false`.** -**→ 1.18.0, IWSN is connected by a person of Intecion (CHANGELOG "Unreleased (for 1.18.0)" → "IWSN: Połącz z IWSN"; email.md "The mail service"; AGENT.md §7.2 point 5) — nothing to run:** +**→ 1.18.0, IWSN is connected by a person of Intecion (CHANGELOG 1.18.0 "IWSN"; PROGRAMISTA §6, item 90; email.md "The mail service"; AGENT.md §7.2 point 5) — nothing to run:** 1. No schema change, no migration, no import-map change. Sites whose "Sending method" is SMTP or Microsoft Graph see no change at all. 2. A site on IWSN that is already active stays active. A site that waits (`relay-pending`, or doctor `mail-relay-connect` diff --git a/docs/consent.md b/docs/consent.md index cc87dd5..3d16bf1 100644 --- a/docs/consent.md +++ b/docs/consent.md @@ -113,7 +113,7 @@ takes `locale` and optional `labels`; defaults: `COOKIE_TABLE_LABELS` (`@intecio | `controls` | `'checkbox'` | `'checkbox' \| 'switch'` | | `settingsActions` | `['back', 'save']` | buttons under the categories (`'accept' \| 'back' \| 'reject' \| 'save'`) | -### Where the cookie button sits (1.17.2) +### Where the cookie button sits (1.18.0) `CookieButton` is fixed in the **bottom corner of the window** — on every page, long or short, at every scroll position, on desktop and phone — and it **never moves**. It is a child of `` (never inside the footer) and it @@ -137,7 +137,7 @@ button** (`reserveCookieButtonSpace`). The footer's background continues through |---|---|---| | `side` | `'left'` | corner: `'left'` or `'right'` | | `reserve` | `COOKIE_BUTTON_RESERVE` | CSS selector of the block that gets the room (the last match); `false` = no room — the button then covers what is in the corner at the end of the page | -| `avoid` | — | placement before 1.17.2: a CSS selector the button lifts above while it is on screen — `avoid={COOKIE_BUTTON_AVOID}` (`'footer, [role="contentinfo"]'`) is exactly the old default (`bottomOverlap`); no room is reserved then. `false` = the default (kept for sites that set it) | +| `avoid` | — | placement before 1.18.0: a CSS selector the button lifts above while it is on screen — `avoid={COOKIE_BUTTON_AVOID}` (`'footer, [role="contentinfo"]'`) is exactly the old default (`bottomOverlap`); no room is reserved then. `false` = the default (kept for sites that set it) | | `className` | — | replaces the default classes; position is then yours too (room is measured from the real button once it is on the page, and only while it is `position: fixed`) | **Set the amount yourself:** `--ipal-cookie-button-space` on the footer — any length, added to the footer's own @@ -581,7 +581,7 @@ to add the hook to a config. Nothing to migrate. - **New consent after a policy change:** Cookies → *Consent version* (sidebar). Raise it by 1 after adding a tool or changing the policy — every visitor will see the banner again. `getConsentTexts` passes the version to `` automatically. -- **The consent version only goes up (1.17.2).** A stored consent counts only under the version it was given for, +- **The consent version only goes up (1.18.0).** A stored consent counts only under the version it was given for, so a lower number would make consent given under an older policy valid again. Saving Cookies with a lower *Consent version* through the panel, REST or GraphQL is refused: "The consent version cannot go down: it is 3 now…" (Polish in a Polish panel). The same number, a higher one, or a save without it pass. A script an admin runs diff --git a/docs/dev/PROGRAMISTA.md b/docs/dev/PROGRAMISTA.md index b647f5e..e3f8368 100644 --- a/docs/dev/PROGRAMISTA.md +++ b/docs/dev/PROGRAMISTA.md @@ -690,11 +690,18 @@ Do one item at a time, build, check. Order by importance: | 80 | **1.17.1 — the sign-in look** — after the update the login and 2FA screens show a dark panel with the logo or the site's name; an editor cannot change the logo or name; forgot / reset password look as before | Nothing required. `whiteLabel: { signIn: false }` (old screens), `{ brandAccess: 'editor' }`, `{ signIn: { logoPlate: true } }` (a dark logo), `{ signIn: { svgLogo: false } }`; the other screens: `signIn: { allScreens: true }` + `pnpm payload generate:importmap`. No `serverURL` → no logo in the link preview: set it | `iapl-upgrade` "→ 1.17.1, the sign-in look", white-label.md "The sign-in screens" | | 81 | **1.17.1 — proxy matcher** — `iapl-doctor` warns `proxy-matcher`; pages such as `/administracja` or `/apis` get no locale redirect or proxy CSP | `src/proxy.ts`: `matcher: ['/((?!(?:api|admin|_next)(?:/|$)|.*\\..*).*)']` (i18n.md "Next matcher") | `iapl-upgrade` "→ 1.17.1" | | 82 | **1.17.1 — e-mail: "Sending method" is a choice** — Site integrations → E-mail sending shows "IWSN (built-in)", "Own SMTP server" or "Microsoft Graph (deprecated)" as selected; or, on Postgres / SQLite, the start log says the column for `emailMethod` is missing and the Site integrations page does not open; or mail fails with `smtp-incomplete` / `graph-not-set-up` | MongoDB: nothing. Postgres / SQLite: `pnpm payload migrate:create`, commit, apply at start. Nothing changes until another option is picked and saved; a chosen method that cannot be used fails loudly (no other transport): fill in SMTP, set `GRAPH_*`, or pick another method | `iapl-upgrade` "→ 1.17.1, e-mail", email.md "Which transport a send takes" | -| 83 | **1.17.2 — cookie button** — after the update the "cookie settings" button no longer sits above the footer; or the footer is about 40 px taller after a decision | Intended: the button stays in the bottom corner of the window on every page and never moves; while it is shown the footer gets just enough bottom padding for its last row to end above the button (measured; own padding counts; nothing before a decision or while the banner is open). Nothing to run. No room: ``; amount by hand: `--ipal-cookie-button-space` on the footer; the placement before: `avoid={COOKIE_BUTTON_AVOID}`; other corner: `side="right"`; distance: `--ipal-cookie-button-offset` | consent.md "Where the cookie button sits", `iapl-upgrade` "→ 1.17.2, cookie button" | -| 84 | **1.17.2 — version history** — `GET /api//versions` as a visitor answered 500 (`Cannot find field for path at _status`, MongoDB `reading 'type'`) with `readVersions: readPublished()` | Update; nothing else. New code: `readVersions: readPublishedVersions()`; a `readVersions` of your own that wraps `readPublished()` must use `readPublishedVersions()` inside | CHANGELOG 1.17.2 point 1, access.md | -| 85 | **1.17.2 — sign-in and panel actions** — a locked editor is told "incorrect" with the right password; or a panel button (mail Connect / Disconnect, test e-mail, cookie scan / approval) answers 403 behind a proxy; or rate limits now count an IPv6 home network as one visitor | Locked: wait 10 minutes or an admin unlocks; Payload's text back: `accounts: { lockedAnswer: 'payload' }`. 403 behind a proxy: set `serverURL`; off: `adminSameOrigin: false`. IPv6 per address: `setIpv6Grouping({ prefix: 128 })` | CHANGELOG 1.17.2 points 2, 3, 8; security.md | -| 86 | **1.17.2 — REST submissions and jobs** — a customer account gets 403 on `POST /api/form-submissions`; a cron gets 401 on `/api/payload-jobs/run` | Submissions: use `submitForm` / `createSubmitAction`, or `formSubmissionOverrides.access.create`. Jobs: `CRON_SECRET` (16+ characters) in the app's env and `Authorization: Bearer …` from the cron, or an admin's API key; `jobsRunAccess: false` = Payload's default | CHANGELOG 1.17.2 points 4–5, `iapl-upgrade` "→ 1.17.2" | -| 87 | **1.17.2 — consent version** — saving Cookies with a lower "Consent version" is refused ("cannot go down") | Raise it or leave it; a script with the Local API and `overrideAccess` may lower it; `cookieSettings: { allowLowerPolicyVersion: true }` restores the old freedom | CHANGELOG 1.17.2 point 7, consent.md | +| 83 | **1.18.0 — cookie button** — after the update the "cookie settings" button no longer sits above the footer; or the footer is about 40 px taller after a decision | Intended: the button stays in the bottom corner of the window on every page and never moves; while it is shown the footer gets just enough bottom padding for its last row to end above the button (measured; own padding counts; nothing before a decision or while the banner is open). Nothing to run. No room: ``; amount by hand: `--ipal-cookie-button-space` on the footer; the placement before: `avoid={COOKIE_BUTTON_AVOID}`; other corner: `side="right"`; distance: `--ipal-cookie-button-offset` | consent.md "Where the cookie button sits", `iapl-upgrade` "→ 1.17.2, cookie button" | +| 84 | **1.18.0 — version history** — `GET /api//versions` as a visitor answered 500 (`Cannot find field for path at _status`, MongoDB `reading 'type'`) with `readVersions: readPublished()` | Update; nothing else. New code: `readVersions: readPublishedVersions()`; a `readVersions` of your own that wraps `readPublished()` must use `readPublishedVersions()` inside | CHANGELOG 1.18.0 "From 1.17.2" point 1, access.md | +| 85 | **1.18.0 — sign-in and panel actions** — a locked editor is told "incorrect" with the right password; or a panel button (mail Connect / Disconnect, test e-mail, cookie scan / approval) answers 403 behind a proxy; or rate limits now count an IPv6 home network as one visitor | Locked: wait 10 minutes or an admin unlocks; Payload's text back: `accounts: { lockedAnswer: 'payload' }`. 403 behind a proxy: set `serverURL`; off: `adminSameOrigin: false`. IPv6 per address: `setIpv6Grouping({ prefix: 128 })` | CHANGELOG 1.18.0 "From 1.17.2" points 2, 3, 8; security.md | +| 86 | **1.18.0 — REST submissions and jobs** — a customer account gets 403 on `POST /api/form-submissions`; a cron gets 401 on `/api/payload-jobs/run` | Submissions: use `submitForm` / `createSubmitAction`, or `formSubmissionOverrides.access.create`. Jobs: `CRON_SECRET` (16+ characters) in the app's env and `Authorization: Bearer …` from the cron, or an admin's API key; `jobsRunAccess: false` = Payload's default | CHANGELOG 1.18.0 "From 1.17.2" points 4–5, `iapl-upgrade` "→ 1.18.0" | +| 87 | **1.18.0 — consent version** — saving Cookies with a lower "Consent version" is refused ("cannot go down") | Raise it or leave it; a script with the Local API and `overrideAccess` may lower it; `cookieSettings: { allowLowerPolicyVersion: true }` restores the old freedom | CHANGELOG 1.18.0 "From 1.17.2" point 7, consent.md | +| 88 | **1.18.0 — two-step set-up by e-mail** — a new editor scans the code and the screen says "a link was sent"; nothing opens until the link is clicked; or "the confirmation e-mail could not be sent" | Open the mailed link in the same browser within 30 minutes, then sign in with password and code. Mail not working: the link is in the server log (Coolify → Logs) or an administrator presses "Confirm the waiting set-up" on the account page; fix mail (`iapl-doctor --deep` → `2fa-enrolment-mail`). Off: `twoFactor: { confirmByEmail: false }` | CHANGELOG 1.18.0 "Two-step verification", security.md | +| 89 | **1.18.0 — staff sign-in** — `429` "Too many failed sign-ins to this address from here"; or `403` on login from another domain; or the account page asks for "Current password"; or a script that changes its own password gets 400 | 429: wait 15 minutes or sign in from elsewhere; pin `IAPL_IP_HEADER`. 403: `accounts.signInSameOrigin: { origins: [...] }` or set `serverURL`. Scripts: send `currentPassword`; off: `accounts.confirmOwnChanges: false` | CHANGELOG 1.18.0 "Staff sign-in", access.md | +| 90 | **1.18.0 — IWSN connect** — Site integrations → E-mail sending shows "Połącz z IWSN"; e-mails refused (`relay-pending`); dashboard alert; `iapl-doctor --deep` error `mail-relay-connect` | Press "Połącz z IWSN"; a person of Intecion confirms on the page that opens; the block then shows "Connected to IWSN". Off: `mail: { relay: { connectButton: false } }` | CHANGELOG 1.18.0 "IWSN", email.md | +| 91 | **1.18.0 — doctor fails** — `iapl-doctor` exits 1 on `perf-*`, `next-min` (16.4.5) or shows `transitive-min` for `ws` / `cross-spawn` / `esbuild` | Fix what the rule says (`next@16.4.6`, the overrides in AGENT.md §4 item 12, a budget test); or lower / silence a rule with a reason in `iapl-doctor.json` | CHANGELOG 1.18.0 "Speed and growth" 9, "Security audit" 8–9; doctor.md | +| 92 | **1.18.0 — lists, sort, locks, access callbacks** — a front-end script gets only 100 documents (`hasNextPage: true`); `?sort=$…` answers 400; a customer gets 403 on document locks; `cookieScanner.access` returning `req.user` now gives 403 | Page through, or `listLimit: { max }` / `{ exclude }`; sort by a field name; locks are staff only (`lockedDocuments`); return `Boolean(req.user)` (or `strictAccessAnswers: false`) | CHANGELOG 1.18.0 "Security audit", security.md "Lists and sorting", "Access callbacks" | +| 93 | **1.18.0 — drafts in menus and blocks** — a menu link or a block pointing at an unpublished page is gone from the site | Publish the page, or `createContentHelpers({ draftRelations: 'keep' })` | CHANGELOG 1.18.0 "Content and plugin writes", content.md | +| 94 | **1.18.0 — uploads and logs** — an uploaded photo has no EXIF / GPS any more; old consent records and statistics disappear on a quiet MongoDB site; a versioned plugin global keeps 20 versions | Intended. Keep metadata: `buildOptimizeUploadHook({ stripMetadata: false })`; no TTL: `consentLog: { ttlIndex: false }`, `stats: { ttlIndex: false }`; more versions: `max` / `maxPerDoc` in your override | CHANGELOG 1.18.0 "Speed and growth" 1–3, performance.md | After updating the package: `pnpm exec iapl-skills` (new skill versions), `pnpm payload generate:importmap`, `rm -rf .next`, restart dev, grep for the new symbol in `node_modules/@intecion/ipal-kit/dist`. diff --git a/docs/doctor.md b/docs/doctor.md index 52824ff..c81fca9 100644 --- a/docs/doctor.md +++ b/docs/doctor.md @@ -110,7 +110,7 @@ Turn off: `iapl({ doctor: false })`. Adapt: `iapl({ doctor: { tokenVar: 'MY_TOKE | | `env-live` | error | (deep) the project's env rules pass in the real environment | | security | `security-headers` | error | `buildSecurityHeaders`; live: HSTS, nosniff, Referrer-Policy, Permissions-Policy, frame protection | | | `powered-by` | error | `withSecurityConfig`; live: no `X-Powered-By` on `/` and the admin | -| | `visitor-writes` | warning | (deep) on a site with a visitor login collection (an auth collection that is not staff): every collection whose `create` / `update` / `delete`, or global whose `update`, lets such an account in — Payload's default "any signed-in account" included. Give it its own rule (`adminOrEditor`, …); asked by behaviour, never by a rule's name (1.17.2) | +| | `visitor-writes` | warning | (deep) on a site with a visitor login collection (an auth collection that is not staff): every collection whose `create` / `update` / `delete`, or global whose `update`, lets such an account in — Payload's default "any signed-in account" included. Give it its own rule (`adminOrEditor`, …); asked by behaviour, never by a rule's name (1.18.0) | | | `proxy-matcher` | warning | `src/proxy.ts`: a matcher that skips `api`, `admin` or `_next` without ending them at "/" (`(?!api|admin|…)`) also skips every page whose first segment only starts with them (`/administracja`): no locale redirect, no proxy CSP. Fix: the literal in i18n.md (1.17.1) | | | `client-hints` | info | `withSecurityConfig` is the outer wrapper (`withSecurityConfig(withPayload(…))`), so Payload's colour-scheme client hints go to the admin only; live: `/` sends no `Critical-CH: Sec-CH-Prefers-Color-Scheme`. Not reported with `adminClientHints: false` | | | `csp` | warning / info | CSP on the site and the admin; report-only is info, a warning after 4 weeks (`seen`) | diff --git a/docs/forms.md b/docs/forms.md index 8ebc96c..b7fba96 100644 --- a/docs/forms.md +++ b/docs/forms.md @@ -445,7 +445,7 @@ share one `unknown-ip` bucket with a ×20 limit (`UNKNOWN_IP_FACTOR`) — real visitors get through, a flood without the header does not. `setUnknownIpFactor(n)` (root, once at startup) changes the multiplier; `setUnknownIpFactor(0)` = the old behaviour (no limit), when a limiter sits in front. -**IPv6 is counted per network (1.17.2).** A host with IPv6 holds a whole /64 — 2^64 addresses, every home +**IPv6 is counted per network (1.18.0).** A host with IPv6 holds a whole /64 — 2^64 addresses, every home connection and every server — so counting per address gave one visitor as many budgets as it had addresses. Every limiter of the plugin (forms, the file upload endpoint, search, MCP, the consent log, stats, the doctor status, the mail service's confirm route and account-mail limit) counts a **/64 as one client**; an IPv4-mapped address @@ -567,7 +567,7 @@ then does it store. A flood dies before it touches the network or the database. **REST is closed.** By default the form-builder lets anyone create submissions through `POST /api/form-submissions` — skipping all the gates below. IAPL -sets `access.create` of the `form-submissions` collection to "a staff account with its second factor" (since 1.17.2; before: any signed-in account, a customer of a visitor login collection included); the front end +sets `access.create` of the `form-submissions` collection to "a staff account with its second factor" (since 1.18.0; before: any signed-in account, a customer of a visitor login collection included); the front end submits through `submitForm` (server action → Local API), so this does not affect it. A deliberately public REST (e.g. an external app) → `forms: { formSubmissionOverrides: { access: { create: () => true } } }` — then @@ -881,7 +881,7 @@ filter it out on the client. - **Turn off:** without the `forms` option the plugin does not wire the form-builder (no Forms / Form Submissions collections). Single field types: `forms.fields.: false`. Files: `forms.attachments` is off unless you set it ("Files"). - **Override the collections:** `formOverrides` / `formSubmissionOverrides` — fields (the `fields` function), `labels`, - `admin`, `access`, `hooks`. The default submissions access (`create`: a staff account with its second factor since 1.17.2, `read`: editor+, `delete`: admin) + `admin`, `access`, `hooks`. The default submissions access (`create`: a staff account with its second factor since 1.18.0, `read`: editor+, `delete`: admin) is overridden by keys in `formSubmissionOverrides.access`; forms access (`create`/`update`/`delete`: editor+, `read`: public) — in `formOverrides.access`. The Emails tab protection (`read`: editor+) is applied to the default fields **before** `formOverrides.fields`, so you change it there. diff --git a/docs/security.md b/docs/security.md index 200dc97..88768ce 100644 --- a/docs/security.md +++ b/docs/security.md @@ -432,14 +432,14 @@ Real panel protection: `/admin → /its` is a layer (it filters out dumb bots), not a lock. Treat it as an addition to real safeguards, not a replacement for them. -## Panel actions only from the site's own origin (`adminSameOrigin`, 1.17.2) +## Panel actions only from the site's own origin (`adminSameOrigin`, 1.18.0) The plugin's panel actions act with the panel's login cookie and read their body whatever its `Content-Type` says: `POST /api/iapl/mail-relay/connect`, `/connect-link` ("Połącz z IWSN", 1.18.0) and `/disconnect` (the mail service), `/api/ipal/test-email`, `/api/ipal/cookie-scan`, `/api/ipal/cookie-approval`, `/api/ipal/cookie-crawl`. A `text/plain` POST needs no CORS preflight, a page on a sibling subdomain is "same site" (the browser sends the `SameSite=Lax` cookie), and -Payload's own CSRF list is empty unless `serverURL` or `csrf` is set. So before 1.17.2 such a page could make a +Payload's own CSRF list is empty unless `serverURL` or `csrf` is set. So before 1.18.0 such a page could make a signed-in administrator disconnect the mail service, send test mails, run scans and crawls, or approve every waiting cookie. Now each of them refuses (`403`, before anything is read) a request a browser marks as coming from elsewhere — the same rule as the 2FA endpoints: the `Origin` header, else `Sec-Fetch-Site`. Own origins: the @@ -451,7 +451,7 @@ these paths is left as it is. The 2FA endpoints keep their own switch (`twoFacto ```ts iapl({ // adminSameOrigin: { origins: ['https://panel.example.com'] }, // the panel served from another origin - // adminSameOrigin: false, // no check (as before 1.17.2) + // adminSameOrigin: false, // no check (as before 1.18.0) }) ``` @@ -1318,11 +1318,11 @@ a root endpoint to the config and the check names it as "not judged". **In the plugin repository:** `pnpm routes:check` (`--update` after a Payload upgrade) on the reference site, also the first step of `pnpm e2e:built`; the test fixtures are switched off for it. -## Payload's job queue (`jobsRunAccess`, 1.17.2) +## Payload's job queue (`jobsRunAccess`, 1.18.0) Payload runs its queue over HTTP at `GET /api/payload-jobs/run` and `/api/payload-jobs/handle-schedules`, checked by `jobs.access.run`. Payload's default is **any signed-in account of any auth collection** — a shop's customer could -run the queue whenever they like. Since 1.17.2, when the project writes **no** `jobs.access.run`, iapl sets: an +run the queue whenever they like. Since 1.18.0, when the project writes **no** `jobs.access.run`, iapl sets: an **admin signed in with the second factor** (an admin's API key counts), or **`Authorization: Bearer `** (16+ characters, compared in constant time). It is set even when the config has no `jobs` (Payload turns the queue on by itself for scheduled publishing). A route that does not exist (no tasks, no workflows) stays 404. @@ -1346,7 +1346,7 @@ Payload fills every missing access rule with **"any signed-in account"** — an included. The plugin narrows its own collections and globals and the staff accounts; **your** collections and globals are yours to rule. On a site that has (or may get) a visitor login collection, give every collection `create` / `update` / `delete` and every global `update` a rule of its own — the reference site and every new site -from `iapl create` do (`adminOrEditor`, since 1.17.2). `iapl-doctor --url` (deep) lists what such an account may +from `iapl create` do (`adminOrEditor`, since 1.18.0). `iapl-doctor --url` (deep) lists what such an account may write (`visitor-writes`, warning), checked by behaviour: it asks every rule with a stand-in visitor account. Payload's own `payload-locked-documents` (who edits which document) is for staff accounts only since 1.18.0 (`lockedDocuments`, "Lists and sorting" below). Verify: the doctor shows no `visitor-writes` finding, and the closed-doors spec's customer diff --git a/reference/.agents/skills/iapl-audit/resources/closed-doors.spec.template.ts b/reference/.agents/skills/iapl-audit/resources/closed-doors.spec.template.ts index f2e8d4c..a48cec0 100644 --- a/reference/.agents/skills/iapl-audit/resources/closed-doors.spec.template.ts +++ b/reference/.agents/skills/iapl-audit/resources/closed-doors.spec.template.ts @@ -46,14 +46,14 @@ const DOORS: Door[] = [ { closedFor: ALL, method: 'POST', name: 'the crawler\'s call-back without its token', path: '/api/ipal/cookie-crawl/results', body: { jobId: 'x', ok: true } }, { closedFor: OUTSIDERS, method: 'POST', name: 'a crawl without the schedule\'s token', path: '/api/ipal/cookie-crawl' }, { closedFor: OUTSIDERS, name: 'form submissions', path: '/api/form-submissions' }, - // IAPL 1.17.2: a staff account only; an open door answers 400 (validation) instead of 403 + // IAPL 1.18.0: a staff account only; an open door answers 400 (validation) instead of 403 { body: { form: NO_ID, submissionData: [] }, closedFor: OUTSIDERS, method: 'POST', name: 'a submission past submitForm', path: '/api/form-submissions', closed: status(403) }, { body: { email: 'door@example.com', password: 'Door-Password-1234', roles: ['admin'] }, closedFor: ALL, method: 'POST', name: 'nobody creates a staff account', path: '/api/users', closed: status(403) }, { body: { email: 'first@example.com', password: 'Door-Password-1234' }, closedFor: ALL, method: 'POST', name: 'the first-user route once an account exists', path: '/api/users/first-register', closed: status(403) }, { body: {}, closedFor: OUTSIDERS, method: 'POST', name: 'Site settings cannot be saved', path: '/api/globals/site-settings', closed: status(403) }, { closedFor: ALL, name: 'the GraphQL playground (production)', path: '/api/graphql-playground', closed: status(404) }, { closedFor: ALL, graphql: '{ __schema { queryType { name } } }', closed: ({ body }) => Boolean((body as { errors?: unknown[] })?.errors?.length), name: 'GraphQL introspection (production)' }, - // a site without jobs: 404. A site WITH jobs (IAPL 1.17.2): refused (401) for everybody but an admin and + // a site without jobs: 404. A site WITH jobs (IAPL 1.18.0): refused (401) for everybody but an admin and // `Authorization: Bearer ` — drop `closed: status(404)` there { closedFor: ALL, name: 'Payload\'s job queue', path: '/api/payload-jobs/run', closed: status(404) }, // the project's own doors: add them here diff --git a/reference/.agents/skills/iapl-consent-check/SKILL.md b/reference/.agents/skills/iapl-consent-check/SKILL.md index 71dcc81..44eb28e 100644 --- a/reference/.agents/skills/iapl-consent-check/SKILL.md +++ b/reference/.agents/skills/iapl-consent-check/SKILL.md @@ -55,7 +55,7 @@ before analytics or marketing consent — check the project's choice in "Project `nonce` to ``. A visitor who decided must never see the banner on reload; one whose decision is from an older Policy version must see it at once. A click on a button before hydration counts (the checks above click as soon as the button is visible). -7. Cookie button (1.17.2, consent.md → "Where the cookie button sits"): after a decision, on a long page, a short +7. Cookie button (1.18.0, consent.md → "Where the cookie button sits"): after a decision, on a long page, a short page and a page with a form, desktop and phone width (also 360 px) — the button is in the bottom corner of the window at the top, in the middle, with the footer in view and at the very end: it must not move at all. At the very end nothing of the footer is under it and the last footer link can be tapped (the footer has grown a little: diff --git a/reference/.agents/skills/iapl-debug/SKILL.md b/reference/.agents/skills/iapl-debug/SKILL.md index 4800773..abf6769 100644 --- a/reference/.agents/skills/iapl-debug/SKILL.md +++ b/reference/.agents/skills/iapl-debug/SKILL.md @@ -34,8 +34,8 @@ through this procedure. Ask only when you are missing something you cannot get y ### Build / TypeScript | Symptom | Cause | Fix | |---|---|---| -| a panel button (mail service Connect / Disconnect, Send test e-mail, cookie scan / approve / check site) answers `403` "Not allowed from this origin."; log `[iapl] a panel action from origin "…" was refused` | the request's origin is not one the site knows (1.17.2, `adminSameOrigin`): a reverse proxy that rewrites `Host` and sends no `X-Forwarded-Host`, and no `serverURL` | set `serverURL: process.env.NEXT_PUBLIC_SERVER_URL` in the Payload config, or make the proxy send `X-Forwarded-Host`, or `adminSameOrigin: { origins: ['https://…'] }`; `iapl-doctor` `csrf-empty` | -| a staff account's correct password gets "The email or password provided is incorrect." | the account is locked by Payload after `maxLoginAttempts` wrong passwords (5, for `lockTime`, 10 min); since 1.17.2 a locked staff account gets the wrong-password answer (`accounts.lockedAnswer`) | wait for the lock to end, or an admin unlocks it (the account in the panel, or `POST /api/users/unlock`); `lockUntil` on the account shows it. Payload's own message back: `accounts: { lockedAnswer: 'payload' }` | +| a panel button (mail service Connect / Disconnect, Send test e-mail, cookie scan / approve / check site) answers `403` "Not allowed from this origin."; log `[iapl] a panel action from origin "…" was refused` | the request's origin is not one the site knows (1.18.0, `adminSameOrigin`): a reverse proxy that rewrites `Host` and sends no `X-Forwarded-Host`, and no `serverURL` | set `serverURL: process.env.NEXT_PUBLIC_SERVER_URL` in the Payload config, or make the proxy send `X-Forwarded-Host`, or `adminSameOrigin: { origins: ['https://…'] }`; `iapl-doctor` `csrf-empty` | +| a staff account's correct password gets "The email or password provided is incorrect." | the account is locked by Payload after `maxLoginAttempts` wrong passwords (5, for `lockTime`, 10 min); since 1.18.0 a locked staff account gets the wrong-password answer (`accounts.lockedAnswer`) | wait for the lock to end, or an admin unlocks it (the account in the panel, or `POST /api/users/unlock`); `lockUntil` on the account shows it. Payload's own message back: `accounts: { lockedAnswer: 'payload' }` | | a sign-in answers `429` "Too many failed sign-ins to this address from here" | 5 failed sign-ins for that address from that client IP in 15 minutes (`accounts.signInLimit`, 1.18.0); everybody behind one IP shares it (an office NAT); without `IAPL_IP_HEADER` everybody may share the no-IP bucket | wait the minutes it names, or sign in from elsewhere; pin `IAPL_IP_HEADER`; more room: `signInLimit: { perAddress: 10 }` | | staff login / "forgot password" answers `403` and the log says `[iapl] a staff sign-in from origin "…" was refused` | the request came from another origin (`accounts.signInSameOrigin`, 1.18.0): a front end on another domain, or a proxy that rewrites `Host` without `serverURL` | set `serverURL`, or `signInSameOrigin: { origins: ['https://…'] }` | | saving one's own account answers "Enter your current password to change your e-mail address or password." | `accounts.confirmOwnChanges` (1.18.0): own e-mail / username / password changes need the current password | type it in "Current password" on the account page; scripts send `currentPassword`; off: `confirmOwnChanges: false` | diff --git a/reference/.agents/skills/iapl-reference/SKILL.md b/reference/.agents/skills/iapl-reference/SKILL.md index d85fd5b..501d517 100644 --- a/reference/.agents/skills/iapl-reference/SKILL.md +++ b/reference/.agents/skills/iapl-reference/SKILL.md @@ -38,7 +38,7 @@ description: Complete map of everything @intecion/ipal-kit provides — every ia | `accounts.staffOnlyRead` | on | `read` and `readVersions` on a staff collection without those rules: a fully signed-in account of a staff collection (Payload's default let a visitor account list the staff accounts) | `false` = Payload's default; a `read` rule you wrote wins | | `accounts.firstUserRoute` | `'panel'` | which auth collections `POST /api//first-register` answers for while they are empty: only the one the panel logs in with (the first account of a site → admin). Others get `403`, a second staff collection included, in any spelling of the URL (the plugin's own endpoint sits in front of Payload's); a collection whose own `create` allows an anonymous request keeps its route. With `access.firstUserAdmin: false` and a default role below the panel role, the default `panelRole` is not applied (logged) and an explicit one is refused at start | a list of slugs; `'all'` = Payload's behaviour | | `accounts.password` | `{ minLength: 12 }` | when a password is SET on a staff collection (create, first-user screen, change, reset by e-mail; panel, API and Local API): at least `minLength` characters, not the account's e-mail address. Existing passwords are never checked — a shorter one keeps logging in | `{ minLength }`; `false` = Payload's rule (3 characters) | -| `accounts.lockedAnswer` | `'wrong'` (1.17.2) | a staff account Payload has locked (too many wrong passwords) gets exactly the wrong-password answer on login (REST, GraphQL, the panel): nobody tells which addresses have an account; the lock itself is unchanged | `'payload'` = Payload's "This user is locked…"; any other value stops the start | +| `accounts.lockedAnswer` | `'wrong'` (1.18.0) | a staff account Payload has locked (too many wrong passwords) gets exactly the wrong-password answer on login (REST, GraphQL, the panel): nobody tells which addresses have an account; the lock itself is unchanged | `'payload'` = Payload's "This user is locked…"; any other value stops the start | | `accounts.signInLimit` | `{ perAddress: 5, windowMinutes: 15, accountLock: { maxLoginAttempts: 50, lockTime: 3_600_000 } }` (1.18.0) | failed staff sign-ins per client IP + typed address (folded): over the limit `429` for that IP and address only; only failures count; Payload's per-account lock raised where the project set none | `{ perAddress, windowMinutes, accountLock }`; `accountLock: false` = Payload's lock; `false` = as before 1.18 | | `accounts.signInSameOrigin` | on (1.18.0) | staff login / forgot / reset password: `403` for a request a browser marks as coming from another origin | `{ origins: [...] }`; `false` | | `accounts.confirmOwnChanges` | on (1.18.0) | own e-mail / username / password change needs `currentPassword` (panel field, REST, GraphQL) | `false` | @@ -50,7 +50,7 @@ description: Complete map of everything @intecion/ipal-kit provides — every ia | `listLimit` | `{ max: 100, staff: false }` (1.18.0, audit F4) | a REST / GraphQL list (`find`, versions, distinct) from a caller that is not staff gets at most `max` documents; `pagination=false` / `limit=0` become one page; staff, the Local API and server reads with `overrideAccess: true` that pass a request on untouched | `false` (Payload's behaviour); `{ max, staff: true, exclude: ['slug'] }`; `buildQueryGuardHook` for a collection added after iapl | | `refuseOperatorSort` | `true` (1.18.0, audit F5) | a `sort` naming a database operator (`$where`, `-$natural`, `a.$ne`) → `400` for everyone, logged as one `info` line (`RefusedSortError`) | `false`; `loggingLevels: { RefusedSortError: false }` hides the log line | | `lockedDocuments` | staff only (1.18.0) | Payload's document locks (`payload-locked-documents`) for staff accounts with the second factor; Payload's default was any signed-in account | `false` (Payload's default); `{ access: { read, create, update, delete } }` | -| `adminSameOrigin` | on (1.17.2) | `POST` mail service connect / disconnect, test e-mail, cookie scan / approval / crawl refuse (`403`) a request a browser marks as coming from another origin; own origins: the request's host, `serverURL`, `csrf`, `cors`, `origins` | `{ origins: [...] }` adds origins; `false` = no check; any other value stops the start | +| `adminSameOrigin` | on (1.18.0) | `POST` mail service connect / disconnect, test e-mail, cookie scan / approval / crawl refuse (`403`) a request a browser marks as coming from another origin; own origins: the request's host, `serverURL`, `csrf`, `cors`, `origins` | `{ origins: [...] }` adds origins; `false` = no check; any other value stops the start | | `adminRoute` | `'/admin'` | `config.routes.admin`; stats link and views, `IntegrationAlerts` | the project moves `app/(payload)//` itself and adds the route to the proxy matcher (security.md) | | `twoFactor` | **none = error** | `@clocklimited/payload-2fa` with `forceSetup: true` (TOTP enforced, also checked in the API) | `twoFactor: false` (discouraged); omitting the option throws `[iapl] twoFactor.issuer is required` | | `twoFactor.issuer` | — (required) | name in the authenticator app | — | @@ -102,7 +102,7 @@ description: Complete map of everything @intecion/ipal-kit provides — every ia | `forms.adminGroup` | `'Forms'` | sidebar group | `false` = Payload default; `admin.group` in overrides wins | | `forms.fields.*` | on: `checkbox`, `checkboxGroup`, `country`, `date`, `email`, `message`, `number`, `radio`, `select`, `state`, `step`, `text`, `textarea`, `time`; off: `payment` | block types in the builder (all with "Show only when") | `: false`; a block object replaces it; `payment: true` **does nothing** (filtered out) — pass a block object | | `forms.formOverrides` | Form/Forms labels, `emails` readable by logged-in users only | overrides the `forms` collection (`fields: ({ defaultFields }) => …`, `slug`, `admin`, `access`…) | any `CollectionConfig` | -| `forms.formSubmissionOverrides` | create: a staff account with its second factor (since 1.17.2; before: any signed-in account), read: editor+, delete: admin | overrides `form-submissions` | `access.create` etc. wins | +| `forms.formSubmissionOverrides` | create: a staff account with its second factor (since 1.18.0; before: any signed-in account), read: editor+, delete: admin | overrides `form-submissions` | `access.create` etc. wins | | `forms.redirectRelationships` | none | collections a form can redirect to | `['pages']` | | `forms.emailLayout` | `false` | `beforeEmail` with a layout (logo, colour, footer) + Site settings → **Emails** tab; `{{*:table}}` readable | `true` | | `forms.beforeEmail` | none | your own e-mail changes (after the layout) | form-builder function | @@ -112,7 +112,7 @@ description: Complete map of everything @intecion/ipal-kit provides — every ia | `consentLog` | **on** (since 1.17.0) | `consent-records` collection + `POST /api/ipal/consent` (rate limit 20/min); Postgres / SQLite: a table, migration in the same deploy; MongoDB: a TTL index deletes records older than the retention (1.18.0) | `false` / `{ retentionDays }` (default 1095) / `{ ttlIndex: false }` | | `unusedMedia` | off | 1.18.0: a notice above upload lists with a link to the files nothing uses (manual delete); then `pnpm generate:importmap` | `true` / `{ collections: ['media'] }` | | `consentLog.collectionOverrides` | none | changes `consent-records`: an object merges `access` / `admin` / `hooks` key by key (your keys win), a function `(collection) => collection` takes over (keep the slug) | e.g. `{ access: { read: ({ req }) => req.user?.email === 'dpo@acme.pl' } }` — narrows who reads records in a project without roles | -| `jobsRunAccess` | on (since 1.17.2), only when the project writes no `jobs.access.run` | Payload's job queue over HTTP (`/api/payload-jobs/run`, `/handle-schedules`): an admin with the second factor (an admin API key counts) or `Authorization: Bearer ` (16+ chars); before: any signed-in account of any auth collection. In-process runs (`jobs.autoRun`, `payload jobs:run`) unaffected | `false` = Payload's default; `{ secretVar }` = another variable; your own `jobs.access.run` wins. Check: `curl -H "Authorization: Bearer $CRON_SECRET" $URL/api/payload-jobs/run` → 200, without it 401 (security.md "Payload's job queue") | +| `jobsRunAccess` | on (since 1.18.0), only when the project writes no `jobs.access.run` | Payload's job queue over HTTP (`/api/payload-jobs/run`, `/handle-schedules`): an admin with the second factor (an admin API key counts) or `Authorization: Bearer ` (16+ chars); before: any signed-in account of any auth collection. In-process runs (`jobs.autoRun`, `payload jobs:run`) unaffected | `false` = Payload's default; `{ secretVar }` = another variable; your own `jobs.access.run` wins. Check: `curl -H "Authorization: Bearer $CRON_SECRET" $URL/api/payload-jobs/run` → 200, without it 401 (security.md "Payload's job queue") | | `doctor` | on (404 until `IAPL_DOCTOR_TOKEN` is set) | `GET /api/ipal/doctor` — read-only counts for `iapl-doctor --url` (users without TOTP, cookies waiting for approval, versions); Bearer token ≥ 32 characters, rate-limited, never names or values | `false` = no endpoint; `{ tokenVar, access }` (doctor.md) | | `cookieScanner` | off | `cookie-review` collection, "Scan cookies" box above its list (`CookieScanButton`), `GET`/`POST /api/ipal/cookie-scan`, and (unless `approval: false`) the *Approve cookies* view `/admin/cookie-approval` (`CookieApprovalView`) + `GET`/`POST /api/ipal/cookie-approval` + the dashboard reminder; a scan lists the cookies of the integrations switched on + names looked up in the bundled Open Cookie Database; one **Approve and add** puts the ticked cookies into Cookies → Cookie list (so `` and the detailed window); never deletes, never overwrites edited text, never duplicates, nothing reaches the banner before approval | `true` / object; after switching on: `pnpm generate:importmap` + `migrate:create`. Check: *Privacy → Cookie review* → **Scan cookies** → "Waiting for approval: N" → **Review and approve** → **Approve and add** → the cookies are in Cookies → Cookie list (cookie-scanner.md) | | `cookieScanner.adminLayout` | `'combined'` | one *Cookies* entry: *Review and approve* and (with `crawl`) *Site check* tabs on the `cookie-settings` global (`ui` fields, `CookieReviewTab` / `CookieSiteCheckTab`); `cookie-review` and `cookie-crawl` get `admin.group: false` (out of the nav, pages and API kept) | `'separate'`; no migration, `generate:importmap` | diff --git a/reference/.agents/skills/iapl-reference/resources/api.md b/reference/.agents/skills/iapl-reference/resources/api.md index fa691e3..c8d48ff 100644 --- a/reference/.agents/skills/iapl-reference/resources/api.md +++ b/reference/.agents/skills/iapl-reference/resources/api.md @@ -85,8 +85,8 @@ Admin panel components from `@intecion/ipal-kit/admin` — the project does NOT | `buildRolesField(defaultRole?, { firstUserAdmin? })` | `@intecion/ipal-kit` | The `roles` select field the plugin injects (only admins set roles; `firstUserAdmin` default `true` = the account made on "Create first user" gets `admin`). The plugin wires it itself — use it only for an auth collection the plugin does not manage. | | `injectRoles(config, accessOption)` | `@intecion/ipal-kit` | Adds `roles` to `accessOption.authCollection` in a config. The plugin calls it itself with `access` — do not call. | -| `requireOwnOrigin(endpoint, origins?)`, `guardAdminEndpoints(config, projectEndpoints, option)`, `ADMIN_POST_ENDPOINTS`, type `AdminSameOriginOption` | `@intecion/ipal-kit` | `adminSameOrigin` (1.17.2): wraps an endpoint so a request a browser marks as coming from another origin gets `403` (logged once per origin); applies it to the plugin's panel actions it added; the list of `[method, path]` covered. `reportRefusedOrigin(req, origins?, { what, option, docs }?)` names your option in the log line. | -| `lockedLooksWrong`, `withLockedAnswer(config)`, `graphqlLoginName(collection)` | `@intecion/ipal-kit` | `accounts.lockedAnswer` (1.17.2): the config-level `afterError` hook that answers Payload's `LockedAuth` on a staff collection's login (REST, GraphQL) exactly like `AuthenticationError`; adding it to a config (idempotent); the GraphQL login mutation's name of a collection. | +| `requireOwnOrigin(endpoint, origins?)`, `guardAdminEndpoints(config, projectEndpoints, option)`, `ADMIN_POST_ENDPOINTS`, type `AdminSameOriginOption` | `@intecion/ipal-kit` | `adminSameOrigin` (1.18.0): wraps an endpoint so a request a browser marks as coming from another origin gets `403` (logged once per origin); applies it to the plugin's panel actions it added; the list of `[method, path]` covered. `reportRefusedOrigin(req, origins?, { what, option, docs }?)` names your option in the log line. | +| `lockedLooksWrong`, `withLockedAnswer(config)`, `graphqlLoginName(collection)` | `@intecion/ipal-kit` | `accounts.lockedAnswer` (1.18.0): the config-level `afterError` hook that answers Payload's `LockedAuth` on a staff collection's login (REST, GraphQL) exactly like `AuthenticationError`; adding it to a config (idempotent); the GraphQL login mutation's name of a collection. | | `applySignInRules(collection, accounts?)`, `buildSignInBeforeOperation(slug, rules)`, `releaseSignInPlace`, `settleFailedSignIn`, `buildCurrentPasswordField()`, `resolveSignInRules(accounts?)`, `foldSignInName(value)`, `passwordMatches({ hash, salt }, password)`, `CURRENT_PASSWORD_FIELD`, `SIGN_IN_RULES_MARK` (the mark on the `beforeOperation` hook); types `SignInRulesOptions`, `SignInLimitOptions`, `SignInSameOriginOptions` | `@intecion/ipal-kit` | 1.18.0, `accounts.signInLimit` / `signInSameOrigin` / `confirmOwnChanges`: the three rules on one staff collection (hooks, field, Payload lock defaults); the `beforeOperation` hook; the `afterLogin` hook that gives a sign-in's place back; the config `afterError` hook that ends a failed one; the virtual "Current password" field; the options with defaults; the address folding (NFKC, lower case, trim); Payload's stored-hash check (unknown formats refused). | | `releaseRateLimit({ key, scope, max?, windowMs?, cost? })` | `@intecion/ipal-kit` | Gives back a place `consumeRateLimit` took (memory: never below 0; a store: `hit(id, -cost)`) — for a limiter that counts failures only. | @@ -170,8 +170,8 @@ Fifteen ready blocks and ten page templates. **Use a library block (or a variant |---|---|---| | `ConsentProvider` | `@intecion/ipal-kit/client` | Consent provider: `{ texts, cookieMap?, logEndpoint?, nonce?, cookieValue?, gpc?, maxAgeDays? }` (`gpc`: Global Privacy Control `'honour'` default / `'ask'` / `false`; `maxAgeDays`: re-ask period, default 180; withdrawal also removes the panel's listed storage keys and tells Meta / TikTok / Clarity) (`nonce`: CSP nonce for the banner's first-paint script; `cookieValue`: optional server-read consent cookie → exact HTML, dynamic pages) — consent state, cookie, Consent Mode, deleting cookies after consent is withdrawn, optional POST of the decision to the log (`'/api/ipal/consent'`). Wrap the layout once; required by the banner, `Analytics`, `ConsentScript`. | | `CookieBanner` | `@intecion/ipal-kit/client` | Consent banner + category settings: `settings: 'inline' \| 'modal' \| 'detailed'`, `controls`, `equalChoice` (recommended `true`), `order`, `settingsActions`, `icon`, `classNames`, `firstPaint` (default `true`: in the server HTML, decided before the first paint by an inline script; pages stay static), `nonce`; colours from `--ipal-*` CSS vars. Do not write your own banner. | -| `CookieButton` | `@intecion/ipal-kit/client` | Floating button that reopens the cookie settings (withdrawing consent); hidden while the banner is visible. Fixed in the bottom corner of the window on every page and never moves (1.17.2: it no longer climbs above the footer). While it is shown the footer gets just enough bottom padding for its last row to end above the button (measured; the footer's own padding counts; nothing where the corner is empty; made before the first paint for a returning visitor). Props `className`, `side` (`'left' \| 'right'`), `reserve` (selector of the block that gets the room, default `COOKIE_BUTTON_RESERVE` = footer; `false` = none), `avoid` (placement before 1.17.2: selector it lifts above — `COOKIE_BUTTON_AVOID`). Amount by hand: `--ipal-cookie-button-space` on the footer (`0` = none). Tokens `--ipal-cookie-button-offset`, `--ipal-cookie-button-inset`. Type `CookieButtonProps`. | -| `COOKIE_BUTTON_AVOID`, `bottomOverlap(tops, viewportHeight)` | `@intecion/ipal-kit/client` | Footer selector for the placement before 1.17.2 (``); pixels the footer covers at the bottom of the screen (how far the button moves up then) | +| `CookieButton` | `@intecion/ipal-kit/client` | Floating button that reopens the cookie settings (withdrawing consent); hidden while the banner is visible. Fixed in the bottom corner of the window on every page and never moves (1.18.0: it no longer climbs above the footer). While it is shown the footer gets just enough bottom padding for its last row to end above the button (measured; the footer's own padding counts; nothing where the corner is empty; made before the first paint for a returning visitor). Props `className`, `side` (`'left' \| 'right'`), `reserve` (selector of the block that gets the room, default `COOKIE_BUTTON_RESERVE` = footer; `false` = none), `avoid` (placement before 1.18.0: selector it lifts above — `COOKIE_BUTTON_AVOID`). Amount by hand: `--ipal-cookie-button-space` on the footer (`0` = none). Tokens `--ipal-cookie-button-offset`, `--ipal-cookie-button-inset`. Type `CookieButtonProps`. | +| `COOKIE_BUTTON_AVOID`, `bottomOverlap(tops, viewportHeight)` | `@intecion/ipal-kit/client` | Footer selector for the placement before 1.18.0 (``); pixels the footer covers at the bottom of the screen (how far the button moves up then) | | `COOKIE_BUTTON_RESERVE`, `COOKIE_BUTTON_SPACE_ATTRIBUTE`, `reserveCookieButtonSpace(options)` | `@intecion/ipal-kit/client` | Default selector of the block that gets room for the cookie button (the footer); the attribute that marks it while the room is there; the function that measures and applies (or, with `release: true`, removes) it — options type `CookieButtonSpaceOptions` (`selector`, `side`, `button?`, `release?`, `sheet?`). For a button of your own | | `consentDecidedScript({ version?, gpc?, cookieName? })` | `@intecion/ipal-kit` | JavaScript statements for an inline script: leave `true` in `d` when the browser holds a current consent decision (as `readConsentRecord` decides). The shared start of the plugin's pre-paint scripts | | `TOTP_TEXTS`, `TOTP_VIEW_TITLE` | `@intecion/ipal-kit` | en/pl texts of the 2FA screens (`totpPlugin:*`, merged by `twoFactor`) and their tab title | @@ -763,7 +763,7 @@ Most routes and metadata are already ready in `createContentHelpers` (`generateP | `setRateLimitStore(store \| null)` | `@intecion/ipal-kit` | Shared store (e.g. Redis) for all plugin limiters (forms, consents, MCP…); `null` = process memory. Call once at startup when several instances run. | | `setUnknownIpFactor(n)` | `@intecion/ipal-kit` | Requests with no client IP share one `unknown-ip` bucket with `n` × the limit (every plugin limiter). Call once at startup; `0` = unlimited (only with a limiter in front, e.g. Cloudflare). | | `UNKNOWN_IP_FACTOR` | `@intecion/ipal-kit` | `20` — the default factor of the no-IP bucket. | -| `setIpv6Grouping({ prefix?, wide?, wideFactor? })`, `ipRateKey(ip)`, type `Ipv6Grouping` | `@intecion/ipal-kit` | 1.17.2: how every plugin limiter counts IPv6 — default one client per /64 (`prefix: 64`), no wide counter; `wide: 48` adds a counter per /48 at `wideFactor` (10) × the limit; `prefix: 128` = per address. Out-of-range values throw. `ipRateKey`: an IPv4 as it is, `::ffff:a.b.c.d` as the IPv4, an IPv6 as its network (`2001:db8:1:2:0:0:0:0/64`), anything else unchanged. | +| `setIpv6Grouping({ prefix?, wide?, wideFactor? })`, `ipRateKey(ip)`, type `Ipv6Grouping` | `@intecion/ipal-kit` | 1.18.0: how every plugin limiter counts IPv6 — default one client per /64 (`prefix: 64`), no wide counter; `wide: 48` adds a counter per /48 at `wideFactor` (10) × the limit; `prefix: 128` = per address. Out-of-range values throw. `ipRateKey`: an IPv4 as it is, `::ffff:a.b.c.d` as the IPv4, an IPv6 as its network (`2001:db8:1:2:0:0:0:0/64`), anything else unchanged. | **Types:** `ClientIpOptions` — `clientIp` options; `RateLimitStore` — store contract (`hit(id, cost, windowMs)` → `{ count, resetAt }`). diff --git a/reference/.agents/skills/iapl-upgrade/SKILL.md b/reference/.agents/skills/iapl-upgrade/SKILL.md index d752c95..c9fbb6a 100644 --- a/reference/.agents/skills/iapl-upgrade/SKILL.md +++ b/reference/.agents/skills/iapl-upgrade/SKILL.md @@ -25,7 +25,7 @@ the MANDATORY SET (GEO: llms-full, Markdown, MCP; R2; Turnstile through `getTurnstileConfig`…). Wire each one according to PROGRAMISTA §2 — it is part of the update, not an extra. Skip one only with a client decision in `AGENTS.md` (`iapl-audit-skip:`). -**→ 1.18.0, sign-in (CHANGELOG 1.18.0; access.md "A stranger cannot lock a staff account out", "Staff sign-in only +**→ 1.18.0, sign-in (CHANGELOG 1.18.0 "Staff sign-in"; PROGRAMISTA §6, item 89; access.md "A stranger cannot lock a staff account out", "Staff sign-in only from the site's own origin", "Changing one's own e-mail or password asks for the current password") — no schema change, no migration, no import-map change; read before deploying:** 1. `IAPL_IP_HEADER` must be pinned in production (`x-forwarded-for` behind Coolify/Traefik): failed staff sign-ins are @@ -39,7 +39,7 @@ no migration, no import-map change; read before deploying:** **Check:** five wrong passwords for an editor from one address → `429` there, `200` from another; the account page shows "Current password"; `curl -X POST /api/users/login -H 'Origin: https://other.example' …` → `403`. -**→ 1.18.0, two-step verification confirmed by e-mail (CHANGELOG 1.18.0; security.md "Set-up confirmed by e-mail") — +**→ 1.18.0, two-step verification confirmed by e-mail (CHANGELOG 1.18.0; PROGRAMISTA §6, item 88; security.md "Set-up confirmed by e-mail") — check before deploying:** (1) e-mail works on the site (Site integrations → E-mail sending → "Send a test e-mail"); (2) `serverURL` is set (`NEXT_PUBLIC_SERVER_URL`); (3) tell the staff: whoever sets two-step verification up for the first time gets a link by e-mail and opens it in the same browser, then signs in again. Accounts that already have it @@ -65,14 +65,34 @@ correct place `// iapl-security-ok: `. **Check:** `curl -s '/api/page `curl -s -o /dev/null -w '%{http_code}' '/api/pages?sort=%24where'` → `400`; `pnpm exec iapl-doctor --url --only live-probes` → no finding. -**→ 1.17.2, security (CHANGELOG 1.17.2; PROGRAMISTA §6, items 84–87) — nothing required, check:** `readVersions: +**→ 1.18.0, speed and growth (CHANGELOG 1.18.0 "Speed and growth"; PROGRAMISTA §6, items 91, 94; performance.md) — +no migration; MongoDB gets a hidden date on two logs; check before deploying:** (1) `pnpm exec iapl-doctor` — the +`perf-*` rules are **errors** now: fix what they name or lower / silence a rule with a reason in `iapl-doctor.json`; +a site with Playwright and no budget test gets `perf-budgets` (copy the `iapl-performance` template); (2) JPEG / PNG +uploads lose their metadata (`buildOptimizeUploadHook({ stripMetadata: false })` keeps it); (3) MongoDB: old consent +records (1095 days) and statistics (90 days) are deleted by a TTL index within a minute of the first start +(`ttlIndex: false` on `consentLog` / `stats`); (4) a plugin collection or global whose versions you turned on keeps 20 +per document unless you set `max` / `maxPerDoc`; (5) `BuilderForm` and `Turnstile` from `/client` are lazy (same +props, the HTML is complete); the eager ones: `@intecion/ipal-kit/client/eager`; (6) a helper without its own +`'use client'` imported from `/client` into a server component is the plain function now (do not pass it to a client +component as a prop); (7) `pnpm exec iapl-skills` installs `iapl-performance`; `unusedMedia: true` needs +`pnpm generate:importmap`. **Check:** `pnpm exec iapl-doctor --only performance` → no error; the site's forms still +send. + +**→ 1.18.0, drafts left out of related documents (CHANGELOG 1.18.0 "Content and plugin writes"; PROGRAMISTA §6, +item 93; content.md "Drafts as related documents") — nothing to run:** a menu link, a block or a System pages link that +points at a page never published no longer shows on the site (its title, slug and text are left out); a preview keeps +it. The old behaviour: `createContentHelpers({ draftRelations: 'keep' })`. **Check:** a menu link to an unpublished +page is gone on the live site and back after publishing. + +**→ 1.18.0 (from 1.17.2, never released alone), security (CHANGELOG 1.18.0 "From 1.17.2"; PROGRAMISTA §6, items 84–87) — nothing required, check:** `readVersions: readPublished()` now works (a wrapper of your own around it: use `readPublishedVersions()` inside); behind a proxy that rewrites `Host` without `X-Forwarded-Host`, set `serverURL` or the panel's mail / cookie buttons answer 403 (`iapl-doctor` warns); a locked editor sees "incorrect" until the lock ends (`accounts.lockedAnswer: 'payload'` for Payload's text); saving Cookies with a lower consent version is refused (`cookieSettings.allowLowerPolicyVersion`). **Check:** `curl -s /api/pages/versions` as a visitor → 200 (published only), not 500. -**→ 1.17.2:** (1) Payload jobs: if the project has tasks or workflows and a cron calls `/api/payload-jobs/run` (or +**→ 1.18.0 (from 1.17.2):** (1) Payload jobs: if the project has tasks or workflows and a cron calls `/api/payload-jobs/run` (or `/handle-schedules`) without its own `jobs.access.run`, set `CRON_SECRET` (16+ characters) in the app's environment and send `Authorization: Bearer ` from the cron; in-process runs (`jobs.autoRun`, `payload jobs:run`) and an admin's API key need nothing (security.md "Payload's job queue"). Verify: the run route answers 401 without @@ -81,7 +101,7 @@ the header, 200 with it. (2) A front end that posted to `/api/form-submissions` (3) A site with a visitor login collection: `iapl-doctor --url …` lists `visitor-writes`; give each listed collection and global its own write rule (`adminOrEditor`). (4) If the project has `tests/routes.ts`: `update`, judge, commit. -**→ 1.17.2, cookie button (CHANGELOG 1.17.2; PROGRAMISTA §6, item 83; consent.md "Where the cookie button sits") — nothing is required:** +**→ 1.18.0 (from 1.17.2), cookie button (CHANGELOG 1.18.0 "From 1.17.2"; PROGRAMISTA §6, item 83; consent.md "Where the cookie button sits") — nothing is required:** visitors now see the "cookie settings" button in the bottom corner of the window on every page; it never moves and no longer rides up above the footer. While it is shown the footer is a little taller (about 40 px on the reference site), so its last row ends above the button. Check the end of a page on a phone and on desktop: nothing under the @@ -322,7 +342,7 @@ and the browser tab shows the same separator. cookie banner only through `--ipal-*-dark`: check the banner in the dark theme. 4. Optional: the block library, block by block (block-library.md); after turning blocks on: `pnpm generate:types`, `pnpm payload generate:importmap`, Postgres/SQLite `migrate:create`. -5. **CookieButton** lifts above the footer — check a site with its own fixed footer bar; `avoid={false}` keeps it fixed. (Since 1.17.2 it stays in the bottom corner by default; the lift is `avoid={COOKIE_BUTTON_AVOID}`.) +5. **CookieButton** lifts above the footer — check a site with its own fixed footer bar; `avoid={false}` keeps it fixed. (Since 1.18.0 it stays in the bottom corner by default; the lift is `avoid={COOKIE_BUTTON_AVOID}`.) 6. `pnpm exec iapl-skills` (new **iapl-doctor**; updated iapl-reference, iapl-setup, iapl-site, iapl-audit). 7. Run `pnpm exec iapl-doctor` (and `--url https://`), fix or silence each finding with a reason in `iapl-doctor.json`. `IAPL_DOCTOR_TOKEN` (≥ 32 characters) only if the deep check runs against production. @@ -742,7 +762,7 @@ PROGRAMISTA §6, items 73–75; email.md; AGENT.md §7.2) — nothing to run; re **Send test e-mail** names the transport you expect; a form submission arrives. **The service is live at `https://webservices.intecion.net/mail`; a new site waits until a person of Intecion confirms it ("Połącz z IWSN") — keep SMTP until then, or `relay: false`.** -**→ 1.18.0, IWSN is connected by a person of Intecion (CHANGELOG "Unreleased (for 1.18.0)" → "IWSN: Połącz z IWSN"; email.md "The mail service"; AGENT.md §7.2 point 5) — nothing to run:** +**→ 1.18.0, IWSN is connected by a person of Intecion (CHANGELOG 1.18.0 "IWSN"; PROGRAMISTA §6, item 90; email.md "The mail service"; AGENT.md §7.2 point 5) — nothing to run:** 1. No schema change, no migration, no import-map change. Sites whose "Sending method" is SMTP or Microsoft Graph see no change at all. 2. A site on IWSN that is already active stays active. A site that waits (`relay-pending`, or doctor `mail-relay-connect` diff --git a/reference/AGENTS.md b/reference/AGENTS.md index 378e796..6966fda 100644 --- a/reference/AGENTS.md +++ b/reference/AGENTS.md @@ -47,7 +47,7 @@ Write everything in this file in English. -## IAPL 1.17.2 — agent guide +## IAPL 1.18.0 — agent guide This project is built on `@intecion/ipal-kit` (a Payload CMS 3 plugin). Before you write code: diff --git a/reference/e2e/closed-doors.spec.ts b/reference/e2e/closed-doors.spec.ts index 9d39dcf..1d6c30e 100644 --- a/reference/e2e/closed-doors.spec.ts +++ b/reference/e2e/closed-doors.spec.ts @@ -72,7 +72,7 @@ for (const caller of ['anonymous', 'customer', 'editor'] as const) { }) } -test.describe('closed doors: the cron secret opens the job queue (IAWL idea 35, 1.17.2)', () => { +test.describe('closed doors: the cron secret opens the job queue (IAWL idea 35, 1.18.0)', () => { test('Authorization: Bearer runs the queue; nothing else changes', async ({ baseURL, playwright }) => { test.skip(lateStaff !== '1' || !process.env.CRON_SECRET, 'needs the fixture\'s job queue (E2E_LATE_STAFF=1) and CRON_SECRET (pnpm e2e:built sets both)') const cron = await playwright.request.newContext({ baseURL, extraHTTPHeaders: { authorization: `Bearer ${process.env.CRON_SECRET}` } }) diff --git a/reference/e2e/closed-doors.ts b/reference/e2e/closed-doors.ts index fdfe3aa..09a1db4 100644 --- a/reference/e2e/closed-doors.ts +++ b/reference/e2e/closed-doors.ts @@ -58,7 +58,7 @@ export const DOORS: Door[] = [ { closedFor: ALL, name: 'the deep doctor status answers 404 without its token', path: '/api/ipal/doctor', closed: notFound }, // ---- jobs, schedules and call-backs (IAWL idea 35) --------------------------------------------------------- - // the fixture's do-nothing task turns the queue on; since 1.17.2 (owner's Q2) only an admin or Bearer CRON_SECRET runs it + // the fixture's do-nothing task turns the queue on; since 1.18.0 (owner's Q2) only an admin or Bearer CRON_SECRET runs it // (the "with the secret" case is its own test in closed-doors.spec.ts). Payload answers 401 when refused. { closedFor: ALL, name: 'Payload\'s job queue cannot be run (only an admin or the cron secret)', path: '/api/payload-jobs/run' }, { closedFor: ALL, name: 'Payload\'s job schedules cannot be handled (only an admin or the cron secret)', path: '/api/payload-jobs/handle-schedules' }, @@ -102,11 +102,11 @@ export const DOORS: Door[] = [ // ---- content and visitors' data -------------------------------------------------------------------------- { closedFor: OUTSIDERS, name: 'form submissions (visitors\' personal data)', path: '/api/form-submissions' }, { closedFor: OUTSIDERS, graphql: '{ FormSubmissions { docs { id } } }', closed: noData('FormSubmissions'), name: 'form submissions over GraphQL' }, - // since 1.17.2 (owner's Q1): a staff account with its second factor only — an editor may (it reaches validation) + // since 1.18.0 (owner's Q1): a staff account with its second factor only — an editor may (it reaches validation) { body: { form: NO_ID, submissionData: [] }, closedFor: OUTSIDERS, method: 'POST', name: 'a submission cannot be posted past submitForm (rate limit, Turnstile, consent, validation)', path: '/api/form-submissions', closed: forbidden }, { body: {}, closedFor: OUTSIDERS, method: 'POST', name: 'Site settings cannot be saved', path: '/api/globals/site-settings', closed: forbidden }, { body: {}, closedFor: OUTSIDERS, method: 'POST', name: 'Cookie settings (legal texts) cannot be saved', path: '/api/globals/cookie-settings', closed: forbidden }, - // the reference site's content has write rules of its own since 1.17.2 (owner's Q3, answer (b)): editors and admins + // the reference site's content has write rules of its own since 1.18.0 (owner's Q3, answer (b)): editors and admins { body: {}, closedFor: OUTSIDERS, method: 'PATCH', name: 'pages cannot be changed', path: `/api/pages/${NO_ID}`, closed: forbidden }, { body: {}, closedFor: OUTSIDERS, method: 'PATCH', name: 'media cannot be changed', path: `/api/media/${NO_ID}`, closed: forbidden }, { body: {}, closedFor: OUTSIDERS, method: 'POST', name: 'the header (navigation) cannot be saved', path: '/api/globals/header', closed: forbidden }, diff --git a/reference/e2e/routes.snapshot.json b/reference/e2e/routes.snapshot.json index 6355a3c..15de8fe 100644 --- a/reference/e2e/routes.snapshot.json +++ b/reference/e2e/routes.snapshot.json @@ -1,20 +1,20 @@ { "$comment": "Every public door of this site: REST routes, GraphQL operations, Next route files. One line per entry: who may use it and why it is open (or that it is closed and to whom). A new route fails `routes:check` until somebody judges it here. `--update` adds new routes with an empty reason and drops gone ones. docs/security.md \"Routes nobody has judged\".", "routes": { - "DELETE /api/caseStudies": "delete: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", - "DELETE /api/caseStudies/:id": "deleteByID: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", + "DELETE /api/caseStudies": "delete: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", + "DELETE /api/caseStudies/:id": "deleteByID: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", "DELETE /api/consent-records": "delete: nobody over the API (create/update false); delete: admin; visitors write through POST /api/ipal/consent", "DELETE /api/consent-records/:id": "deleteByID: nobody over the API (create/update false); delete: admin; visitors write through POST /api/ipal/consent", "DELETE /api/cookie-review": "delete: create/update: editor+; delete: admin", "DELETE /api/cookie-review/:id": "deleteByID: create/update: editor+; delete: admin", - "DELETE /api/form-submissions": "delete: create: a staff account with its second factor (1.17.2; the site submits through submitForm); update: nobody (form-builder); delete: admin", - "DELETE /api/form-submissions/:id": "deleteByID: create: a staff account with its second factor (1.17.2; the site submits through submitForm); update: nobody (form-builder); delete: admin", + "DELETE /api/form-submissions": "delete: create: a staff account with its second factor (1.18.0; the site submits through submitForm); update: nobody (form-builder); delete: admin", + "DELETE /api/form-submissions/:id": "deleteByID: create: a staff account with its second factor (1.18.0; the site submits through submitForm); update: nobody (form-builder); delete: admin", "DELETE /api/forms": "delete: editor+ (staffAccess)", "DELETE /api/forms/:id": "deleteByID: editor+ (staffAccess)", - "DELETE /api/media": "delete: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", - "DELETE /api/media/:id": "deleteByID: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", - "DELETE /api/pages": "delete: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", - "DELETE /api/pages/:id": "deleteByID: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", + "DELETE /api/media": "delete: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", + "DELETE /api/media/:id": "deleteByID: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", + "DELETE /api/pages": "delete: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", + "DELETE /api/pages/:id": "deleteByID: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", "DELETE /api/payload-kv": "delete: nobody (every rule false)", "DELETE /api/payload-kv/:id": "deleteByID: nobody (every rule false)", "DELETE /api/payload-locked-documents": "delete: staff accounts with the second factor (iapl lockedDocuments, 1.18.0; set at start, Payload's default was any signed-in account)", @@ -22,8 +22,8 @@ "DELETE /api/payload-preferences": "delete: own preferences only (Payload)", "DELETE /api/payload-preferences/:id": "deleteByID: own preferences only (Payload)", "DELETE /api/payload-preferences/:key": "deleteByID: own preferences only (Payload)", - "DELETE /api/posts": "delete: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", - "DELETE /api/posts/:id": "deleteByID: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", + "DELETE /api/posts": "delete: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", + "DELETE /api/posts/:id": "deleteByID: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", "DELETE /api/users": "delete: create/delete/unlock: an admin with the second factor; update: admin or self; roles field: admin", "DELETE /api/users/:id": "deleteByID: create/delete/unlock: an admin with the second factor; update: admin or self; roles field: admin", "GET /api/access": "Payload: the signed-in account's permissions (what the panel may show); anonymous gets an empty map", @@ -125,36 +125,36 @@ "GET /api/users/me": "Payload: the signed-in account itself, or null; no other account", "GET /api/users/versions": "versions: readVersions = read (an admin, or the account itself (adminOrSelfIn users)); no version history kept here", "GET /api/users/versions/:id": "versionByID: readVersions = read (an admin, or the account itself (adminOrSelfIn users)); no version history kept here", - "PATCH /api/caseStudies": "update: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", - "PATCH /api/caseStudies/:id": "updateByID: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", + "PATCH /api/caseStudies": "update: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", + "PATCH /api/caseStudies/:id": "updateByID: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", "PATCH /api/consent-records": "update: nobody over the API (create/update false); delete: admin; visitors write through POST /api/ipal/consent", "PATCH /api/consent-records/:id": "updateByID: nobody over the API (create/update false); delete: admin; visitors write through POST /api/ipal/consent", "PATCH /api/cookie-review": "update: create/update: editor+; delete: admin", "PATCH /api/cookie-review/:id": "updateByID: create/update: editor+; delete: admin", - "PATCH /api/form-submissions": "update: create: a staff account with its second factor (1.17.2; the site submits through submitForm); update: nobody (form-builder); delete: admin", - "PATCH /api/form-submissions/:id": "updateByID: create: a staff account with its second factor (1.17.2; the site submits through submitForm); update: nobody (form-builder); delete: admin", + "PATCH /api/form-submissions": "update: create: a staff account with its second factor (1.18.0; the site submits through submitForm); update: nobody (form-builder); delete: admin", + "PATCH /api/form-submissions/:id": "updateByID: create: a staff account with its second factor (1.18.0; the site submits through submitForm); update: nobody (form-builder); delete: admin", "PATCH /api/forms": "update: editor+ (staffAccess)", "PATCH /api/forms/:id": "updateByID: editor+ (staffAccess)", - "PATCH /api/media": "update: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", - "PATCH /api/media/:id": "updateByID: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", - "PATCH /api/pages": "update: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", - "PATCH /api/pages/:id": "updateByID: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", + "PATCH /api/media": "update: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", + "PATCH /api/media/:id": "updateByID: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", + "PATCH /api/pages": "update: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", + "PATCH /api/pages/:id": "updateByID: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", "PATCH /api/payload-kv": "update: nobody (every rule false)", "PATCH /api/payload-kv/:id": "updateByID: nobody (every rule false)", "PATCH /api/payload-locked-documents": "update: staff accounts with the second factor (iapl lockedDocuments, 1.18.0; set at start, Payload's default was any signed-in account)", "PATCH /api/payload-locked-documents/:id": "updateByID: staff accounts with the second factor (iapl lockedDocuments, 1.18.0; set at start, Payload's default was any signed-in account)", "PATCH /api/payload-preferences": "update: own preferences only (Payload)", "PATCH /api/payload-preferences/:id": "updateByID: own preferences only (Payload)", - "PATCH /api/posts": "update: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", - "PATCH /api/posts/:id": "updateByID: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", + "PATCH /api/posts": "update: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", + "PATCH /api/posts/:id": "updateByID: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", "PATCH /api/users": "update: create/delete/unlock: an admin with the second factor; update: admin or self; roles field: admin", "PATCH /api/users/:id": "updateByID: create/delete/unlock: an admin with the second factor; update: admin or self; roles field: admin", "POST /api/admin/remove-user-totp": "2FA: an admin removes another account's second factor", "POST /api/admin/reset-user-totp": "2FA: an admin resets another account's second factor", - "POST /api/caseStudies": "create: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", - "POST /api/caseStudies/:id/duplicate": "duplicate: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", + "POST /api/caseStudies": "create: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", + "POST /api/caseStudies/:id/duplicate": "duplicate: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", "POST /api/caseStudies/access/:id?": "the signed-in account's own permissions on caseStudies", - "POST /api/caseStudies/versions/:id": "restore a version: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", + "POST /api/caseStudies/versions/:id": "restore a version: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", "POST /api/consent-records": "create: nobody over the API (create/update false); delete: admin; visitors write through POST /api/ipal/consent", "POST /api/consent-records/:id/duplicate": "duplicate: nobody over the API (create/update false); delete: admin; visitors write through POST /api/ipal/consent", "POST /api/consent-records/access/:id?": "the signed-in account's own permissions on consent-records", @@ -163,29 +163,29 @@ "POST /api/cookie-review/:id/duplicate": "duplicate: create/update: editor+; delete: admin", "POST /api/cookie-review/access/:id?": "the signed-in account's own permissions on cookie-review", "POST /api/cookie-review/versions/:id": "restore a version: create/update: editor+; delete: admin", - "POST /api/form-submissions": "create: a staff account with its second factor (1.17.2; the site submits through submitForm); update: nobody (form-builder); delete: admin", - "POST /api/form-submissions/:id/duplicate": "duplicate: create: a staff account with its second factor (1.17.2; the site submits through submitForm); update: nobody (form-builder); delete: admin", + "POST /api/form-submissions": "create: a staff account with its second factor (1.18.0; the site submits through submitForm); update: nobody (form-builder); delete: admin", + "POST /api/form-submissions/:id/duplicate": "duplicate: create: a staff account with its second factor (1.18.0; the site submits through submitForm); update: nobody (form-builder); delete: admin", "POST /api/form-submissions/access/:id?": "the signed-in account's own permissions on form-submissions", - "POST /api/form-submissions/versions/:id": "restore a version: create: a staff account with its second factor (1.17.2; the site submits through submitForm); update: nobody (form-builder); delete: admin", + "POST /api/form-submissions/versions/:id": "restore a version: create: a staff account with its second factor (1.18.0; the site submits through submitForm); update: nobody (form-builder); delete: admin", "POST /api/forms": "create: editor+ (staffAccess)", "POST /api/forms/:id/duplicate": "duplicate: editor+ (staffAccess)", "POST /api/forms/access/:id?": "the signed-in account's own permissions on forms", "POST /api/forms/versions/:id": "restore a version: editor+ (staffAccess)", - "POST /api/globals/company": "update: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", + "POST /api/globals/company": "update: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", "POST /api/globals/company/access": "the signed-in account's own permissions on globals/company", - "POST /api/globals/company/versions/:id": "restore a version: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", + "POST /api/globals/company/versions/:id": "restore a version: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", "POST /api/globals/cookie-crawl": "update: admin; the crawl endpoints write it after their own checks", "POST /api/globals/cookie-crawl/access": "the signed-in account's own permissions on globals/cookie-crawl", "POST /api/globals/cookie-crawl/versions/:id": "restore a version: admin; the crawl endpoints write it after their own checks", "POST /api/globals/cookie-settings": "update: editor+", "POST /api/globals/cookie-settings/access": "the signed-in account's own permissions on globals/cookie-settings", "POST /api/globals/cookie-settings/versions/:id": "restore a version: editor+", - "POST /api/globals/footer": "update: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", + "POST /api/globals/footer": "update: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", "POST /api/globals/footer/access": "the signed-in account's own permissions on globals/footer", - "POST /api/globals/footer/versions/:id": "restore a version: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", - "POST /api/globals/header": "update: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", + "POST /api/globals/footer/versions/:id": "restore a version: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", + "POST /api/globals/header": "update: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", "POST /api/globals/header/access": "the signed-in account's own permissions on globals/header", - "POST /api/globals/header/versions/:id": "restore a version: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", + "POST /api/globals/header/versions/:id": "restore a version: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", "POST /api/globals/notifications": "update: editor+", "POST /api/globals/notifications/access": "the signed-in account's own permissions on globals/notifications", "POST /api/globals/notifications/versions/:id": "restore a version: editor+", @@ -209,14 +209,14 @@ "POST /api/ipal/forms/submit": "public by design: a form with files; the submitForm pipeline (rate limit, Turnstile, consent, validation, file checks)", "POST /api/ipal/test-email": "send a test e-mail: admin", "POST /api/ipal/two-factor/reset": "reset another account's 2FA set-up window: admin signed in with the second factor", - "POST /api/media": "create: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", - "POST /api/media/:id/duplicate": "duplicate: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", + "POST /api/media": "create: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", + "POST /api/media/:id/duplicate": "duplicate: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", "POST /api/media/access/:id?": "the signed-in account's own permissions on media", - "POST /api/media/versions/:id": "restore a version: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", - "POST /api/pages": "create: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", - "POST /api/pages/:id/duplicate": "duplicate: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", + "POST /api/media/versions/:id": "restore a version: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", + "POST /api/pages": "create: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", + "POST /api/pages/:id/duplicate": "duplicate: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", "POST /api/pages/access/:id?": "the signed-in account's own permissions on pages", - "POST /api/pages/versions/:id": "restore a version: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", + "POST /api/pages/versions/:id": "restore a version: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", "POST /api/payload-kv": "create: nobody (every rule false)", "POST /api/payload-kv/:id/duplicate": "duplicate: nobody (every rule false)", "POST /api/payload-kv/access/:id?": "the signed-in account's own permissions on payload-kv", @@ -234,10 +234,10 @@ "POST /api/plugin-seo/generate-image": "SEO plugin (panel button): Payload default (signed-in account); nothing stored", "POST /api/plugin-seo/generate-title": "SEO plugin (panel button): Payload default (signed-in account); nothing stored", "POST /api/plugin-seo/generate-url": "SEO plugin (panel button): Payload default (signed-in account); nothing stored", - "POST /api/posts": "create: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", - "POST /api/posts/:id/duplicate": "duplicate: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", + "POST /api/posts": "create: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", + "POST /api/posts/:id/duplicate": "duplicate: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", "POST /api/posts/access/:id?": "the signed-in account's own permissions on posts", - "POST /api/posts/versions/:id": "restore a version: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", + "POST /api/posts/versions/:id": "restore a version: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", "POST /api/remove-totp": "2FA: the signed-in account's own second factor, fully signed in", "POST /api/setup-totp": "2FA: sets up the signed-in account's own authenticator; same-origin only", "POST /api/users": "create: create/delete/unlock: an admin with the second factor; update: admin or self; roles field: admin", @@ -252,64 +252,64 @@ "POST /api/users/verify/:id": "public by design: needs the e-mailed verification token (verify is off on users)", "POST /api/users/versions/:id": "restore a version: create/delete/unlock: an admin with the second factor; update: admin or self; roles field: admin", "POST /api/verify-totp": "2FA (payload-2fa): the signed-in account's own code; same-origin only, 5 tries per account in 10 min", - "graphql mutation createCaseStudy": "GraphQL create: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", + "graphql mutation createCaseStudy": "GraphQL create: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", "graphql mutation createConsentRecord": "GraphQL create: nobody over the API (create/update false); delete: admin; visitors write through POST /api/ipal/consent", "graphql mutation createCookieReview": "GraphQL create: create/update: editor+; delete: admin", "graphql mutation createForm": "GraphQL create: editor+ (staffAccess)", - "graphql mutation createFormSubmission": "GraphQL create: a staff account with its second factor (1.17.2; the site submits through submitForm); update: nobody (form-builder); delete: admin", - "graphql mutation createMedia": "GraphQL create: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", - "graphql mutation createPage": "GraphQL create: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", + "graphql mutation createFormSubmission": "GraphQL create: a staff account with its second factor (1.18.0; the site submits through submitForm); update: nobody (form-builder); delete: admin", + "graphql mutation createMedia": "GraphQL create: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", + "graphql mutation createPage": "GraphQL create: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", "graphql mutation createPayloadKv": "GraphQL create: nobody (every rule false)", "graphql mutation createPayloadLockedDocument": "GraphQL create: staff accounts with the second factor (iapl lockedDocuments, 1.18.0; set at start, Payload's default was any signed-in account)", "graphql mutation createPayloadPreference": "GraphQL create: own preferences only (Payload)", - "graphql mutation createPost": "GraphQL create: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", + "graphql mutation createPost": "GraphQL create: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", "graphql mutation createUser": "GraphQL create: create/delete/unlock: an admin with the second factor; update: admin or self; roles field: admin", - "graphql mutation deleteCaseStudy": "GraphQL delete: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", + "graphql mutation deleteCaseStudy": "GraphQL delete: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", "graphql mutation deleteConsentRecord": "GraphQL delete: nobody over the API (create/update false); delete: admin; visitors write through POST /api/ipal/consent", "graphql mutation deleteCookieReview": "GraphQL delete: create/update: editor+; delete: admin", "graphql mutation deleteForm": "GraphQL delete: editor+ (staffAccess)", - "graphql mutation deleteFormSubmission": "GraphQL delete: create: a staff account with its second factor (1.17.2; the site submits through submitForm); update: nobody (form-builder); delete: admin", - "graphql mutation deleteMedia": "GraphQL delete: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", - "graphql mutation deletePage": "GraphQL delete: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", + "graphql mutation deleteFormSubmission": "GraphQL delete: create: a staff account with its second factor (1.18.0; the site submits through submitForm); update: nobody (form-builder); delete: admin", + "graphql mutation deleteMedia": "GraphQL delete: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", + "graphql mutation deletePage": "GraphQL delete: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", "graphql mutation deletePayloadKv": "GraphQL delete: nobody (every rule false)", "graphql mutation deletePayloadLockedDocument": "GraphQL delete: staff accounts with the second factor (iapl lockedDocuments, 1.18.0; set at start, Payload's default was any signed-in account)", "graphql mutation deletePayloadPreference": "GraphQL delete: own preferences only (Payload)", - "graphql mutation deletePost": "GraphQL delete: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", + "graphql mutation deletePost": "GraphQL delete: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", "graphql mutation deleteUser": "GraphQL delete: create/delete/unlock: an admin with the second factor; update: admin or self; roles field: admin", - "graphql mutation duplicateCaseStudy": "GraphQL duplicate: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", + "graphql mutation duplicateCaseStudy": "GraphQL duplicate: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", "graphql mutation duplicateConsentRecord": "GraphQL duplicate: nobody over the API (create/update false); delete: admin; visitors write through POST /api/ipal/consent", "graphql mutation duplicateCookieReview": "GraphQL duplicate: create/update: editor+; delete: admin", "graphql mutation duplicateForm": "GraphQL duplicate: editor+ (staffAccess)", - "graphql mutation duplicateFormSubmission": "GraphQL duplicate: create: a staff account with its second factor (1.17.2; the site submits through submitForm); update: nobody (form-builder); delete: admin", - "graphql mutation duplicateMedia": "GraphQL duplicate: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", - "graphql mutation duplicatePage": "GraphQL duplicate: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", + "graphql mutation duplicateFormSubmission": "GraphQL duplicate: create: a staff account with its second factor (1.18.0; the site submits through submitForm); update: nobody (form-builder); delete: admin", + "graphql mutation duplicateMedia": "GraphQL duplicate: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", + "graphql mutation duplicatePage": "GraphQL duplicate: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", "graphql mutation duplicatePayloadKv": "GraphQL duplicate: nobody (every rule false)", "graphql mutation duplicatePayloadLockedDocument": "GraphQL duplicate: staff accounts with the second factor (iapl lockedDocuments, 1.18.0; set at start, Payload's default was any signed-in account)", "graphql mutation duplicatePayloadPreference": "GraphQL duplicate: own preferences only (Payload)", - "graphql mutation duplicatePost": "GraphQL duplicate: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", + "graphql mutation duplicatePost": "GraphQL duplicate: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", "graphql mutation forgotPasswordUser": "public by design: the same answer for a real and an invented address", "graphql mutation loginUser": "public by design: sign-in (as POST /api/users/login)", "graphql mutation logoutUser": "public by design: ends the caller's own session", "graphql mutation refreshTokenUser": "the signed-in account's own token only", "graphql mutation resetPasswordUser": "public by design: needs the e-mailed reset token", "graphql mutation unlockUser": "admin with the second factor (accounts.adminOnlyWrite)", - "graphql mutation updateCaseStudy": "GraphQL update: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", - "graphql mutation updateCompany": "GraphQL update: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", + "graphql mutation updateCaseStudy": "GraphQL update: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", + "graphql mutation updateCompany": "GraphQL update: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", "graphql mutation updateConsentRecord": "GraphQL update: nobody over the API (create/update false); delete: admin; visitors write through POST /api/ipal/consent", "graphql mutation updateCookieCrawl": "GraphQL update: admin; the crawl endpoints write it after their own checks", "graphql mutation updateCookieReview": "GraphQL update: create/update: editor+; delete: admin", "graphql mutation updateCookieSetting": "GraphQL update: editor+", - "graphql mutation updateFooter": "GraphQL update: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", + "graphql mutation updateFooter": "GraphQL update: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", "graphql mutation updateForm": "GraphQL update: editor+ (staffAccess)", - "graphql mutation updateFormSubmission": "GraphQL update: create: a staff account with its second factor (1.17.2; the site submits through submitForm); update: nobody (form-builder); delete: admin", - "graphql mutation updateHeader": "GraphQL update: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", - "graphql mutation updateMedia": "GraphQL update: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", + "graphql mutation updateFormSubmission": "GraphQL update: create: a staff account with its second factor (1.18.0; the site submits through submitForm); update: nobody (form-builder); delete: admin", + "graphql mutation updateHeader": "GraphQL update: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", + "graphql mutation updateMedia": "GraphQL update: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", "graphql mutation updateNotification": "GraphQL update: editor+", - "graphql mutation updatePage": "GraphQL update: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", + "graphql mutation updatePage": "GraphQL update: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", "graphql mutation updatePayloadKv": "GraphQL update: nobody (every rule false)", "graphql mutation updatePayloadLockedDocument": "GraphQL update: staff accounts with the second factor (iapl lockedDocuments, 1.18.0; set at start, Payload's default was any signed-in account)", "graphql mutation updatePayloadPreference": "GraphQL update: own preferences only (Payload)", - "graphql mutation updatePost": "GraphQL update: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)", + "graphql mutation updatePost": "GraphQL update: editor+ (adminOrEditor, the site's own rule since 1.18.0; Payload's default would let any signed-in account in)", "graphql mutation updateSiteIntegration": "GraphQL update: admin; secrets write-only", "graphql mutation updateSiteSetting": "GraphQL update: editor+", "graphql mutation updateUser": "GraphQL update: create/delete/unlock: an admin with the second factor; update: admin or self; roles field: admin", diff --git a/reference/e2e/sign-in-answers.spec.ts b/reference/e2e/sign-in-answers.spec.ts index c447529..70241e6 100644 --- a/reference/e2e/sign-in-answers.spec.ts +++ b/reference/e2e/sign-in-answers.spec.ts @@ -4,7 +4,7 @@ import { randomUUID } from 'node:crypto' import { totp } from './totp' /** - * On the BUILT site (pnpm e2e:built, webpack and Turbopack), what 1.17.2 changed at the sign-in and in the panel: + * On the BUILT site (pnpm e2e:built, webpack and Turbopack), what 1.18.0 changed at the sign-in and in the panel: * - a locked staff account answers its login exactly like a wrong password (accounts.lockedAnswer) — the hook * recognises Payload's error by the name Payload gives it, which a minified bundle must keep; * - the plugin's panel actions refuse a request from another origin (adminSameOrigin), the site's own still works. diff --git a/reference/e2e/smoke.spec.ts b/reference/e2e/smoke.spec.ts index 8b62f9e..33e6858 100644 --- a/reference/e2e/smoke.spec.ts +++ b/reference/e2e/smoke.spec.ts @@ -493,7 +493,7 @@ test('consent: withdrawal — reopen, reject: analytics cookies and listed stora expect((await consentRecord(context))!.state).toMatchObject({ analytics: false, functional: false, marketing: false }) }) -// The "cookie settings" button stays in the bottom corner of the window (1.17.2) and never moves: not above the +// The "cookie settings" button stays in the bottom corner of the window (1.18.0) and never moves: not above the // footer, not at the end of the page. The footer gets room under its last row while the button is shown, so the // button covers nothing there (consent.md → "Where the cookie button sits"). const BUTTON_PAGES = ['/pl', '/pl/kontakt', '/en', '/pl/blog', '/pl/regulamin'] diff --git a/scripts/e2e-built.mjs b/scripts/e2e-built.mjs index 351beee..3e444a8 100644 --- a/scripts/e2e-built.mjs +++ b/scripts/e2e-built.mjs @@ -17,7 +17,7 @@ * and e2e/sign-in-look.spec.ts (the sign-in panel in the first HTML, on a phone, the language links, the 2FA screen), * e2e/own-account.spec.ts (1.18.0: the account page asks for the current password; staff sign-in failures per place; * staff sign-in from another origin refused); - * e2e/sign-in-answers.spec.ts (1.17.2: a locked staff account answers like a wrong password; the panel actions refuse + * e2e/sign-in-answers.spec.ts (1.18.0: a locked staff account answers like a wrong password; the panel actions refuse * another origin), e2e/two-factor-enrolment.spec.ts (1.18.0: the first 2FA set-up waits for the e-mailed link, * read from the mail sink; the password alone no longer enrols a factor), e2e/attack-probes.spec.ts (security audit * 2026-12: the plugin's ATTACK_PROBES — secret files, bundle secrets, proxy bypass, open redirect, host-header and diff --git a/scripts/reference-index.mjs b/scripts/reference-index.mjs index 259859d..a20ec1f 100644 --- a/scripts/reference-index.mjs +++ b/scripts/reference-index.mjs @@ -78,7 +78,7 @@ export const DESCRIPTIONS = { 'e2e/mail-relay.spec.ts': 'the mail service on a built site: the state block in the panel, the first e-mail through the public confirm route, no token in anything the browser receives', 'e2e/smtp-sink.ts': 'a local mail sink for the smoke tests: reads what the site really sent (recipients, attachments)', 'e2e/own-account.spec.ts': 'built-site test (pnpm e2e:built, 1.18.0): the account page asks for the current password before a new e-mail is saved (accounts.confirmOwnChanges); five failed staff sign-ins from one place answer 429 there, not elsewhere (accounts.signInLimit); a staff sign-in from another origin gets 403 (accounts.signInSameOrigin)', - 'e2e/sign-in-answers.spec.ts': 'built-site test (pnpm e2e:built, 1.17.2): a locked staff account gets the wrong-password answer over REST and GraphQL (accounts.lockedAnswer); the plugin\'s panel actions refuse another origin and take the site\'s own (adminSameOrigin)', + 'e2e/sign-in-answers.spec.ts': 'built-site test (pnpm e2e:built, 1.18.0): a locked staff account gets the wrong-password answer over REST and GraphQL (accounts.lockedAnswer); the plugin\'s panel actions refuse another origin and take the site\'s own (adminSameOrigin)', 'e2e/sign-in-look.spec.ts': 'browser test of the sign-in look (whiteLabel.signIn): the panel comes with the form, sits above it on a phone in both themes, is on forgot / reset / logout too, the language links work, the 2FA code screen keeps its boxes (now named)', 'e2e/two-factor-back.spec.ts': 'browser test of the 2FA screens\' `back` link (twoFactor.safeBack): a prepared link — script or another host — ends on the admin root, an ordinary one is followed', 'e2e/routes.snapshot.json': 'every public route of the site (REST, GraphQL, Next route files) with one line saying who may use it and why — the judged list `routes:check` compares with', diff --git a/src/globals/CookieSettings/fields.ts b/src/globals/CookieSettings/fields.ts index 9fa0dd9..9f79861 100644 --- a/src/globals/CookieSettings/fields.ts +++ b/src/globals/CookieSettings/fields.ts @@ -7,7 +7,7 @@ import { rowLabel } from '../../modules/admin-ui/index.js' import { consentCategoryOptions } from '../../modules/consent/categoryLabels.js' /** - * Cookie settings → Consent version only goes up (1.17.2). A stored consent counts only under the version it was + * Cookie settings → Consent version only goes up (1.18.0). A stored consent counts only under the version it was * given for, so a LOWER number would make old consent cookies valid again — consent given under an older policy. * A save through access control (the panel, REST, GraphQL) with a lower number is refused with a message; the * Local API with `overrideAccess` (a script an admin runs) may still lower it. `iapl({ cookieSettings: @@ -25,7 +25,7 @@ export const policyVersionNeverDown: FieldHook = ({ global, originalDoc, overrid } export type CookieSettingsFieldOptions = { - /** `true` = an editor may lower the consent version, as before 1.17.2. Default false. */ + /** `true` = an editor may lower the consent version, as before 1.18.0. Default false. */ allowLowerPolicyVersion?: boolean } diff --git a/src/modules/access/access.ts b/src/modules/access/access.ts index 4f8b1ef..09d4cde 100644 --- a/src/modules/access/access.ts +++ b/src/modules/access/access.ts @@ -32,7 +32,7 @@ export const READ_PUBLISHED = Symbol.for('iapl.readPublished') * * For `read`. Version history (`readVersions`) asks for the status at another path (`version._status`): use * `readPublishedVersions()` there. Given to `readVersions` of a collection or global that iapl() sees, this rule - * is swapped for `readPublishedVersions()` with the same role (1.17.2; in 1.17.1 it answered 500 there). + * is swapped for `readPublishedVersions()` with the same role (1.18.0; in 1.17.1 it answered 500 there). * * access: { read: readPublished(), readVersions: readPublishedVersions() } */ diff --git a/src/modules/access/lockedAnswer.ts b/src/modules/access/lockedAnswer.ts index acae26a..2f425dd 100644 --- a/src/modules/access/lockedAnswer.ts +++ b/src/modules/access/lockedAnswer.ts @@ -5,7 +5,7 @@ import { AuthenticationError, formatNames, toWords } from 'payload' import { staffCollectionSlugs } from './predicates.js' /** - * A locked staff account answers its login exactly like a wrong password (`accounts.lockedAnswer`, 1.17.2). + * A locked staff account answers its login exactly like a wrong password (`accounts.lockedAnswer`, 1.18.0). * * Payload checks the lock BEFORE the password: after five wrong passwords for `owner@site` any password gets * `401 "This user is locked due to having too many failed login attempts."` (GraphQL: `LockedAuth`), while an diff --git a/src/modules/access/types.ts b/src/modules/access/types.ts index 0c682eb..5e965c1 100644 --- a/src/modules/access/types.ts +++ b/src/modules/access/types.ts @@ -59,7 +59,7 @@ export type AccountsOptions = { firstUserRoute?: 'all' | 'panel' | string[] /** * What a staff account that Payload has locked (too many wrong passwords) is told when it logs in. - * Default (1.17.2): exactly what a wrong password gets — same status, message and GraphQL error name — so + * Default (1.18.0): exactly what a wrong password gets — same status, message and GraphQL error name — so * nobody can find out which addresses have a staff account by locking them. The lock itself is unchanged. * `'wrong'` = the default, said out loud. `'payload'` = Payload's own "This user is locked due to having too many failed login attempts." */ diff --git a/src/modules/consent/CookieButton.tsx b/src/modules/consent/CookieButton.tsx index 9de8c4c..7c3824b 100644 --- a/src/modules/consent/CookieButton.tsx +++ b/src/modules/consent/CookieButton.tsx @@ -9,14 +9,14 @@ import { COOKIE_BUTTON_RESERVE, cookieButtonSpaceScript, reserveCookieButtonSpac import { consentDecidedScript } from './firstPaint.js' /** - * The site footer: the selector of the placement before 1.17.2, when the button moved up by the visible part of + * The site footer: the selector of the placement before 1.18.0, when the button moved up by the visible part of * the footer. `` brings that placement back. */ export const COOKIE_BUTTON_AVOID = 'footer, [role="contentinfo"]' export type CookieButtonProps = { /** - * Placement before 1.17.2: a CSS selector of elements the button lifts above while they are on screen + * Placement before 1.18.0: a CSS selector of elements the button lifts above while they are on screen * (`COOKIE_BUTTON_AVOID` = the site footer; no room is reserved then). Default: none — the button stays in the * bottom corner of the window and never moves. `false` = the same as the default (kept for sites that set it). */ @@ -40,10 +40,10 @@ export type CookieButtonProps = { * after deciding (GDPR: withdrawing consent must be as easy as giving it). * Hidden while the banner is showing. * - * Placement (1.17.2): fixed in the bottom corner of the window, on every page and at every scroll position. It + * Placement (1.18.0): fixed in the bottom corner of the window, on every page and at every scroll position. It * never moves — it does not climb above the footer any more. So that it covers nothing at the very end of a page, * the footer gets room under its last row while the button is shown (`reserve`, cookieButtonSpace.ts). The - * placement before 1.17.2 (riding on the footer's top edge): `avoid={COOKIE_BUTTON_AVOID}`. + * placement before 1.18.0 (riding on the footer's top edge): `avoid={COOKIE_BUTTON_AVOID}`. * * Colours follow the same design tokens as CookieBanner (--ipal-surface, * --ipal-border, --ipal-hover, --ipal-text). Position: --ipal-cookie-button-offset diff --git a/src/modules/consent/cookieButtonSpace.ts b/src/modules/consent/cookieButtonSpace.ts index bcf4993..eb5ad45 100644 --- a/src/modules/consent/cookieButtonSpace.ts +++ b/src/modules/consent/cookieButtonSpace.ts @@ -1,5 +1,5 @@ /** - * Room for the cookie button at the end of the page (1.17.2). + * Room for the cookie button at the end of the page (1.18.0). * * The button is fixed in the bottom corner of the window and never moves. At the very end of a page whatever is in * that corner — usually the footer's last row — would stay under it for good. So while the button is shown, the diff --git a/src/modules/doctor/rules/security.ts b/src/modules/doctor/rules/security.ts index 8430866..ef6b6fe 100644 --- a/src/modules/doctor/rules/security.ts +++ b/src/modules/doctor/rules/security.ts @@ -231,7 +231,7 @@ export const securityRules: DoctorRule[] = [ { // Payload accepts the login cookie from ANY origin while its `csrf` list is empty — and it is empty // unless `csrf` or `serverURL` is set. A page on a sibling subdomain can then act with a panel user's cookie. - // The plugin's own-origin checks (2FA verify / setup / reset, the panel actions — 1.17.2) then know the site + // The plugin's own-origin checks (2FA verify / setup / reset, the panel actions — 1.18.0) then know the site // only from the request's Host: behind a proxy that rewrites it, the site's own panel would be refused. id: 'csrf-empty', check: (ctx) => { @@ -264,7 +264,7 @@ export const securityRules: DoctorRule[] = [ }, { // An account of a visitor login collection (customers, members) may write content or settings: Payload fills a - // missing rule with "any signed-in account", and the plugin narrows only its own entities (owner's Q3, 1.17.2). + // missing rule with "any signed-in account", and the plugin narrows only its own entities (owner's Q3, 1.18.0). id: 'visitor-writes', check: (ctx) => { const byEntity = new Map() diff --git a/src/modules/doctor/types.ts b/src/modules/doctor/types.ts index 0e69f13..62c79ae 100644 --- a/src/modules/doctor/types.ts +++ b/src/modules/doctor/types.ts @@ -109,7 +109,7 @@ export type DoctorStatus = { /** Auth collections whose `create` rule lets an anonymous request through (slugs only). */ openSignUp?: null | string[] /** - * The running config has a `serverURL` (1.17.2), or a non-empty `csrf` list. Without either Payload takes the + * The running config has a `serverURL` (1.18.0), or a non-empty `csrf` list. Without either Payload takes the * login cookie from any origin, and the plugin's own-origin checks know the site only from the request's host. */ originKnown?: boolean diff --git a/src/modules/forms/formsPluginConfig.ts b/src/modules/forms/formsPluginConfig.ts index 6299ec4..88d4fd3 100644 --- a/src/modules/forms/formsPluginConfig.ts +++ b/src/modules/forms/formsPluginConfig.ts @@ -164,7 +164,7 @@ const withHint = (key: 'email' | 'number' | 'text' | 'textarea') => withShowWhen /** * REST/GraphQL: a staff account (any role) with its second factor. Local API (submitForm) is unaffected. Before - * 1.17.2 any signed-in account was enough — a customer of a visitor login collection could POST + * 1.18.0 any signed-in account was enough — a customer of a visitor login collection could POST * /api/form-submissions past the rate limit, Turnstile, consent and validation, and the form's e-mails went out. * `formSubmissionOverrides.access.create` is the way back. */ diff --git a/src/modules/security/adminSameOrigin.ts b/src/modules/security/adminSameOrigin.ts index b166893..ccfcfbe 100644 --- a/src/modules/security/adminSameOrigin.ts +++ b/src/modules/security/adminSameOrigin.ts @@ -7,7 +7,7 @@ import { RELAY_CONNECT_LINK_PATH, RELAY_CONNECT_PATH, RELAY_DISCONNECT_PATH } fr import { reportRefusedOrigin, requestFromOwnOrigin } from './totp/sameOrigin.js' /** - * The plugin's panel actions only from the site's own origin (`adminSameOrigin`, 1.17.2; IAWL idea 7, owner's Q6). + * The plugin's panel actions only from the site's own origin (`adminSameOrigin`, 1.18.0; IAWL idea 7, owner's Q6). * * These endpoints act with the panel's login cookie and read a body whatever its `Content-Type` says — a * `text/plain` POST, which another origin can send without a CORS preflight. A page on a sibling subdomain is diff --git a/src/modules/security/jobsAccess.ts b/src/modules/security/jobsAccess.ts index cbb0524..fae83df 100644 --- a/src/modules/security/jobsAccess.ts +++ b/src/modules/security/jobsAccess.ts @@ -7,7 +7,7 @@ import { userMeetsRole } from '../access/predicates.js' /** * Who may run Payload's job queue over HTTP (`GET /api/payload-jobs/run`, `/api/payload-jobs/handle-schedules`, * both checked by `jobs.access.run`). Payload's own default is any signed-in account of ANY auth collection — a - * customer of a shop included (IAWL idea 35: a route open to the web is a visitor, not the system). Since 1.17.2, + * customer of a shop included (IAWL idea 35: a route open to the web is a visitor, not the system). Since 1.18.0, * when the project writes no `jobs.access.run`, iapl sets: an admin signed in with the second factor (an admin's API * key counts), or `Authorization: Bearer `. A project's own rule always wins; `jobsRunAccess: false` * keeps Payload's default. Jobs run in-process (`jobs.autoRun`, `payload jobs:run`, `payload.jobs.run()`) never @@ -71,7 +71,7 @@ export function jobsRunNotice(config: { custom?: unknown; jobs?: { enabled?: boo if (secret.length >= CRON_SECRET_MIN_LENGTH) {return null} return ( `[iapl] Payload's job queue runs over HTTP (/api/payload-jobs/run, /handle-schedules) only for an admin signed in with the second factor ` + - `or with "Authorization: Bearer <${secretVar}>" (1.17.2), and ${secretVar} is ${secret ? `shorter than ${CRON_SECRET_MIN_LENGTH} characters` : 'not set'}. ` + + `or with "Authorization: Bearer <${secretVar}>" (1.18.0), and ${secretVar} is ${secret ? `shorter than ${CRON_SECRET_MIN_LENGTH} characters` : 'not set'}. ` + `A cron that calls the run route: set ${secretVar} and send the header. In-process runs (jobs.autoRun, payload jobs:run) are not affected. ` + 'Your own jobs.access.run wins; iapl({ jobsRunAccess: false }) keeps Payload\'s default (docs/security.md "Payload\'s job queue").' ) diff --git a/src/modules/shared/rateLimit.ts b/src/modules/shared/rateLimit.ts index 353c772..ad5c716 100644 --- a/src/modules/shared/rateLimit.ts +++ b/src/modules/shared/rateLimit.ts @@ -95,7 +95,7 @@ export function setUnknownIpFactor(factor: number): void { } /** - * IPv6 is counted per network, not per address (1.17.2, IAWL idea 9). A host with IPv6 gets a whole /64 + * IPv6 is counted per network, not per address (1.18.0, IAWL idea 9). A host with IPv6 gets a whole /64 * (2^64 addresses) — every home connection and every server does — so counting per address gave one visitor * as many budgets as it has addresses. Every limiter of the plugin (forms, search, MCP, consent log, stats, * doctor, the mail service's confirm route and account-mail limit) counts a /64 as one client. One home network @@ -105,7 +105,7 @@ export function setUnknownIpFactor(factor: number): void { * customer often holds a /48 (65,536 /64s). Off by default — mobile carriers can put many phones in one /48. */ export type Ipv6Grouping = { - /** Prefix length one client is counted by. Default 64; 128 = per address (as before 1.17.2). 1–128. */ + /** Prefix length one client is counted by. Default 64; 128 = per address (as before 1.18.0). 1–128. */ prefix?: number /** A second counter per this wider prefix (e.g. 48), at `wideFactor` × the limit. Default: none. */ wide?: false | number diff --git a/src/modules/shared/switches.ts b/src/modules/shared/switches.ts index 774eaeb..66049d5 100644 --- a/src/modules/shared/switches.ts +++ b/src/modules/shared/switches.ts @@ -50,7 +50,7 @@ export function assertPluginSwitches(options: Record): void { // `accounts: 0` / `''` dropped every account rule (staff-only reads, admin-only writes, the panel role, // the password rule, the closed first-user route). assertSwitchOrObject('accounts', options.accounts, { allowTrue: false }) - // 1.17.2: only 'payload' brings Payload's "locked" answer back (it tells which addresses have an account). + // 1.18.0: only 'payload' brings Payload's "locked" answer back (it tells which addresses have an account). // 1.18.0: the sign-in rules. `signInLimit: 0` / `'false'` must not read as off; a limit of 0 never refuses. const accounts = bag(options.accounts) if (accounts) { @@ -93,7 +93,7 @@ export function assertPluginSwitches(options: Record): void { assertBooleanSwitch('refuseOperatorSort', options.refuseOperatorSort) assertSwitchOrObject('lockedDocuments', options.lockedDocuments, { allowTrue: false }) assertBooleanSwitch('strictAccessAnswers', options.strictAccessAnswers) - // 1.17.2: `adminSameOrigin: 0` / `'false'` must not read as off (it took the origin check off the panel actions) + // 1.18.0: `adminSameOrigin: 0` / `'false'` must not read as off (it took the origin check off the panel actions) assertSwitchOrObject('adminSameOrigin', options.adminSameOrigin) const adminSameOrigin = bag(options.adminSameOrigin) if (adminSameOrigin && adminSameOrigin.origins !== undefined && !(Array.isArray(adminSameOrigin.origins) && adminSameOrigin.origins.every((o) => typeof o === 'string'))) { diff --git a/src/types.ts b/src/types.ts index 3c347c1..ffb0efb 100644 --- a/src/types.ts +++ b/src/types.ts @@ -76,8 +76,8 @@ export type IaplOptions = { /** * The plugin's panel actions — `POST` mail service connect / disconnect, test e-mail, cookie scan, cookie * approval, cookie crawl — refuse (`403`) a request a browser marks as coming from another origin, before - * anything is read (1.17.2). Own origins: the request's host (`Host`, `X-Forwarded-Host`), `serverURL`, - * Payload's `csrf` and `cors` lists, and `origins` here. `false` = no check (as before 1.17.2). + * anything is read (1.18.0). Own origins: the request's host (`Host`, `X-Forwarded-Host`), `serverURL`, + * Payload's `csrf` and `cors` lists, and `origins` here. `false` = no check (as before 1.18.0). * The 2FA endpoints follow `twoFactor.sameOrigin`. docs/security.md "Panel actions only from the site's own origin". */ adminSameOrigin?: AdminSameOriginOption @@ -133,7 +133,7 @@ export type IaplOptions = { /** * Cookie settings (the global). `allowLowerPolicyVersion: true` lets an editor LOWER the consent version, as - * before 1.17.2 — a lower number makes consent given under an older policy valid again, so by default a save + * before 1.18.0 — a lower number makes consent given under an older policy valid again, so by default a save * through access control with a lower number is refused (the Local API with `overrideAccess` may still). */ cookieSettings?: { allowLowerPolicyVersion?: boolean } @@ -221,7 +221,7 @@ export type IaplOptions = { /** * Who may run Payload's job queue over HTTP (`/api/payload-jobs/run`, `/handle-schedules`) when the project * writes no `jobs.access.run` of its own: an admin signed in with the second factor (an admin's API key counts), or - * `Authorization: Bearer ` (16+ characters). Default on since 1.17.2; `secretVar` names another + * `Authorization: Bearer ` (16+ characters). Default on since 1.18.0; `secretVar` names another * variable; `false` keeps Payload's default (any signed-in account of any auth collection). A project's own * `jobs.access.run` always wins. In-process runs (`jobs.autoRun`, `payload jobs:run`) are not affected. * docs/security.md "Payload's job queue". diff --git a/test/accessControl.test.ts b/test/accessControl.test.ts index 76da3e5..f47e3b8 100644 --- a/test/accessControl.test.ts +++ b/test/accessControl.test.ts @@ -159,7 +159,7 @@ describe('forms collection: public read, editor+ write, Emails hidden from plain }) }) -describe('form submissions over REST / GraphQL: staff only (1.17.2)', () => { +describe('form submissions over REST / GraphQL: staff only (1.18.0)', () => { const build = async (forms: object = {}) => { const config = await iapl({ access: { authCollection: 'users' }, forms, i18n, twoFactor: false })( empty({ collections: [{ slug: 'customers', auth: true, fields: [] }] }), diff --git a/test/adminSameOriginOff.test.ts b/test/adminSameOriginOff.test.ts index d743d17..8b81ef9 100644 --- a/test/adminSameOriginOff.test.ts +++ b/test/adminSameOriginOff.test.ts @@ -10,7 +10,7 @@ vi.mock('next/headers.js', async () => (await import('./http/server.js')).nextHe const { action } = adminSite(false) describe('adminSameOrigin: false', () => { - test('a request from a sibling subdomain reaches the action, as before 1.17.2', async () => { + test('a request from a sibling subdomain reaches the action, as before 1.18.0', async () => { expect((await action('/ipal/cookie-approval', SIBLING, '{"ids":[]}')).status).toBe(200) }) diff --git a/test/adminSameOriginSuite.ts b/test/adminSameOriginSuite.ts index 7cd0262..b93bf65 100644 --- a/test/adminSameOriginSuite.ts +++ b/test/adminSameOriginSuite.ts @@ -1,5 +1,5 @@ /** - * The plugin's panel actions only from the site's own origin (adminSameOrigin, 1.17.2). Shared by + * The plugin's panel actions only from the site's own origin (adminSameOrigin, 1.18.0). Shared by * adminSameOrigin.test.ts (default) and adminSameOriginOff.test.ts (`adminSameOrigin: false`): one Payload per file. * A signed-in administrator's cookie rides on a `text/plain` POST (no CORS preflight) from a page on a sibling * subdomain. Database: SQLite in memory, or IPAL_TEST_POSTGRES_URI / IPAL_TEST_MONGO_URI (test/http/db.ts). diff --git a/test/consentFirstPaint.test.ts b/test/consentFirstPaint.test.ts index 3f51930..00ff7fe 100644 --- a/test/consentFirstPaint.test.ts +++ b/test/consentFirstPaint.test.ts @@ -444,7 +444,7 @@ describe('tags: nothing earlier than before', () => { const pixels = { clarityProjectId: 'clar', consentMode: 'basic', gtmContainerId: 'GTM-TEST', metaPixelId: '123' } const layer = () => [...((window.dataLayer ?? []))].map((entry) => (Object.prototype.toString.call(entry) === '[object Arguments]' ? Array.from(entry as ArrayLike) : entry)) - test("the server HTML holds two scripts, the banner's and the cookie button's (1.17.2), and neither names a tag", () => { + test("the server HTML holds two scripts, the banner's and the cookie button's (1.18.0), and neither names a tag", () => { const html = renderToString(tree({ analytics: pixels })) expect(html.match(/]*data-ipal="(?:banner|cookie-button)-script"/g)).toHaveLength(2) expect(html.match(/