Compare commits

..
71 Commits
Author SHA1 Message Date
Radosław SmolińskiandClaude Opus 5.5 e436534190 1.18.0 notes: the changelog's link to consent.md follows the heading's new version
CI / check (push) Failing after 8m19s
CI / reference (push) Skipped
CI / reference-full (push) Skipped
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-02 10:08:27 +01:00
Radosław SmolińskiandClaude Opus 5.5 9b83cc600a 1.18.0 upgrade notes
PROGRAMISTA §6 rows 83–87 now 1.18.0 (1.17.2 was never released alone) and new rows 88–94; iapl-upgrade blocks for
speed and growth and for drafts in related documents, the 1.17.2 blocks as "→ 1.18.0 (from 1.17.2)"; every "since
1.17.2" in docs, comments and tests reads 1.18.0; reference skills, AGENTS.md and the reference index on 1.18.0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-02 09:38:00 +01:00
Radosław SmolińskiandClaude Opus 5.5 af98cfba96 1.18.0
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-02 09:36:13 +01:00
Radosław SmolińskiandClaude Opus 5.5 b9bcd55ac4 Audit clean with dev tooling: overrides for esbuild (<0.25, via drizzle-kit), eslint (<9.39.4, @eslint/plugin-kit) and minimatch (7–11.0.7, via typescript-eslint); security:gate fails on moderate and above in the production tree and the dev tooling (--audit-level, --prod-only to loosen); doctor transitive-min warns on esbuild for Postgres sites; AGENT.md §4 item 12, skills, security.md, changelog
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-02 00:41:46 +01:00
Radosław SmolińskiandClaude Opus 5.5 f38a8cc677 Overrides for two advisories published 2026-12-01: ws below 8.23.0 (GHSA-37g9-w4hg-h9qr, high, via payload) and cross-spawn below 7.1.0 (GHSA-ghv9-86vm-4v8m, critical, Windows only, via cross-env / eslint) in the plugin and the reference site (and so the starter); doctor transitive-min, AGENT.md §4 item 12, setup and upgrade skills, changelog
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 23:54:52 +01:00
Radosław SmolińskiandClaude Opus 5.5 713b28e79f Changelog: connect-link only from the site's own origin
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 23:00:59 +01:00
Radosław SmolińskiandClaude Opus 5.5 be30812423 connect-link ("Połącz z IWSN") is a panel action: only from the site's own origin (adminSameOrigin), like connect and disconnect
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 23:00:52 +01:00
Radosław SmolińskiandClaude Opus 5.5 9ca563e2af Merge claude/iwsn-connect: "Połącz z IWSN" — the IAPL side of IWSN contract 1.8.0 (connect)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 23:00:26 +01:00
Radosław SmolińskiandClaude Opus 5.5 68fb8fc8f3 Routes snapshot: the new admin route connect-link is judged; a test comment names the database variables in full
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 22:01:54 +01:00
Radosław SmolińskiandClaude Opus 5.5 25af43442e Real-service test: the connect flow against IWSN's code at IWDL de560ef (policy connect) — wait, link, confirm on the stand-in's page, active, send
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 21:44:19 +01:00
Radosław SmolińskiandClaude Opus 5.5 2c0262367d IWSN: "Połącz z IWSN" — a person of Intecion connects the site (contract 1.8.0)
- the state block on the e-mail tab (method IWSN): the button while the service offers the confirmation page
  (connectAvailable) or before the site has enrolled; a click asks the site's server for the link
  (POST /api/iapl/mail-relay/connect-link, admin only), which asks the service (POST /v1/connect, enrolling first),
  checks that it begins with the service's own {base}/connect?, and hands it over without storing or logging it;
  the browser opens it in a new tab with noopener noreferrer; the block asks /v1/status every 5 s for 10 min
- states: waiting for confirmation (button), waiting for approval (no page), connected, stopped; 503
  connect-unavailable and 429 said in the admin's language; a load of the panel asks the service while the site waits
- dashboard alert for a waiting site (live); doctor mail-relay-connect (error) — replaces the pending warning and the
  "not enrolled yet" note of mail-relay-state
- opt-out mail.relay.connectButton: false (no button, no route); building blocks requestRelayConnectLink,
  isRelayConnectUrl, RELAY_CONNECT_LINK_PATH; the fake service implements /v1/connect, connectAvailable and
  confirmConnect
- contract copy 1.8.0 (IWDL working tree, checksums match); docs, AGENT.md, setup / upgrade / debug skills, changelog

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 21:42:23 +01:00
Radosław SmolińskiandClaude Opus 5.5 347e3bafa1 Minimum safe Next.js 16.4.6 (owner's decision): doctor next-min, AGENT.md §4 item 11, doctor.md, setup and upgrade skills, changelog; O1 settled — Next 16.4.6's React copy carries the GHSA-xqc2-xf4c-x3h3 fix (checked in the code)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 20:57:47 +01:00
Radosław SmolińskiandClaude Opus 5.5 dcf820b365 F3 docs: HTML pages keep Next's own Vary and their ISR caching (measured on the built reference site, both bundlers); the private, no-store Markdown answer is what closes F3
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 18:01:21 +01:00
Radosław SmolińskiandClaude Opus 5.5 631c583fa3 Lint: queryGuardHttp test config keys in order
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 17:47:56 +01:00
Radosław SmolińskiandClaude Opus 5.5 2af8ef180f List cap (F4): a server read with overrideAccess: true that passes a request on is not capped (the cookie scanner's scheduled crawl read its review list through the token request); reference types without the e2e fixtures; changelog heading covers all of 1.18.0
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 17:22:10 +01:00
Radosław SmolińskiandClaude Opus 5.5 e23edb2429 Merge claude/security-audit-1180-fixes: security audit fixes F1–F5, document locks for staff, strict access callbacks, the security suites and gate
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 17:20:40 +01:00
Radosław SmolińskiandClaude Opus 5.5 c6bfb621f5 Access callbacks allow only on a literal true (owner's decision for 1.18.0), strictAccessAnswers: false for the old reading; the new 1.18.0 security options checked strictly at start; docs, skills, changelog
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 17:07:04 +01:00
Radosław SmolińskiandClaude Opus 5.5 d90825a396 Security audit fixes: the document-locks door closed for customers, route reasons for the staff-only locks
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 17:03:56 +01:00
Radosław SmolińskiandClaude Opus 5.5 e5964d4e05 Security audit fixes: docs (security.md, content.md, i18n.md, AGENT.md, skills), changelog, static-rule judgments for the merged doctor and 2FA code, hook mark for the account-rule tests
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 17:02:20 +01:00
Radosław SmolińskiandClaude Opus 5.5 e9f9947eb7 Security audit fixes for 1.18.0: Markdown negotiation private + Vary: Accept (F3), public lists capped (F4), operator sort names refused (F5), CSP report log normalised and capped (F1), buildUrlField and the reference socials (F2), document locks for staff only
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 16:56:09 +01:00
Radosław SmolińskiandClaude Opus 5.5 d2f19095dc Security suites from the 2026-12 audit: static rules, attack probes, per-class tests, gate
- doctor: code-patterns (unescaped HTML/JSON-LD, eval, shell, NEXT_PUBLIC_ secrets,
  overrideAccess / Local API user, where from the request, redirects and fetches to a
  request address) and config-dangerous; live-probes runs the safe attack probes on --url
- ATTACK_PROBES / runAttackProbes / createProbeContext exported from /doctor; the reference
  site runs all of them in pnpm e2e:built (both bundlers) plus CSRF and cookie flags;
  project template iapl-audit/resources/attack-probes.spec.template.ts
- test/securityPatterns.test.ts gates every hit against test/security-patterns.allow.json;
  test/securityClasses.test.ts covers XSS, redirects, pollution, logs, DoS, cache poisoning
- pnpm security:gate (pnpm audit --prod, the two suites, optional offline ZAP) in prepublishOnly
- audit findings F1, F3, F4, F5 reproduced as expected-to-fail tests/probes; no fix built
- docs: security.md threat list + Security suites, doctor.md, AGENT.md, CHANGELOG, skills

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 16:46:42 +01:00
Radosław SmolińskiandClaude Opus 5.5 a416411f01 legacy:site accepts only the performance errors the unedited 1.16.7 site meets (perf-budgets); changelog: /client helpers are plain values in server components, iaplTtlFrom in MongoDB types
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 16:45:07 +01:00
Radosław SmolińskiandClaude Opus 5.5 c9285f0349 Merge claude/performance-1180-items: the owner's performance decisions for 1.18.0 (lazy form and Turnstile with /client/eager, metadata stripped on upload, MongoDB TTL indexes, version limit, unused-media notice, performance rules as errors)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 16:20:07 +01:00
Radosław SmolińskiandClaude Opus 5.5 8cf5a58045 Doctor: the performance rules are errors (owner's decision for 1.18.0); lowered or silenced per rule in iapl-doctor.json; growth stays warnings; audit reports them as errors; legacy:site lists perf-* errors an old site meets; docs, skills, changelog; reference skills refreshed
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 16:10:23 +01:00
Radosław SmolińskiandClaude Opus 5.5 f0127ac1b8 1.18.0 performance items: tests, the reference budget gate tightened (JS 195 kB, 404 without its exception, TTL check), docs (performance.md, AGENT.md, iapl-performance, module pages, api.md), changelog: what changes for an existing site
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 15:54:15 +01:00
Radosław SmolińskiandClaude Opus 5.5 d628839235 1.18.0 performance items: reference 404 placeholder and heading font without preload, lazy form and Turnstile code (eager entry /client/eager), Turnstile space kept, background video paused for reduced motion, card hover on opacity, metadata stripped on upload, MongoDB TTL indexes for the consent log and statistics, unused-media notice, version limit for the plugin's entities
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 15:38:38 +01:00
Radosław SmolińskiandClaude Opus 5.5 076b3ef707 Merge claude/performance-2026-12-36a376: fewer queries per render, no 'use client' on the /client barrels, budgets, the doctor's performance and growth groups
Conflicts kept both sides: the doctor status (twoFactorConfirm with growth and media), its key test, e2e:built (the 2FA
enrolment spec and the performance budgets), the reference index (regenerated). Reference skill copies synced
(iapl-performance added, iapl-audit and iapl-reference updated).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 14:58:44 +01:00
Radosław SmolińskiandClaude Opus 5.5 350e3147cf Merge claude/2fa-enrolment-email-confirm: the first two-step set-up is confirmed by e-mail (twoFactor.confirmByEmail, security audit F0)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 14:57:55 +01:00
Radosław SmolińskiandClaude Opus 5.5 8991867e01 What grows: the doctor's growth group (sizes, versions, retention, submissions, KV, unused media, disk) with thresholds, expired mail-service nonces swept, opt-in forms.submissionRetentionDays, docs
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 14:48:35 +01:00
Radosław SmolińskiandClaude Opus 5.5 6b16b9f933 perf-budgets reports only for a project that runs Playwright (a new starter site has no e2e yet)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 14:29:17 +01:00
Radosław SmolińskiandClaude Opus 5.5 3b32e659c5 Budget gate: Next's idle link prefetches counted apart, third parties recorded then aborted, spec filter safe for any checkout path; zero counted queries fail
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 14:19:26 +01:00
Radosław SmolińskiandClaude Opus 5.5 beef517c23 Tests: the lightbox viewer's first open waits for its chunk; reference index lists the performance spec and the lab helper
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 14:07:07 +01:00
Radosław SmolińskiandClaude Opus 5.5 9bac7e7bf0 Performance review: final numbers for both bundlers, memory measured on its own, the font decision measured
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 14:04:45 +01:00
Radosław SmolińskiandClaude Opus 5.5 45c6dcd968 e2e:built runs the performance budgets with both bundlers; Turbopack numbers after
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 13:53:57 +01:00
Radosław SmolińskiandClaude Opus 5.5 c6c5dfbcbf Docs: performance.md, the iapl-performance skill, AGENT.md 6.11b, doctor.md, audit, api.md, the measurements and the audit
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 13:51:43 +01:00
Radosław SmolińskiandClaude Opus 5.5 801b897ea0 Budgets and checks: PERF_BUDGETS / perfBudgets / overBudget, the reference gate (both bundlers), the doctor's performance group (static, live, deep)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 13:51:43 +01:00
Radosław SmolińskiandClaude Opus 5.5 21073d98d0 Client: no 'use client' on barrels, lazy lightbox viewer, rAF table of contents, Turnstile polling stops, reduced motion, Media eager, 404 placeholder option
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 13:51:39 +01:00
Radosław SmolińskiandClaude Opus 5.5 1d6108765c Fewer queries per render: resolveRoute and page metadata cached by value, select for slug-only reads, one Site integrations read
Home 43 -> 24 MongoDB queries per render, other pages -36 to -44 %.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 13:51:39 +01:00
Radosław SmolińskiandClaude Opus 5.5 f3be77b2bc Performance measurement: pnpm perf:measure and the lab helper (phone/desktop, vitals, bytes, queries per render)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 13:51:39 +01:00
Radosław SmolińskiandClaude Opus 5.5 c9d1f4b340 2FA: the first set-up is confirmed by e-mail (twoFactor.confirmByEmail, 1.18.0)
Security audit 2026-12, F0: inside an account's setup window its password alone
enrolled an authenticator of the caller's choosing; the owner was locked out.

- /setup-totp for an account without a factor: IAPL checks the code, keeps the
  secret pending (payload-kv), mails a single-use 30-min link to the account and
  ties it to the enrolling browser; the package's handler (and its -totp cookie)
  is never used for a first enrolment
- GET /api/iapl/two-factor/confirm = a page with one button; POST confirms
  (own origin, same browser), ends the account's sessions, signs nobody in
- notice mails on every enrolment, change, removal / reset (any path)
- mail not working: link to the server log, admin confirms on the account page
  (POST /api/iapl/two-factor/confirm-pending), doctor rule 2fa-enrolment-mail
- options and opt-out (confirmByEmail: false), building blocks exported
- tests: HTTP suite on SQLite, MongoDB, Postgres; built-site spec in e2e:built;
  closed doors and judged routes; docs, AGENT.md, skills, changelog

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 13:37:39 +01:00
Radosław SmolińskiandClaude Opus 5.5 2bf8502aae Reference site: import map regenerated (MaskedField moved by currentPassword), skill copies synced after the 1.18.0 merges
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 13:20:16 +01:00
Radosław SmolińskiandClaude Opus 5.5 84717804ae legacy:site: the same import-map entries in another order pass, and the old site is then built with its committed map
Payload writes import-map entries in the order it meets them; 1.18.0's currentPassword field moves MaskedField three
lines up. A new or a missing entry still fails. The typecheck and both builds run with the map the old site has,
which proves an unedited site works without generate:importmap (the 1.18.0 notes say so).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 13:03:32 +01:00
Radosław SmolińskiandClaude Opus 5.5 1ba191e580 Merge claude/security-a-118: a stranger cannot lock a staff account, staff sign-in only from the site's own origin, own e-mail and password changes ask for the current password
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 13:03:26 +01:00
Radosław SmolińskiandClaude Opus 5.5 8888a38c10 Lint: lockedAnswer suite after the merge
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 12:58:02 +01:00
Radosław SmolińskiandClaude Opus 5.5 1bc0ebca63 Merge local main (1.17.2) into security-a-118
Conflicts resolved by keeping both sides: lockedAnswer + sign-in rules in plugin.ts and switches.ts, IPv6 grouping in the
mail service's new per-visitor address count, both built-site specs in e2e:built, docs and skills (reference copies
synced). The lockedAnswer suite and the sign-in-answers spec now reach Payload's lock the 1.18.0 way: a spray from
50 IPs, one failure each (one IP alone gets 429 after five).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 12:57:52 +01:00
Radosław SmolińskiandClaude Opus 5.5 23215d91a8 Merge claude/security-b-118: plugin status written alone, access answers announced (strict in 1.19.0), drafts left out of related documents
Merged onto ee241de (the prepared 1.17.2). Conflicts kept both sides: AGENT.md rows (consent version; drafts, status, access answers), security.md sections (job queue, visitor accounts; access callbacks), src/index.ts (the jobs exports).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 12:53:59 +01:00
Radosław SmolińskiandClaude Opus 5.5 ee241deee0 1.17.2 upgrade notes
PROGRAMISTA §6 rows 84–87 (version history, sign-in and panel actions, REST submissions and jobs, consent version);
iapl-upgrade "→ 1.17.2, security"; reference skills, AGENTS.md and the reference index on 1.17.2.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 12:11:56 +01:00
Radosław SmolińskiandClaude Opus 5.5 0709141cae 1.17.2
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 12:11:56 +01:00
Radosław SmolińskiandClaude Opus 5.5 0dffd377a7 Merge claude/cookie-button-bottom: the cookie button never moves; the footer keeps room under its last row (owner's option 3)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 12:08:57 +01:00
Radosław SmolińskiandClaude Fable 5.2 3821174be4 Cookie button never moves; the footer gets room under its last row while the button is shown
Owner, 2026-12-01, after the review of fb92b35: option 3, "miejsce pod stopką" — the button stays in its corner at
all times and covers nothing; the page gets room under its last row.

- Removed: the step up at the end of the page (`clear`, COOKIE_BUTTON_CLEAR, stepAbove; never released).
- New: while the button is shown, the last footer (`reserve`, COOKIE_BUTTON_RESERVE; no footer: <body>) gets bottom
  padding, measured: button height + offset + safe area + 8 px, minus what is already free under the lowest text or
  control in the button's column. The footer's own padding counts (no double space); an empty corner gets nothing.
  Not before a decision, not while the banner is open, gone with the button; `reserve={false}` turns it off,
  `--ipal-cookie-button-space` on the footer sets the amount (0 = none, per breakpoint).
- No layout shift: on a static page <CookieButton> renders an inline script that makes the room before the first
  paint for a visitor who already decided — in a constructed style sheet, so the server's markup is untouched and
  React hydrates without a mismatch; after hydration the same function moves it onto the element.
- consentDecidedScript: the shared start of the banner's and the button's pre-paint scripts.
- avoid={COOKIE_BUTTON_AVOID} is still the placement before 1.17.2 (no room then).

Tests: test/cookieButtonPlacement.test.ts rewritten (24); reference e2e on desktop, 390 px and 360 px phones, light
and dark, five pages: the corner at every scroll position, nothing under the button at the very end, every footer
link clickable, layout shift < 0.001, the room before hydration.
Docs: consent.md, AGENT.md, skills, PROGRAMISTA item 83, changelog draft 1.17.2.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
2026-12-01 12:08:00 +01:00
Radosław SmolińskiandClaude Opus 5.5 9ac56bc794 Docs: SIGN_IN_RULES_MARK; reference types with the field's description
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 11:25:25 +01:00
Radosław SmolińskiandClaude Opus 5.5 7fca1a5883 Reference site: generated types with the virtual currentPassword field (1.18.0)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 11:18:28 +01:00
Radosław SmolińskiandClaude Opus 5.5 420fe40442 Sign-in rules: tests that change their own password send the current one; field labels en/pl; the hook carries a mark
Tests and the late-staff built-site spec that change an account's OWN
password now send currentPassword (the 1.18.0 rule). The Current password
field's label and description are plain { en, pl } (house style checked by
the wording test). The beforeOperation hook carries SIGN_IN_RULES_MARK so
the password-rule hook counts stay what they measure. The injected users
collection carries Payload's lock defaults (50, 1 h).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 11:18:21 +01:00
Radosław SmolińskiandClaude Opus 5.5 66afd5ea43 Merge claude/cookie-button-bottom: the cookie button stays in the bottom corner of the window
Conflicts in the 1.17.2 changelog draft and the upgrade skill: both sides kept (rewritten into one entry at release).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 11:17:59 +01:00
Radosław SmolińskiandClaude Opus 5.5 07ad2bde60 Merge claude/security-b-1172: the consent version only goes up
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 11:17:51 +01:00
Radosław SmolińskiandClaude Opus 5.5 529a766fb1 Merge claude/security-c-1172: form submissions over REST only for staff, the job queue for an admin or Bearer CRON_SECRET, doctor visitor-writes
Conflicts with security-a-1172 kept both sides: imports (adminSameOrigin, jobsAccess), the doctor status (originKnown and visitorWrites), its test, and the e2e:built line (A's sign-in answers spec with C's CRON_SECRET).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 11:17:51 +01:00
Radosław SmolińskiandClaude Opus 5.5 21ef0fdeb0 1.18.0 (owner's decisions Q3, Q4, Q5): writes that keep others' saves, access answers announced, drafts out of related documents
- Q3: the integration status (emailStatus, turnstileStatus) is written alone through the
  database adapter (writeGlobalFields, exported): a visitor's form submit no longer puts back an
  admin's SMTP or Turnstile change saved at the same moment. addToCookieList reads the list again
  right before writing and works the change out again when an editor's save changed it (up to 5
  times). Both races reproduced exactly in test/statusWrites.test.ts, on the three adapters.
- Q4: cookieScanner.access and the doctor's access go through accessAllowed: any truthy answer
  still allows, an answer that is not a boolean is reported once per option; strict (only true)
  is announced for 1.19.0.
- Q5: related documents that are drafts are left out of what the public helpers answer
  (resolveRoute, getSettings, getArchiveEntries, the 404 page, llms-full; Markdown and MCP through
  resolveRoute): null alone, removed from a list, value null in a polymorphic one. A preview keeps
  them; draftRelations: 'keep' keeps the old behaviour. withoutDraftRelations,
  applyDraftRelations exported.
- Docs: content.md, frontend.md, integrations.md, cookie-scanner.md, security.md, AGENT.md;
  iapl-nav and iapl-doctor skills.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 11:15:13 +01:00
Radosław SmolińskiandClaude Opus 5.5 52710021ef Staff sign-in rules: failures per IP and address, own origin, current password for own changes (1.18.0)
Q2 (IAWL idea 16): Payload locks a staff account after 5 wrong passwords
from anybody, so a stranger kept the owner out without a password. Failed
sign-ins are now counted per client IP and typed address (folded: NFKC,
lower case, trim): 5 in 15 min, then 429 for that IP and address only;
only failures count (a place taken before the compare, given back on
success or refusal; "try again in a moment" while others are being
checked). Payload's own lock stays as the net at 50 failures for an hour
where the project set none. The mail service's account-mail limit now
counts per address per visitor (5) with 20 per address in all, so one
stranger no longer blocks the owner's own reset mail.
Q3 (idea 7): staff login, forgot and reset password refuse a request a
browser marks as coming from another origin (403 before anything is
counted or sent); visitor collections untouched.
Q5 (idea 29): an account that changes its own e-mail, username or password
must send its current password (panel field on the account page via the
plugin's MaskedField, no import-map change; REST and GraphQL). Admins
changing others, server code and API keys are not asked; wrong ones count
like failed sign-ins.
Options accounts.signInLimit / signInSameOrigin / confirmOwnChanges, all
validated at start. Tests: 15 HTTP tests (2FA on/off, all off), fail
before on 1.17.1; built-site spec own-account.spec.ts in e2e:built.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 11:12:40 +01:00
Radosław SmolińskiandClaude Opus 5.5 35bc4f094a Consent version test: no direct buildConfig import (testConfig guard)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 11:07:46 +01:00
Radosław SmolińskiandClaude Opus 5.5 ac6151a0ba Merge claude/security-a-1172: a locked staff account answers like a wrong password, IPv6 counted per /64, panel actions only from the site's own origin
plugin.ts import conflict: withVersionReadRules (readPublished fix) and withLockedAnswer both kept.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 11:06:15 +01:00
Radosław SmolińskiandClaude Opus 5.5 b72327c252 Merge claude/read-published-versions-fix: readPublished on version history, readPublishedVersions, the documented form works
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 10:56:16 +01:00
Radosław SmolińskiandClaude Opus 5.5 27ddbc3b41 Consent version only goes up (owner's decision Q2, 1.17.2)
A stored consent counts only under the version it was given for, so a lower Cookies →
Consent version made consent given under an older policy valid again. A save through access
control (panel, REST, GraphQL) with a lower number is now refused with a message (English and
Polish); the same or a higher number and saves without it pass; the Local API with
overrideAccess may still lower it. iapl({ cookieSettings: { allowLowerPolicyVersion: true } })
keeps the old behaviour. Building blocks exported: policyVersionNeverDown,
buildCookieSettingsFields, buildCookieSettings. No schema change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 10:55:44 +01:00
Radosław SmolińskiandClaude Opus 5.5 910fbd75cf IPv6 grouping without node:net (the limiter also reaches non-Node bundles; webpack build); reference index entry; export order
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 10:52:25 +01:00
Radosław SmolińskiandClaude Fable 5.2 fb92b357e8 Consent-check skill: the cookie button step after the first-paint step
Co-Authored-By: Claude Fable 5.2 <[email protected]>
2026-12-01 10:50:03 +01:00
Radosław SmolińskiandClaude Fable 5.2 1025446a28 Cookie button stays in the bottom corner of the window; it no longer climbs above the footer
Owner, 2026-12-01: by default the cookie button should go to the bottom of the page, not to the footer.
Until now the button (fixed, a child of <body>) moved up by the visible part of the footer: on a phone with a tall
footer it ended at the top of the screen over the header, on a short page in the middle of it.

- Default: fixed in the bottom corner on every page and scroll position; safe-area inset also on the side.
- Only at the very end of the page it steps just above a link, button or form field it would keep covered
  (`clear`, COOKIE_BUTTON_CLEAR, stepAbove); a transform, no layout shift.
- The placement before: avoid={COOKIE_BUTTON_AVOID}; avoid={false} still means never move; className as before.

Tests: test/cookieButtonPlacement.test.ts; reference e2e on desktop and phone (corner on long and short pages,
no covered control at the page end, no layout shift, keyboard reopen).
Docs: consent.md "Where the cookie button sits", AGENT.md, skills, PROGRAMISTA item 83, changelog draft 1.17.2.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
2026-12-01 10:49:23 +01:00
Radosław SmolińskiandClaude Opus 5.5 0f67a6884c e2e:built: a locked staff account and the panel actions checked on the built site (both bundlers)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 10:46:42 +01:00
Radosław SmolińskiandClaude Opus 5.5 03f5cf1a8d Panel actions only from the site's own origin (adminSameOrigin); doctor reads serverURL from the running config
The plugin's panel actions (mail service connect / disconnect, test e-mail,
cookie scan, approval, crawl) act with the panel's login cookie and read a
text/plain body, which another origin sends without a CORS preflight; a
sibling subdomain is same-site and Payload's csrf list is empty without
serverURL. On 1.17.1 such a page reached connect with an admin's cookie
(it called the mail service). Now each refuses a request a browser marks as
coming from elsewhere (403 before anything is read), the rule of the 2FA
endpoints; only endpoints the plugin added; logged once per origin, naming
adminSameOrigin. adminSameOrigin: false / { origins } (owner's Q6).
iapl-doctor csrf-empty: the deep status reports originKnown (serverURL or
csrf in the running config, never the value) and it wins over the file.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 10:46:05 +01:00
Radosław SmolińskiandClaude Opus 5.5 4e68b7e44a 1.17.2 (owner's Q1-Q3): form submissions over REST for staff only; Payload's job queue for an admin or Bearer CRON_SECRET; doctor visitor-writes; explicit write rules on the reference site
- form-submissions create: a staff account with its second factor (formSubmissionOverrides.access.create keeps the way back)
- jobsRunAccess (default on when the project writes no jobs.access.run): admin with the second factor or Bearer CRON_SECRET (16+); start-up note when the secret is missing; jobsRunAccess: false keeps Payload's default
- iapl-doctor deep rule visitor-writes: entities a visitor login account may write, asked by behaviour
- reference: Pages, Posts, CaseStudies, Media, Header, Footer, Company get adminOrEditor write rules
- closed doors: submissions, pages, media, header, company closed for customers; the fixture's job queue refused without the secret, run with it
- route snapshot reasons, docs, AGENT.md, skills, changelog draft 1.17.2

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 10:44:18 +01:00
Radosław SmolińskiandClaude Opus 5.5 97c62f21f0 Every plugin limiter counts IPv6 per /64 (setIpv6Grouping)
clientIp() returns the whole IPv6 address and every limiter keyed on it, so
one host with a /64 had 2^64 budgets: 50 addresses of one /64 against a
limit of 5 all passed (IAWL idea 9, owner's Q4). consumeRateLimit and
checkRateLimit now count an IPv6 key by its /64 (an IPv4-mapped address by
its IPv4); the mail service's per-visitor account-mail key too. A second
counter per /48 at 10x the limit is available and off by default
(setIpv6Grouping({ wide: 48 })); setIpv6Grouping({ prefix: 128 }) counts
per address as before. ipRateKey(ip) is exported for own limiters.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 10:42:02 +01:00
Radosław SmolińskiandClaude Opus 5.5 4b17254135 readPublished on version history: readPublishedVersions, and the documented form works (1.17.2)
readVersions: readPublished(), as access.md showed, answered every version read with 500 on
MongoDB, Postgres and SQLite: the rule returns the document's `_status` path, a version query
runs on the versions collection where the status is `version._status` (SQL: "Cannot find field
for path at _status"; MongoDB: TypeError in sanitizeQueryValue). Reported by a client project
upgrading to 1.17.1.

- readPublishedVersions(minimum): the version form, for readVersions.
- readPublished() carries a symbol mark (READ_PUBLISHED); iapl() swaps it on readVersions of the
  collections and globals it sees (withVersionReadRules, exported for plugins listed after it).
- Tests on the three adapters: the version list (REST, depth 0/2, Local API, GraphQL), one version
  by id, the count, a global, an explicit role; the 1.17.1 HTTP test now checks the status too.
- access.md says where each rule goes; AGENT.md, iapl-collection and iapl-audit skills.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 10:39:41 +01:00
Radosław SmolińskiandClaude Opus 5.5 15b5c6258d A locked staff account answers its login like a wrong password (accounts.lockedAnswer)
Payload checks the lock before the password, so after five wrong passwords
a staff address answered "This user is locked…" to any password while an
address with no account always answered "The email or password provided is
incorrect.": anybody could find out which addresses have a staff account
(IAWL idea 6, owner's Q1). A config-level afterError hook now answers
LockedAuth on a staff collection's login exactly like AuthenticationError:
REST status and body, GraphQL message and extensions.name. The lock is
unchanged; visitor collections keep Payload's answer.
accounts: { lockedAnswer: 'payload' } keeps Payload's message; any other
value stops the start. Building blocks lockedLooksWrong, withLockedAnswer,
graphqlLoginName.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 10:39:40 +01:00
294 changed files with 19266 additions and 1267 deletions
+21
View File
@@ -1,5 +1,26 @@
# Changelog of the wire contract
## 1.8.0 — 2026-12-01 (not released; no tag yet)
A site is confirmed by a person of Intecion on the service's own page (§2.1). Additive: a client of 1.7 keeps
working — its sites enrol, are `pending`, and get `403 site-pending` until an operator confirms them by hand.
**Client: to let its own administrator start the confirmation, add what is marked.**
- **New route `POST /v1/connect`** (token and `X-Intecion-Site`, no body). For a pending site it answers
`{ ok, state: "pending", connectUrl, expiresAt }` — a link valid 15 minutes, for one confirmation, each call
replacing the earlier link; for an active site `{ ok, state: "active" }`. **Client: a panel button that asks
for the link from the server on the click and opens `connectUrl` in a new tab** (after checking that it
begins with the service's base address and `/connect?`). Schema `ConnectResponse`.
- **New code `503 connect-unavailable`** (not retryable): no confirmation page is set up. **Client: show "ask
Intecion to confirm this site".**
- **`/v1/status` of a pending site may carry `connectAvailable: true`.** **Client: show the button only then.**
- **How a site learns that it was confirmed:** it asks `/v1/status` (at most every 5 seconds for at most 10
minutes while the panel that opened the link is open, and on every panel load), or it simply sends. The
service does not call the site. **Client: add the polling.**
- `site-pending` now reads "not yet confirmed by Intecion"; its handling is unchanged.
- Examples: `connect-pending`, `connect-active`, `connect-suspended`, `connect-unavailable`,
`status-pending-connect`; `given.connect`.
## 1.7.1 — 2026-11-25 (not released; no tag yet)
Wording only; nothing for a client to change, and a copy of 1.7.0 need not be refreshed for it.
+10 -5
View File
@@ -1,12 +1,16 @@
3d5c4b7ed53fe6fe2c7c28826c0cf666f9c1d0b79f861b404503e7029728a61f README.md
53da77d5dfff9948d68fca26b828563e21f83418245053d78b03a5aecac6c1d1 CHANGELOG.md
249182a01164b81a5f7af87e5c5cdbd3344a80a7a66dfca624cecfb1501b2420 VERSION
2ff0ad5b6a245365c0fa8733fa17b7bbd3ab91d4825981709d0fd02b762b939f schema.json
9d8381d2e3465e97dc801a61f598fcf822e27e73a2c0729877744ec307097910 runner.mjs
eabe3563e3ada8c4bb85ca03be33b259a38f80e49cc235603096e6efd74974a5 README.md
af76187dbaf87e9ad8de8bf75f1066ec2f3120fb8d1de34feb2028d67f478f92 CHANGELOG.md
3eb1ef94b5890ca727158b106142685c8733b0ace5bcb4cf3f0ac14f9f0643f4 VERSION
9d1e429d266561d4b4baddee5fa8526c7fbce93dad0f16c32fe6e0999b5c9475 schema.json
8a15b61b862fb01c8cb928ef202ba0bb14cf77cbce1fd1bfe32be6873d67989b runner.mjs
7c46860adee597e570832c72bcdb418752a20b9f7d1b2d7a656ed065f9632b2a checksums.mjs
df6015faf02a7cf7e9b5816b9e22b2e82968678ddd72a61c1f9665a8c0897ddf examples/callback-confirm-wordpress.json
f5018ca4fb7d25794ee92168d715aaf47feeba3d907c0550651b16c10a691ceb examples/callback-confirm.json
27bd95712cc36a71519cddc52c03d857b1009c2c384940dbc052022d86bc4231 examples/callback-unknown-nonce.json
4008be4ec65e46d6a43221e400acf8682162cb14d54c5d8a4ab20b49e9985821 examples/connect-active.json
9110ce20a6577b5884fa48a7ddb5d203f4671c863d56ef952a411907daaf45de examples/connect-pending.json
6658a53ffec104a45e00fe962801bdc1a2b47a3f9cb10647d5405e0ed0355fa6 examples/connect-suspended.json
394096063e2c135bb99622d4b37f65ad609cb276b610949fffdc26175cdb0dc9 examples/connect-unavailable.json
de693b060c10c3d0f88fb8edfcd38c491cf141628d747328beee1b50c700c19b examples/enrol-address-literal.json
7c4cf75eb9ab156a3031336ab2688e7c9dcd4cd266b7b7e5e4592285dcbd25ba examples/enrol-callback-no-content.json
64466afc5bf0fecfa36f986d973cd987bbe1f64867e01cdf35e0de40838eb0d1 examples/enrol-callback-not-found.json
@@ -60,5 +64,6 @@ ce4cbea2306f73bd5905249c10ab451a2599cb779e2386828971f40c97b8c591 examples/send-
28e05f3c53cab6433b6af4d425511fa6655d0673df2e840af1fed9d25294a123 examples/send-unknown-token.json
f105c38ab11ab5fc508ba0ed3f23f69108c318765c2670029b230b5b9a83912a examples/status-active.json
89009ee9ab8f38e9ec290fb5412f206e1be28ad10fce6a7071d4406ac52dd4f0 examples/status-no-site-header.json
28eeab5dc50c26f452e438f5cceddf99635ee7b3897e44dfe4255eb49123cc0f examples/status-pending-connect.json
c9f49fa0dae1f0beacaacfe01660b467d06f990228c35a653307c8793f3c97a5 examples/status-pending.json
afdb07ba8279479b6bbfdc4289efda657d4e5a9eccd94b8de165ec728b4a2386 examples/status-unknown-address.json
+71 -3
View File
@@ -1,6 +1,6 @@
# Intecion Notifications Webservice — wire contract
Version: see [`VERSION`](VERSION) (this text describes **1.7.1**). Path prefix of this major version: `/v1`.
Version: see [`VERSION`](VERSION) (this text describes **1.8.0**). Path prefix of this major version: `/v1`.
This is the whole agreement between the Intecion Notifications Webservice ("the service" below) and a client (the mail transport built into a
site's plugin). It names no product: nothing here says Payload, WordPress, IAPL or IAWL except the values of
@@ -63,7 +63,7 @@ Every refusal has the same body ([`Error`](schema.json)) — with one exception:
| 400 | `invalid-request` | Body, header or field is wrong; `field` names it | no | Report a bug | — |
| 401 | `invalid-token` | No token, or one the service does not know (unknown, expired, revoked) | no | Enrol again, then send once more (§2, "Which token") | — |
| 401 | `reverify` | The token is good but comes from a server address the service has not seen for this site | no | Enrol again (the same call-back), then send once more | — |
| 403 | `site-pending` | Enrolled, waiting for approval by Intecion | no | Keep the token; show "waiting for approval" | `relay-pending` |
| 403 | `site-pending` | Enrolled, not yet confirmed by Intecion (§2.1) | no | Keep the token; show "waiting for confirmation" with the connect button (§2.1) | `relay-pending` |
| 403 | `site-suspended` | Stopped by Intecion | no | Keep the token; show it; do not enrol again | `relay-suspended` |
| 403 | `host-not-allowed` | Enrolment: the host is not a public DNS name | no | Show it (a local or private site cannot use the service) | `relay-refused` |
| 403 | `enrolment-closed` | Enrolment is closed for this product, or altogether | no | Show it | `relay-refused` |
@@ -85,6 +85,7 @@ Every refusal has the same body ([`Error`](schema.json)) — with one exception:
| 429 | `quota-exceeded` | A limit of the site (`limit`: `hour`, `day`, `recipient`, `new-recipients`, `alerts`) or of the whole service (`service`) | no | Show it; the message is not sent | `relay-quota` |
| 502 | `backend-failed` | The mail back end failed, or refused this message | **as `retryable` says** | Retry with the same key when `retryable` is true | `relay-unreachable` if it persists |
| 503 | `unavailable` | The service cannot work right now | **as `retryable` says** | Retry when `retryable` is true | `relay-unreachable` if it persists |
| 503 | `connect-unavailable` | `/v1/connect` only: the service has no confirmation page set up right now | no | Show "ask Intecion to confirm this site"; do not retry by itself | `relay-pending` |
| 500 | `internal` | A fault in the service | **yes** | Retry | `relay-unreachable` if it persists |
A network error or a time-out is treated like `503`. The "suggested site status" column is advice, in the words
@@ -240,6 +241,66 @@ Rules a client must know:
site stores it the same way.
- Use the token only from the site's server. Never print it, never send it to a browser.
### 2.1 Connecting a waiting site — `POST /v1/connect` (since 1.8.0)
An enrolment proves that a site is served at its host; it does not prove that the site is Intecion's. Under the
service's `connect` policy every newly enrolled site is therefore **`pending`** and sends nothing
(`403 site-pending`) until a person of Intecion confirms it on the service's own page, signed in with an
`@intecion.com` address. The site's part is to hand that person the link:
1. **The site enrols as always** (§2). The answer says `"state": "pending"`; the token is stored as always.
2. **An administrator of the site presses a button in the site's panel** ("Połącz z IWSN"). On that click — never
on page load, never by itself — the site's **server** calls
```
POST /v1/connect
Authorization: Bearer ims_…
X-Intecion-Site: example.com
```
with no body (or `{}`). If the site holds no token yet it enrols first, as before any other call. The answer
([`ConnectResponse`](schema.json)):
```json
{ "ok": true, "state": "pending",
"connectUrl": "https://webservices.intecion.net/mail/connect?ref=…",
"expiresAt": "2026-12-01T10:15:00.000Z" }
```
| Answer | Meaning | The panel |
|---|---|---|
| `200`, `state: "pending"`, `connectUrl`, `expiresAt` | A link for this host, valid **15 minutes**, usable for **one** confirmation. Each call makes a new link and the earlier one stops working | Opens `connectUrl` in a **new browser tab** |
| `200`, `state: "active"` (no `connectUrl`) | The site is confirmed already | Shows "connected"; opens nothing |
| `403 site-suspended` | Stopped by Intecion | As everywhere |
| `503 connect-unavailable` | The service has no confirmation page right now | "Ask Intecion to confirm this site" (an operator can do it by hand) |
| `429 rate-limited` | More than 10 links for this site within an hour | Wait `retryAfter` |
| `401` / `403 host-mismatch` | As for every route with a token (§8) | Enrol again / forget the token, as there |
3. **The browser opens `connectUrl`** as a top-level navigation in a new tab
(`target="_blank" rel="noopener noreferrer"`, or the equivalent after the click). The client
- takes the address from the answer as it is and adds nothing to it;
- opens it only if it begins with the service's base address followed by `/connect?` — anything else is a
fault, shown as such;
- never fetches it from the server, never puts it in a frame, never stores it and never writes it to a log.
It is not a secret — it authorises nothing by itself, the person's sign-in does — but it is of use only
for those fifteen minutes.
4. **On the service's page** the person signs in (Cloudflare Access: a one-time code sent to their
`@intecion.com` address), sees the host, and presses "Potwierdź". Nothing of this passes through the site.
5. **The site learns that it is active by asking** — the service never calls the site for this:
- `GET /v1/status` answers `"state": "active"`. While the panel that opened the link is open, the client
asks **at most every 5 seconds, for at most 10 minutes**, then stops and shows "not confirmed yet" with
the button again. It also asks whenever the panel is loaded.
- Or simply by sending: the first `/v1/send` after the confirmation is accepted. Mail refused with
`site-pending` before that was **not sent and is not kept by the service**; what a client does with it is
what it does for any refusal that is not retryable.
**States a panel shows.** `pending` with `connectAvailable: true` in `/v1/status` (§4): "waiting for
confirmation" and the button. `pending` without it: "waiting for approval by Intecion", no button. `active`:
connected. `suspended`: stopped by Intecion.
A pending site that nobody confirms is forgotten 14 days after it first enrolled; it then enrols again by itself
on its next send and is pending again.
## 3. Sending — `POST /v1/send`
Headers (`Bearer` in any case; one space; then the token exactly):
@@ -360,7 +421,7 @@ not go out ([`StatusResponse`](schema.json)):
```json
{ "ok": true, "state": "active", "host": "example.com", "product": "iapl",
"service": { "name": "Intecion Notifications Webservice", "version": "1.0.0", "contract": "1.7.1" },
"service": { "name": "Intecion Notifications Webservice", "version": "1.0.0", "contract": "1.8.0" },
"sender": { "address": "[email protected]" },
"limits": { "messagesPerHour": 30, "messagesPerDay": 200, "recipientsPerMessage": 10,
"perRecipientPerDay": 10, "newRecipientsPerDay": 50,
@@ -372,6 +433,9 @@ not go out ([`StatusResponse`](schema.json)):
A client takes its attachment limit from `limits.maxAttachmentBytes`, never from a constant of its own.
Since 1.8.0 the answer for a **pending** site may carry `"connectAvailable": true`: the site can be confirmed
through `/v1/connect` (§2.1) and a panel shows the button. The field is left out otherwise.
## 5. Rotation — `POST /v1/rotate`
`Authorization: Bearer ims_…`, no body. When `token.rotateAfter` has passed (90 days after issue), the client
@@ -474,6 +538,7 @@ Each file in `examples/` is one case:
| `quota` | `fresh`, `hour-exhausted`, `day-exhausted`, `recipient-exhausted`, `hour-share-used` | The site's counters. `recipient-exhausted`: `{{recipient}}` got the day's maximum of form confirmations. `hour-share-used`: mail other than `account` has used its four fifths of the hour |
| `idempotency` | `fresh`, `sent-same`, `sent-other` | Whether `{{idempotencyKey}}` was already used: for this very body, or for another |
| `backend` | `ok`, `recipient-suppressed`, `failure` | How the mail back end answers |
| `connect` | `available`, `unavailable` | Whether the service's confirmation page is set up (§2.1). `available` when left out |
Variables: `{{host}}`, `{{token}}`, `{{nonce}}`, `{{idempotencyKey}}`, `{{recipient}}`, and — read from the
service — `{{senderAddress}}`, `{{alertRecipient}}`.
@@ -536,5 +601,8 @@ Checklist for a client:
7. Strip from the subject what §3 does not allow (line breaks, control characters, direction marks and other
invisible characters — not only line breaks); bare addresses only; the right `kind` for each mail.
8. Read limits from `/v1/status`; rotate after `token.rotateAfter`.
8a. **Connect (§2.1):** a button for an administrator that asks `/v1/connect` from the server on the click and
opens the answered `connectUrl` in a new tab after checking its beginning; `/v1/status` every 5 seconds for
at most 10 minutes while that panel is open; the four states shown. No link is asked for on page load.
9. Run the examples: the `client` block of each against canned answers, and the whole set against your local
stand-in.
+1 -1
View File
@@ -1 +1 @@
1.7.1
1.8.0
@@ -0,0 +1,31 @@
{
"id": "connect-active",
"title": "A site that is confirmed already gets no link",
"given": {
"site": "active"
},
"request": {
"method": "POST",
"path": "/v1/connect",
"headers": {
"authorization": "Bearer {{token}}",
"x-intecion-site": "{{host}}"
}
},
"response": {
"status": 200,
"schema": "ConnectResponse",
"body": {
"ok": true,
"state": "active"
}
},
"client": {
"retry": false,
"reEnrol": false,
"status": null
},
"then": {
"mails": 0
}
}
@@ -0,0 +1,31 @@
{
"id": "connect-pending",
"title": "A waiting site asks for the link a person of Intecion confirms it with",
"given": {
"site": "pending"
},
"request": {
"method": "POST",
"path": "/v1/connect",
"headers": {
"authorization": "Bearer {{token}}",
"x-intecion-site": "{{host}}"
}
},
"response": {
"status": 200,
"schema": "ConnectResponse",
"body": {
"ok": true,
"state": "pending"
}
},
"client": {
"retry": false,
"reEnrol": false,
"status": "relay-pending"
},
"then": {
"mails": 0
}
}
@@ -0,0 +1,32 @@
{
"id": "connect-suspended",
"title": "A suspended site cannot be connected",
"given": {
"site": "suspended"
},
"request": {
"method": "POST",
"path": "/v1/connect",
"headers": {
"authorization": "Bearer {{token}}",
"x-intecion-site": "{{host}}"
}
},
"response": {
"status": 403,
"schema": "Error",
"body": {
"ok": false,
"code": "site-suspended",
"retryable": false
}
},
"client": {
"retry": false,
"reEnrol": false,
"status": "relay-suspended"
},
"then": {
"mails": 0
}
}
@@ -0,0 +1,33 @@
{
"id": "connect-unavailable",
"title": "The service has no confirmation page set up: the site stays waiting and says whom to ask",
"given": {
"site": "pending",
"connect": "unavailable"
},
"request": {
"method": "POST",
"path": "/v1/connect",
"headers": {
"authorization": "Bearer {{token}}",
"x-intecion-site": "{{host}}"
}
},
"response": {
"status": 503,
"schema": "Error",
"body": {
"ok": false,
"code": "connect-unavailable",
"retryable": false
}
},
"client": {
"retry": false,
"reEnrol": false,
"status": "relay-pending"
},
"then": {
"mails": 0
}
}
@@ -0,0 +1,29 @@
{
"id": "status-pending-connect",
"title": "Status of a waiting site says that it can be confirmed through /v1/connect",
"given": {
"site": "pending"
},
"request": {
"method": "GET",
"path": "/v1/status",
"headers": {
"authorization": "Bearer {{token}}",
"x-intecion-site": "{{host}}"
}
},
"response": {
"status": 200,
"schema": "StatusResponse",
"body": {
"ok": true,
"state": "pending",
"connectAvailable": true
}
},
"client": {
"retry": false,
"reEnrol": false,
"status": "relay-pending"
}
}
+1 -1
View File
@@ -2,7 +2,7 @@
// No dependency. Works in Node 20+ and in the Workers runtime (uses only WebCrypto, btoa and TextEncoder).
// How to use it: README.md, "The examples and the runner".
export const CONTRACT_VERSION = '1.7.1'
export const CONTRACT_VERSION = '1.8.0'
export class ContractError extends Error {
constructor(exampleId, message) {
+63 -1
View File
@@ -497,6 +497,10 @@
"senderName": {
"description": "The name the last mail left under, when there was one.",
"type": "string"
},
"connectAvailable": {
"description": "Only for a pending site, and only when true: the site can be confirmed through /v1/connect (contract 2.1).",
"const": true
}
}
},
@@ -572,7 +576,8 @@
"quota-exceeded",
"backend-failed",
"unavailable",
"internal"
"internal",
"connect-unavailable"
],
"description": "The codes the service answers with today. The list grows with minor versions; that is why Error.code is an open string."
},
@@ -619,6 +624,63 @@
"type": "string"
}
}
},
"ConnectResponse": {
"description": "Answer of POST /v1/connect. For a pending site: a link for a person of Intecion, valid until expiresAt, usable for one confirmation. For an active site: no link.",
"type": "object",
"required": [
"ok",
"state"
],
"properties": {
"ok": {
"const": true
},
"state": {
"enum": [
"pending",
"active"
]
},
"connectUrl": {
"type": "string",
"pattern": "^https?://[^/?#\\s]+(/[A-Za-z0-9._~-]+)*/connect\\?ref=[A-Za-z0-9_-]{43}$",
"description": "Opened by a person's browser as a top-level navigation. Never fetched by the site's server."
},
"expiresAt": {
"type": "string",
"format": "date-time"
}
},
"if": {
"properties": {
"state": {
"const": "pending"
}
}
},
"then": {
"required": [
"connectUrl",
"expiresAt"
]
},
"else": {
"not": {
"anyOf": [
{
"required": [
"connectUrl"
]
},
{
"required": [
"expiresAt"
]
}
]
}
}
}
}
}
+369
View File
@@ -9,6 +9,375 @@ versions at once, go through every "Requires project changes" section in order,
version you have. A new release = a new section at the top; we remove the oldest ones only
once there are more than 20.
## 1.18.0 (2026-12-02) — first two-step set-up confirmed by e-mail, staff sign-in protection, speed and growth, security audit fixes, IWSN connect
> **Read before upgrading — what changes for an existing site, most important first.** 1.17.2 was never released on
> its own: its changes are part of this release ("From 1.17.2" at the end of this entry). **No migration** on any
> database and no schema change for Postgres / SQLite (MongoDB: a hidden date on two log collections, "Speed and
> growth" point 2). **Import map:** `pnpm generate:importmap` moves one existing line (`MaskedField`, because of the new
> "Current password" field); the committed map works too. Regenerate it when you turn on `unusedMedia`.
>
> 1. **The first two-step set-up ends with an e-mail** to the account's own address, opened in the same browser.
> Mail must work, or an administrator confirms from the account page. Tell the staff before the upgrade.
> → "Two-step verification".
> 2. **Staff sign-in:** pin `IAPL_IP_HEADER` in production (failed sign-ins are counted per client IP and address);
> Payload's per-account lock becomes 50 failures for an hour; staff sign-in only from the site's own origin; an
> account's own e-mail / password change asks for the current password. → "Staff sign-in".
> 3. **Every site on IWSN needs one "Połącz z IWSN"** confirmed by a person of Intecion; until then its e-mails are
> refused. SMTP and Graph sites see no change. → "IWSN".
> 4. **`iapl-doctor` can fail where it passed:** the performance rules are errors, the minimum Next.js is 16.4.6, and
> `transitive-min` warns on `ws`, `cross-spawn` and (Postgres) `esbuild` below their fixes. → "Speed and growth" 9,
> "Security audit" 8–9.
> 5. **Outside callers get less:** public REST / GraphQL lists are capped at 100, an operator name in `?sort=` is a
> 400, document locks are for staff only, access callbacks allow only on a literal `true`. → "Security audit".
> 6. **Drafts as related documents are left out** of what the content helpers answer (a menu link to an unpublished
> page disappears from the site). → "Content and plugin writes".
> 7. **Uploads and logs:** JPEG / PNG metadata is removed on upload, MongoDB deletes expired consent records and
> statistics by itself, versioned plugin entities keep 20 versions. → "Speed and growth".
> 8. **From 1.17.2:** a cron calling `/api/payload-jobs/run` needs `CRON_SECRET`; customer accounts no longer create
> form submissions over REST; a locked staff account hears "incorrect"; the consent version only goes up.
>
> **Known:** the time of a failed sign-in still differs between an existing and an unknown address (Payload hashes the
> password only for an existing one), so timing can still tell which accounts exist.
### Staff sign-in (docs/access.md)
> **What changes for an existing site** (no schema change, no migration; each with its opt-out):
>
> 1. **A stranger can no longer lock a staff account out** (`accounts.signInLimit`). Failed sign-ins to a staff
> collection are counted per client IP and typed address: after 5 failures in 15 minutes that IP gets `429` for
> that address, and the owner signs in from anywhere else. Payload's own per-account lock stays as the net against
> many IPs, at **50 failures for an hour** (only where the project set no `auth.maxLoginAttempts` / `lockTime`).
> **Pin `IAPL_IP_HEADER`** in production; without it every visitor shares one bucket (20× the limit). Adapt:
> `signInLimit: { perAddress, windowMinutes, accountLock }`; Payload's behaviour back: `signInLimit: false`.
> 2. **Staff sign-in only from the site's own origin** (`accounts.signInSameOrigin`): login, "forgot password" and
> "reset password" of a staff collection answer `403` to a request a browser marks as coming from elsewhere.
> Customer logins are not touched. A panel or front end on another domain:
> `signInSameOrigin: { origins: [...] }`; behind a proxy that rewrites `Host`, set `serverURL`. Off: `false`.
> 3. **Changing one's own e-mail, username or password asks for the current password** (`accounts.confirmOwnChanges`):
> a "Current password" field on the account page, `currentPassword` over REST / GraphQL. Not asked: an
> administrator changing another account, server code, API keys, the reset flow. **Scripts that change their own
> password add `currentPassword`.** Off: `confirmOwnChanges: false`.
>
> Note for the owner: with 50 failures an hour, many different clients (an IPv6 /48 holds 65,536 /64s) can still keep
> a staff account out for an hour at a time; `accounts.signInLimit.accountLock` sets the numbers.
### Content and plugin writes (docs/content.md, docs/integrations.md)
> **What changes for an existing site** (no schema change):
>
> 1. **Drafts as related documents are left out.** A block, a menu or a System pages link that points at a page never
> published no longer brings its title, slug or text into the content helpers' answers (pages, Site settings,
> archive entries, the 404 page, Markdown, MCP, llms-full): a single relationship becomes `null`, a draft is removed
> from a list, a polymorphic one gets `value: null`. A preview keeps them. Old behaviour:
> `createContentHelpers({ draftRelations: 'keep' })` (also per helper). Building blocks: `withoutDraftRelations`,
> `applyDraftRelations`, type `DraftRelations`.
> 2. **The plugin's status writes keep others' saves.** The e-mail and Turnstile status is written alone
> (`writeGlobalFields`): a save an editor makes to Site integrations at the same moment is no longer
> overwritten by a status update, and no version is made for it. Nothing to do.
> 3. **Access callbacks that answer something other than `true` / `false`** are named once in the server log (and,
> since this release, refused: "Security audit" point 6).
### IWSN: "Połącz z IWSN" — a person of Intecion connects the site (docs/email.md, contract 1.8.0)
> **What changes for an existing site:** nothing for a site whose "Sending method" is SMTP or Microsoft Graph, and
> nothing for a site already active on IWSN. A site on IWSN that is new or still waits now shows **"Połącz z IWSN"**
> on Site integrations → E-mail sending: pressing it opens the service's confirmation page in a new tab, where a
> person of Intecion signs in with an `@intecion.com` address and presses "Potwierdź"; the panel then shows
> "Connected to IWSN" by itself. Until then the site's e-mails are refused (`relay-pending`), the dashboard alert says
> so, and `iapl-doctor --deep` reports an **error** (`mail-relay-connect`). No schema change, no import-map change.
- **The button** (state block on the e-mail tab, method IWSN): shown while the service offers the confirmation page
(`connectAvailable` in `/v1/status`) or before the site has enrolled. A click asks the site's server for the link
(`POST /api/iapl/mail-relay/connect-link`, admin only, from the site's own origin, enrolling first when there
is no token); the server asks the
service (`POST /v1/connect`), checks that the link begins with the service's own `{base}/connect?`, and hands it
over without storing or logging it; the browser opens it with `noopener noreferrer`. The panel then asks
`/v1/status` every 5 seconds for at most 10 minutes; every load of the panel asks too while the site waits.
- **States shown:** "Waiting for confirmation" (with the button), "waiting for approval" (no button: no confirmation
page), "Connected to IWSN", stopped. "The confirmation page is not available now" for `503 connect-unavailable`; a
wait in minutes for more than 10 links an hour.
- **Dashboard alert** for a waiting site (live, no call to the service); the text of `relay-pending` now speaks of
confirmation.
- **Doctor:** `mail-relay-connect` (error, deep) — the method is IWSN and the site is not connected or not confirmed.
`mail-relay-state` no longer reports "waiting for approval" (warning) or "not enrolled yet" (info): both are this error.
- **Opt-out:** `mail: { relay: { connectButton: false } }` — no button, no route.
- **Building blocks:** `requestRelayConnectLink(payload, options?)` (`ConnectLinkResult`), `isRelayConnectUrl(url, base)`,
`RELAY_CONNECT_LINK_PATH`, `RelayStatus.connectAvailable`; `relayPanelEndpoints(own, { connectLink })`. The stand-in:
`createFakeRelay({ connect: 'available' | 'unavailable' })`, `relay.confirmConnect(connectUrl)`, `connectAvailable` in
its `/v1/status`, `/v1/connect`.
- The contract copy is 1.8.0 (`RELAY_CONTRACT_VERSION`); additive, every other route unchanged.
### Two-step verification: the first set-up is confirmed by e-mail (docs/security.md)
> **Read before upgrading — what changes for an existing site, most important first:**
>
> 1. **Setting up two-step verification now ends with an e-mail.** Whoever sets it up for the first time (a new
> account, an account whose setup was reset or reopened, every account that never finished it) scans the code as
> before, then gets a link at the **account's own e-mail address**; the factor is on only after that link is opened
> **in the same browser** within 30 minutes, and then they sign in again with password and code. Accounts that
> already have two-step verification are not affected. Tell the staff before the upgrade.
> 2. **E-mail must work before that.** Check Site integrations → E-mail sending → "Send a test e-mail". Where it does
> not work, nobody is locked out: the link is written to the server log (Coolify → Logs) and an administrator can
> choose "Confirm the waiting set-up" on the account page; `iapl-doctor --deep` reports it as an error
> (`2fa-enrolment-mail`).
> 3. **Notice mails:** the account's address now gets a mail when its two-step verification is turned on, changed,
> removed or reset.
> 4. `serverURL` must be set (it is, from `NEXT_PUBLIC_SERVER_URL`, on every site made with `iapl create`): the link is
> made from it, never from the request.
>
> Why: with the password of an account inside its setup window, anybody could enrol their own authenticator and lock
> the owner out (security audit 2026-12, F0; every release since 1.16.6 within the window, earlier without one). No
> schema change, no migration, no import-map change. Turn off: `twoFactor: { confirmByEmail: false }`; adapt:
> `confirmByEmail: { linkMinutes, sameBrowser, adminConfirm, logLinkWhenMailFails, notices, maxMailsPerHour }`
> (security.md "Set-up confirmed by e-mail").
### Speed and growth (docs/performance.md)
> **What changes for an existing site** (no edit needed unless a line says so; each with its opt-out):
>
> 1. **Metadata is removed from JPEG and PNG uploads** (camera, date, GPS position, comments) — without
> re-encoding: the pixels stay byte for byte, the colour profile stays. A photo whose EXIF says "rotate" is turned
> once (JPEG quality 92) so it does not show sideways. Only new uploads; stored files are not touched.
> Off: `buildOptimizeUploadHook({ stripMetadata: false })`.
> 2. **MongoDB: TTL indexes delete old consent records and statistics by themselves** — the records the daily purge
> already deleted (older than `retentionDays`: 1095 days for the consent log, 90 for statistics), now also on a
> quiet site where no new record starts the purge. At the first start the plugin adds a hidden date
> (`iaplTtlFrom`) to every existing record and creates the index `iapl_ttl`; **records older than the retention
> are deleted by MongoDB within a minute of that start** (they were due already). Off: `consentLog: { ttlIndex:
> false }`, `stats: { ttlIndex: false }` (the index is dropped at the next start; the purge stays). Postgres /
> SQLite: nothing changes (no field, no migration).
> 3. **A versioned plugin collection or global keeps 20 versions per document** (Site settings, Site integrations,
> the forms…) when a project turned its versions on without a limit — Payload's default is 100. **The oldest
> versions above 20 are removed when such a document is saved next.** Keep more: set `max` / `maxPerDoc` in your
> override. The plugin itself turns versions on nowhere.
> 4. **Forms load their code only on pages that show a form.** `BuilderForm` and `Turnstile` from
> `@intecion/ipal-kit/client` are now lazy wrappers with the same props; the server renders the whole form as
> before. On other pages 6–9 KB less JavaScript (gzip; reference site: webpack −8.8 KB, Turbopack −6.1 KB). The eager components: `@intecion/ipal-kit/client/eager`
> (`<RenderForm Form={BuilderForm}>`).
> 5. **The Turnstile widget's height is kept free before Cloudflare draws it** (73 px): the form no longer jumps when
> it appears. For an invisible widget: `turnstileReserveHeight={0}` on `RenderForm` / `BuilderForm`
> (`reserveHeight={0}` on `Turnstile`).
> 6. **A background video stops for visitors who asked for less motion** (`prefers-reduced-motion`), after
> hydration; everyone else sees no change. Off: `<Media pauseForReducedMotion={false}>`.
> 7. **Card hover** (`Card interactive`, the library's link cards) fades a shadow layer instead of animating the
> card's shadow: the same lift, drawn by the compositor. The 1.17 class: `CARD_INTERACTIVE_SHADOW_CLASS`.
> 8. **Fewer database queries per page render** (36–44 %), the lightbox viewer loads on first open, the `/client`
> barrels are no longer one client boundary, the table of contents measures once per frame, Turnstile stops
> polling once drawn, the cookie banner honours reduced motion. Nothing to do.
>
> 9. **`iapl-doctor` can now fail on the performance rules** (`perf-*`: images config, fonts, render-blocking,
> embeds, animations, a budget test; `--url`: uncompressed HTML, blocking scripts, more than four font preloads, a
> lazy first image, HTML over 150 KB; `--deep`: stored images over 1.5 MB / 2560 px) — they are **errors**, so a
> plain run exits 1 on them and `--strict` too. None measures time: the same site gives the same answer every run.
> A site with Playwright and no budget test gets `perf-budgets` (copy the `iapl-performance` skill's template).
> Lower one with a reason: `iapl-doctor.json` → `"rules": { "perf-fonts": { "severity": "warning", "reason": "…" } }`;
> silence one: `{ "off": true, "reason": "…", "until": "2027-03-01" }` (docs/doctor.md). The `growth-*` rules stay
> warnings and infos.
>
> 10. **Helpers from `@intecion/ipal-kit/client` are plain values in a server component.** The `/client` barrels have
> no `'use client'` any more, so a helper without its own directive (`pushDataLayer`, the role predicates, …)
> imported into a server component is now the function itself, not a client reference. Only a project that passed
> such a function from a server component to a client component as a prop notices it (Next: "Functions cannot be
> passed directly to Client Components"): import it inside the client component instead.
> 11. **MongoDB: the generated types gain `iaplTtlFrom`** on consent records and statistics visits (the hidden TTL
> date, point 2) after `payload generate:types`. Nothing to change in code.
>
> **New, off until a project turns it on:** `iapl({ unusedMedia: true })` — above the Media list, how many files no
> page, entry or setting uses, with a link to Payload's list filtered to them (deleting stays manual; **run
> `pnpm generate:importmap`** after turning it on); `forms: { submissionRetentionDays }`; `Media eager` (a logo
> above the fold, no high priority); `createNotFoundPage({ load, placeholder })` (the reference site keeps its 404
> height: CLS 0).
> **Doctor:** the `performance` group (errors, point 9) and the `growth` group (warnings and infos;
> `growth-versions-config` is a hint), thresholds in `iapl-doctor.json` → `growth`. **Agents:** the `iapl-performance` skill (`pnpm exec iapl-skills`) and the budget
> gate template. **Recommended for projects:** `index: true` on `slugHistory.slug`; the heading font with
> `preload: false` (the starter's default now); a placeholder of the 404 content's height.
### Security audit 2026-12: fixes and suites (docs/security.md)
> **What changes for an existing site** (no migration, no import-map change; each with its opt-out):
>
> 1. **Public lists are capped at 100** (`listLimit`, finding F4). A REST / GraphQL list (`find`, versions, distinct
> values) asked by a caller that is not staff gets at most 100 documents; `pagination=false` and `limit=0` become one
> page of 100. Before, one anonymous `GET /api/posts?limit=100000` read a whole collection with its relations.
> Staff accounts, the panel, the Local API (the frontend, seeds) and server code that reads with
> `overrideAccess: true` while passing a request on (the cookie scanner's scheduled crawl) are not capped. **A client-side script that reads
> more than 100 documents anonymously now gets the first 100 and `hasNextPage: true`** — page through, or adapt:
> `listLimit: { max: 500 }`, `{ exclude: ['products'] }`, `{ staff: true }`; off: `listLimit: false`.
> 2. **An operator name in `?sort=` answers 400** (`refuseOperatorSort`, F5): `$where`, `-$natural`, `title.$ne` —
> for everyone, staff too — instead of reaching MongoDB and ending in a 500 with a stack trace in the log. Logged as
> one `info` line (`RefusedSortError`; `loggingLevels: { RefusedSortError: false }` hides it). Off:
> `refuseOperatorSort: false`. Reported to Payload upstream.
> 3. **Payload's document locks are for staff only** (`lockedDocuments`). `payload-locked-documents` ("who edits
> what") ran on Payload's default, any signed-in account — a visitor account of a login collection for customers
> could read who edits which document and write or delete locks. Now staff accounts with the second factor; the
> panel works as before. Off: `lockedDocuments: false`; your own rule: `lockedDocuments: { access: { read } }`.
> 4. **The Markdown negotiated at a page URL is never cached as the page** (F3). `createProxy({ markdown: true })`
> marks the rewrite, the Markdown route answers `cache-control: private, no-store` with `Vary: Accept`, and the
> HTML pages keep their caching and Next's own `Vary` (ISR unchanged). Before, a CDN that caches HTML (Cloudflare "Cache Everything",
> Varnish) could store the Markdown copy after one anonymous `Accept: text/markdown` request and serve it to every
> visitor of that page. `/md/…` keeps its public caching. A proxy of your own that rewrites to `/md/…` copies the
> headers (`MARKDOWN_NEGOTIATED_HEADER`, `NEGOTIATED_CACHE_CONTROL`, `appendVary`; content.md). Off:
> `markdown: { negotiate: false }` (Markdown only at `/md/…`).
> 5. **CSP report log lines change shape** (F1): `blocked=` is the origin (`https://cdn.example`, or `inline` /
> `eval`), `page=` the path without its query, `src=` origin and path; control characters are removed and each
> value is cut at 128 characters, so a posted report can no longer write a forged line into the Coolify log. One
> request handles at most 10 violations (was 50), one client at most 60 requests a minute (the answer stays `204`).
> **A log parser that read full URLs must adapt.** Your own `onReport` still gets the raw values. Adapt:
> `createCspReportRoute({ maxReports: 50, rateLimit: false | { max, windowMs } })`; the line: `cspLogLine`.
> 6. **Access callbacks allow only on a literal `true`** (`cookieScanner.access`, the doctor's `access`). A callback
> that returns `req.user` — `cookieScanner: { access: ({ req }) => req.user }` — returned an account object, which
> let the request in; **now it is refused (`403`)**, and so are `1`, `'yes'`, `{}` and a Promise that was not
> awaited. The server log names the option once: `[iapl] cookieScanner.access returned an object, not true or
> false, so the request was refused …`. Fix: `({ req }) => Boolean(req.user)` (or a role check such as
> `isAdmin(req.user, req.payload)`). The old reading back: `iapl({ strictAccessAnswers: false })`. New exports:
> `strictAccessAnswers(req)`, type `AccessAnswerOptions`; `accessAllowed(option, answer, { strict })`.
> 7. **New doctor findings the first time** (the suites below): `iapl-doctor --only security` reads the project's own
> code and configs. Judge each; a correct place gets `// iapl-security-ok: <why>`.
>
> 8. **The minimum safe Next.js is 16.4.6** (was 16.4.5): a site on 16.4.5 now gets a `next-min` error from
> `iapl-doctor`. Fix: `pnpm add [email protected] [email protected]`, `rm -rf .next`, build, redeploy. 16.4.6 is
> the version the plugin, the reference site and the starter are tested with, and its React copy carries the fix for
> React's RSC advisory GHSA-xqc2-xf4c-x3h3 (checked in the code, AGENT.md §4 item 11). Silence with a reason in
> `iapl-doctor.json` → `rules.next-min` if an upgrade must wait.
>
> 9. **`ws` below 8.23.0 and `cross-spawn` below 7.1.0 are reported** (GHSA-37g9-w4hg-h9qr, high: memory exhaustion through unbounded automatic pong
> responses, published 2026-12-01). It comes with `payload` (`^8.16.0`); a lockfile made earlier keeps 8.21 / 8.22.
> `iapl-doctor` (`transitive-min`) warns and `pnpm audit --prod` shows it as high. Fix: add
> `"ws@>=8 <8.23.0": "^8.23.0"` to `pnpm.overrides` (AGENT.md §4 item 12), `pnpm install`, commit the lockfile,
> redeploy. The plugin, the reference site and new sites from `iapl create` carry it. The same for `cross-spawn`
> below 7.1.0 (GHSA-ghv9-86vm-4v8m, critical, command injection when spawning batch files — Windows only; comes
> with `cross-env` and `eslint`): `"cross-spawn@>=7 <7.1.0": "^7.1.2"`.
> **Postgres sites:** `esbuild` below 0.25 (GHSA-67mh-4wv8-2f99, moderate) comes with `@payloadcms/db-postgres` →
> `drizzle-kit`; `transitive-min` warns, fix `"esbuild@<0.25.0": "^0.25.12"`. The plugin's own dev tooling is clean
> too now (`eslint` 9.39.4 and `minimatch` 11.0.10 through overrides); AGENT.md §4 item 12 lists them for a project
> that uses `@payloadcms/eslint-config`.
>
> **Recommended for projects:** a text field of your own whose value goes into `href` (social profiles, a website)
> becomes `buildUrlField()` and its render goes through `safeHref()` (F2) — no schema change, it stays a text column.
> The reference site and every new site from `iapl create` do it for Company → Profiles (also in the `sameAs` of the
> JSON-LD). Not exploitable as the reference site wrote it (`target="_blank"`), but a copy without it would run an
> editor's `javascript:` link as the admin who clicks it.
>
> **New checks a project can run on its own site:**
>
> - **Static security rules** in the doctor: `iapl-doctor --only security` now also reads the project's own code
> (`code-patterns`: unescaped HTML / JSON-LD, `overrideAccess: true` and a Local API `user` without
> `overrideAccess: false` where a request reaches, a `where` from the request, `eval`, `NEXT_PUBLIC_` secrets,
> redirects and fetches to an address from the request) and its configs (`config-dangerous`).
> - **Attack probes**: `iapl-doctor --url https://<domain> --only live-probes` (requests that change nothing) and the
> Playwright template `iapl-audit/resources/attack-probes.spec.template.ts`. Exported: `ATTACK_PROBES`,
> `runAttackProbes`, `createProbeContext`, `scanCode`, `scanConfigs` (`@intecion/ipal-kit/doctor`). A site on the
> 1.18.0 defaults passes every probe; `markdown-vary`, `unbounded-list` or `sort-operator` mean a fix above is off.
> - **For the plugin's own release:** `pnpm security:gate` (in `prepublishOnly`): `pnpm audit` with no moderate, high
> or critical advisory in the production tree **and the dev tooling** (lows reported; `--audit-level high` or
> `--prod-only` for the looser rule), the static-rule gate and the per-class tests; `--zap <url>` adds an optional OWASP ZAP baseline scan.
>
> **New exports:** `buildQueryGuardHook`, `applyQueryGuard`, `capListLimit`, `isOperatorSort`, `isStaffRequest`,
> `RefusedSortError`, `DEFAULT_LIST_LIMIT`, `isQueryGuardHook`, `QUERY_GUARD_MARK`, `applyLockedDocumentsAccess`,
> `staffOnlyLocks`, `LOCKED_DOCUMENTS_SLUG` (types `ListLimitOptions`, `LockedDocumentsAccess`); `buildUrlField`,
> `isAllowedUrl` (types `BuildUrlFieldOptions`, `UrlScheme`); `cspLogLine`, `CSP_LOG_VALUE_MAX`;
> `MARKDOWN_NEGOTIATED_HEADER`, `NEGOTIATED_CACHE_CONTROL`, `appendVary`. New options: `listLimit`,
> `refuseOperatorSort`, `lockedDocuments`; `createProxy({ markdown: { prefix, negotiate } })`;
> `createCspReportRoute({ maxReports, rateLimit })`; `markdownResponse(md, { negotiated })`.
>
> **GHSA-xqc2-xf4c-x3h3 (React RSC, critical) and Next:** Next 16.4.6 vendors a React copy labelled
> `19.3.0-canary-278794d7-20261002`; its code carries the fix (React commit 0c9913ae: the new backing-store reads,
> the `"S"` stream key and error 612 "Cannot transport a detached buffer"). No watch remains; AGENT.md §4 item 11 says
> how to check after a Next upgrade.
### From 1.17.2 (never released on its own)
> **Read before upgrading.** No schema change, no migration on any database, no import-map change. What changes for
> an existing site, most important first:
>
> 1. **Fix: `readPublished()` on version history.** The form 1.17.1 documented, `readVersions: readPublished()`,
> answered every version read by a visitor or a plain account with **500** (MongoDB, Postgres and SQLite alike).
> It now works by itself: iapl() gives that `readVersions` the new `readPublishedVersions()` with the same role.
> Visitors see published versions only; a draft version by id is `403`; staff see everything, as before. A
> `readVersions` of your own that **wraps** `readPublished()` is not changed: use `readPublishedVersions()` inside it.
> 2. **A locked staff account is told "The email or password provided is incorrect."** (REST, GraphQL, the panel),
> so five wrong passwords no longer tell a stranger that an address has a staff account. A locked editor with the
> right password sees "incorrect" too until the lock ends (10 minutes); an admin can unlock it. Payload's message
> back: `accounts: { lockedAnswer: 'payload' }`. Known: the answer's **time** still differs for an existing
> account (Payload hashes only then); see "Known" at the top of 1.18.0.
> 3. **The plugin's panel actions refuse other origins** (mail service Connect / Disconnect, Send test e-mail, cookie
> scan, approval, site check): `403` for a request a browser marks as coming from elsewhere. The panel's buttons
> work. **Behind a proxy that rewrites `Host` and sends no `X-Forwarded-Host`, set `serverURL`**, or those buttons
> are refused too (the log says so once; `iapl-doctor` warns). Off: `adminSameOrigin: false`.
> 4. **A customer account can no longer create form submissions over REST / GraphQL** (staff only). The site's own
> forms (`submitForm`, `createSubmitAction`, the file endpoint) are not affected. Way back:
> `forms.formSubmissionOverrides.access.create`.
> 5. **Payload's job queue over HTTP: only an admin or `Authorization: Bearer <CRON_SECRET>`** (16+ characters), when
> the project wrote no `jobs.access.run`. **A cron that calls `/api/payload-jobs/run` must set `CRON_SECRET` and
> send the header**, or it gets `401`. In-process runs and a project's own rule are not affected;
> `jobsRunAccess: false` keeps Payload's default.
> 6. **The cookie button stays in the bottom corner and never moves**; while it is shown the footer gets a little
> room under its last row (about 43 px on the reference site) so the button covers nothing. No layout shift.
> No room: `<CookieButton reserve={false} />`; the placement before: `<CookieButton avoid={COOKIE_BUTTON_AVOID} />`.
> 7. **The consent version only goes up** through the panel, REST and GraphQL (a lower number would make old consent
> count again). The Local API with `overrideAccess` may still lower it; `cookieSettings: { allowLowerPolicyVersion: true }`
> restores the old freedom.
> 8. **IPv6 visitors are counted per /64** by every plugin rate limit (one home network shares a budget, as an
> IPv4 home behind one router always did). Per address: `setIpv6Grouping({ prefix: 128 })`.
#### Security
- **Version history with `readPublished()`** (point 1): new `readPublishedVersions(minimum)` for `readVersions`;
`withVersionReadRules(entities)` swaps a marked `readPublished()` on `readVersions` (iapl() runs it on the
collections and globals it sees; a plugin listed after iapl() uses `readPublishedVersions()` itself).
- **Locked staff accounts answer like a wrong password** (point 2): `lockedLooksWrong`, `withLockedAnswer`,
`graphqlLoginName`; type `LockedAnswerOption`.
- **Panel actions from the site's own origin only** (point 3): `requireOwnOrigin`, `guardAdminEndpoints`,
`ADMIN_POST_ENDPOINTS`; type `AdminSameOriginOption`; `reportRefusedOrigin(req, origins?, context?)` takes a third
argument; `iapl-doctor` warns (`csrf-empty`) without `serverURL` or `csrf`.
- **A customer account can no longer create submissions over REST.** `POST /api/form-submissions` (and GraphQL
`createFormSubmission`) needed only a signed-in account of any login collection, so a customer of a visitor
collection could skip the rate limit, Turnstile, the consent tick and the validation, and the form's e-mails went
out. Now: a staff account with its second factor. The site's own forms (`submitForm`, `createSubmitAction`, the file
endpoint) are not affected. Way back: `forms.formSubmissionOverrides.access.create`.
- **Payload's job queue over HTTP: only an admin or the cron secret.** When the project writes no
`jobs.access.run`, `/api/payload-jobs/run` and `/handle-schedules` now answer only an admin signed in with the second
factor (an admin's API key counts) or `Authorization: Bearer <CRON_SECRET>` (16+ characters); before, any signed-in
account of any login collection. **A site whose cron calls the run route:** set `CRON_SECRET` in the app's
environment and send the header; the start log says so when it is missing. In-process runs (`jobs.autoRun`,
`payload jobs:run`) and a project's own rule are not affected; `iapl({ jobsRunAccess: false })` keeps Payload's
default (security.md "Payload's job queue").
- **The consent version only goes up** (point 7): `policyVersionNeverDown`, `buildCookieSettingsFields`,
`buildCookieSettings(options)`; type `CookieSettingsFieldOptions`.
- **IPv6 per network** (point 8): `setIpv6Grouping`, `ipRateKey`; type `Ipv6Grouping`. A second counter per /48 is
available (`wide: 48`), off by default.
#### Added
- `iapl-doctor` deep rule **`visitor-writes`** (warning): on a site with a visitor login collection, every collection
and global whose write rule lets such an account in, Payload's default included.
- `jobsRunAccess`, `withJobsRunAccess`, `jobsRunNotice`, `cronSecretMatches`, `CRON_SECRET_ENV`,
`CRON_SECRET_MIN_LENGTH`; option `jobsRunAccess`; env `CRON_SECRET`.
- `CookieButton` prop `reserve` (the block that gets the room; `false` = off); `COOKIE_BUTTON_RESERVE`,
`COOKIE_BUTTON_SPACE_ATTRIBUTE`, `reserveCookieButtonSpace` (`/client`, type `CookieButtonSpaceOptions`);
`consentDecidedScript` (root); the token `--ipal-cookie-button-space`.
#### Changed
- **What an existing site's visitors see: the "cookie settings" button stays in the bottom corner of the window and
never moves; the footer is a little taller while it is shown**
([consent.md → Where the cookie button sits](./consent.md#where-the-cookie-button-sits-1180)). Until now the button
moved up by the visible part of the footer: on a phone with a tall footer it ended at the top of the screen (over
the header), on a short page in the middle of it. Now it is in the same corner on every page and at every scroll
position. So that it covers nothing at the very end of a page, the footer gets bottom padding while the button is
shown — just enough for its last row to end above the button (measured: the footer's own padding counts, an empty
corner gets nothing; on the reference site 42–43 px on phones and desktop). Not before a decision, not while the
banner is open. No layout shift: for a returning visitor the room is made before the first paint. Same look,
keyboard and screen-reader access unchanged; the side inset now adds the device's safe-area inset.
**Nothing to do; an existing site gets it by updating.** No room: `<CookieButton reserve={false} />`; an amount of
your own: `--ipal-cookie-button-space` on the footer (`0` = none, also per breakpoint); the placement before:
`<CookieButton avoid={COOKIE_BUTTON_AVOID} />` (on `SiteProviders`: `cookieButton={…}`). A site that passes a
selector in `avoid` keeps its behaviour. A project e2e test that expects the button above the footer, or an exact
footer height after a decision, needs an update.
- The reference site (and every new site from `iapl create`): `Pages`, `Posts`, `CaseStudies`, `Media` and the
`Header`, `Footer`, `Company` globals have their own write rules (`adminOrEditor`) instead of Payload's default.
Existing sites: nothing changes; the doctor's `visitor-writes` names what to add where it matters.
- Not built (owner's Q3 answer (a), planned for 2.0): a plugin-wide default for the project's own entities and for
Payload's `payload-locked-documents`.
## 1.17.1 — security fixes from the IAWL review; the panel's sign-in look; the sending method is chosen
> **Read before upgrading.** **MongoDB: no migration. Postgres / SQLite: one migration** — a new column for the
+1
View File
@@ -50,6 +50,7 @@ API details — one file per module:
| Rich text, table of contents | [richtext.md](./richtext.md) |
| Headers, CSP, 2FA | [security.md](./security.md) |
| SEO, metadata, sitemap, JSON-LD, llms.txt | [seo.md](./seo.md) |
| Speed: what the plugin does, what the project does, budgets, measuring, the doctor's performance group | [performance.md](./performance.md) |
| Stats in the admin panel (no cookies; visitor history with consent) | [stats.md](./stats.md) |
| Auto-slug | [slug.md](./slug.md) |
| Light / dark theme, switcher | [theme.md](./theme.md) |
+108 -3
View File
@@ -195,10 +195,26 @@ 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).
access: { read: readPublished(), readVersions: readPublished() }
access: { read: readPublished('admin') }
// 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') }
```
**Where each rule may be used.**
| Rule | Where | What a visitor gets |
|---|---|---|
| `readPublished()` | `access.read` of a collection or global with `versions: { drafts: true }` | published documents: by id, lists, `?draft=true`, GraphQL |
| `readPublishedVersions()` | `access.readVersions` of the same collection or global | published versions: the version list, one version by id (a draft one: `403`), the count, GraphQL, the panel's version view |
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.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,
`GET /api/<slug>/versions?limit=10` → `200` with published versions only, never `500`.
A role name the plugin does not know (`requireRole('Admin')`, `readPublished('superadmin')`) throws where the rule
is written; `hasMinimumRole` / `userMeetsRole` answer `false` for it (before 1.17.1 every staff account met it).
`readPublished` with `?draft=true` on a page whose newest version is a draft answers a visitor `404` (Payload applies
@@ -250,6 +266,10 @@ iapl({
// accounts: { firstUserRoute: 'all' }, // Payload's first-user route for every empty auth collection
// accounts: { firstUserRoute: ['users', 'partners'] },
// accounts: { password: { minLength: 16 } }, // or password: false
// accounts: { lockedAnswer: 'payload' }, // a locked staff account is told it is locked (Payload's answer)
// accounts: { signInLimit: { perAddress: 10, windowMinutes: 15 } }, // or signInLimit: false (Payload's lock as before)
// accounts: { signInSameOrigin: { origins: ['https://panel.example.com'] } }, // or signInSameOrigin: false
// accounts: { confirmOwnChanges: false }, // own e-mail / password without the current password (as before)
// accounts: false, // none of the rules
})
```
@@ -477,10 +497,95 @@ 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.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
it checks the lock **before** the password: the locked account then gets `401 "This user is locked due to having too
many failed login attempts."` for any password, while an address with no account always gets `401 "The email or
password provided is incorrect."`. Five wrong guesses told anybody, without a password, whether an address has a
staff account. Now a staff collection's login answers a locked account exactly like a wrong password — the same
status, body and GraphQL `extensions.name` (`AuthenticationError`) — over REST, GraphQL and the panel's sign-in
form. The lock itself is unchanged: the owner's correct password is still refused until it ends, and the owner is
then told "wrong e-mail or password" (an administrator sees `lockUntil` on the account and can unlock it). Visitor
collections (not staff) keep Payload's answer.
- **Turn off:** `accounts: { lockedAnswer: 'payload' }` (Payload's message), or `accounts: false`. Any other value
stops the start.
- **Building blocks:** `lockedLooksWrong` (the config-level `afterError` hook), `withLockedAnswer(config)`,
`graphqlLoginName(collection)` (`login<SingularName>`, as GraphQL names the mutation).
- **Check:** five wrong passwords for an admin's address, then `POST /api/users/login` with the right one → the same
`401` body as for `[email protected]`; GraphQL `loginUser` → `extensions.name: "AuthenticationError"`.
### A stranger cannot lock a staff account out (`accounts.signInLimit`, 1.18.0)
Payload locks an account after `maxLoginAttempts` wrong passwords (5) for `lockTime` (10 minutes) — wrong passwords
from **anybody**: five posts with no password at all kept the owner out, again and again. Now failed sign-ins to a
staff collection are counted **per client IP and typed address**: after **5 failures in 15 minutes** from one IP for
one address, that IP gets `429` ("Too many failed sign-ins to this address from here. Try again in N min.") for that
address; the owner, from anywhere else, signs in. Payload's own per-account lock stays as the net against a spray
from many IPs, at **50 failures, locked for an hour** — set only where the project did not set
`auth.maxLoginAttempts` / `auth.lockTime` itself (a value you wrote stays; no schema change).
- **Only failures count.** A sign-in takes its place before the password is compared (a burst cannot slip under the
limit) and gives it back when it worked, or when it was refused without a compare. Several correct sign-ins at once
from one place may hear "try again in a moment" — nothing is locked.
- **One count for every spelling** of an address: the typed address is folded like the database that folds the most
(case, full-width and compatibility forms — NFKC — and spaces), so `OWNER@…`, `owner@…` and `owner@…` share it.
The "too many" answer is the same for a real and an invented address.
- **The client IP** is `clientIp()` — pin `IAPL_IP_HEADER` in production ([forms.md](./forms.md)). Requests without
an address share one bucket at 20× the limit (`setUnknownIpFactor`). Server code (the Local API) is never limited.
- **Options:** `signInLimit: { perAddress, windowMinutes, accountLock: { maxLoginAttempts, lockTime } }`;
`accountLock: false` = Payload's lock (5, 10 min) beside the per-IP count; `signInLimit: false` = no per-IP count
and Payload's lock as before. Values that make no sense (`0`, `'false'`) stop the start.
- **Check:** five wrong passwords for an editor with `X-Forwarded-For: 198.51.100.1` (behind one proxy, with
`IAPL_IP_HEADER=x-forwarded-for`), then the right one from there → `429`; from `203.0.113.1` → `200`.
- A staff collection a plugin listed after `iapl` adds is not covered (its config is built after these rules).
### Staff sign-in only from the site's own origin (`accounts.signInSameOrigin`, 1.18.0)
Login, "forgot password" and "reset password" of a staff collection refuse (`403`, before anything is counted or sent)
a request a browser marks as coming from another origin (`Origin`, else `Sec-Fetch-Site`) — over REST and GraphQL.
A foreign page could otherwise sign a visitor's browser into an account of the attacker's choosing (login CSRF), or
make visitors' browsers ask for reset mails. Own origins: the request's host (`Host`, `X-Forwarded-Host`),
`serverURL`, Payload's `csrf` and `cors` lists, and `signInSameOrigin.origins`. A request with neither header (a
script, `curl`, a server) passes. Visitor collections (not staff) are not touched — a shop front end on another
domain keeps signing its customers in. The first refusal of each origin is logged with the ways to allow it.
- **A panel or front end that signs staff in from another origin:** `signInSameOrigin: { origins: ['https://…'] }`.
**Behind a proxy that rewrites `Host`** without `serverURL`: set `serverURL` (or the site's own sign-in is refused).
- **Off:** `signInSameOrigin: false`.
- **Check:** `curl -X POST <site>/api/users/login -H 'Origin: https://other.example' -H 'Content-Type: application/json'
-d '{"email":"a@b.c","password":"x"}'` → `403`.
### Changing one's own e-mail or password asks for the current password (`accounts.confirmOwnChanges`, 1.18.0)
A stolen session alone could take an account over: change the e-mail, then "forgot password". Now an account that
changes its **own** e-mail address, username or password must send its current password — in the panel a
**Current password** field on the account's own page (the plugin's `MaskedField`, already in every site's import
map: no `generate:importmap`), over REST / GraphQL `currentPassword` in the body / `data`. Without it: `400` on the
`currentPassword` field ("Enter your current password…"); wrong: `400` ("The current password is not right."). Wrong
current passwords count like failed sign-ins (`signInLimit`). The field is virtual: never stored, never read back.
- **Not asked:** an administrator changing **another** account; other fields of one's own account; server code
(`overrideAccess`); a request with an API key; "forgot password" / "reset password" (the token is the proof).
- **Scripts that change their own password** add `"currentPassword": "<the old one>"` to the body.
- **Off:** `confirmOwnChanges: false`. A project with its own `currentPassword` field keeps its field and its value (the
rule reads the value from it and does not take it out of the save).
- The check uses Payload's stored hash formats (PBKDF2-SHA256 at 600,000 / 100,000 iterations, and the older
25,000-iteration hashes); a hash format a later Payload adds is refused until IAPL knows it (fail closed — the
user then changes the password through "forgot password").
- **Check:** as an editor, `PATCH /api/users/<own id>` with `{ "email": "new@…" }` → `400`; with `"currentPassword"`
→ `200`. In the panel: Account → the new e-mail and "Current password" → saved.
- **Building blocks** of the three rules: `applySignInRules(collection, accounts)`, `buildSignInBeforeOperation`,
`releaseSignInPlace` (`afterLogin`), `settleFailedSignIn` (config `afterError`), `buildCurrentPasswordField`,
`resolveSignInRules`, `foldSignInName`, `passwordMatches`, `CURRENT_PASSWORD_FIELD`, `SIGN_IN_RULES_MARK` (on the hook); `releaseRateLimit` (gives a
place of `consumeRateLimit` back — for limiters that count failures only).
## Turn off, override, extend
- **Account rules:** `accounts: false`, or one by one — `panelRole`, `adminOnlyCreate`, `adminOnlyWrite`,
`staffOnlyRead`, `firstUserRoute`, `password` (above).
`staffOnlyRead`, `firstUserRoute`, `password`, `lockedAnswer`, `signInLimit`, `signInSameOrigin`, `confirmOwnChanges` (above).
- **Turn off:** leave out `access` — no `roles` field, the auth collection keeps Payload's rules
(or yours). `access.firstUserAdmin: false` stops giving admin to the first account.
- **Override:** `access.staffCollections` (who is staff), `access.authAccess` (injected collection), your own auth collection (wins whole),
+101 -28
View File
@@ -240,14 +240,14 @@ site), **P** = a test in the panel. Full code: PROGRAMISTA.md §2.
| 3a | **Search Console / Bing** | recommended: **domain verification via DNS** (TXT record, deployment.md §6) — the plugin does nothing, the verification fields stay empty; only for URL-prefix verification: code in **Site settings → Search engines** (Google, Bing, Yandex), `generatePageMetadata` adds the `<meta>` itself; sitemap `https://<domain>/sitemap.xml` submitted in GSC and Bing | panel (optional), `verificationFrom` | P |
| 4 | **SEO** — structured data | layout: `<SiteProviders shell={…}>` gives `WebSite` + `Organization` (`sameAs`) from Site settings; local business → `createContentHelpers({ siteJsonLd })` with `buildLocalBusinessJsonLd` (`type`, hours → `formatOpeningHours`); navigation: `<SiteProviders jsonLd={[buildNavigationJsonLd(…)]}>`; page: `createPageRoute` adds `getPageJsonLd` (WebPage/BlogPosting, breadcrumbs, FAQ — `pageJsonLd: { faq }`) | `getSiteShell`, `SiteProviders`, `build*JsonLd`, `getPageJsonLd` | A, S |
| 5 | **GEO** — llms | `src/app/llms.txt/route.ts` (`llmsRoute`) and `src/app/llms-full.txt/route.ts` (`llmsFullRoute`) from `lib/content`; the `buildSummaryField()` field in Pages, `summaryField: 'aiSummary'` in `createContentHelpers` | `llmsRoute`, `llmsFullRoute`, `buildSummaryField` | A, S |
| 6 | **GEO** — Markdown | `src/app/md/[locale]/[[...slug]]/route.ts` (single-language: `src/app/md/[[...slug]]/route.ts`) = `export { markdownRoute as GET } from '@/lib/content'`; `createContentHelpers({ markdownAlternate: true })` (link in `<head>`); `createProxy(…, { NextResponse, markdown: true })` (without it `/md/…` gets redirected to a language) | `markdownRoute`, `markdownAlternate`, `createProxy({ markdown })` | A, S |
| 6 | **GEO** — Markdown | `src/app/md/[locale]/[[...slug]]/route.ts` (single-language: `src/app/md/[[...slug]]/route.ts`) = `export { markdownRoute as GET } from '@/lib/content'`; `createContentHelpers({ markdownAlternate: true })` (link in `<head>`); `createProxy(…, { NextResponse, markdown: true })` (without it `/md/…` gets redirected to a language; the `Accept: text/markdown` answer at a page URL is `private, no-store` + `Vary: Accept` since 1.18.0 — check: `curl -sD- -o/dev/null -H 'Accept: text/markdown' localhost:3000/pl \| grep -i cache-control` → `private, no-store`) | `markdownRoute`, `markdownAlternate`, `createProxy({ markdown })`, `markdown: { negotiate: false }` | A, S |
| 7 | **GEO** — MCP | `src/app/api/mcp/route.ts` = `export { mcpGET as GET, mcpPOST as POST } from '@/lib/content'` (public — AI browses the site: `get_site_info`, `list_pages`, `search_content`, `get_page`); name: `createContentHelpers({ mcp: { serverName } })` | `mcpGET`, `mcpPOST` | A, S |
| 8 | **GEO** — AI bots + IndexNow | robots **lets in** AI bots (default `aiBots: 'allow'`; block only on a client decision); AI bot policy and per-bot exceptions — Site settings → Search engines → AI assistants (works only with `getRobots`); `iapl({ indexNow: true })` + `src/app/indexnow-key.txt/route.ts` (`indexNowKeyRoute`; publishing → Bing/ChatGPT Search within minutes; IndexNow sends nothing with `IAPL_NOINDEX=1`) | `buildRobots`, `getRobots`, `indexNowKeyRoute` | A, S |
| 9 | **Media / R2 / speed** | `Media` with `focalPoint`, `normalizeFilenameHook`, `buildOptimizeUploadHook`, `buildMediaPlaceholderHook` + field; **always** `buildR2Storage(['media'], { s3Storage })` + `@payloadcms/storage-s3`; `R2_*` in `.env.example`; `<MediaPreconnect/>`; `images: buildImagesConfig()` and `buildUploadSecurityHeaders()` in `next.config.ts`; the project's `<Media>` via `mediaImageProps`/`videoProps` (§6.11b) | `buildR2Storage`, `mediaImageProps`, `videoProps`, `buildImagesConfig` | A, S |
| 10 | **Forms** | every form from a **seed** (`scripts/seed-form-*.ts`: fields, confirmation, mail to the company **and** confirmation to the customer, every language); a block with `<RenderForm>` + `formClasses.ts` (look, once); `actions.ts` = `createSubmitAction({ getCachedPayload, headers })`; `forms: {…}` in `iapl`; `email: mailAdapter()` | `RenderForm` (`/rsc`), `createSubmitAction`, `mailAdapter` | A, P |
| 11 | **Turnstile** | `<SiteProviders>` in `[locale]/layout.tsx` (wires `TurnstileProvider` with the key from the panel); `RenderForm` renders the widget; keys in Site integrations | `SiteProviders`, `getTurnstileConfig`, `TurnstileProvider` | A, P |
| 12 | Consent + analytics | Consent Mode: `'advanced'` (default — the Google tag loads at once with every signal `denied`) or `'basic'` (`<SiteProviders analytics={{ consentMode: 'basic' }}>` — no request to Google before consent; a client who wants zero requests), the choice goes to "Project decisions"; the consent log is on by default since 1.17.0 (`consentLog: false` turns it off; **Postgres / SQLite: `pnpm payload migrate:create consent-log` and apply it in the same deploy**, doctor `consent-log-migration`) + `<SiteProviders banner={<CookieBanner settings="detailed" />}>` (posts every decision to the log by itself; "Reject" is as prominent as "Accept all" by default — `equalChoice`; Global Privacy Control honoured by default — `gpc`, consent.md → "Global Privacy Control"; ConsentProvider, banner, CookieButton, Analytics in the right order; the banner is in the server HTML and painted with the page — pages stay static, an inline script decides before the first paint; with a nonce CSP pass `nonce` to `SiteProviders`; never wrap the banner in a "mounted" guard or `dynamic(…, { ssr: false })`, never read the consent cookie in the layout unless the site is dynamic anyway: `consentCookie`, consent.md → "First paint"); settings window mode (`settings`: `inline` / `modal` / `detailed`) per the design, brief is silent → `detailed`, the decision goes to "Project decisions"; tool IDs in the panel; the cookie list from a scan (`cookieScanner: true` → *Cookie review* → **Scan cookies** → *Approve cookies* → **Approve and add**; or cookie-scan → import) — feeds `<CookieTable>` on the policy page **and** the lists in the `detailed` window; Cookies → Settings window → Cookie list headings in every language | consent.md, analytics.md | A, `iapl-consent-check` |
| 13 | Security | `buildSecurityHeaders` in `next.config.ts`; `withSecurityConfig(withPayload(nextConfig))` — this order (no `X-Powered-By`; Payload's colour-scheme client hints for `/admin` only, check: `curl -sI localhost:3000/pl \| grep -i critical-ch` → nothing); CSP: `buildSecurityHeaders({ csp: { mode: 'report-only', reportUri: '/api/csp-report', … } })` + `buildAdminCspHeaders` on `/admin/:path*` + `src/app/api/csp-report/route.ts` (`createCspReportRoute`) → read the reports → `mode: 'enforce'`; `twoFactor: { issuer, plugin: payloadTotp }` + `generate:importmap` (`TotpRedirectProvider`, `SafeTotpView`; check: a new admin lands on `/admin/setup-totp?back=%2Fadmin` with the QR, no reloading; a login with the password only gets `403` from `/api/globals/site-integrations` and `/api/form-submissions` — security.md "What the second factor covers"); own endpoints: `secondFactorPassed(req)` / `userMeetsRole(req, role)`; **an account without 2FA can only set it up** (`twoFactor.requireSetup`, default: nothing else answers, 72 h from creation or an admin's reset, then blocked until an admin chooses "Reopen setup" on the account) — so set 2FA up right after creating an account; `iapl-doctor --url` must report 0 accounts without 2FA; Postgres/SQLite: migration for `totpSetupFrom`; `IAPL_IP_HEADER` in production | security.md, forms.md | A |
| 13 | Security | `buildSecurityHeaders` in `next.config.ts`; `withSecurityConfig(withPayload(nextConfig))` — this order (no `X-Powered-By`; Payload's colour-scheme client hints for `/admin` only, check: `curl -sI localhost:3000/pl \| grep -i critical-ch` → nothing); CSP: `buildSecurityHeaders({ csp: { mode: 'report-only', reportUri: '/api/csp-report', … } })` + `buildAdminCspHeaders` on `/admin/:path*` + `src/app/api/csp-report/route.ts` (`createCspReportRoute`) → read the reports → `mode: 'enforce'`; `twoFactor: { issuer, plugin: payloadTotp }` + `generate:importmap` (`TotpRedirectProvider`, `SafeTotpView`; check: a new admin lands on `/admin/setup-totp?back=%2Fadmin` with the QR, no reloading; a login with the password only gets `403` from `/api/globals/site-integrations` and `/api/form-submissions` — security.md "What the second factor covers"); own endpoints: `secondFactorPassed(req)` / `userMeetsRole(req, role)`; **an account without 2FA can only set it up** (`twoFactor.requireSetup`, default: nothing else answers, 72 h from creation or an admin's reset, then blocked until an admin chooses "Reopen setup" on the account) — so set 2FA up right after creating an account; **the first set-up ends with a link sent to the account's e-mail** (`twoFactor.confirmByEmail`, 1.18.0): e-mail must work first (Site integrations → "Send a test e-mail"; without it the link is only in the server log and an admin confirms on the account page; `iapl-doctor --deep` rule `2fa-enrolment-mail`), `serverURL` must be set (the link is made from it), check: a new editor scans the code → the screen names `e…@…`, `/api/globals/site-integrations` stays `403` until the link is opened in the same browser; `iapl-doctor --url` must report 0 accounts without 2FA; Postgres/SQLite: migration for `totpSetupFrom`; `IAPL_IP_HEADER` in production | security.md, forms.md | A |
| 14 | Operations | `src/app/api/health/route.ts` (`healthRoute`); `src/instrumentation.ts` with `assertEnv(iaplEnvRules({ storage: true, ipHeader: true }))`; staging with `IAPL_NOINDEX=1`; smoke tests (§8a) | `healthRoute`, `assertEnv`, `iaplEnvRules` | A |
| 15 | System pages | Site settings → System pages: homepage, 404, privacy policy, cookies; legal links in the footer by role (`getSystemLinks(locale)`) | `getSystemLinks`, `getSystemPagePath`, `getNotFoundPage` | P |
| 16 | **Nothing hardcoded** | every text, link, image, file, company data from the panel; domains and keys from `.env` (§2) | — | A, P |
@@ -553,26 +553,50 @@ No abbreviations (`HeroSection`, not `HeroSec`). Do not create `lib/pages.ts`,
9. **RSC by default.** `'use client'` only for state/interaction, in a separate file;
the section stays a server component and passes data to it. Secrets: `import 'server-only'`.
10. **Blocks do not import `lib/*`** (cycle). Server-side data → `enhanceProps`.
11. **Next.js 16.4.5 or later** (minimum safe version; the plugin, the reference site and the starter use 16.4.6).
11. **Next.js 16.4.6 or later** (minimum safe version since 1.18.0; the plugin, the reference site and the starter use 16.4.6).
16.0.0–16.4.0 have unauthenticated RCE and DoS advisories (GHSA-2464-fhr4-w9xw, GHSA-673q-mjm6-r5xr,
GHSA-p3m5-59mp-jv5r); 16.3.0–16.4.4 have GHSA-mfr8-8qww-v76h (information disclosure across root params when a
`'use cache'` function is called through `unstable_cache()`, moderate; fixed in 16.4.5). Payload supports no
patched 15.x line. Pin `next` and `eslint-config-next` to the same 16.4.x (≥ 16.4.5):
`'use cache'` function is called through `unstable_cache()`, moderate; fixed in 16.4.5). 16.4.6 is the tested
version; its React copy carries the fix for React's RSC advisory GHSA-xqc2-xf4c-x3h3 (critical, fixed in
`react-server-dom-*` 19.3.1). Payload supports no patched 15.x line. Pin `next` and `eslint-config-next` to the
same 16.4.x (≥ 16.4.6):
`pnpm add [email protected] [email protected]`, and make sure `sharp` resolves to 0.35.5 or later
(`pnpm why sharp`). The plugin's peer range stays open (`next >=15`) — the minimum is yours to keep.
**Check:** `pnpm ls next sharp` → next ≥ 16.4.5, sharp ≥ 0.35.5; `pnpm exec iapl-doctor` → no `next-min`
**Check:** `pnpm ls next sharp` → next ≥ 16.4.6, sharp ≥ 0.35.5; `pnpm exec iapl-doctor` → no `next-min`
finding; `pnpm dev` prints no security-upgrade warning.
**GHSA-xqc2-xf4c-x3h3 in Next (security audit 2026-12, O1, settled):** Next vendors its own React copy
(`next/dist/compiled/react-server-dom-{webpack,turbopack}`), labelled `19.3.0-canary-278794d7-20261002`. That
label is older than the fix, but the code carries it: compared with React's fix commit 0c9913ae (#37846), the
vendored server has the new backing-store reads (`getBackingBlob`), stream chunks under their own `"S"` key, and
the fix's new error 612 ("Cannot transport a detached buffer"), and none of the old helpers. `pnpm audit` does not
flag `next` for it (the advisory names `react-server-dom-*`, not `next`). After a Next upgrade, check the same way:
`grep -c "detached buffer" node_modules/next/dist/compiled/react-server-dom-webpack/cjs/*server.node.production.js` → 1.
12. **No open production advisories.** Node.js 20 or later for the plugin itself (its `nodemailer` 10 requires it);
**Payload 3.94 needs Node.js 22.23.5 or later** on the 22 line (`engines`: `">=22.23.5 <23"`, `.nvmrc` `22`), locally,
in CI and in Coolify (Nixpacks takes the major from `engines` / `.nvmrc` and the patch from its own release: check
`node -v` in the app's Terminal; below 22.23.5, update Coolify before moving to Payload 3.94). Run
`pnpm audit --prod`. The plugin's own dependencies are clean; what remains comes from Payload's tree, which only
the project's lockfile can fix. With `payload` **3.94.x** two packages are still pinned below a fix and need
`pnpm.overrides` next to the `@payloadcms/*` ones:
the project's lockfile can fix. With `payload` **3.94.x** four packages are still below a fix in a lockfile and
need `pnpm.overrides` next to the `@payloadcms/*` ones:
```json
"cross-spawn@>=7 <7.1.0": "^7.1.2",
"dompurify@<3.4.17": "^3.4.17",
"happy-dom@<21.0.4": "^21.0.4"
"happy-dom@<21.0.4": "^21.0.4",
"ws@>=8 <8.23.0": "^8.23.0"
```
`ws` comes from `payload` (`^8.16.0`): GHSA-37g9-w4hg-h9qr (high, memory exhaustion through unbounded automatic
pong responses, published 2026-12-01) is fixed in 8.23.0. Payload's range allows it, but a lockfile made earlier
keeps 8.21 / 8.22 until it is updated; the override lifts it in every lockfile and does nothing once it resolves
8.23 or later. `iapl-doctor` (`transitive-min`) warns while an older one is installed. `cross-spawn` comes with `cross-env` (the
site's scripts) and `eslint`: GHSA-ghv9-86vm-4v8m (critical, command injection when spawning batch files, Windows
only, published 2026-12-01) is fixed in 7.1.0; Coolify runs Linux, but `pnpm audit --prod` reports it as critical.
**Postgres sites** also add `"esbuild@<0.25.0": "^0.25.12"`: `@payloadcms/db-postgres` → `drizzle-kit` →
`@esbuild-kit/*` brings esbuild 0.18 (GHSA-67mh-4wv8-2f99, moderate: esbuild's own dev server answers any origin;
drizzle-kit never starts that server, but `pnpm audit --prod` lists it). The plugin's own tests run the Postgres
adapter on 0.25 with this override. A project that runs `@payloadcms/eslint-config` also adds
`"eslint@>=9 <9.39.4": "^9.39.4"` and `"minimatch@>=7 <11.0.8": "^11.0.10"` (dev tooling: GHSA-xffm-g5w8-qvg7 in
`@eslint/plugin-kit` 0.2, GHSA-g3hv-75wg-m249 and GHSA-c859-jr93-m5j4 in `minimatch` 9 / 10; the plugin's lint
gives the same results with them).
`happy-dom` comes from `@payloadcms/richtext-lexical` → `@lexical/headless` 0.50 (`^20.9.0`, still so in 3.94.1);
every 20.x has GHSA-c8p4-j97h-3vg8 (high, SSRF when parsing untrusted HTML, fixed in 21.0.0) and
GHSA-834v-8h66-3h79 (high, host code execution, fixed in 21.0.4). 21 is a major, but only
@@ -636,12 +660,20 @@ for visitors. Then, all four:
`access.staffCollections` is for a second collection of STAFF (access.md → "Who is staff").
3. In every auth collection use `adminOrSelfIn('<its slug>')`, 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`. 2FA covers the panel's collection only.
Give every collection and global explicit `access` (writes: `adminOrEditor`, as the reference site's collections
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".
5. Never let a sign-up write a field that grants rights (`roles`, `isAdmin`, …): give such a field
`access: { create: adminOnlyField, update: adminOnlyField }`.
6. Check: log in as such an account (`POST /api/customers/login`), then `GET /api/globals/site-integrations`,
`GET /api/form-submissions` and `GET /api/users` with its token must answer `403`, and so must
`POST /api/setup-totp`.
`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.18.0 only an admin or `Authorization: Bearer <CRON_SECRET>` (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").
**NEVER:** a second `media`, `daneFirmy`/`settings`/
`navigation`/`footer` as collections (they are globals), FAQ/hero/features as collections
@@ -1035,22 +1067,31 @@ Example `styles.css`: [section-code.md](./skills/iapl-block/resources/section-co
125 % and 150 % zoom at 1366 (common on Windows). No horizontal scroll, no clipped text,
the menu works, the hero CTA is visible.
### 6.11b Speed (Core Web Vitals)
### 6.11b Speed (Core Web Vitals) — the handbook is [performance.md](../performance.md), the skill `iapl-performance`
| What | How | Forbidden |
|---|---|---|
| LCP image (the first visible one, usually the hero) | `<Media priority>` — exactly one per page | `priority` on many images, the hero as a CSS `background-image` |
| every other image | `<Media sizes={MEDIA_SIZES.third}>` — `sizes` = the width on screen | no `sizes` (downloads the full width), `<img>` |
| LCP image (the first visible one, usually the hero) | `<Media priority>` — exactly one per page (preload + `fetchpriority="high"`) | `priority` on many images, the hero as a CSS `background-image`, a lazy hero |
| above the fold, not the LCP (header logo) | `<Media eager>` — loads at once, no high priority, no preload | `priority` on the logo (it competes with the hero) |
| every other image | `<Media sizes={MEDIA_SIZES.third}>` — `sizes` = the width on screen; lazy by default | no `sizes` (downloads the full width), `<img>` |
| placeholder | `buildMediaPlaceholderHook` + a field in Media (blur + color) | empty boxes that "jump in" while loading |
| background video | `videoMode="background"`, MP4 H.264 ≤ 20 MB, no sound, with a poster | a video as the hero without a poster, `autoplay` with sound |
| uploads | `buildOptimizeUploadHook` (stops images over 1.5 MB / 2560 px, converts on request, removes JPEG/PNG metadata — GPS, camera — without re-encoding; `stripMetadata: false` keeps it); `iapl-doctor --deep` counts stored images over the limits | 8 MB phone photos in the library |
| background video | `videoMode="background"`, MP4 H.264 ≤ 20 MB, no sound, with a poster; paused for "reduce motion" by itself (`pauseForReducedMotion={false}` turns that off) | a video as the hero without a poster, `autoplay` with sound |
| video with content | `videoMode="player"` (loads after a click) | `preload="auto"` |
| YouTube | `<YouTubeEmbed>` from `/client` (the iframe only after a click) | a bare `<iframe src="youtube.com/embed…">` |
| next.config | `images: { ...buildImagesConfig() }` (AVIF/WebP, R2) | no `remotePatterns` → images from R2 without optimization |
| fonts | `next/font`, max 2 families × 2–3 weights, `subsets: ['latin', 'latin-ext']` (PL), `display: 'swap'` | a `<link>` to Google Fonts, 6 weights "just in case" |
| third-party scripts | `Analytics` (via `SiteProviders`, `analytics={{ defer: true }}`) / `ConsentScript` from the plugin | chat/map widgets loaded at start |
| client components | small, interaction only (§6.9) | a whole section `'use client'` |
| YouTube, maps, widgets | `<YouTubeEmbed>` from `/client` (the iframe only after a click); a map behind a click (a picture + a button) | a bare `<iframe>` that loads with the page |
| next.config | `images: buildImagesConfig()` (AVIF/WebP, R2, 31-day cache) | no `remotePatterns` → images from R2 without optimization |
| fonts | `next/font`, max 2 families, variable, `subsets: ['latin', 'latin-ext']` (PL), `display: 'swap'`; the heading font `preload: false` (the starter's default: the stylesheet and the hero load first) | a `<link>` to Google Fonts, `display: 'block'`, 6 weights "just in case" |
| third-party scripts | `Analytics` (via `SiteProviders`, `analytics={{ defer: true }}`) / `ConsentScript` from the plugin; `next/script` for anything else | `<script src>` without `async` in the layout, chat/map widgets loaded at start |
| animations | `transform` / `opacity` only (the library's card hover fades a shadow layer), the token durations (`duration-fast`, reduced motion built in) or `motion-reduce:`; IntersectionObserver for "is it on screen" | animating `height` / `top` / `margin`, `transition-all`, a `scroll` listener doing work per event |
| client components | small, interaction only (§6.9); import from `@intecion/ipal-kit/client` freely — a page ships only what it renders; `BuilderForm` and `Turnstile` there load their code only where a form is shown (`/client/eager` for the eager ones, `RenderForm Form={…}`); the Turnstile widget's 73 px are kept free (`turnstileReserveHeight={0}` for an invisible widget) | a whole section `'use client'`; an empty box that a widget fills later |
| 404 | `createNotFoundPage({ load, placeholder })` with a block as tall as the 404 content (reference `not-found.tsx`) | a lazy 404 that moves the footer |
| data | the cached helpers of `lib/content` (`getSettings`, `resolveRoute`, `getSiteShell`…), `depth` as low as the page needs, `select` when you need one field, `cache()` around your own getters | `findGlobal` in a component without `cache()`, `depth: 2` "to be safe", a query per list item |
| what grows | logs with a retention (consent log 1095 days, statistics 90 — on MongoDB a TTL index deletes them by itself, `ttlIndex: false` turns it off; `forms: { submissionRetentionDays }` on the client's decision), `versions: { maxPerDoc: 20 }` where you turn versions on (the plugin's own entities get 20 by themselves), unused media reviewed in the panel (`iapl({ unusedMedia: true })`, then `pnpm generate:importmap`); `iapl-doctor --deep --only growth` ([performance.md](../performance.md) §6) | `maxPerDoc: 0`, submissions kept forever without a decision, a persistent volume on `.next` |
| budgets | `e2e/performance.spec.ts` from the `iapl-performance` skill (`perfBudgets()` from `/doctor`): fails when a page gets slower | "it felt fast on my machine" |
Target on the built site (mobile, Lighthouse/PageSpeed): LCP < 2.5 s, CLS < 0.1, INP < 200 ms.
Checks: `iapl-audit` (img/video outside Media, many `priority`, `h-screen`, fixed widths,
Target on the built site (mobile, Lighthouse/PageSpeed): LCP < 2.5 s, CLS < 0.1, INP < 200 ms — the plugin's default
budgets (`PERF_BUDGETS`). Checks: `iapl-doctor --only performance` — **errors** since 1.18.0, an accepted exception lowered or silenced with a reason in `iapl-doctor.json` (images config, fonts, render-blocking, embeds,
animations, a budget test; `--url`: compression, blocking scripts, preloads, a lazy first image, HTML size; `--deep`:
stored images over the limits), `iapl-audit` (img/video outside Media, many `priority`, `h-screen`, fixed widths,
YouTube `<iframe>`) and `iapl-seo-check` (images without dimensions, LCP image without priority).
### 6.12 Exports and imports
@@ -1103,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 with drafts: `access: { read: readPublished(), readVersions: readPublished() }` (editors read drafts, everybody else published only — Payload's open `read: () => true` answers `?draft=true` with the draft; verify: `GET /api/<slug>/<draft id>?draft=true` without a session → 404); 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/<slug>/<draft id>?draft=true` → 404 and `GET /api/<slug>/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**
@@ -1114,7 +1155,9 @@ project → **plugin gap**, not a copy.
| Legal links in the footer (href + page title) | `getSystemLinks(locale)` / `resolveSystemLinks` | links.md |
| Highlighted item, button variant | `buildLinkField({ appearances: [...] })` — the project's names | links.md |
| Language paths, switcher, hreflang | `getLocalizedSlugs`, `switchLocalePath`, `LanguageSwitcher`, `buildLocalizedPath` | i18n.md |
| Safe URL (no `javascript:`) | `safeHref` | links.md |
| Safe URL (no `javascript:`) | `safeHref`; a text field for an address rendered into `href`: `buildUrlField({ schemes })`, `isAllowedUrl`, types `BuildUrlFieldOptions`, `UrlScheme` (security.md "Addresses rendered into `href`") | links.md, security.md |
| Lists and sorting from outside | `listLimit`, `refuseOperatorSort`, `lockedDocuments` (options); `buildQueryGuardHook`, `applyQueryGuard`, `capListLimit`, `isOperatorSort`, `isStaffRequest`, `isQueryGuardHook`, `QUERY_GUARD_MARK`, `RefusedSortError`, `DEFAULT_LIST_LIMIT`, `applyLockedDocumentsAccess`, `staffOnlyLocks`, `LOCKED_DOCUMENTS_SLUG`; types `ListLimitOptions`, `LockedDocumentsAccess` | security.md |
| Markdown negotiation, cache-safe | `MARKDOWN_NEGOTIATED_HEADER`, `NEGOTIATED_CACHE_CONTROL`, `appendVary`, `markdownResponse(md, { negotiated })` | content.md |
**Forms**
| Need | Use | Doc |
@@ -1151,7 +1194,7 @@ project → **plugin gap**, not a copy.
| Enlarge an image (card, gallery, product, rich text) | `<SiteProviders lightbox>` + `<LightboxTrigger group image={lightboxImage(media, { size })}>` (`/client`), `RenderRichText lightbox`, `useLightbox`; labels: `iapl({ lightbox: true })` → Form messages → Image viewer | lightbox.md |
| YouTube without cookies before a click | `<YouTubeEmbed poster={…}>` (`/client`) — always pass an uploaded poster (without it the thumbnail comes from Google before any choice; a development warning says so) | storage.md |
| `next.config` | `buildImagesConfig`, `buildSecurityHeaders` (`csp`), `buildCsp`, `buildCspHeaders`, `buildAdminCsp` / `buildAdminCspHeaders`, `buildUploadSecurityHeaders`, `withSecurityConfig` (the OUTER wrapper: hides `X-Powered-By`, keeps Payload's `Accept-CH` / `Critical-CH` / `Vary` colour-scheme hints on the admin only; `adminClientHints: { route, sources } \| false`), `scopeColorSchemeClientHints`, `adminClientHintSources`, `COLOR_SCHEME_CLIENT_HINT` | storage.md, security.md |
| CSP reports, nonces | `createCspReportRoute` (`parseCspReports`, type `CspViolation`), `createProxy({ csp })` + `<SiteProviders nonce>` (dynamic pages only), `createCspNonce`, `CSP_NONCE_HEADER`, `buildReportingEndpoints`, `cspHeaderKey`, `DEFAULT_CSP_REPORT_GROUP`; types `BuildAdminCspArgs`, `CspDirective`, `CspSources`, `CreateCspReportRouteArgs`, `WithSecurityConfigOptions` | security.md |
| CSP reports, nonces | `createCspReportRoute` (`parseCspReports`, `cspLogLine`, `CSP_LOG_VALUE_MAX`, type `CspViolation`), `createProxy({ csp })` + `<SiteProviders nonce>` (dynamic pages only), `createCspNonce`, `CSP_NONCE_HEADER`, `buildReportingEndpoints`, `cspHeaderKey`, `DEFAULT_CSP_REPORT_GROUP`; types `BuildAdminCspArgs`, `CspDirective`, `CspSources`, `CreateCspReportRouteArgs`, `WithSecurityConfigOptions` | security.md |
| Fluid typography and spacing | `fluid.css` / `fluid-wide.css` (`--ipal-*` variables); your own sizes: `fluidClamp`, `FLUID_SCALE`, `FLUID_RANGES` | design-tokens.md |
| Brand colours, fonts, radii, motion, dark mode | `tokens.css` + `tailwind.css`, `src/design/tokens.ts` (`defineTokens`, types `TokensInput`, `ColorInput`, `ColorRole`), `pnpm exec iapl-tokens` (`--check`, `--report`, `--warn-only`); building blocks `tokensToCss`, `defaultTokensCss`, `contrastReport` (`ContrastRow`), `contrastRatio`, `parseColor`, `resolveColors`, `IAPL_TOKENS`, `iaplVar`, `IaplTokenName`, `IAPL_BREAKPOINTS`, `COLOR_DEFAULTS`, `STATIC_DEFAULTS`, `FLUID_TOKENS`, `INVERSE_SCOPE`, `LEGACY_DARK_ROLES`, `LIGHT_SELECTOR`, `DARK_SELECTOR`, `INVERSE_SELECTOR`, `RemValue`, `FluidRange` | design-tokens.md |
| Accessibility widget CSS | `@intecion/ipal-kit/a11y.css` (works through the tokens) | accessibility.md |
@@ -1161,6 +1204,7 @@ project → **plugin gap**, not a copy.
|---|---|---|
| Banner, settings, cookie button | `<SiteProviders banner={<CookieBanner …/>}>`, `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.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 <page> \| 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 | `<CookieBanner settings="inline" \| "modal" \| "detailed">` — do not build your own window or cookie list | consent.md → "Large window with details" |
| A consent-dependent script | `ConsentScript` | consent.md |
@@ -1217,6 +1261,10 @@ 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 <site>/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.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" |
| Consent log on (since 1.17.0; Postgres / SQLite: a migration in the same deploy) | `consentLog: false`; one layout: `logEndpoint={false}` | `consentLog: { retentionDays, collectionOverrides }`; `buildConsentLogCollection` / `buildConsentLogEndpoint`, `CONSENT_LOG_PATH` |
| Global Privacy Control honoured: no banner, analytics and marketing off, no Google request also in Consent Mode `advanced`; a grant made without the signal is switched off when it appears | `gpc={false}` (doctor warns) | `gpc="ask"`; `resolveConsent`, `gpcFromHeaders`, `consentBannerScript({ gpc })` |
| "Reject" styled like "Accept all" (`equalChoice`) | `equalChoice={false}` (doctor warns) | `classNames.rejectButton` |
@@ -1227,11 +1275,22 @@ 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.18.0). The panel's buttons are not affected; set `serverURL` (doctor `csrf-empty` warns without it). **Verify:** `curl -X POST <site>/api/ipal/test-email -H 'Origin: https://other.example' -H 'Content-Type: text/plain' -b <admin cookies> -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 '<site>/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}' '<site>/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` |
| CSP report log lines normalised (1.18.0, audit F1): origin of the blocked resource, path of the page, no control characters, every value ≤ 128 characters; at most 10 violations per request, 60 requests per client a minute (answer stays `204`) | `rateLimit: false`; your own `onReport` (gets the raw values) | `createCspReportRoute({ maxReports, rateLimit: { max, windowMs }, onReport })`, `cspLogLine` |
| Markdown negotiated at a page URL is `private, no-store` + `Vary: Accept`; HTML keeps Next's own `Vary` and caching (1.18.0, audit F3); `/md/…` stays publicly cacheable | `markdown: { negotiate: false }` (Markdown only at `/md/…`) | `markdown: { prefix }`; `MARKDOWN_NEGOTIATED_HEADER`, `appendVary` for your own proxy |
| 2FA first set-up confirmed by e-mail (1.18.0): the code only starts it; a link to the account's own address, opened in the same browser within 30 min, turns it on and ends the account's sessions; notice mails on every enrolment, change, removal / reset; without working mail the link goes to the server log and an admin confirms on the account page ("Confirm the waiting set-up", `POST /api/iapl/two-factor/confirm-pending`). **Verify:** security.md "Set-up confirmed by e-mail" → Verify; doctor `2fa-enrolment-mail` | `twoFactor.confirmByEmail: false` | `confirmByEmail: { linkMinutes, sameBrowser, adminConfirm, logLinkWhenMailFails, notices, maxMailsPerHour }`; `startEnrolment`, `buildEnrolmentEndpoints`, `buildTotpNoticeHooks`, `sendTwoFactorNotice`, `verifyTotpCode`, `readPendingEnrolment`, `pendingEnrolmentInfo`, `countPendingEnrolments`, `mailConfigured` |
| 2FA verify and setup attempts only from the site's own origin: a request a browser marks as coming from elsewhere (`Origin`, `Sec-Fetch-Site`) gets `403` and is not counted. The admin's reset `POST /api/ipal/two-factor/reset` follows the same rule (1.17.1). **Verify:** `curl -X POST <site>/api/ipal/two-factor/reset -H 'Origin: https://other.example' -H 'Content-Type: text/plain' -b <admin cookies> -d '{"userId":1}'` → `403`; the panel's button still works. **Set `serverURL`**: behind a proxy that rewrites `Host` and sends no `X-Forwarded-Host` the site's own page is refused without it (logged once per origin: `[iapl] 2FA: a code from origin … was refused`) | `twoFactor.sameOrigin: false` | `sameOrigin: { origins: ['https://app.example.com'] }`; `requestFromOwnOrigin`, `reportRefusedOrigin` |
| Stored secrets are write-only: `smtpPassword` and `turnstileSecretKey` come back as `'********'` over REST, GraphQL and in the panel; an empty save keeps the value, `'[[clear]]'` removes it; server code reads the real value with the Local API. A query cannot name a secret (1.17.1): `where` / `sort` on it — REST, GraphQL, versions — is refused (`secretReadAccess`, the field's `read` rule; verify: `GET /api/globals/site-integrations/versions?where[version.smtpPassword][exists]=true` as an admin → 400 `QueryError`, no `totalDocs`). **The panel is the source — never add an env variable for them** (`TURNSTILE_SECRET_KEY` is deprecated) | `secrets: { writeOnly: false }` | `writeOnlySecret(field)` / `writeOnlySecrets(fields, names)` for your own secret fields; with versions on the entity add `hooks.afterRead: [maskSecretsOnRestore]` |
| 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.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 <site>/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/<own id> {"email":"…"}` → `400`, with `"currentPassword"` → `200` | `accounts: { confirmOwnChanges: false }` | `buildCurrentPasswordField`, `passwordMatches`, `CURRENT_PASSWORD_FIELD` (access.md) |
| A password set on a staff account has at least 12 characters and is not the e-mail address; existing passwords are not checked | `accounts: { password: false }` | `password: { minLength }`; `checkPassword`, `buildPasswordRuleHook` |
| While Turnstile cannot check (wrong secret, Cloudflare down): a text form is accepted, a form with files is refused | `forms: { turnstileOnConfigError: 'allow' }` | `'reject'`, `{ text, files }`; `turnstileOnConfigError` at a call site wins |
| Dashboard alerts by role: integration details for admins, a neutral line for editors, nothing for others; cookie alerts for editors and above. `'all'` checks nothing — no role, no second factor | `dashboardAlerts: { integrations: 'all', cookies: 'all' }` | `integrations: 'editor'`; the components' `details` / `audience` props |
@@ -1240,12 +1299,13 @@ 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.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::<n>` → `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 `<Analytics>` props (`SiteProviders analytics={false}`) |
| Locale cookie: consent read under its own stored version | — | `createProxy(config, { policyVersion })` / `createLocaleMiddleware({ policyVersion })` |
| No `X-Powered-By` (with `withSecurityConfig`) | `withSecurityConfig(config, { hidePoweredBy: false })` | — |
| Payload's colour-scheme client hints only on `/admin/:path*` (with `withSecurityConfig` outside `withPayload`) | `withSecurityConfig(config, { adminClientHints: false })` | `{ adminClientHints: { route, sources } }`, `scopeColorSchemeClientHints(rules, sources)` |
| CSP off until `buildSecurityHeaders({ csp })`; then hard rules, `'unsafe-eval'` only in dev | leave out `csp` | `buildCsp({ extra, override, strictDynamic, dev })`, `buildAdminCsp({ extra, override })`, `createCspReportRoute({ onReport, maxBytes })`, your own string via `additional` |
| CSP off until `buildSecurityHeaders({ csp })`; then hard rules, `'unsafe-eval'` only in dev | leave out `csp` | `buildCsp({ extra, override, strictDynamic, dev })`, `buildAdminCsp({ extra, override })`, `createCspReportRoute({ onReport, maxBytes, maxReports, rateLimit })`, your own string via `additional` |
| Construction mode hides pages in Markdown, MCP | `markdown: { isPathVisible: () => true }`, `mcp: { isPathVisible: () => true }` | `isPathVisible`, `isPathVisibleIn(mode, path)`, `pathOf(url)`, type `PathVisibility` |
| Construction mode filters the sitemap and llms.txt | `underConstructionSeo: false` | `include` / `getIncludedPaths` in the low-level builders |
| `getSettings` at `depth: 1` | — | `createContentHelpers({ settingsDepth: 2 })` (every request pays) |
@@ -1318,8 +1378,12 @@ reports `mail-method` info (nothing picked yet) or nothing (picked and usable).
3. The server may call `https://webservices.intecion.net`.
4. Site integrations → E-mail sending: "Sender name" (else the site name is used) and **"Sender address"** — with
the mail service that is where replies go; the service's own address has no mailbox.
5. Nothing to arrange with Intecion: a site that passes the call-back is active at once (`relay-pending`, held for
approval, is the exception — the panel says so).
5. **A person of Intecion connects the site** (contract 1.8.0): after its first e-mail (or the button) the site waits
(`relay-pending`). Site integrations → E-mail sending → **"Połącz z IWSN"** opens the service's confirmation page in a
new tab; a person of Intecion signs in with an `@intecion.com` address and presses "Potwierdź"; the block shows
"Connected to IWSN" by itself (it asks every 5 s for 10 min, and on every load while the site waits). Tell the owner
that step is theirs. Nothing to paste, no token. Opt-out: `mail: { relay: { connectButton: false } }` (no button, no
route). **Verify:** `iapl-doctor --deep` has no `mail-relay-connect` error; a test e-mail answers "through IWSN".
6. **Launch needs nobody:** a site enrolled on its development address and then served on the real domain (or moved
to another domain) enrols by itself on its first e-mail. **A non-public copy does not send by itself:** a site
whose host matches `iapl({ developmentHosts })` — default `['*.dev.netscale.pl']`, Intecion's development
@@ -1369,6 +1433,7 @@ overrides per adapter; `resolveRelayOptions` reads what is in effect):
| `otherHosts` | `'auto'` | a database holding another host's connection: a public site enrols by itself (launch, a move), a non-public one (`IAPL_NOINDEX=1` / `developmentHosts`) neither enrols nor sends until "Connect again"; a list of the site's own other hosts; `'wait'` (a public site without a connection waits too); `'enrol'` (no rule) |
| `developmentHosts` | `iapl({ developmentHosts })`, default `DEFAULT_DEVELOPMENT_HOSTS` = `['*.dev.netscale.pl']` (`pluginDevelopmentHosts`) | host patterns (`*`) of development and staging addresses, for the mail service alone: a site there is non-public for `otherHosts` with no env (`siteIsNonPublic`, `siteNonPublicSignal` → `NonPublicSignal`, `matchDevelopmentHost`, `isDevelopmentHost`); `[]` = none. Checked when the config is built (`assertDevelopmentHosts`): not an array of non-empty host patterns, or a lone `*` → the site does not start; Unicode patterns are punycoded, a trailing dot and the port are ignored |
| `enrol` | `'auto'` | `'manual'` (only "Connect again" / `enrolRelay`), `false` (token from `token` / `setRelayToken`) |
| `connectButton` | `true` | `false`: no "Połącz z IWSN" and no `POST /api/iapl/mail-relay/connect-link`; confirm by an operator or with `requestRelayConnectLink` |
| `accessKeyField` | `false` | `true`: admins get "Enter an access key" in the state block (a hand-issued token) |
| `token` | — | a token from elsewhere; nothing is stored, the site does not enrol |
| `senderName` | panel → site name (`relaySenderName`) | fixed name or function |
@@ -1402,6 +1467,7 @@ needs more: Intecion raises the limits, or SMTP.
|---|---|
| The transport alone, no SMTP / Graph | `email: relayAdapter()` (`RelayAdapterArgs`) |
| Enrol from a deploy script; state; rotate; disconnect; a token issued by hand | `enrolRelay` (`EnrolResult`), `getRelayStatus` (`RelayStatus`), `rotateRelayToken`, `disconnectRelay`, `setRelayToken` |
| A button of your own for the confirmation by Intecion | `requestRelayConnectLink(payload)` (`ConnectLinkResult`: `{ state: 'pending', connectUrl, expiresAt }` / `{ state: 'active' }` / a refusal) on a person's click only; open `connectUrl` in a new tab with `noopener noreferrer`; never store, log or fetch it; `isRelayConnectUrl(url, base)`; the route `RELAY_CONNECT_LINK_PATH`; the stand-in `createFakeRelay({ connect })` + `relay.confirmConnect(url)` |
| Your own state block or panel route | `mailPanelState` (`MailPanelState`), `relayPanelEndpoints`, `relayConfirmEndpoint`; the plugin's component is `MailRelayStatus` (`/admin`) |
| One message with the retry rule; one HTTP call | `sendThroughRelay` (`RelaySendContext`, `RelaySendResult`), `relayRequest` (`RelayCall`, `RelayAnswer`, `RelayRefusal`) |
| The request the service takes | `buildRelayMessage` (`BuildRelayMessageArgs`, `BuiltRelayMessage`, `RelaySendRequest`), `bareAddress`, `bareAddresses`, `cleanSubject` |
@@ -1435,6 +1501,9 @@ its own tests). Order from the cheapest:
| Site in the browser | `iapl-seo-check`, `iapl-consent-check`, `cookie-scan` | before handover, after deploy |
| Closed doors (Playwright) | `iapl-audit/resources/closed-doors.spec.template.ts` → `tests/closed-doors.spec.ts`: every door that must stay closed, asked on a production build as anonymous, customer and editor; add the project's own doors (security.md "Closed doors from outside") | before every release and after every IAPL / Payload update |
| Routes judged | `iapl-audit/resources/routes.template.ts` → `tests/routes.ts`; `pnpm payload run tests/routes.ts` against the committed `tests/routes.snapshot.json`, one reason per route; `… update` after an upgrade (security.md "Routes nobody has judged") | in CI, and after every IAPL / Payload / plugin update |
| Security, code | `pnpm exec iapl-doctor --only security`: headers, CSP, 2FA, account rules and the static rules over your code (`code-patterns`: unescaped HTML / JSON-LD, `overrideAccess: true` or a Local API `user` without `overrideAccess: false` where a request reaches, a `where` from the request, `eval`, `NEXT_PUBLIC_` secrets, redirects and fetches to an address from the request; `config-dangerous`). A correct place: `// iapl-security-ok: <why>` (security.md "Security suites") | before every "done", in CI |
| Attack probes (Playwright / doctor) | `iapl-audit/resources/attack-probes.spec.template.ts` → `tests/attack-probes.spec.ts` on a production build or staging (secret files, bundle secrets, proxy bypass, open redirect, cache poisoning, NoSQL operators, anonymous where / draft / GraphQL reads, error leaks, unbounded lists, `/_next/image`, 8 MB bodies); add a probe per custom endpoint in `EXTRA`. On the live site: `pnpm exec iapl-doctor --url https://<domain> --only live-probes` (changes nothing) | before every release, after every IAPL / Payload / Next update, and after deploy (live) |
| Dependencies | `pnpm audit --prod` (the doctor's `deps-audit`): no high or critical; see §4 for the minimum Next / sharp / Payload | before every deploy |
| Project logic | vitest for your own functions (mapping company data to JSON-LD, helpers, hooks, migration scripts with `--dry-run`) | when you write logic the plugin does not have |
| Panel | the editor test (§11) and the empty-block test (§6.5a) | every new block / global |
@@ -1543,6 +1612,8 @@ block library — [doctor.md](../doctor.md)):
bash .agents/skills/iapl-audit/scripts/audit.sh
pnpm exec iapl-doctor # + --deep --url http://localhost:3000 on the built site
node .agents/skills/iapl-seo-check/scripts/seo-check.mjs http://localhost:3000
pnpm test:e2e e2e/performance.spec # the budget gate (iapl-performance) on the built site
pnpm exec iapl-doctor --deep --only growth # what grows: sizes, versions, retention, old submissions, unused media
pnpm generate:types && pnpm tsc --noEmit
pnpm build # --webpack in the script; locally, not only dev
# hardcoding and the field zoo in blocks
@@ -1603,6 +1674,7 @@ Anything that needs a developer → move it to the panel.
| Rich text | [richtext.md](../richtext.md) |
| Headers, CSP, 2FA, panel path | [security.md](../security.md) |
| SEO, metadata, sitemap, JSON-LD, llms.txt | [seo.md](../seo.md) |
| Speed: what the plugin does, what the project does, budgets, measuring, the doctor's performance group | [performance.md](../performance.md) |
| Auto-slug | [slug.md](../slug.md) |
| Media: collection, file names, optimization, placeholders | [media.md](../media.md) |
| Image lightbox (enlarge, galleries, rich text images) | [lightbox.md](../lightbox.md) |
@@ -1684,6 +1756,7 @@ the task matches — manually: `/<name>`.
| `iapl-debug` | anything does not work — procedure + a symptom → cause → fix table |
| `iapl-audit` | before every "done" — the §0b set + the §11 checks + panel (§6.5a) + hardcoding in JSX + tsc + build |
| `iapl-seo-check` | the running site through the eyes of Googlebot and AI agents (head, canonical, hreflang, sitemap, 404, JSON-LD, llms, Markdown, MCP) |
| `iapl-performance` | speed: the doctor's performance group, measuring the built site (phone and desktop), the budget gate `e2e/performance.spec.ts` (`resources/`), reading LCP / CLS / INP / bytes / queries — when building pages or blocks, before handing over, whenever "slow" or PageSpeed comes up |
| `iapl-consent-check` | browser: no tracking pixels or cookies before consent; the Google tag may load before consent only in Consent Mode `advanced` (all signals `denied`) — a client who wants zero requests gets `consentMode: 'basic'` |
| `iapl-doctor` | the whole site against the team standard in one command (`pnpm exec iapl-doctor`): versions, Node 22, layout, database names, env, headers, CSP, 2FA, cookie scanner, adminMeta, AGENTS.md, skills, seeds, block library, pnpm audit; `--url` / `--deep` for the running site and the database; `--strict` in the CI of a new site |
| `iapl-plugin-gap` | IAPL has a bug or is missing a feature — report to the owner, wait for the decision; a marked workaround only after approval |
+72 -59
View File
@@ -2,7 +2,7 @@
<!-- Generated by scripts/reference-index.mjs from reference/ — do not edit by hand (pnpm reference:index). -->
The reference site is one complete client site on IAPL 1.17.1 ("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:
@@ -279,7 +279,7 @@ Rules: AGENT.md §5, iapl-nav, iapl-collection.
| `src/collections/Pages.ts` | Pages: slug, blocks layout, AI summary, noindex, slug history, revalidation, system-page delete guard (below) |
| `src/collections/Posts.ts` | the blog collection (archive in System pages) (below) |
| `src/collections/entryFields.ts` | shared fields of archive collections (names the entry card reads) (below) |
| `src/globals/Company.ts` | company data (PL market): footer, contact details, LocalBusiness JSON-LD (below) |
| `src/globals/Company.ts` | company data (PL market): footer, contact details, LocalBusiness JSON-LD |
| `src/globals/Footer.ts` | footer navigation global (below) |
| `src/globals/Header.ts` | header navigation global (below) |
@@ -288,7 +288,7 @@ Rules: AGENT.md §5, iapl-nav, iapl-collection.
```ts
import type { CollectionConfig } from 'payload'
import { buildRevalidateHook } from '@intecion/ipal-kit'
import { adminOrEditor, buildRevalidateHook } from '@intecion/ipal-kit'
import { revalidatePath } from 'next/cache'
import { i18nConfig } from '@/i18n.config'
@@ -301,7 +301,8 @@ const revalidate = buildRevalidateHook({ config: i18nConfig, revalidatePath })
export const CaseStudies: CollectionConfig = {
slug: 'caseStudies',
admin: { defaultColumns: ['title', 'publishedAt', 'updatedAt'], useAsTitle: 'title' },
access: { read: () => true },
// write rules of its own: Payload's default is "any signed-in account" — a visitor login collection would reach it (security.md "Visitor accounts")
access: { create: adminOrEditor, delete: adminOrEditor, read: () => true, update: adminOrEditor },
defaultSort: '-publishedAt',
fields: entryFields,
hooks: { afterChange: [revalidate.afterChange], afterDelete: [revalidate.afterDelete] },
@@ -315,6 +316,7 @@ export const CaseStudies: CollectionConfig = {
import type { CollectionConfig } from 'payload'
import {
adminOrEditor,
buildMediaPlaceholderField,
buildMediaPlaceholderHook,
buildOptimizeUploadField,
@@ -325,7 +327,8 @@ import {
/** media.md "Full collection", 1:1. */
export const Media: CollectionConfig = {
slug: 'media',
access: { read: () => true }, // public files; media are served by the app (/api/media/file/…)
// write rules of its own: Payload's default is "any signed-in account" — a visitor login collection would reach it (security.md "Visitor accounts")
access: { create: adminOrEditor, delete: adminOrEditor, read: () => true, update: adminOrEditor }, // public files; media are served by the app (/api/media/file/…)
upload: { focalPoint: true, mimeTypes: ['image/*', 'application/pdf', 'video/mp4', 'video/webm'] },
hooks: {
beforeOperation: [normalizeFilenameHook, buildOptimizeUploadHook(), buildMediaPlaceholderHook()],
@@ -344,6 +347,7 @@ export const Media: CollectionConfig = {
import type { CollectionConfig } from 'payload'
import {
adminOrEditor,
buildNoindexField,
buildPreventDeleteSystemPage,
buildRevalidateHook,
@@ -362,14 +366,15 @@ const revalidate = buildRevalidateHook({ config: i18nConfig, revalidatePath })
export const Pages: CollectionConfig = {
slug: 'pages',
admin: { defaultColumns: ['title', 'slug', 'updatedAt'], useAsTitle: 'title' },
access: { read: () => true },
// write rules of its own: Payload's default is "any signed-in account" — a visitor login collection would reach it (security.md "Visitor accounts")
access: { create: adminOrEditor, delete: adminOrEditor, read: () => true, update: adminOrEditor },
fields: [
{ name: 'title', type: 'text', localized: true, required: true },
buildSlugField({ from: 'title' }),
{ name: 'layout', type: 'blocks', blocks: pageBlocks, minRows: 1 },
buildSummaryField(), // aiSummary — GEO (llms.txt, MCP)
buildNoindexField(),
{ name: 'slugHistory', type: 'array', admin: { components: rowLabel('slug', 'Old address'), readOnly: true }, fields: [{ name: 'slug', type: 'text' }], labels: { plural: 'Old addresses', singular: 'Old address' } },
{ name: 'slugHistory', type: 'array', admin: { components: rowLabel('slug', 'Old address'), readOnly: true }, fields: [{ name: 'slug', type: 'text', index: true }], labels: { plural: 'Old addresses', singular: 'Old address' } },
],
hooks: {
afterChange: [revalidate.afterChange],
@@ -385,7 +390,7 @@ export const Pages: CollectionConfig = {
```ts
import type { CollectionConfig } from 'payload'
import { buildRevalidateHook } from '@intecion/ipal-kit'
import { adminOrEditor, buildRevalidateHook } from '@intecion/ipal-kit'
import { revalidatePath } from 'next/cache'
import { i18nConfig } from '@/i18n.config'
@@ -398,7 +403,8 @@ const revalidate = buildRevalidateHook({ config: i18nConfig, revalidatePath })
export const Posts: CollectionConfig = {
slug: 'posts',
admin: { defaultColumns: ['title', 'publishedAt', 'updatedAt'], useAsTitle: 'title' },
access: { read: () => true },
// write rules of its own: Payload's default is "any signed-in account" — a visitor login collection would reach it (security.md "Visitor accounts")
access: { create: adminOrEditor, delete: adminOrEditor, read: () => true, update: adminOrEditor },
defaultSort: '-publishedAt',
fields: entryFields,
hooks: { afterChange: [revalidate.afterChange], afterDelete: [revalidate.afterDelete] },
@@ -431,63 +437,19 @@ export const entryFields: Field[] = [
]
```
### `src/globals/Company.ts`
```ts
import type { GlobalConfig } from 'payload'
import { buildGlobalRevalidateHook, rowLabel } from '@intecion/ipal-kit'
import { revalidatePath } from 'next/cache'
/** Company data for a PL market site: footer, contact block details, LocalBusiness JSON-LD. */
export const Company: GlobalConfig = {
slug: 'company',
access: { read: () => true },
fields: [
{ name: 'name', type: 'text', required: true },
{ name: 'legalName', type: 'text' },
{ name: 'taxId', type: 'text', label: 'NIP' },
{ name: 'taxIdLabel', type: 'text', admin: { description: 'Shown before the tax ID in the footer.' }, defaultValue: 'NIP', label: 'Tax ID label', localized: true },
{
name: 'address',
type: 'group',
fields: [
{ name: 'street', type: 'text' },
{ name: 'postalCode', type: 'text' },
{ name: 'city', type: 'text' },
{ name: 'country', type: 'text', defaultValue: 'PL' },
],
},
{ name: 'phone', type: 'text' },
{ name: 'email', type: 'email' },
{ name: 'hours', type: 'text', localized: true, admin: { description: 'Shown next to the contact form, e.g. "Mon–Fri 9:00–17:00".' } },
{
name: 'socials',
type: 'array',
admin: { components: rowLabel('label', 'Profile'), initCollapsed: true },
labels: { plural: 'Profiles', singular: 'Profile' },
fields: [
{ name: 'label', type: 'text', required: true },
{ name: 'url', type: 'text', required: true },
],
},
],
hooks: { afterChange: [buildGlobalRevalidateHook({ revalidatePath })] },
}
```
### `src/globals/Footer.ts`
```ts
import type { GlobalConfig } from 'payload'
import { buildGlobalRevalidateHook, buildLinkField, rowLabel } from '@intecion/ipal-kit'
import { adminOrEditor, buildGlobalRevalidateHook, buildLinkField, rowLabel } from '@intecion/ipal-kit'
import { revalidatePath } from 'next/cache'
/** iapl-nav: link columns and a note. Legal links come from System pages (getSystemLinks), not from here. */
export const Footer: GlobalConfig = {
slug: 'footer',
access: { read: () => true },
// write rules of its own: Payload's default is "any signed-in account" — a visitor login collection would reach it (security.md "Visitor accounts")
access: { read: () => true, update: adminOrEditor },
fields: [
{
name: 'columns',
@@ -517,13 +479,14 @@ export const Footer: GlobalConfig = {
```ts
import type { GlobalConfig } from 'payload'
import { buildGlobalRevalidateHook, buildLinkField, buildLinksField, rowLabel } from '@intecion/ipal-kit'
import { adminOrEditor, buildGlobalRevalidateHook, buildLinkField, buildLinksField, rowLabel } from '@intecion/ipal-kit'
import { revalidatePath } from 'next/cache'
/** iapl-nav: menu with one submenu level, a CTA button, the mobile menu label. Logo comes from Site settings. */
export const Header: GlobalConfig = {
slug: 'header',
access: { read: () => true },
// write rules of its own: Payload's default is "any signed-in account" — a visitor login collection would reach it (security.md "Visitor accounts")
access: { read: () => true, update: adminOrEditor },
fields: [
{
name: 'navItems',
@@ -866,7 +829,12 @@ import * as content from '@/lib/content'
import { loadNotFoundView } from './notFoundView'
export default createNotFoundPage(content, { load: loadNotFoundView })
// The lazy 404 content arrives after hydration: a block as tall as it keeps the footer still (no layout shift).
// Measured for this site's 404 content: 282 px at 360 px wide to 432 px at 1920 — change it with that content.
export default createNotFoundPage(content, {
load: loadNotFoundView,
placeholder: <div aria-hidden style={{ minHeight: 'max(290px, calc(212px + 11.5vw))' }} />,
})
```
### `src/app/(frontend)/[locale]/notFoundView.ts`
@@ -1164,23 +1132,68 @@ Rules: AGENT.md §8a.
| File | What it shows |
|---|---|
| `e2e/attack-probes.spec.ts` | attack probes on the built site (run by `pnpm e2e:built` in both bundlers): every probe of the plugin's ATTACK_PROBES (security.md "Security suites") with this site's secret values for the bundle check, plus CSRF with the editor's cookie from another origin and the session cookie's flags; probes tied to an open audit finding are expected to fail (`test.fail`) |
| `e2e/closed-doors.spec.ts` | closed doors from outside (run by `pnpm e2e:built` in both bundlers): every door of e2e/closed-doors.ts asked on the production build as an anonymous visitor, a customer (the fixture's `e2e-visitors`) and an editor; doors still open while the owner decides are asserted open (`test.fail`) |
| `e2e/closed-doors.ts` | the doors that must stay closed, who each is closed for and how a closed answer looks; a project adds its own (security.md "Closed doors from outside") |
| `e2e/create-test-admin.ts` | two test admins with a known TOTP secret (the specs share out the five 2FA verify attempts per account), their stored verify counts cleared, and e-mail sending pointed at the tests' mail sink (local / CI database only) |
| `e2e/enrolment.ts` | reads the two-step verification confirmation link (twoFactor.confirmByEmail, 1.18.0) from the mail sink: quoted-printable undone, the latest message to an address, waited for (below) |
| `e2e/global-setup.ts` | Playwright global setup: resets the test admins and clears their stored 2FA attempt counts before every run, so specs do not depend on run order (below) |
| `e2e/late-staff-fixture.ts` | test fixture, on only with E2E_LATE_STAFF=1: one plugin before iapl (staff collections of the config: roles with one more value, the plugin's roles, roles of the project's own) and one after it (a staff collection without rules, one whose roles field is text, copies of staff collections under new slugs — plain, with rules of their own, one rule used for another operation, other role values, the opt-out, not staff — and a visitor collection with open sign-up) |
| `e2e/late-staff.spec.ts` | the account rules on a BUILT site (run by `pnpm e2e:built` after a webpack and a Turbopack build): a staff collection a later plugin adds, staff collections whose accounts can hold `admin`, and copies of staff collections — a visitor account gets nothing, nobody raises its own role or makes an admin, a copy is never wider than the plugin's rule |
| `e2e/mail-relay-fixture.ts` | test fixture, on only with E2E_MAIL_RELAY_URL: points the mail service's client at the stand-in the spec starts; never in a real site (a real site names no address) (below) |
| `e2e/mail-relay-setup.ts` | for the mail-service spec: empties the SMTP fields and the stored token, so the next e-mail enrols and goes through the mail service (local database only) (below) |
| `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/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/perf-lab.mjs` | the lab measurement of one page (Lighthouse's phone and desktop profiles, Web Vitals observers, bytes per type) — used by the performance spec and `pnpm perf:measure`; the iapl-performance skill ships the same file |
| `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.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) |
| `e2e/totp.ts` | RFC 6238 code generator for the 2FA sign-in in the smoke test, and the addresses of the second test admin and the test editor (below) |
| `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/two-factor-enrolment.spec.ts` | the first 2FA set-up confirmed by e-mail on the built site (run by `pnpm e2e:built` in both bundlers): the password alone no longer enrols an attacker's factor (the link goes to the owner and is refused in another browser), and the panel flow — code, notice, link from the mail sink, sign in again |
| `e2e/two-factor-setup.spec.ts` | browser check of "2FA setup required": the first admin of a fresh site, a new editor, the administrator's reset on the account page |
| `e2e/unused-media.spec.ts` | the unused-files notice above the Media list (`unusedMedia: true`): an image nothing uses is listed and the link opens Payload's list filtered to it; the test deletes its own upload, the panel never deletes |
### `e2e/enrolment.ts`
```ts
import type { SinkMessage } from './smtp-sink'
/**
* twoFactor.confirmByEmail (IAPL 1.18.0, on by default): the first set-up of two-step verification waits for a link
* sent to the account's e-mail. The specs read that link from the mail sink (e2e/smtp-sink.ts; create-test-admin.ts
* points the site's SMTP at it).
*/
/** A raw message body as text: quoted-printable soft breaks and escapes undone. */
export const decodeMail = (raw: string): string =>
raw.replace(/=\r?\n/g, '').replace(/=([0-9A-F]{2})/g, (_, hex: string) => String.fromCharCode(parseInt(hex, 16)))
/** The confirmation link of the latest message to `email`, or null. */
export function enrolmentLink(messages: SinkMessage[], email: string): null | URL {
for (const message of [...messages].reverse()) {
if (!message.to.some((to) => to.toLowerCase().includes(email.toLowerCase()))) {continue}
const found = decodeMail(message.data).match(/https?:\/\/[^\s"<>]+\/two-factor\/confirm\?u=[^\s"<>&]+&(?:amp;)?t=[\w-]+/)
if (found) {return new URL(found[0].replace('&amp;', '&'))}
}
return null
}
/** Waits until a message with the confirmation link for `email` arrives (mail goes out right after the request). */
export async function waitForEnrolmentLink(messages: SinkMessage[], email: string, timeoutMs = 10_000): Promise<URL> {
const until = Date.now() + timeoutMs
for (;;) {
const link = enrolmentLink(messages, email)
if (link) {return link}
if (Date.now() > until) {throw new Error(`no confirmation e-mail for ${email} in the mail sink`)}
await new Promise((r) => setTimeout(r, 200))
}
}
```
### `e2e/global-setup.ts`
+18 -1
View File
@@ -42,6 +42,13 @@ classes (warnings), `styles.css` without `@intecion/ipal-kit/tokens.css` (warnin
next/font in `--font-body` with the preset (warning), and with `src/design/tokens.ts`: no `DESIGN.md` (warning) and
`iapl-tokens --check` — a stale `src/design/tokens.css` or a WCAG AA contrast failure is an error.
## Speed (AGENT.md §6.11b, docs/performance.md)
The full run (not `--quick`) lists the doctor's `performance` group as errors (since 1.18.0; a rule the project lowered in `iapl-doctor.json` shows as a warning): `next.config` without
`buildImagesConfig()`, fonts from Google or with `display: 'block'`, more than two families, a blocking `<script src>`
or a remote stylesheet, an `<iframe>` that loads with the page, transitions of layout properties, `transition-all`,
`scroll` listeners, animations with nothing for reduced motion. The `iapl-performance` skill measures the built site and
adds the budget test.
## iapl-audit and iapl-doctor
`iapl-audit` checks the **code** inside the edit loop (and tsc + build). `pnpm exec iapl-doctor` checks the **site**
against the team standard: it runs this script (`--quick`) from the installed package, reports its findings under its
@@ -58,6 +65,15 @@ names, env, admin, AGENTS.md, skills, seeds and — with `--url` / `--deep` —
`pnpm payload run tests/routes.ts` fails on a route nobody has judged). A new custom endpoint, collection or
route file of the project = a new snapshot entry with its reason, and a door in `DOORS` if it must stay closed.
- **Attack probes and static security rules** (security.md "Security suites"): `resources/attack-probes.spec.template.ts`
→ `tests/attack-probes.spec.ts`, run on a production build or staging (`BASE_URL=… PAGE=/pl pnpm exec playwright test
tests/attack-probes.spec.ts`): the plugin's ATTACK_PROBES, plus the project's own in `EXTRA` for every custom
endpoint. On the live site: `pnpm exec iapl-doctor --url https://<domain> --only live-probes`. The code side:
`pnpm exec iapl-doctor --only security` (`code-patterns`, `config-dangerous`); a correct place gets
`// iapl-security-ok: <why>`. Dependencies: `pnpm audit --prod` (the doctor's `deps-audit`) — no high or critical.
Every address field rendered into `href` (social profiles, a website) is `buildUrlField()` and rendered through
`safeHref()` (security.md "Addresses rendered into `href`"); the static rules do not flag an `href` from data.
- **Editor test** (AGENT.md §11): every text, image, button, section,
menu, footer and SEO field can be changed in the panel, in every language.
- **Cookie consent:** in Network, before accepting, there are no requests to
@@ -78,7 +94,8 @@ names, env, admin, AGENTS.md, skills, seeds and — with `--url` / `--deep` —
- **Drafts and locales over the API** (a collection with `versions: { drafts: true }`): without a session,
`curl -s "$U/api/<slug>?draft=true&limit=100" | grep -c '"_status":"draft"'` → `0`, else ERROR: give it
`access: { read: readPublished(), readVersions: readPublished() }` (access.md). `curl -sI "$U/md/xx"` → `404`
`access: { read: readPublished(), readVersions: readPublishedVersions() }` (access.md). `curl -s -o /dev/null -w '%{http_code}' "$U/api/<slug>/versions?limit=10"`
→ `200` (a `500` = a rule with the document's `_status` path on `readVersions`: ERROR). `curl -sI "$U/md/xx"` → `404`
(no stand-in locale); a 404 page assigned in System pages must be published.
- **Secrets out of queries** (as an admin, with versions on for Site integrations or a collection using
`writeOnlySecret`): `curl -s -H "Authorization: JWT $T" "$U/api/globals/site-integrations/versions?where[version.smtpPassword][exists]=true"`
@@ -0,0 +1,30 @@
/**
* Attack probes from outside — the requests attackers send to Payload / Next.js sites, asked on a PRODUCTION build
* (`pnpm build && pnpm start`) or a staging copy (IAPL docs/security.md "Security suites"). Copy to
* tests/attack-probes.spec.ts and run:
*
* BASE_URL=http://localhost:3000 PAGE=/pl pnpm exec playwright test tests/attack-probes.spec.ts
*
* The probes come from the plugin (ATTACK_PROBES, @intecion/ipal-kit/doctor), so an IAPL upgrade brings new ones.
* On a LIVE site use `pnpm exec iapl-doctor --url https://<domain> --only live-probes` instead: it runs only the
* probes that change nothing (no 8 MB bodies). This spec runs all of them — local or staging only.
* The bundle check looks for this site's own secret VALUES: they are read from the environment (.env of the local
* build) and never printed. Add the project's own probes to EXTRA.
*/
import { ATTACK_PROBES, type AttackProbe, createProbeContext } from '@intecion/ipal-kit/doctor'
import { expect, test } from '@playwright/test'
const BASE = (process.env.BASE_URL ?? 'http://localhost:3000').replace(/\/$/, '')
const PAGE = process.env.PAGE ?? '/'
const secrets = ['PAYLOAD_SECRET', 'CRON_SECRET', 'R2_SECRET_ACCESS_KEY', 'TURNSTILE_SECRET_KEY', 'IAPL_DOCTOR_TOKEN', 'IAPL_COOKIE_SCAN_TOKEN'].map((k) => process.env[k]).filter((v): v is string => !!v && v.length >= 8)
/** The project's own probes, e.g. a custom endpoint that must refuse an 8 MB body or an operator in its query. */
const EXTRA: AttackProbe[] = []
for (const probe of [...ATTACK_PROBES, ...EXTRA]) {
test(`${probe.class}: ${probe.title}`, async () => {
const result = await probe.run(createProbeContext(BASE, { page: PAGE, secrets }))
test.skip(!!result.skipped, result.skipped)
expect(result.ok, result.detail).toBe(true)
})
}
@@ -46,12 +46,16 @@ 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.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: '[email protected]', password: 'Door-Password-1234', roles: ['admin'] }, closedFor: ALL, method: 'POST', name: 'nobody creates a staff account', path: '/api/users', closed: status(403) },
{ body: { email: '[email protected]', 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)' },
{ closedFor: ALL, name: 'Payload\'s job queue (a site without jobs)', path: '/api/payload-jobs/run', closed: status(404) },
// a site without jobs: 404. A site WITH jobs (IAPL 1.18.0): refused (401) for everybody but an admin and
// `Authorization: Bearer <CRON_SECRET>` — 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
// { closedFor: OUTSIDERS, body: {}, method: 'PATCH', name: 'pages cannot be changed', path: `/api/pages/${NO_ID}`, closed: status(403) },
]
@@ -362,6 +362,16 @@ if [ -n "$UI" ]; then
done
fi
# --- Speed (§6.11b, performance.md) — the doctor's performance group (errors since 1.18.0): images config, fonts,
# render-blocking, embeds, animations, a budget test. Full mode only: the doctor itself runs this audit with --quick.
if [ "$QUICK" -eq 0 ] && [ -x node_modules/.bin/iapl-doctor ]; then
# errors since 1.18.0; a rule the project lowered in iapl-doctor.json comes back as a warning, a silenced one not at all
PERF=$(node_modules/.bin/iapl-doctor --only performance --offline --json 2>/dev/null \
| node -e 'let s="";process.stdin.on("data",(d)=>(s+=d)).on("end",()=>{try{for(const f of JSON.parse(s).findings){if(!f.silenced&&f.severity!=="info"){console.log(`${f.severity==="error"?"E":"W"}|${f.file??"(site)"} [${f.rule}] ${f.message}`)}}}catch{}})')
report ERROR "speed (iapl-doctor --only performance)" "§6.11b / performance.md — each line names the rule; lower or silence one with a reason in iapl-doctor.json" "$(printf '%s\n' "$PERF" | sed -n 's/^E|//p')"
report WARNING "speed, lowered to a warning in iapl-doctor.json" "§6.11b / performance.md" "$(printf '%s\n' "$PERF" | sed -n 's/^W|//p')"
fi
# --- Compile & build ---
if [ "$QUICK" -eq 0 ]; then
echo
+4 -2
View File
@@ -46,9 +46,11 @@ Ask only when the brief leaves a business question open (e.g. "do posts have aut
**No URL prefix in code** — the editor assigns the archive page in
Site settings (`<slug>Archive`). The plugin handles routing, sitemap,
generateStaticParams, hreflang.
**With drafts** (`versions: { drafts: true }`): `access: { read: readPublished(), readVersions: readPublished() }`
**With drafts** (`versions: { drafts: true }`): `access: { read: readPublished(), readVersions: readPublishedVersions() }`
(`readPublished` is for `read`, `readPublishedVersions` for `readVersions` — the version list asks for `version._status`)
— Payload's open `read: () => true` answers `?draft=true` with the draft over REST and GraphQL. Check:
`curl -i <site>/api/<slug>/<draft id>?draft=true` without a session → `404`; the same with an editor's token → the draft.
`curl -i <site>/api/<slug>/<draft id>?draft=true` without a session → `404`; the same with an editor's token → the draft;
`curl -s -o /dev/null -w '%{http_code}' <site>/api/<slug>/versions?limit=10` without a session → `200`, never `500`.
3. Entry list = a block (EntriesList) with `getEntries`; the entry page uses
`resolveRoute` (type `entry`); JSON-LD per seo.md (e.g. Article).
4. **An auth collection for visitors** (`auth: true`: customers, members) only when the client requires it
@@ -55,6 +55,14 @@ before analytics or marketing consent — check the project's choice in "Project
`nonce` to `<SiteProviders>`. 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.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:
`[data-ipal-cookie-space]` on it). Before a decision and while the banner is open the footer has its own padding
only. Tab reaches the button and Enter reopens the banner. A project scroll handler, a button rendered inside
the footer or hand-made bottom padding for it → remove (AGENT.md §7). Too much or too little room:
`--ipal-cookie-button-space` on the footer; none: `reserve={false}`.
The script needs buttons with `data-ipal="accept"` / `"reject"` — the plugin's
`CookieBanner` has them in every `settings` mode (`inline`, `modal`, `detailed`). A custom banner in the project violates AGENT.md §7.
+13 -1
View File
@@ -34,11 +34,23 @@ 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.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` |
| the 2FA code screen answers "Too many codes were tried…" (`429` from `/api/verify-totp`) | more than 5 wrong codes for that account in 10 minutes (`twoFactor.verifyLimit`; right codes do not count since 1.17.1). "…being checked right now. Try again in a moment." (`Retry-After: 2`) = several attempts of one account at the same moment, nothing is locked; repeated lines `[iapl] 2FA: too many verify attempts` in the log without the owner trying = someone has the password | wait for the window, enter the current code once; unexplained attempts: change that account's password. Tests that log in often: `verifyLimit: { max: … }` for that environment |
| `isAdmin(req.user)` says `false` for a real administrator on the server, in a process that loads two Payload configs (tests, a multi-site script) | a call without a source counts only collections that are staff in **every** config of the process | pass the source: `isAdmin(req.user, req.payload)` — with it each config gets its own answer |
| `isAdmin(user)` / `isEditor(user)` is always `false` in a client component or in `proxy.ts` | the staff collections are not known there (no config in the browser bundle / middleware), and the predicates fail closed | `isAdmin(user, config)` with `useConfig()`, imported from `@intecion/ipal-kit/client`; in middleware `isAdmin(user, { staffCollections: ['users'] })` |
| `next build --webpack`: `'server-only' cannot be imported from a Client Component module … caused by importing '@intecion/ipal-kit/dist/index.js'` | a `'use client'` file imports the main entry (Turbopack lets it pass) | import from `@intecion/ipal-kit/client` (role predicates are there since 1.16.7; types: `import type` from the main entry is fine); data the browser needs → a prop from a server component |
| an account logs in but every page and request answers 403 / the setup screen says "The time to set up two-step verification has passed" | 2FA setup required: the account did not set TOTP up within the window (72 h from its creation, an admin's reset, or the first start after the upgrade) | an administrator opens the account in the panel → Two-step verification → "Reopen setup" (or `POST /api/ipal/two-factor/reset` `{ userId }`); every administrator is blocked: security.md "Every administrator is blocked" — a script with the Local API, `payload.update({ collection: 'users', id, data: { totpSetupFrom: new Date().toISOString() } })` (`pnpm payload run`), then log in and set TOTP up; or `requireSetup: { windowHours: false }`, redeploy, set up, put it back |
| a REST / GraphQL list from the front end returns only 100 documents (`hasNextPage: true`) although `limit` asks for more | `listLimit` (1.18.0, audit F4): callers that are not staff get at most 100 per request; staff and the Local API are not capped | page through (`page=2`), read on the server with the Local API, or `iapl({ listLimit: { max: 500 } })` / `{ exclude: ['slug'] }` / `false` (security.md "Lists and sorting") |
| `GET /api/<collection>?sort=$…` answers `400` "This sort field is not allowed." | `refuseOperatorSort` (1.18.0, audit F5): a sort naming a database operator is refused | sort by a field name; `refuseOperatorSort: false` = Payload's behaviour |
| a visitor account (customer) gets `403` on `/api/payload-locked-documents` | `lockedDocuments` (1.18.0): Payload's document locks are for staff only | intended; your own rule: `lockedDocuments: { access: { read } }`, or `false` |
| `[csp]` log lines show only `blocked=https://host` and `page=/path` (no query), or some reports are missing | `createCspReportRoute` (1.18.0, audit F1): the default line keeps origins and paths, at most 10 violations per request and 60 requests per client a minute | your own `onReport` gets the raw values; `maxReports`, `rateLimit: false` |
| a CDN or Varnish serves Markdown to visitors of an HTML page, or `Accept: text/markdown` answers `public, s-maxage` | a proxy of your own rewrites to `/md/…` without the 1.18.0 headers, or IAPL < 1.18.0 | `createProxy({ markdown: true })`, or copy `MARKDOWN_NEGOTIATED_HEADER` / `appendVary` into your proxy (content.md "content negotiation"); purge the CDN |
| saving a social profile / website address answers "Enter a full address, e.g. https://example.com." | `buildUrlField` (1.18.0, audit F2) accepts `https://` / `http://` and the `schemes` you list | type the full address; `buildUrlField({ schemes: ['mailto', 'tel'] })` for more kinds |
| after typing the code the setup screen says "we sent a link to …" / "the confirmation e-mail could not be sent", and nothing opens | 1.18.0 `twoFactor.confirmByEmail`: the first set-up waits for the link sent to the account's e-mail, opened in the browser that scanned the code | open the link in that browser, then sign in again; no mail: the link is in the server log (`[iapl] 2FA: … Link`), or an admin opens the account → "Confirm the waiting set-up"; fix e-mail (doctor `2fa-enrolment-mail`); "open this link in the browser where you scanned the code" = scan again in the browser you read mail in |
| a new account gets `403` from the API although its role allows the request | 2FA setup required: until TOTP is set up the account reaches only the setup screen | set TOTP up (log in to the panel); an integration: use an API key, or `twoFactor.requireSetup.exempt` |
| after an upgrade EVERY panel login answers `500` (also `/api/users/init`), administrators with 2FA included; log: `[iapl] 2FA: the column for "totpSetupFrom" is missing … NOBODY CAN LOG IN` or `column users.totp_setup_from does not exist` | Postgres/SQLite: the migration that adds the 2FA column has not run (needed whenever 2FA is on) | `pnpm payload migrate:create` if no migration has it, commit, and redeploy with migrations run when the new container starts — `prodMigrations` in the adapter or the start command `pnpm payload migrate && pnpm start` (deployment.md §4.3; not Coolify's Pre-deployment command, which runs in the old container); nothing is lost. `iapl-doctor` reports a project whose migrations lack `totp_setup_from` |
| the site does not start: `[iapl] twoFactor.requireSetup.exempt must not be async` / `…windowHours must be a number` | `exempt` is an `async` function, or `windowHours` is a string / negative | `exempt: ({ user }) => user.email === '…'` (returns `true` / `false` at once); `windowHours: 72` or `false` |
@@ -110,7 +122,7 @@ through this procedure. Ask only when you are missing something you cannot get y
| a site sends nothing: "The data comes from another site (…), so this copy does not send e-mails by itself" / `relay-refused`, cause `client-other-host` | the site is non-public — its host matches `developmentHosts` (built in: `*.dev.netscale.pl`) or `IAPL_NOINDEX=1` is set; `iapl-doctor --deep` says which (`mail-non-public`) — and its database holds another host's connection: a staging copy of production, or production's data copied back onto the development address. Expected — a copy with production's data must not mail real people by itself | should it send: "Connect again" in the state block, once (until the data is replaced). A copy that must never send: `mail: { relay: false }` or SMTP to a catcher. **The production site itself says this:** `IAPL_NOINDEX` was left set after launch — remove it; or its host matches a development pattern — take it out of `iapl({ developmentHosts })` |
| the site does not start: "[iapl] … developmentHosts must be an array of host patterns …" | the list is not an array of non-empty host patterns (a single string, `null`, `['']`), or holds a lone `*` | write it as `['*.dev.netscale.pl', 'staging.client.pl']`; `[]` = none; to change who waits use `mail.relay.otherHosts` |
| a staging or test copy **does** send, to real addresses | its host matches no development pattern and it has no `IAPL_NOINDEX=1`, so it looks like a launch (a public site enrols by itself); the doctor's deep run notes "the database also holds the mail-service connection of another host" | name its host in `iapl({ developmentHosts: ['*.dev.netscale.pl', '<the copy's pattern>'] })`, or `IAPL_NOINDEX=1` on the copy; to be sure: `mail: { relay: false }` or SMTP to a catcher |
| `relay-pending` / "waiting for approval" | while the service runs with enrolment "pending" (from its launch until Intecion switches to open enrolment), every new site waits for approval; after that, the exception (many new sites at once, or approval by hand) | Intecion approves it on the service; nothing to change on the site; the same token then works |
| `relay-pending` / "Waiting for confirmation" / doctor `mail-relay-connect` | a new site waits until a person of Intecion confirms it (contract 1.8.0) | Site integrations → E-mail sending → "Połącz z IWSN"; the person signs in with an @intecion.com address on the page that opens and presses "Potwierdź"; the block turns "Connected" by itself. "Waiting for approval" with no button, or "the confirmation page is not available": Intecion confirms the host by hand. "Too many confirmation links": wait the minutes it says. The same token works afterwards |
| `relay-suspended` | Intecion stopped the site (abuse, a flood from a form) | contact Intecion; fill in SMTP meanwhile |
| `relay-disconnected` | an admin pressed "Disconnect" | "Connect again", or SMTP |
| `relay-quota` | the site's hour or day is used up (30 / 200 by default), more than 10 recipients, more than 10 confirmations to one address a day, too many new addresses, or the site's own limit on account mail (`mail.relay.accountMail`) | the server log names the limit; look for a form being abused (Turnstile on? rate limit?); a site that really sends more: Intecion raises the limits, or SMTP |
+22 -2
View File
@@ -1,6 +1,6 @@
---
name: iapl-doctor
description: Checks the whole site against the IAPL team standard with one command (`pnpm exec iapl-doctor`) — plugin, Next, sharp and Node versions, the AGENT.md §3 folder layout and naming, database names (<domain>_dev/_prod), env rules, security headers, X-Powered-By, CSP, 2FA, the cookie scanner, adminMeta/agency, AGENTS.md "Project decisions", current iapl-* skills, seeds (createSeeder, SEED_ONLY, no deletes), the block library, pnpm audit, hardcoded texts, and with --url / --deep the running site and the database. Use after setting up a site, after an IAPL upgrade, before a deploy, in CI of a new site, and when asked whether a site follows the team rules.
description: Checks the whole site against the IAPL team standard with one command (`pnpm exec iapl-doctor`) — plugin, Next, sharp and Node versions, the AGENT.md §3 folder layout and naming, database names (<domain>_dev/_prod), env rules, security headers, X-Powered-By, CSP, 2FA, the cookie scanner, adminMeta/agency, AGENTS.md "Project decisions", current iapl-* skills, seeds (createSeeder, SEED_ONLY, no deletes), the block library, pnpm audit, hardcoded texts, speed (the performance rules — errors) and what grows (sizes, versions, retention, unused media), and with --url / --deep the running site and the database. Use after setting up a site, after an IAPL upgrade, before a deploy, in CI of a new site, and when asked whether a site follows the team rules.
---
# iapl-doctor
@@ -25,11 +25,16 @@ Full reference: `node_modules/@intecion/ipal-kit/docs/doctor.md`.
with the Intecion mail service (IWSN in the panel): waiting for approval, stopped, refused, disconnected, a replaced sender name),
`mail-reply-address`, `mail-graph-deprecated`, `mail-relay-route` (trailing slashes, another API route, a redirect or a
block in front of `/api/iapl/mail-relay/confirm`) — fixes: `iapl-debug` "Consent / analytics / forms / email".
**Speed (`perf-*`) findings are errors since 1.18.0** (images config, fonts, render-blocking, embeds, animations,
a budget test; `--url`: compression, blocking scripts, font preloads, a lazy first image, HTML size; `--deep`:
oversized stored images) — the `iapl-performance` skill. The `growth-*` findings stay warnings and infos.
4. A deliberate exception (the owner's decision) goes into `iapl-doctor.json` **with a reason** — the same reason as in
AGENTS.md "Project decisions". Never silence a rule just to make the run pass:
```json
{ "rules": { "i18n-literals": { "off": true, "files": ["src/components/design/**"], "reason": "approved exception: styleguide labels" } } }
```
A speed rule the client accepts is lowered rather than silenced, so it stays in the report:
`"perf-fonts": { "severity": "warning", "reason": "the client's brand font, replaced in Q1" }`.
Keys: `off`, `severity`, `reason` (required), `until` (ISO date), `files` (globs). Top level: `domain`, `launched`,
`layout.allow`, `layout.frontend` (the pages' folder, e.g. `src/app/(site)` — found by structure otherwise; any route
group name works), `seen` (written by the doctor), `extraRules`.
@@ -41,6 +46,19 @@ Full reference: `node_modules/@intecion/ipal-kit/docs/doctor.md`.
`--url <url>` · `--staging` (must be noindex) · `--admin-route <path>` · `--deep` · `--env-file <prod export>` (checks
`<domain>_prod`) · `--only` / `--skip <ids,groups>` · `--sites '../*-web'` (a read-only rule × site table, exit 0).
**Security checks only** (security.md "Security suites"): `pnpm exec iapl-doctor --only security` — headers, CSP,
2FA, account rules, plus the static rules over the project's own code (`code-patterns`: unescaped HTML / JSON-LD,
`overrideAccess: true` or a Local API `user` without `overrideAccess: false` where a request reaches, a `where` from
the request, `eval`, `NEXT_PUBLIC_` secrets, redirects and fetches to an address from the request) and its configs
(`config-dangerous`). With `--url https://<domain>` also `live-probes`: the plugin's attack probes that change
nothing, run against the real site (secret files, bundle secrets, proxy bypass, open redirects, cache poisoning,
NoSQL operators, anonymous where / draft / GraphQL reads, error leaks, unbounded lists, `/_next/image`). Verify: on a
fresh starter site the run lists no `code-*` finding; add `eval(x)` to a page and `code-eval` appears. A correct
place is marked `// iapl-security-ok: <why>`. From 1.18.0 a site on IAPL's defaults passes every probe; `markdown-vary`,
`unbounded-list` or `sort-operator` on such a site means a fix was turned off (`markdown: { negotiate }` with a proxy
of its own, `listLimit: false`, `refuseOperatorSort: false`) — security.md "Lists and sorting"; silence the rule with
the reason when that was the decision.
Exit `0` ok · `1` findings at or above `--fail-on` · `2` could not run · `3` a rule crashed.
## CI of a new site (starter, reference site)
@@ -56,7 +74,9 @@ Existing client sites are not gated on it; run it there as a report only.
`GET /api/ipal/doctor` is added by `iapl` and answers 404 until the site has `IAPL_DOCTOR_TOKEN` (≥ 32 characters).
Then `Authorization: Bearer <token>`; counts and states only (`usersWithout2fa`, `usersSetupClosed` = of those, blocked because the 2FA setup window has passed, `pendingCookies`, `openSignUp` = slugs of auth collections with open sign-up, `turnstile` = the recorded state of the Turnstile check, `turnstileSecretFromEnv`, `plugin`, `node`) — never a key or a name. With the same
`IAPL_DOCTOR_TOKEN` in the doctor's environment, `--url` reads it. Off: `iapl({ doctor: false })`; adapt:
`iapl({ doctor: { tokenVar, access } })`.
`iapl({ doctor: { tokenVar, access } })`. `access` returns a boolean (`({ req }) => isAdmin(req.user, req.payload)`):
since 1.18.0 only a literal `true` allows — `({ req }) => req.user` (an object) refuses — and any other answer is
reported once in the server log (`strictAccessAnswers: false` gives the old truthy reading back).
## Env the doctor reads
+3 -1
View File
@@ -35,4 +35,6 @@ Requires the UI primitives from `../iapl-block/resources/section-code.md` (like
## Verification
The **iapl-audit** skill. By hand: a menu item added in the panel is visible right after
saving; the mobile menu works with the keyboard (Tab, Enter, Esc).
saving; the mobile menu works with the keyboard (Tab, Enter, Esc). A menu item that points at a page never
published is not shown (since 1.18.0 the helpers leave draft pages out; `createContentHelpers({ draftRelations:
'keep' })` shows it as before): publish the page and the item appears.
@@ -0,0 +1,72 @@
---
name: iapl-performance
description: Makes and keeps an IAPL site fast — page loading (LCP image, fonts, nothing render-blocking, static rendering), elements (lazy below the fold, reserved space, click-to-load embeds), animations (transform/opacity, reduced motion, no scroll handlers), resources (only the JS a page uses, compression, no third-party request before consent), images (AVIF/WebP, sizes, upload limits) and the server (queries per render, depth, select, caching); what grows in the database and on disk over the years (logs and their retention, form submissions, versions, KV, unused media, the image cache). Measures the built site, runs the doctor's performance group, and adds the budget gate that fails when a change makes the site slower. Use when building pages or blocks, before handing over, after an IAPL upgrade, and whenever "slow", PageSpeed, Lighthouse, Core Web Vitals, LCP, CLS, INP, a growing database or disk come up.
---
# iapl-performance
The handbook is `node_modules/@intecion/ipal-kit/docs/performance.md`: what the plugin does for you, what the project
must do, how to measure, how to read the findings. This skill is the order of work.
## 1. Check what the plugin cannot do for you (code)
```bash
pnpm exec iapl-doctor --only performance # images config, fonts, render-blocking, embeds, animations, budget test
bash .agents/skills/iapl-audit/scripts/audit.sh --quick # <img>/<video> outside Media, priority outside the hero, YouTube iframe, h-screen
```
These are **errors** since 1.18.0 (`iapl-doctor` fails). Fix each — it names the file, the fix and the doc. When the
client accepts one (a brand font, a map that is the page's content), lower it with a reason in `iapl-doctor.json`
(`"perf-fonts": { "severity": "warning", "reason": "…" }`) or silence it (`"off": true`, optionally `until`), and record
it in AGENTS.md → Project decisions. The rules that matter most:
| Area | Do | Never |
|---|---|---|
| LCP image | `<Media priority>` on the first image of the page — **one** per page; a header logo gets `eager` | `priority` on many images; a lazy hero; the hero as a CSS background |
| layout shift | content that arrives late keeps its space: the lazy 404's `placeholder` (its content's height), the Turnstile widget's 73 px (kept by the plugin) | an empty box a widget or a server action fills later |
| other images | `<Media sizes={MEDIA_SIZES.third}>` — the width on screen; lazy by default | no `sizes`; a plain `<img>` |
| fonts | `next/font` (self-hosted), ≤ 2 families, variable, `display: 'swap'`, the heading font `preload: false` | a `<link>` to Google Fonts; `display: 'block'` |
| scripts | the plugin's `Analytics` / `ConsentScript`; `next/script` for anything else | a `<script src>` without `async` in the layout |
| embeds | `<YouTubeEmbed>`; a map or widget behind a click (a picture + a button) | an `<iframe>` that loads with the page |
| animations | `transform` / `opacity` only; the token durations (`duration-fast`) or `motion-reduce:` | animating `height`, `top`, `margin`; `transition-all`; a `scroll` listener (use IntersectionObserver) |
| client code | small `'use client'` leaves; server components by default; forms through `RenderForm` / `BuilderForm` from `/client` (their code loads only where a form is shown) | a whole section `'use client'`; importing `/client/eager` without a reason |
| server | the plugin's cached helpers (`lib/content`), `depth` as low as the page needs, `select` for one field | `findGlobal` without `cache()`; `depth: 2` "to be safe"; a query per list item |
## 2. Measure the built site
```bash
pnpm build && pnpm start # dev numbers mean nothing
pnpm exec iapl-doctor --url http://localhost:3000 --only perf-live # compression, blocking scripts, preloads, lazy hero, HTML size
pnpm exec iapl-doctor --deep --only perf-images # stored images over 1.5 MB / 2560 px
```
Lab numbers per page (phone on Slow 4G with a 4× slower CPU, and desktop): copy `resources/perf-lab.mjs` and
`resources/performance.spec.template.ts` (→ `e2e/performance.spec.ts`), list one page of each template, run
`pnpm test:e2e e2e/performance.spec`, then set each budget to what you measured plus ~20 %. From then on the test fails when
a change makes a page slower. PageSpeed Insights on the deployed site shows the field data (real visitors).
## 3. Read the result
- **LCP** > 2.5 s on the phone: the LCP element is named in the measurement (`lcpElement`). An image → `priority`,
`sizes`, a smaller upload; text → a font that arrives late (fewer preloaded files).
- **CLS** > 0.1: an image without dimensions (use `Media`), content that arrives after hydration (the lazy 404 —
`createNotFoundPage({ load, placeholder })`), a font swap (next/font sets fallback metrics).
- **TBT / INP**: long tasks — a big client component, a scroll handler, a third-party widget at start.
- **JS bytes**: what the page ships; import client components from `@intecion/ipal-kit/client` freely — since
1.18.0 a page carries only the ones it renders.
- **Queries per render** (the reference gate counts them): over 30 for an ordinary page → a missing `cache()`, a
`depth` too high, or a loop of `findByID`.
## 4. What grows (performance.md §6)
```bash
pnpm exec iapl-doctor --deep --only growth # counts and sizes per collection, oldest records, versions, expired KV, unused media, disk
```
- Logs purge themselves (consent log 1095 days, statistics 90). Form submissions are kept unless
`iapl({ forms: { submissionRetentionDays } })` — ask the client (personal data) and record it in AGENTS.md.
- Versions: where you turn them on, `versions: { maxPerDoc: 20 }` (globals `max`); never `0`.
- Unused media: `iapl({ unusedMedia: true })` (then `pnpm generate:importmap`) shows them above the Media list with a
link to Payload's filtered list; the editor deletes them there. The plugin never deletes media or submissions by itself.
- MongoDB: the consent log and statistics are deleted by TTL indexes at their retention (`ttlIndex: false` turns that off).
- Coolify: no persistent volume on `.next` (the image cache starts empty on each deploy); database backups on the
MongoDB resource.
- Thresholds of the findings: `iapl-doctor.json` → `growth`.
## 5. Before "done"
`iapl-doctor --only performance` without errors (each exception lowered or silenced with a reason in `iapl-doctor.json`),
the budget test green, and the numbers in `AGENTS.md` → "Project decisions" when the client accepted an exception
(a heavy font, a third-party widget).
@@ -0,0 +1,175 @@
/**
* Lab measurements of one page in Chromium (Playwright + the DevTools protocol) — used by `pnpm perf:measure`
* (scripts/perf-measure.mjs, numbers for docs/performance.md) and by the budget gate (e2e/performance.spec.ts).
*
* Profiles follow Lighthouse's defaults so the numbers compare with PageSpeed Insights' lab data:
* - mobile: 412×823 at DPR 1.75, "Slow 4G" (150 ms RTT, 1.6 Mbit/s down, 750 kbit/s up), CPU 4× slower;
* - desktop: 1350×940, 40 ms RTT, 10 Mbit/s, CPU 1×.
* Every run is a fresh browser context (empty HTTP cache, no cookies): a first visit, the worst ordinary case.
*
* What is measured (all from the browser itself, web.dev/articles/vitals):
* ttfb, fcp, lcp (+ the LCP element: tag, src, loading, fetchpriority), cls (session windows, as web-vitals does),
* tbt (sum of long-task time over 50 ms between FCP and the end of the run: the lab stand-in for INP),
* inp (the longest Event Timing entry of one scripted interaction: a click on the page's first visible button),
* scriptMs (CDP Performance.ScriptDuration: parse, compile, run and hydrate), requests, bytes per type
* (transfer size, compressed), renderBlocking (resource timing renderBlockingStatus), thirdParty (requests to
* another origin before any consent is given). Next's link prefetches (`?_rsc=`, made when the browser is idle) are
* counted apart (`prefetches`): they are not part of the page's load and come at a different moment each run.
* Option `blockThirdParty` (the gate): requests to another origin are recorded, then aborted — a slow external host
* cannot hold the page's load event, and the numbers are the site's own.
*/
import { chromium } from '@playwright/test'
export const PROFILES = {
desktop: { cpu: 1, network: { downloadThroughput: (10 * 1024 * 1024) / 8, latency: 40, uploadThroughput: (10 * 1024 * 1024) / 8 }, viewport: { deviceScaleFactor: 1, height: 940, isMobile: false, width: 1350 } },
mobile: { cpu: 4, network: { downloadThroughput: (1.6 * 1024 * 1024) / 8, latency: 150, uploadThroughput: (750 * 1024) / 8 }, viewport: { deviceScaleFactor: 1.75, hasTouch: true, height: 823, isMobile: true, width: 412 } },
}
const OBSERVERS = `(() => {
const v = (window.__perf = { cls: 0, events: [], lcp: null, longTasks: [] })
let win = 0, winStart = 0, winLast = 0
new PerformanceObserver((l) => { for (const e of l.getEntries()) {
const el = e.element
v.lcp = { at: e.startTime, size: e.size, tag: el ? el.tagName.toLowerCase() : null, src: e.url || null,
loading: el && el.getAttribute ? el.getAttribute('loading') : null,
fetchpriority: el && el.getAttribute ? el.getAttribute('fetchpriority') : null }
} }).observe({ buffered: true, type: 'largest-contentful-paint' })
new PerformanceObserver((l) => { for (const e of l.getEntries()) {
if (e.hadRecentInput) continue
if (win && e.startTime - winLast < 1000 && e.startTime - winStart < 5000) { win += e.value } else { win = e.value; winStart = e.startTime }
winLast = e.startTime
v.cls = Math.max(v.cls, win)
} }).observe({ buffered: true, type: 'layout-shift' })
new PerformanceObserver((l) => { for (const e of l.getEntries()) v.longTasks.push([e.startTime, e.duration]) }).observe({ buffered: true, type: 'longtask' })
new PerformanceObserver((l) => { for (const e of l.getEntries()) v.events.push({ d: e.duration, n: e.name }) }).observe({ buffered: true, durationThreshold: 16, type: 'event' })
})()`
/**
* @typedef {{ bytes: { css: number, font: number, html: number, image: number, js: number, other: number }, cls: number,
* fcp: null | number, inp: null | number, interaction: null | string, lcp: null | number,
* lcpElement: null | { fetchpriority: null | string, loading: null | string, src: null | string, tag: null | string },
* load: null | number, prefetches: number, profile: string, renderBlocking: string[], requests: number, runs?: number, scriptMs: null | number,
* status: null | number, tbt: null | number, thirdParty: string[], ttfb: null | number, url: string }} PageMeasurement
*/
const typeOf = (resourceType, mime = '') => {
if (resourceType === 'Document') {return 'html'}
if (resourceType === 'Script') {return 'js'}
if (resourceType === 'Stylesheet') {return 'css'}
if (resourceType === 'Font') {return 'font'}
if (resourceType === 'Image' || mime.startsWith('image/')) {return 'image'}
return 'other'
}
/**
* @param {import('@playwright/test').Browser} browser
* @param {string} url
* @param {'mobile'|'desktop'} profileName
* @param {{ blockThirdParty?: boolean, interact?: boolean, settleMs?: number }} [options]
* @returns {Promise<PageMeasurement>}
*/
export async function measurePage(browser, url, profileName, options = {}) {
const profile = PROFILES[profileName]
const context = await browser.newContext({ ...profile.viewport, viewport: { height: profile.viewport.height, width: profile.viewport.width } })
const page = await context.newPage()
const cdp = await context.newCDPSession(page)
await cdp.send('Network.enable')
await cdp.send('Network.setCacheDisabled', { cacheDisabled: true })
await cdp.send('Network.emulateNetworkConditions', { offline: false, ...profile.network })
await cdp.send('Emulation.setCPUThrottlingRate', { rate: profile.cpu })
await cdp.send('Performance.enable')
await page.addInitScript(OBSERVERS)
const origin = new URL(url).origin
if (options.blockThirdParty) {await context.route((u) => u.origin !== origin, (route) => route.abort())}
const requests = new Map()
let prefetches = 0
cdp.on('Network.requestWillBeSent', (e) => {
if (e.request.url.startsWith('data:')) {return}
if (/[?&]_rsc=/.test(e.request.url)) {prefetches++; return}
requests.set(e.requestId, { bytes: 0, type: typeOf(e.type), url: e.request.url })
})
cdp.on('Network.responseReceived', (e) => { const r = requests.get(e.requestId); if (r) {r.type = typeOf(e.type, e.response.mimeType); r.status = e.response.status} })
cdp.on('Network.loadingFinished', (e) => { const r = requests.get(e.requestId); if (r) {r.bytes = e.encodedDataLength} })
const response = await page.goto(url, { timeout: 60_000, waitUntil: 'load' })
await page.waitForLoadState('networkidle', { timeout: 15_000 }).catch(() => {})
await page.waitForTimeout(options.settleMs ?? 1000)
let interaction = null
if (options.interact !== false) {
// INP stand-in: one click on the first visible button (menu toggle, cookie settings, theme): a real handler runs
const button = page.locator('button:visible').first()
if (await button.count()) {
interaction = (await button.getAttribute('aria-label')) ?? (await button.innerText()).slice(0, 40)
await button.click({ timeout: 5000 }).catch(() => { interaction = null })
await page.waitForTimeout(500)
}
}
const nav = await page.evaluate(() => {
const n = performance.getEntriesByType('navigation')[0]
const fcp = performance.getEntriesByName('first-contentful-paint')[0]
const blocking = performance.getEntriesByType('resource').filter((r) => r.renderBlockingStatus === 'blocking').map((r) => r.name)
return { blocking, domContentLoaded: n.domContentLoadedEventEnd, fcp: fcp ? fcp.startTime : null, load: n.loadEventEnd, ttfb: n.responseStart }
})
const vitals = await page.evaluate(() => window.__perf)
const { metrics } = await cdp.send('Performance.getMetrics')
const metric = (name) => metrics.find((m) => m.name === name)?.value ?? 0
await context.close()
const list = [...requests.values()]
const bytes = { css: 0, font: 0, html: 0, image: 0, js: 0, other: 0 }
for (const r of list) {bytes[r.type] += r.bytes}
const fcp = nav.fcp ?? 0
const tbt = vitals.longTasks.filter(([start]) => start >= fcp).reduce((sum, [, d]) => sum + Math.max(0, d - 50), 0)
const round = (n) => (n == null ? null : Math.round(n))
return {
bytes: Object.fromEntries(Object.entries(bytes).map(([k, b]) => [k, Math.round(b)])),
cls: Math.round(vitals.cls * 1000) / 1000,
fcp: round(nav.fcp),
inp: vitals.events.length ? round(Math.max(...vitals.events.map((e) => e.d))) : interaction ? 0 : null,
interaction,
lcp: round(vitals.lcp?.at),
lcpElement: vitals.lcp ? { fetchpriority: vitals.lcp.fetchpriority, loading: vitals.lcp.loading, src: vitals.lcp.src ? vitals.lcp.src.replace(origin, '') : null, tag: vitals.lcp.tag } : null,
load: round(nav.load),
prefetches,
profile: profileName,
renderBlocking: nav.blocking.map((u) => u.replace(origin, '')),
requests: list.length,
scriptMs: round(metric('ScriptDuration') * 1000),
status: response?.status() ?? null,
tbt: round(tbt),
thirdParty: [...new Set(list.filter((r) => !r.url.startsWith(origin)).map((r) => new URL(r.url).origin))],
ttfb: round(nav.ttfb),
url: url.replace(origin, ''),
}
}
export const median = (values) => {
const sorted = values.filter((v) => typeof v === 'number').sort((a, b) => a - b)
if (!sorted.length) {return null}
const mid = Math.floor(sorted.length / 2)
return sorted.length % 2 ? sorted[mid] : Math.round(((sorted[mid - 1] + sorted[mid]) / 2) * 1000) / 1000
}
/**
* The median of `runs` measurements for every number; the rest from the last run.
* @param {import('@playwright/test').Browser} browser
* @param {string} url
* @param {'mobile'|'desktop'} profileName
* @param {number} [runs]
* @param {{ blockThirdParty?: boolean, interact?: boolean, settleMs?: number }} [options]
* @returns {Promise<PageMeasurement>}
*/
export async function measureMedian(browser, url, profileName, runs = 3, options = {}) {
const all = []
for (let i = 0; i < runs; i++) {all.push(await measurePage(browser, url, profileName, options))}
const last = all.at(-1)
const out = { ...last, runs }
for (const key of ['cls', 'fcp', 'inp', 'lcp', 'load', 'requests', 'scriptMs', 'tbt', 'ttfb']) {out[key] = median(all.map((r) => r[key]))}
out.bytes = Object.fromEntries(Object.keys(last.bytes).map((k) => [k, median(all.map((r) => r.bytes[k]))]))
return out
}
export const launch = () => chromium.launch()
@@ -0,0 +1,48 @@
// e2e/performance.spec.ts — the project's performance budget gate (iapl-performance skill, docs/performance.md).
// Copy this file and perf-lab.mjs (same folder) to e2e/. Runs against the BUILT site: pnpm build && pnpm test:e2e.
// It fails when a page breaks a budget: the plugin's defaults (Core Web Vitals "good", bytes, requests), tightened
// below to what this site measured, so a change that makes it slower fails. Loosen a number only with a reason.
import type { Browser } from '@playwright/test'
import { overBudget, perfBudgets } from '@intecion/ipal-kit/doctor'
import { chromium, expect, test } from '@playwright/test'
// a plain ES module (JSDoc types) — perf-lab.mjs from the skill's resources
import { measureMedian } from './perf-lab.mjs'
const runs = Number(process.env.PERF_RUNS ?? 1)
// Start from the defaults; after the first run, set each number to what you measured plus ~20 % (the lab is noisy).
const budgets = perfBudgets({
desktop: {},
mobile: {},
})
// One page of each template the site has (AGENTS.md → Site map). `budget` changes a number for one page, with a reason.
const PAGES: Array<{ budget?: Partial<typeof budgets.mobile>; name: string; path: string }> = [
{ name: 'home', path: '/pl' },
// { name: 'page', path: '/pl/o-nas' },
// { name: 'post', path: '/pl/blog/<a-post>' },
// { name: 'form', path: '/pl/kontakt', budget: { thirdParty: ['https://challenges.cloudflare.com'] } }, // Turnstile
]
let browser: Browser
test.beforeAll(async () => {
browser = await chromium.launch()
})
test.afterAll(async () => {
await browser?.close()
})
for (const page of PAGES) {
for (const profile of ['mobile', 'desktop'] as const) {
test(`${page.name} (${profile}) stays within its performance budget`, async ({ baseURL }) => {
test.setTimeout(120_000)
// third-party requests are recorded, then aborted: an external host cannot fail or hang the test
const measured = await measureMedian(browser, `${baseURL}${page.path}`, profile, runs, { blockThirdParty: true })
test.info().annotations.push({ description: JSON.stringify({ bytes: measured.bytes, cls: measured.cls, inp: measured.inp, lcp: measured.lcp, requests: measured.requests }), type: 'measured' })
expect(overBudget(measured, { ...budgets[profile], ...page.budget }), `${page.path} ${profile}`).toEqual([])
if (measured.lcpElement?.tag === 'img') {expect(measured.lcpElement.loading, 'the LCP image is lazy').not.toBe('lazy')}
})
}
}
+15 -2
View File
@@ -38,10 +38,19 @@ 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/<slug>/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.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` |
| `secrets.writeOnly` | on | `smtpPassword` and `turnstileSecretKey` (Site integrations) are never returned: REST, GraphQL and the panel get `'********'` when a value is stored; a save with nothing / empty / the mask keeps it, a new value replaces it, `'[[clear]]'` removes it; the Local API with access control off reads the real value. The panel is the source of these secrets — no env variable. A restore of a version is masked too | `false` = returned to whoever may read the global, as before |
| "Sending method" (`emailMethod`; `getMailMethod` / `setMailMethod`) | nobody has chosen: the order of 1.17.0, shown as selected | `relay` (IWSN), `smtp`, `graph` (deprecated): what is chosen is what is used, no fallback; a stored field (Postgres / SQLite: one migration) |
| `secrets.reenterOnChange` | on | a save through access control that changes `smtpHost`, `smtpPort` or `smtpUser` while a password is stored must send the password again or remove it (`400` on the field otherwise), whatever `emailTransport` says — so an admin session cannot send the stored password to a server of its own. A change of the transport alone, and the Local API with access control off, are not asked | `false` = the stored password follows the new server |
| `dashboardAlerts` | `{ integrations: 'admin', cookies: 'editor' }` | who sees the plugin's dashboard alerts: integration details (error text, link) for `integrations` and above, a neutral "ask an administrator" for editors below it, nothing for others; the cookie crawl / approval alert for `cookies` and above. With a role, a session that owes its second factor sees none | `integrations: 'editor' | 'all'`, `cookies: 'all'` (`'all'` = as before: no role and no second factor is checked) |
| `strictAccessAnswers` | `true` (1.18.0) | a project's access callback (`cookieScanner.access`, the doctor's `access`) allows only on a literal `true`; `req.user`, `1`, a string, an un-awaited Promise refuse; a non-boolean answer is reported once per option | `false` = any truthy answer allows (as before 1.18.0) |
| `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.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)/<route>/` 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 | — |
@@ -93,15 +102,17 @@ 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") | `<type>: 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: logged-in, 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 |
| `forms.turnstileOnConfigError` | `{ text: 'allow', files: 'reject' }` | what a form does while Turnstile CANNOT check (wrong / missing secret, Cloudflare down): a text form is accepted, a submission to the file endpoint is refused. Not involved while Turnstile is off | `'allow'` / `'reject'` for every form, or `{ text, files }`; `turnstileOnConfigError` at a call site (`createSubmitAction`, `attachments.submit`) wins |
| `forms.attachments` | off | **File** field in the form builder; a file is checked (size, count, type by content, refused extensions), attached to the company e-mail and dropped — **never stored**; adds `POST /api/ipal/forms/submit`, the fields `submissionFiles` / `filesDelivery` / `filesDeliveryNote` / `attemptKey` on `form-submissions`, and the **Files** texts in Form messages | `true` / `FormAttachmentsOption`: `maxSizeMB` (10), `maxTotalMB`, `maxFiles` (3), `fileTypes`, `allowRisky`, `scan` (antivirus hook — none built in), `strictPdf`, `notice`, `maxConcurrent` (2), `path`, `submit` (`maxPerMinute`, `clientIp`, `honeypotField`, `turnstileHostnames`, `turnstileOnConfigError`, `allowedOrigins`, `idleTimeoutMs`, `timeoutMs`); block only: `forms.fields.file: false` or `buildFileBlock(…)`. Postgres: `migrate:create`. Check: submit a PDF → attached to the company e-mail, absent from the customer e-mail, submission shows *File delivery: Handed to the mail server* (forms.md "Files") |
| `forms.consentFieldName` | `'consent'` | name of the GDPR consent field `submitForm` requires (read from `config.custom.ipal`) | `createSubmitAction({ consentFieldName })` / `submitForm` argument wins |
| `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 | `false` / `{ retentionDays }` (default 1095) |
| `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 === '[email protected]' } }` — narrows who reads records in a project without roles |
| `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 <CRON_SECRET>` (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 `<CookieTable>` 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` |
@@ -212,6 +223,7 @@ Mandatory set: AGENT.md §0b, skill **iapl-setup**; checks: **iapl-audit**, **ia
| storage | `payload.config.ts` | `buildR2Storage(['media'], { s3Storage })` — always (without `R2_*` = local disk) | upload → URL from `R2_PUBLIC_URL` | storage.md |
| e-mail | `payload.config.ts` | `email: mailAdapter()` (SMTP from the panel / Graph from env; also `panelSmtpAdapter`, `graphAdapter`, `sendEmail` from `/server`) | Site integrations → E-mail sending → **Send test** | email.md |
| forms — action | `app/(frontend)/[locale]/actions.ts` | `'use server'`; `export const sendForm = createSubmitAction({ getCachedPayload, headers })` (`/server`) | submit → document in Form Submissions + e-mails | forms.md, skill **iapl-form** |
| forms — retention | config (client decision) | `forms: { submissionRetentionDays: 365 }` (1.18.0; default: kept) | `iapl-doctor --deep --only growth-submissions` quiet; old submissions gone a day after the next submission | performance.md §6, forms.md |
| forms — files | config + panel | `forms: { attachments: true }`; a **File** field on the form; an e-mail with fixed recipients in Forms → E-mails; `mailAdapter({ graph: { largeAttachments } })` when Graph must stay under 3 MB; Azure: `Mail.ReadWrite` limited to the forms mailbox for files of 3 MB and more over Graph | Test e-mail with "Attach a 10 MB test file" arrives; a submission with a PDF arrives with the attachment; nothing in Media | forms.md "Files", email.md "Attachments" |
| forms — render | form block | `<RenderForm form={form} action={sendForm} locale={locale} texts={formTexts} classNames={formClasses} />` (`/rsc`) | form from the panel, Turnstile, message from Notifications | forms.md |
| Turnstile | panel / env | `SiteProviders` wires `TurnstileProvider`; keys in Site integrations → Spam protection or env; server: `verifyTurnstile` (`/server`) | widget in the form; dashboard alert on a bad key | turnstile.md |
@@ -277,6 +289,7 @@ The plugin's own variables are `IAPL_<NAME>`; a deploy that sets the spelling fr
| `IAPL_IP_HEADER` | `ipHeader: true` + production | rate limit trusts any IP header (spoofing) + warning in prod | env: `cf-connecting-ip` (Cloudflare) / `x-forwarded-for` (Traefik/nginx) |
| `IAPL_COOKIE_SCAN_URL`, `IAPL_COOKIE_SCAN_TOKEN` | `cookieScanner.crawl` (`iaplEnvRules({ cookieCrawl: true })` requires both in production; token ≥ 16 chars) | **Check site** disabled, the box names the missing variable | env; the token also goes into the scanner service's `IAPL_CRAWLER_SITES` as `host=token` |
| `IAPL_DOCTOR_TOKEN` | no; ≥ 32 characters | `GET /api/ipal/doctor` answers 404; with it the endpoint answers a Bearer token, and `iapl-doctor --url` with the same variable reads the deep counts | env (Coolify) and the doctor's shell; also read by the doctor: `CI`, `NO_COLOR`, `PAYLOAD_CONFIG_PATH` (`--deep`), `IAPL_DOCTOR_IMPORT_MAP` (internal) — doctor.md |
| `CRON_SECRET` | no; ≥ 16 characters (name: `jobsRunAccess.secretVar`) | Payload's job queue runs over HTTP only for an admin; the start log says so when the queue is on | env (Coolify); the cron sends `Authorization: Bearer <CRON_SECRET>` to `/api/payload-jobs/run` |
| `IAPL_NOINDEX` | no; `1`/`true`/`yes` **staging/preview only** | — (when set: robots Disallow, meta noindex, `X-Robots-Tag`, IndexNow sends nothing) | staging env |
| `NEXT_PHASE` | set by Next | only tells `next build` from runtime: during the build an unreachable database gives an empty sitemap; at runtime the sitemap throws (route → 503) | do not set by hand |
| `NEXT_RUNTIME` | set by Next | `instrumentation.ts` checks for `nodejs`; missing (scripts, seed) → `buildRevalidateHook` does not revalidate | do not set by hand |
@@ -1,7 +1,7 @@
# IAPL — export index
Every public export of `@intecion/ipal-kit` (all entries: root, `/client`, `/rsc`,
`/server`, `/seed`, `/starter`, `/next/middleware`, `/admin`, `/env`, `/blocks`, `/blocks/rsc`, `/templates`, `/tokens`, `/doctor`), grouped by module. Search with grep
`/client/eager`, `/server`, `/seed`, `/starter`, `/next/middleware`, `/admin`, `/env`, `/blocks`, `/blocks/rsc`, `/templates`, `/tokens`, `/doctor`), grouped by module. Search with grep
(`grep -n "name" .agents/skills/iapl-reference/resources/api.md`) before you write anything yourself.
"Import from" column — the first entry is preferred. Plugin options, env, routes and what the
project wires: `../SKILL.md`. Module details: `node_modules/@intecion/ipal-kit/docs/<page>.md`.
@@ -13,7 +13,7 @@ project wires: `../SKILL.md`. Module details: `node_modules/@intecion/ipal-kit/d
| `ipalKit`, `IpalOptions`, `ipalEnvRules`, `IpalEnvFeatures`, `ipalT`, `ipalVar`, `IPAL_TOKENS`, `IPAL_BREAKPOINTS`, `IpalTokenName`, `IpalGlobalSlug` | as their new names | The names before 1.17.0 of `iapl`, `IaplOptions`, `iaplEnvRules`, `IaplEnvFeatures`, `iaplT`, `iaplVar`, `IAPL_TOKENS`, `IAPL_BREAKPOINTS`, `IaplTokenName`, `IaplGlobalSlug`: the same values, deprecated, removed in 2.0. Existing code keeps them; new code uses the new names (AGENT.md "Names: IAPL and ipal-kit"). |
| `iapl(options)` | `@intecion/ipal-kit` | Payload 3 plugin (`plugins: [iapl({...})]`) — the only wiring point: adds globals (SiteSettings, SiteIntegrations, CookieSettings, Notifications), roles, enforced 2FA, SEO, forms, i18n (localization), white-label, stats, consent log, `/api/ipal/*` endpoints; no auth collection → injects a simple `users`. Validates `i18n` right away (fail fast). `enabled: false` = schema stays, behaviour off. |
**Types:** `IaplOptions` — `iapl()` options: `i18n`, `access`, `twoFactor` (`{ issuer, plugin: payloadTotp }` or `false`), `whiteLabel`, `adminRoute`, `consentLog`, `content`, `cookieScanner`, `forms`, `pages`, `seo`, `searchSettings`, `stats`, `indexNow`, `siteSettingsFields`, `integrationsFields`, `globalOverrides`, `revalidatePath`, `enabled`. `GlobalOverride`, `GlobalOverrides`, `IaplGlobalSlug` — see Payload globals below.
**Types:** `IaplOptions` — `iapl()` options: `i18n`, `access`, `twoFactor` (`{ issuer, plugin: payloadTotp }` or `false`), `whiteLabel`, `adminRoute`, `consentLog`, `content`, `cookieScanner`, `forms`, `pages`, `seo`, `searchSettings`, `stats`, `indexNow`, `siteSettingsFields`, `integrationsFields`, `globalOverrides`, `revalidatePath`, `unusedMedia`, `enabled`. `GlobalOverride`, `GlobalOverrides`, `IaplGlobalSlug` — see Payload globals below.
## Admin (import map) (`admin`, `branding`, `admin-ui`, `globals/SiteIntegrations`) — details: `node_modules/@intecion/ipal-kit/docs/white-label.md`, `…/docs/integrations.md`, `…/docs/email.md`, `…/docs/links.md`
@@ -85,7 +85,12 @@ 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. |
**Types:** `AccountsOptions` (`accounts`: `panelRole`, `adminOnlyCreate`, `adminOnlyWrite`, `staffOnlyRead`, `firstUserRoute`, `password`), `StaffAccountAccessOptions` (`{ create?, write?, read?, pluginRoles? }`), `StaffRuleMark` (`{ slug, self }`), `AccountsMarker` (`{ slug, staff, own? }`, in `custom.ipalAccounts`; `own`: the operations that had a rule of the project's at config time, kept when the collection becomes staff later), `LateAdoption` (`{ slug, applied, kept, known, password, firstUser }`; `known`: in the config when iapl ran and staff only afterwards, `kept`: its operations whose own rule was left as written), `StaffAccountRules` (what the plugin put on a staff collection, in `custom.ipalAccountRules`: `{ applied, ownRoles }`), `WriteOnlySecretOptions` (`{ boundTo?, appliesWhen? }`), `PasswordRuleOptions` (`{ minLength? }`), `FirstUserRouteOption` (`'panel' \| 'all' \| string[]`), `TurnstileOnConfigError` / `TurnstileOnConfigErrorOption` / `TurnstileFormKind` (`@intecion/ipal-kit/server`), `VerifyLimitOptions` (`twoFactor.verifyLimit`: `{ max?, windowMinutes?, store? }`), `RequireSetupOptions` (`twoFactor.requireSetup`), `TwoFactorResetOptions`, `TwoFactorSetupState`, `SafeBackRule` / `SafeBackContext` (`twoFactor.safeBack` as a function: `(back, { adminRoute, origin? }) => string`), `TotpViewComponent` (a view component as registered: a path or `{ path, exportName?, clientProps?, serverProps? }`), `SafeTotpViewProps` (`@intecion/ipal-kit/admin`), `Role` (`'user' \| 'editor' \| 'admin'`), `AccessOption` (the plugin's `access` option: `authCollection`, `defaultRole`, `authAccess`, `firstUserAdmin`, `staffCollections`).
| `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. |
**Types:** `AccountsOptions` (`accounts`: `panelRole`, `adminOnlyCreate`, `adminOnlyWrite`, `staffOnlyRead`, `firstUserRoute`, `password`, `lockedAnswer`, `signInLimit`, `signInSameOrigin`, `confirmOwnChanges`), `LockedAnswerOption`, `StaffAccountAccessOptions` (`{ create?, write?, read?, pluginRoles? }`), `StaffRuleMark` (`{ slug, self }`), `AccountsMarker` (`{ slug, staff, own? }`, in `custom.ipalAccounts`; `own`: the operations that had a rule of the project's at config time, kept when the collection becomes staff later), `LateAdoption` (`{ slug, applied, kept, known, password, firstUser }`; `known`: in the config when iapl ran and staff only afterwards, `kept`: its operations whose own rule was left as written), `StaffAccountRules` (what the plugin put on a staff collection, in `custom.ipalAccountRules`: `{ applied, ownRoles }`), `WriteOnlySecretOptions` (`{ boundTo?, appliesWhen? }`), `PasswordRuleOptions` (`{ minLength? }`), `FirstUserRouteOption` (`'panel' \| 'all' \| string[]`), `TurnstileOnConfigError` / `TurnstileOnConfigErrorOption` / `TurnstileFormKind` (`@intecion/ipal-kit/server`), `VerifyLimitOptions` (`twoFactor.verifyLimit`: `{ max?, windowMinutes?, store? }`), `RequireSetupOptions` (`twoFactor.requireSetup`), `TwoFactorResetOptions`, `TwoFactorSetupState`, `SafeBackRule` / `SafeBackContext` (`twoFactor.safeBack` as a function: `(back, { adminRoute, origin? }) => string`), `TotpViewComponent` (a view component as registered: a path or `{ path, exportName?, clientProps?, serverProps? }`), `SafeTotpViewProps` (`@intecion/ipal-kit/admin`), `Role` (`'user' \| 'editor' \| 'admin'`), `AccessOption` (the plugin's `access` option: `authCollection`, `defaultRole`, `authAccess`, `firstUserAdmin`, `staffCollections`).
## Accessibility — widget (`accessibility`) — details: `node_modules/@intecion/ipal-kit/docs/accessibility.md`
@@ -150,7 +155,7 @@ Fifteen ready blocks and ten page templates. **Use a library block (or a variant
| `HeroBlock`, `TextMediaBlock`, `FeatureGridBlock`, `GalleryBlock`, `FaqBlock`, `CtaBlock`, `ContactBlock`, `TeamBlock`, `PricingBlock`, `LogosBlock`, `TestimonialsBlock`, `StatsBlock`, `RichTextBlock`, `StepsBlock`, `EntryListBlock` | `@intecion/ipal-kit/blocks/rsc` | The block components (server; props `LibraryBlockProps`: data + `locale`, `isFirst`, `ui`, `ctx`, `classNames`). |
| `HERO_PARTS`, `TEXT_MEDIA_PARTS`, `FEATURE_GRID_PARTS`, `GALLERY_PARTS`, `FAQ_PARTS`, `CTA_PARTS`, `CONTACT_PARTS`, `TEAM_PARTS`, `PRICING_PARTS`, `LOGOS_PARTS`, `TESTIMONIALS_PARTS`, `STATS_PARTS`, `RICH_TEXT_PARTS`, `STEPS_PARTS`, `ENTRY_LIST_PARTS` | `@intecion/ipal-kit/blocks/rsc` | Default token classes per block part — the keys of `classNames`. |
| `defaultEntryCard(doc)`, `defaultTestimonial(doc)` | `@intecion/ipal-kit/blocks/rsc` | Default mapping of a collection document to an entry card / a testimonial (`entryCard`, `mapTestimonial` replace them). |
| `Section`, `SECTION_BACKGROUNDS`, `SectionHeader`, `Media`, `CMSLink`, `Anchor`, `buttonClass`, `BUTTON_CLASSES`, `Container`, `CONTAINER_WIDTHS`, `Card`, `CARD_CLASS`, `CARD_INTERACTIVE_CLASS` | `@intecion/ipal-kit/blocks/rsc` | UI primitives, token utilities only: section (anchor, background, `data-surface`), heading group, image/video, panel link, link element, button looks, page column, card. |
| `Section`, `SECTION_BACKGROUNDS`, `SectionHeader`, `Media`, `CMSLink`, `Anchor`, `buttonClass`, `BUTTON_CLASSES`, `Container`, `CONTAINER_WIDTHS`, `Card`, `CARD_CLASS`, `CARD_INTERACTIVE_CLASS`, `CARD_INTERACTIVE_SHADOW_CLASS` | `@intecion/ipal-kit/blocks/rsc` | UI primitives, token utilities only: section (anchor, background, `data-surface`), heading group, image/video (`Media`: `priority`, `eager`, `sizes`, `videoMode`, `pauseForReducedMotion` — a background video paused for "reduce motion", default true), panel link, link element, button looks, page column, card (hover: an `::after` shadow layer fading with `opacity`; the 1.17 `box-shadow` transition is `CARD_INTERACTIVE_SHADOW_CLASS`). |
| `itemHeadingLevel(slug, props)`, `leadsWithImage(props)` | `@intecion/ipal-kit/blocks/rsc` | Item heading tag (one below the section heading; `h2` without one; `itemHeadings` overrides) and whether the block's first image is the page's LCP image (`isFirst` / `firstImage`; `priorityImage: false` turns it off). |
| `Buttons`, `headingId(block)`, `TitleLink`, `GRID_COLUMNS`, `cx`, `parts(defaults, overrides)` | `@intecion/ipal-kit/blocks/rsc` | Helpers for own blocks: button row, heading id for `aria-labelledby`, card title link (plain text when the link is dead), grid columns, class joining, part classes. |
| `BLOCK_TEXTS`, `blockTexts(locale, own?)`, `fillText(text, value)` | `@intecion/ipal-kit/blocks/rsc` | Visitor texts the blocks write (rating, step) in en/pl; override with `texts`. |
@@ -165,8 +170,10 @@ 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. Props `className`, `side` (`'left' \| 'right'`), `avoid` (selector it lifts above, default `COOKIE_BUTTON_AVOID` = footer; `false`). Tokens `--ipal-cookie-button-offset`, `--ipal-cookie-button-inset`. Type `CookieButtonProps`. |
| `COOKIE_BUTTON_AVOID`, `bottomOverlap(tops, viewportHeight)` | `@intecion/ipal-kit/client` | Default footer selector; pixels the footer covers at the bottom of the screen (how far the button moves up) |
| `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 (`<CookieButton avoid={COOKIE_BUTTON_AVOID} />`); 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 |
| `ConsentScript` | `@intecion/ipal-kit/client` | Loads an external script (`src` or `code`) only after consent for `category` — for vendors without Consent Mode (chat, Plausible etc.). Inside `ConsentProvider`. |
| `CookieTable` | `@intecion/ipal-kit/rsc` | Server Component: cookie table for the cookie policy page — `{ rows, labels?, locale?, categories?, caption?, classNames?, storageColumn?, storageTypes? }`; `rows` from `getCookieTable()`; a **Type** column when a row is local / session storage (`storageColumn: 'auto' \| boolean`). |
@@ -197,7 +204,7 @@ Fifteen ready blocks and ten page templates. **Use a library block (or a variant
| `readEffectiveConsent(version, gpc?)` | `@intecion/ipal-kit/client` | The stored choice under `version` with Global Privacy Control applied, read live from the cookie and `navigator` (not React state) — for your own tag loader's effects. |
| `signalVendors(prev, next)` / `clarityConsent(state)` | `@intecion/ipal-kit/client` | Tells the running Meta Pixel (`fbq('consent', …)`), TikTok (`ttq.revokeConsent` / `grantConsent`) and Clarity (`consentv2` / `consent false`) about a change; `useConsent` calls it on every decision — for your own banner. `clarityConsent` → Clarity's `{ ad_Storage, analytics_Storage }`. |
| `buildConsentLogCollection()` | `@intecion/ipal-kit` | Consent log collection (id, choices, version, time — no IP/personal data; proof of consent under GDPR Art. 7(1)). The plugin wires it itself with `consentLog: true` — do not call. |
| `buildConsentLogEndpoint({ retentionDays? })` | `@intecion/ipal-kit` | `POST /api/ipal/consent` endpoint that saves decisions and deletes records older than `retentionDays` (default 1095). The plugin wires it itself with `consentLog` — do not call. |
| `buildConsentLogEndpoint({ retentionDays? })` | `@intecion/ipal-kit` | `POST /api/ipal/consent` endpoint that saves decisions and deletes records older than `retentionDays` (default 1095). The plugin wires it itself with `consentLog` — do not call. On MongoDB a TTL index (`consentLog.ttlIndex`, default true) deletes them too, also without new records. |
**Built-in texts:** `CONSENT_FALLBACK`, `CONSENT_FALLBACK_PL`, `consentFallback(locale)` (banner defaults by page language), `CONSENT_CATEGORY_LABELS` / `consentCategoryOptions()` (category names `{ en, pl }`), `COOKIE_TABLE_LABELS` (`/rsc`, `<CookieTable locale>` defaults), `COOKIE_STORAGE_LABELS` (`/rsc`, type names per language).
@@ -294,6 +301,7 @@ Opt-in with `iapl({ cookieScanner: true })`; the plugin wires the collection, en
| `MARKDOWN_PREFIX` | `@intecion/ipal-kit` | constant `'/md'` — default prefix of Markdown routes |
| `markdownHref(pathname, prefix?)` | `@intecion/ipal-kit` | page path → Markdown version address (`/pl/o-nas` → `/md/pl/o-nas`), e.g. for `alternates.types` |
| `prefersMarkdown(request \| headers \| accept)` | `@intecion/ipal-kit` | whether the `Accept` header prefers `text/markdown` (q-values); for your own proxy — `createProxy({ markdown: true })` does it itself |
| `MARKDOWN_NEGOTIATED_HEADER`, `NEGOTIATED_CACHE_CONTROL`, `appendVary(headers, token)` | `@intecion/ipal-kit` | 1.18.0 (audit F3): the request marker the proxy sets on a negotiated rewrite (the route then answers `private, no-store` + `Vary: Accept`), that cache-control, and `Vary` with a token added once — for your own proxy (content.md "content negotiation"). `markdownResponse(md, { negotiated: true })` gives the same headers. `createProxy({ markdown: { prefix?, negotiate? } })`: `negotiate: false` = no rewrite. |
| `searchContent({ payload, query, config, locale?, limit?, baseUrl?, collection?, summaryField? })` | `@intecion/ipal-kit` | searches published, indexable pages by title/description → `SearchResult[]`; does not throw |
| `listContent({ payload, config, locale?, limit? })` | `@intecion/ipal-kit` | list of published, indexable pages (no query) — used by MCP `list_pages` |
| `createSearchRoute({ getCachedPayload, config, baseUrl, defaultLimit?, rateLimit?, clientIp?, isPathVisible? })` | `@intecion/ipal-kit` | `GET` handler for the JSON search endpoint (`?q=&locale=&limit=`), with a per-IP rate limit; pass `isPathVisible` from `@/lib/content` so construction mode hides pages here too |
@@ -331,7 +339,7 @@ Opt-in with `iapl({ cookieScanner: true })`; the plugin wires the collection, en
|---|---|---|
| `createContentHelpers({ config, content?, i18n?, baseUrl?, … })` | `@intecion/ipal-kit` | factory for `src/lib/content.ts`: cached `getCachedPayload`, `getSettings`, `resolveRoute`, `getEntries`, `generatePageMetadata`, `getSiteShell`, `sitemap`, `robots`, `getRobots`, `isPathVisible`, `markdownRoute`, `healthRoute`, `mcpGET`/`mcpPOST`… — do not write these wrappers yourself |
| `createPageRoute(content, { blocks, notFound, permanentRedirect, redirect?, … })` | `@intecion/ipal-kit/rsc` | ready `[[...slug]]` catch-all page → `{ Page, generateMetadata, generateStaticParams }` (blocks, slug history redirects, JSON-LD, under-construction mode); does not paginate `?page=` |
| `createNotFoundPage(content, { load } \| { blocks, fallback?, … })` | `@intecion/ipal-kit/rsc` | default export of `not-found.tsx` — the 404 page chosen in the panel or a fallback (the lazy `load` variant is recommended) |
| `createNotFoundPage(content, { load, placeholder? } \| { blocks, fallback?, … })` | `@intecion/ipal-kit/rsc` | default export of `not-found.tsx` — the 404 page chosen in the panel or a fallback (the lazy `load` variant is recommended; `placeholder` (1.18.0) reserves the 404 content's height until it arrives — no layout shift, performance.md) |
| `renderNotFoundView(content, { blocks, fallback?, blockProps?, layoutField? }, locale)` | `@intecion/ipal-kit/rsc` | 404 content in one language — called from a server action for the lazy `createNotFoundPage({ load })` (pages.md) |
| `SiteProviders` | `@intecion/ipal-kit/rsc` | layout component: `shell={await getSiteShell(locale)}` mounts consent, cookie banner, analytics, Turnstile, site JSON-LD, theme script (and `lightbox` → `LightboxProvider`); `nonce` (from `x-nonce`) goes on the theme script and the GA4/GTM tag; does not mount `AlternateLinksProvider` |
@@ -394,6 +402,7 @@ Full option lists of `createContentHelpers` / `createPageRoute` / `SiteProviders
| `recordIntegrationStatus(payload, field, previous, { state, code?, message? })` | `@intecion/ipal-kit` | saves the state of your own integration in Site integrations (only on change / every 10 min); does not throw. For e-mail and Turnstile the plugin calls it itself — do not call |
| `buildIntegrationStatusField(name)` | `@intecion/ipal-kit` | hidden status group field (`state`, `code`, `message`, `since`, `checkedAt`) for `integrationsFields` |
| `buildIntegrationStatusBanner(statusField, label, texts?)` | `@intecion/ipal-kit` | UI field with a status banner on the integration tab (`label` string or `{ en, pl }`; `texts` = `{ failing, hint }` keys of your own `ipal` translations) (`integrationsFields`; then `pnpm generate:importmap`) |
| `UnusedMediaNotice`, `UNUSED_MEDIA_LINK_LIMIT` | `@intecion/ipal-kit/admin` | `iapl({ unusedMedia })` (1.18.0, opt-in): above an upload collection's list, how many files nothing uses (`findUnusedMedia` from `/doctor`) and a link to Payload's list filtered to them (first 100); editors and admins; deletes nothing; a hint only when the site is too big to check here |
| `IntegrationAlerts` | `@intecion/ipal-kit/admin` | dashboard alert about integrations in the `degraded` state; always injected by the plugin (`beforeDashboard`); your own integrations: a second instance with `checks`. By role: the detail (error text, link) for `details` and above (`'admin'` default, `'editor'`, `'all'`), a neutral "ask an administrator" for editors below it, nothing for others or for a session that owes its second factor (`dashboardAlerts.integrations`). `CookieCrawlAlert` takes `audience: 'editor' \| 'all'` the same way |
| `IntegrationStatusBanner` | `@intecion/ipal-kit/admin` | status banner on the tab; injected by the plugin / `buildIntegrationStatusBanner` through the import map (`pnpm generate:importmap`), the project does not import it |
@@ -424,10 +433,11 @@ The editor builds forms in the panel (Forms collection). The project does NOT wr
| Export | Import from | What it does / when |
|---|---|---|
| `RenderForm({ form, action, locale, texts, classNames?, values?, … })` | `@intecion/ipal-kit/rsc` | A panel form in a block in one line (RSC): renders message blocks and the confirmation, binds `sendForm` to the form and language, resolves the redirect, sends only `publicForm` to the browser; `form` not populated → nothing |
| `RenderForm({ form, action, locale, texts, classNames?, values?, Form?, turnstileReserveHeight?, … })` | `@intecion/ipal-kit/rsc` | A panel form in a block in one line (RSC): renders message blocks and the confirmation, binds `sendForm` to the form and language, resolves the redirect, sends only `publicForm` to the browser; `form` not populated → nothing. Renders the lazy `BuilderForm` (its code only on pages with a form, the HTML complete); `Form` swaps the component (the eager one from `/client/eager`); `turnstileReserveHeight` (default 73, 0 for an invisible widget) |
| `prepareBuilderForm({ form, action, locale, … })` | `@intecion/ipal-kit/rsc` | The server half of `RenderForm` without markup → `PreparedBuilderForm` (or `null`) to spread into `<BuilderForm>` in a client component (e.g. a configurator with changing `values`) |
| `publicForm(form)` | `@intecion/ipal-kit/rsc` | Public part of the form document (no Emails tab, no message rich text, safe redirect URL) — when you pass the form to the client yourself; never pass the raw document |
| `BuilderForm(props)` | `@intecion/ipal-kit/client` | Client renderer for any panel form (steps, all field types, Turnstile, honeypot, a11y), unstyled — look via `classNames`, field replacement via `renderField`; usually used indirectly through `RenderForm` |
| `BuilderForm(props)` | `@intecion/ipal-kit/client` | Client renderer for any panel form (steps, all field types, Turnstile, honeypot, a11y), unstyled — look via `classNames`, field replacement via `renderField`; usually used indirectly through `RenderForm`. Since 1.18.0 the `/client` export is a lazy wrapper with the same props (the code loads where a form is shown; SSR complete); `turnstileReserveHeight` keeps the widget's space |
| `BuilderForm`, `Turnstile` | `@intecion/ipal-kit/client/eager` | The same components without lazy loading — in every page's bundle. Only when a project needs them eager: `<RenderForm Form={BuilderForm}>` |
| `useBuilderForm({ form, action, texts, values?, onSuccess?, navigate?, redirectHref? })` | `@intecion/ipal-kit/client` | Panel form engine without markup (steps, `next/back/goTo`, per-step validation, server errors, redirect, analytics, `getInputProps`/`getSelectProps`/…, `TurnstileWidget`) — for your own markup of an unusual form |
### Pure panel form logic (client and server)
@@ -447,7 +457,7 @@ The editor builds forms in the panel (Forms collection). The project does NOT wr
| Export | Import from | What it does / when |
|---|---|---|
| `createSubmitAction({ getCachedPayload, headers, … })` | `@intecion/ipal-kit/server` | Creates the server action `sendForm(formId, locale, values, token?)`: honeypot → `clientIp` → `submitForm` → text from Notifications; returns `SubmitActionResult`. Standard: `export const sendForm = createSubmitAction({ getCachedPayload, headers })` in `actions.ts` |
| `submitForm({ payload, formId, data, files?, attemptKey?, turnstileToken?, ip?, locale?, maxPerMinute?, consentFieldName?, turnstileHostnames? })` | `@intecion/ipal-kit/server` | Server core (`consentFieldName`: argument → `iapl({ forms: { consentFieldName } })` → `'consent'`; `turnstileHostnames` rejects a token solved on another domain): rate limit → Turnstile → validation against the panel definition (+ GDPR consent) → saves the submission; returns a `SubmitFormResult` code, not text. Usually through `createSubmitAction`; server-only |
| `submitForm({ payload, formId, data, files?, attemptKey?, turnstileToken?, ip?, locale?, maxPerMinute?, consentFieldName?, turnstileHostnames? })` | `@intecion/ipal-kit/server` | Server core (`consentFieldName`: argument → `iapl({ forms: { consentFieldName } })` → `'consent'`; `turnstileHostnames` rejects a token solved on another domain): rate limit → Turnstile → validation against the panel definition (+ GDPR consent) → saves the submission (and, with `forms.submissionRetentionDays`, deletes older ones at most once a day); returns a `SubmitFormResult` code, not text. Usually through `createSubmitAction`; server-only |
### Honeypot
@@ -494,6 +504,7 @@ The editor builds forms in the panel (Forms collection). The project does NOT wr
| `resolveSystemLinks(settings, { locale, config, roles?, … })` | `@intecion/ipal-kit` | Links to system pages from Site settings (privacy/cookies/terms) with the page title as the label → `SystemLink[]`; in a project usually `getSystemLinks` from `lib/content` |
| `homeSlugFrom(settings, field?)` | `@intecion/ipal-kit` | Homepage slug from `SiteSettings.homepage` (populated) or `undefined` |
| `safeHref(url)` | `@intecion/ipal-kit` | The URL when safe (http(s), mailto, tel, sms, #, `/` path), otherwise `null` — blocks `javascript:`/`data:` |
| `buildUrlField({ name?, label?, required?, schemes?, description?, overrides? })`, `isAllowedUrl(value, schemes?)` | `@intecion/ipal-kit` | 1.18.0 (audit F2): a text field for an address rendered into `href` — `https://` / `http://` pass, plus the `schemes` you list (`mailto`, `tel`, `sms`, `hash`, `relative`); `javascript:`, `data:`, `//host` never. Render the value with `safeHref` too. Types `BuildUrlFieldOptions`, `UrlScheme`. |
**Types:** `BuildLinkFieldOptions`, `BuildLinksFieldOptions`, `LinkAppearance`, `LinkAppearanceOption` — link field options and styles; `LinkValue`, `ResolveLinkHrefOptions`, `ResolvedLink`, `NavItem`, `ResolveNavOptions`, `SystemLink` — panel link value, resolver options and results.
@@ -525,12 +536,13 @@ The editor builds forms in the panel (Forms collection). The project does NOT wr
| Export | Import from | What it does / when |
|---|---|---|
| `mediaImageProps(resource, { sizes?, priority?, alt?, placeholderColor? })` | `@intecion/ipal-kit` | `next/image` props for an image upload (dimensions, focal point → `objectPosition`, blur placeholder, `preload` for LCP) or `null` (video/PDF/ID) — for your own `<Media>` |
| `mediaImageProps(resource, { sizes?, priority?, eager?, alt?, placeholderColor? })` | `@intecion/ipal-kit` | `next/image` props for an image upload (dimensions, focal point → `objectPosition`, blur placeholder, `preload` for LCP) or `null` (video/PDF/ID) — for your own `<Media>`. `eager` (1.18.0): above the fold but not the LCP image (a logo) — eager without high priority or a preload |
| `videoProps(resource, { mode?, poster?, reducedMotion? })` | `@intecion/ipal-kit` | `<video>` attributes for a video upload (`'background'`: autoplay/muted/loop; `'player'`: controls, `preload="none"`) or `null` |
| `MEDIA_SIZES` | `@intecion/ipal-kit` | Ready constant `sizes` values: `full`, `half`, `third`, `quarter`, `thumb` |
| `normalizeFilename(filename)` | `@intecion/ipal-kit` | Slugifies a file name, keeping the extension (`"Zdjęcie 1.JPG"` → `"zdjecie-1.jpg"`) |
| `normalizeFilenameHook` | `@intecion/ipal-kit` | `beforeOperation` hook for an upload collection (Media) that normalizes the file name; the project adds it to its Media collection |
| `buildOptimizeUploadHook(options?)` | `@intecion/ipal-kit` | `beforeOperation` hook: blocks oversized JPG/PNG/video, converts the image to WebP after the editor agrees (sharp from `buildConfig`); the project adds it to Media |
| `buildOptimizeUploadHook(options?)` | `@intecion/ipal-kit` | `beforeOperation` hook: blocks oversized JPG/PNG/video, converts the image to WebP after the editor agrees (sharp from `buildConfig`); removes the metadata of JPEG/PNG uploads that pass without re-encoding (`stripMetadata`, default true; 1.18.0); the project adds it to Media |
| `stripImageMetadata(buffer, mimeType)`, `exifOrientation(app1)` | `@intecion/ipal-kit` | Lossless metadata removal: JPEG APP1/APP13/COM, PNG tEXt/zTXt/iTXt/eXIf/tIME → `{ buffer, changed, orientation }` (the EXIF rotation, to apply before); anything unreadable comes back unchanged. Type `StripResult` |
| `buildOptimizeUploadField(name?)` | `@intecion/ipal-kit` | "Optimize this upload" consent checkbox (default `optimizeOnUpload`) for Media, paired with `buildOptimizeUploadHook` |
| `buildMediaPlaceholderHook({ field?, size? })` | `@intecion/ipal-kit` | `beforeOperation` hook that computes a tiny blur preview (base64 WebP) and the dominant colour on upload; the project adds it to Media |
| `buildMediaPlaceholderField(name?)` | `@intecion/ipal-kit` | Hidden field group for the placeholder (read by `mediaImageProps`), paired with `buildMediaPlaceholderHook` |
@@ -621,6 +633,9 @@ Server only (`pnpm payload run`); never import it from client code, the Payload
| `SAFE_TOTP_VIEW` / `totpViewImportKey(component)` | `@intecion/ipal-kit` | `'@intecion/ipal-kit/admin#SafeTotpView'`, the wrapper's import-map path (the default `wrapper` of `wrapTotpViews`); and the import-map key (`path#export`) of a component given as a string or `{ path, exportName }`. |
| `findImportMapFile(config, cwd?)` / `missingImportMapEntries(config, entries, cwd?)` | `@intecion/ipal-kit` | Where the project's `importMap.js` is on disk (`admin.importMap.importMapFile`, else `app/(payload)<admin route>/` or `src/app/…` under `admin.importMap.baseDir` / the working directory; `null` when not found), and which of `entries` its text does not contain (`{ file, missing }`). A hint from the file on disk, not the map in the build: warn on it, never block on it. Behind `twoFactor.importMapCheck`. |
| `buildSetupFields({ statusField? })`, `stampSetupFrom`, `backfillSetupFrom(payload, collection)` | `@intecion/ipal-kit` | The parts of "2FA setup required" for a project that wires them itself: the fields for the 2FA collection (`totpSetupFrom`, and the panel's `totpSetupStatus` unless `statusField: false`), the `beforeChange` hook that stamps the window start (on create, and when an account loses its TOTP secret), and the start-up step that gives accounts without TOTP and without a start their window (returns how many; once per account). |
| `resolveConfirmByEmail(option)`, `startEnrolment(req, { collection, options, totp? })`, `buildEnrolmentEndpoints({ collection, options, ownOrigin?, resetAccess? })`, `ENROL_CONFIRM_PATH`, `ENROL_ADMIN_CONFIRM_PATH` | `@intecion/ipal-kit` | `twoFactor.confirmByEmail` (1.18.0, on by default; security.md "Set-up confirmed by e-mail"): the option read strictly (null = off); the `/setup-totp` answer for an account without a factor (checks the code, keeps the secret pending, mails the link, sets the browser cookie, `202 { ok: false, pending: true, mailed, message }`); the link's page `GET /api/iapl/two-factor/confirm`, its button `POST` (single use, 30 min, same browser, own origin; writes the factor, ends the sessions, signs nobody in) and the admin's `POST /api/iapl/two-factor/confirm-pending { userId }`. Types `ConfirmByEmailOptions`, `ResolvedConfirmByEmail`, `EnrolmentContext`, `EnrolmentEndpointsOptions`. |
| `readPendingEnrolment(payload, collection, id)`, `pendingEnrolmentInfo(…)`, `dropPendingEnrolment(…)`, `countPendingEnrolments(payload, collection)`, `pendingEnrolmentKey(collection, id)` | `@intecion/ipal-kit` | The waiting set-up in payload-kv (`iapl:2fa-enrol:<collection>:<id>`; memory when there is no kv): read (null when expired), `{ createdAt, expiresAt }` for screens, end it, count them (the doctor). Type `PendingEnrolment` (`{ secret, token, browser, createdAt, expiresAt }`, token and browser as sha256). |
| `buildTotpNoticeHooks(collection, { notices })`, `sendTwoFactorNotice(payload, account, 'on' \| 'off' \| 'changed', by?)`, `verifyTotpCode(secret, token, { algorithm?, digits?, period? })`, `mailConfigured(payload)` | `@intecion/ipal-kit` | beforeChange + afterChange for the 2FA collection: a notice mail on every enrolment, change, removal / reset (any path; a removal ends a waiting set-up); the notice itself; RFC 6238 check with one period either side (as the 2FA package); whether Payload has a real mail transport (its `console` fallback = false). |
| `buildTwoFactorResetEndpoint(collection, { access?, ownOrigin? })`, `TWO_FACTOR_RESET_PATH` | `@intecion/ipal-kit` | `POST /api/ipal/two-factor/reset` `{ userId }`: clears the account's TOTP secret and sessions and starts a new window. `ownOrigin(req)` false → `403` before anything changes (the plugin passes the `twoFactor.sameOrigin` rule; wire `requestFromOwnOrigin` when you build it yourself). Default: a staff admin whose session entered its own TOTP code; `access` replaces that (only `true` allows; a session that owes its code is always refused). `iapl` registers it only with `twoFactor.guard` on. |
| `countAccountsWithoutTotp(payload, collection, setupWindowMs?)` | `@intecion/ipal-kit` | `{ without, blocked }` — accounts of the 2FA collection without TOTP, and how many are past their window. |
| `resolveRequireSetup(option)`, `strictExempt(fn)`, `SETUP_FROM_FIELD`, `DEFAULT_SETUP_WINDOW_HOURS` | `@intecion/ipal-kit` | `twoFactor.requireSetup` → `{ requireSetup, setupWindowMs, exempt? }` as the guard reads it (throws on a `windowHours` that is not a number ≥ 0 or `false`, and on an `async` `exempt`); the wrapper that makes an `exempt` function answer `true` only for exactly `true`; the field name `'totpSetupFrom'`; `72`. |
@@ -637,7 +652,11 @@ Server only (`pnpm payload run`); never import it from client code, the Payload
| `buildCsp({ mode?, reportUri?, reportGroup?, r2Url?, analytics?, metaPixel?, linkedIn?, tiktok?, clarity?, turnstile?, youtube?, googleMaps?, nonce?, strictDynamic?, dev?, extra?, override? })` | `@intecion/ipal-kit` | Returns `{ key, value }` with a hardened CSP (`base-uri`, `object-src`, `frame-ancestors`, `form-action`) + sources for the enabled integrations. `mode: 'report-only'` → `…-Report-Only` (start here), `'enforce'` later. `extra` adds to any directive, `override` replaces / drops one (`null`). `dev` (default `NODE_ENV === 'development'`) adds `'unsafe-eval'`. `nonce` → `'nonce-…' 'strict-dynamic'`. |
| `buildCspHeaders(args)` | `@intecion/ipal-kit` | `[csp, Reporting-Endpoints]` (the second only with `reportUri`). |
| `buildAdminCsp(args)` / `buildAdminCspHeaders(args)` | `@intecion/ipal-kit` | Looser policy for Payload's admin: Monaco from `cdn.jsdelivr.net`, `blob:` workers, `https:` images, Live Preview `frame-src 'self'`, `frame-ancestors 'self'`. Rule `{ source: '/admin/:path*', headers: buildAdminCspHeaders({ mode, reportUri }) }` AFTER the site-wide rule. |
| `createCspReportRoute({ onReport?, maxBytes? })` | `@intecion/ipal-kit` | `POST` handler for `reportUri` (`src/app/api/csp-report/route.ts`): both report formats, body cap 16 KB, always `204`; default sink = one `[csp] …` `console.warn` line per violation (Coolify logs). |
| `createCspReportRoute({ onReport?, maxBytes?, maxReports?, rateLimit? })` | `@intecion/ipal-kit` | `POST` handler for `reportUri` (`src/app/api/csp-report/route.ts`): both report formats, body cap 16 KB, always `204`; default sink = one `[csp] …` `console.warn` line per violation (Coolify logs) made by `cspLogLine` — origin / path only, no control characters, values ≤ `CSP_LOG_VALUE_MAX` (128) (1.18.0, audit F1); at most `maxReports` (10) per request, `rateLimit` 60 / min per client (`false` = none); your `onReport` gets the raw values. |
| `accessAllowed(option, answer, { strict?, warn? })`, `strictAccessAnswers(req)` | `@intecion/ipal-kit` | how the plugin reads a project's access callback (`cookieScanner.access`, the doctor's `access`): since 1.18.0 only a literal `true` allows (`strict`, default; `iapl({ strictAccessAnswers: false })` = any truthy answer); a non-boolean answer is reported once per option with the fix `Boolean(req.user)`. `strictAccessAnswers(req)` = the reading of the request's config. Type `AccessAnswerOptions`. |
| `cspLogLine(violation)`, `CSP_LOG_VALUE_MAX` | `@intecion/ipal-kit` | the default CSP log line (safe to log) for your own sink, and its value cap. |
| `buildQueryGuardHook({ listLimit?, refuseOperatorSort? })`, `applyQueryGuard(config, options)`, `capListLimit(args, max?)`, `isOperatorSort(sort)`, `isStaffRequest(req)`, `RefusedSortError`, `DEFAULT_LIST_LIMIT`, `isQueryGuardHook`, `QUERY_GUARD_MARK` | `@intecion/ipal-kit` | 1.18.0 (audit F4, F5; security.md "Lists and sorting"): the `beforeOperation` hook iapl adds to every collection — lists from a non-staff caller over REST / GraphQL capped at 100 (`pagination=false`, `limit=0` included), a `sort` naming a database operator → `400` (logged as `info`). Options `listLimit: false \| { max, staff, exclude }`, `refuseOperatorSort: false`. Put the hook on a collection a plugin adds after iapl. Type `ListLimitOptions`. |
| `applyLockedDocumentsAccess(config, access?)`, `staffOnlyLocks`, `LOCKED_DOCUMENTS_SLUG` | `@intecion/ipal-kit` | 1.18.0: Payload's document locks (`payload-locked-documents`) for staff accounts only (with the second factor); iapl sets it at start (`lockedDocuments: false` = Payload's default, `{ access }` = your rule per operation). Type `LockedDocumentsAccess`. |
| `parseCspReports(body)` | `@intecion/ipal-kit` | Normalises a report body (`csp-report` object or Reporting API array) to `CspViolation[]` — for your own collector. |
| `buildReportingEndpoints(url, group?)`, `cspHeaderKey(mode?)`, `DEFAULT_CSP_REPORT_GROUP` | `@intecion/ipal-kit` | Building blocks: the `Reporting-Endpoints` header, the header name for a mode, the default `report-to` group (`'csp-endpoint'`). |
| `createCspNonce()`, `CSP_NONCE_HEADER` | `@intecion/ipal-kit/next/middleware`, `@intecion/ipal-kit` | A per-request nonce and the request header (`x-nonce`) `createProxy({ csp })` passes it in — for your own proxy. Nonces make pages dynamic (no ISR). |
@@ -744,6 +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.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 }`).
@@ -870,14 +890,25 @@ Bin: `iapl-doctor` (`pnpm exec iapl-doctor [dir] [--json] [--md] [--strict] [--f
| `findFrontend(ctx)` | `@intecion/ipal-kit/doctor` | The folder of the site's pages (`FrontendLayout`: `dir`, `multi`, `ambiguous`, `missingOverride`) — found by structure (any route group with the catch-all page, a localized one first); `layout.frontend` in `iapl-doctor.json` wins. |
| `createLiveFetcher(url, { adminRoute, staging })` | `@intecion/ipal-kit/doctor` | Cached GET-only fetcher for the live rules. |
| `runDeepProbe(ctx)` | `@intecion/ipal-kit/doctor` | `pnpm exec payload run …/dist/modules/doctor/probe.js` in the project → `DoctorStatus`. |
| `collectDoctorStatus(payload)` | `@intecion/ipal-kit/doctor` | Read-only counts: `usersWithout2fa`, `pendingCookies`, `plugin`, `node`. |
| `collectDoctorStatus(payload)` | `@intecion/ipal-kit/doctor` | Read-only counts: `usersWithout2fa`, `pendingCookies`, `media` (images over `IMAGE_RULES`, 1.18.0), `plugin`, `node`. |
| `PERF_BUDGETS`, `SERVER_BUDGET`, `perfBudgets(overrides)`, `overBudget(measured, budget)`, `IMAGE_RULES` | `@intecion/ipal-kit/doctor` | Performance budgets (1.18.0, performance.md): the defaults per profile (`mobile`, `desktop`: `lcp`, `cls`, `inp`, `tbt`, `jsBytes`, `cssBytes`, `fontBytes`, `requests`, `renderBlocking`, `thirdParty`) and per render (`queriesPerRender`); a project's own on top; the broken budgets of one measurement as lines (empty = within budget); the image limits (1.5 MB, 2560 px, AVIF/WebP). Types `PerfBudget`, `PerfMeasurement`, `PerfProfile`, `ServerBudget`. The gate: `iapl-performance/resources/performance.spec.template.ts` + `perf-lab.mjs`. |
| `findUnusedMedia(payload, { limit?, only? })` → `UnusedMedia \| null` | `@intecion/ipal-kit/doctor` | Media of the upload collections no document or global mentions — by id or by file name in a text; `{ byCollection, checked, complete, total }`; reads only. The panel notice lists them only when `complete` |
| `syncTtlIndex(payload, slug, { days, enabled, from })`, `ttlField()`, `TTL_FIELD`, `TTL_INDEX`, `isMongo(config)` | `@intecion/ipal-kit` | The MongoDB TTL index the plugin keeps for the consent log and statistics (1.18.0): created / moved to the current retention (`collMod`) / dropped; records backfilled once from `from`. For a log collection of your own: add `ttlField()`, call it in `onInit`. Type `TtlSyncResult` |
| `withVersionLimit(entity, 'collection' \| 'global', limit?)`, `PLUGIN_VERSION_LIMIT` | `@intecion/ipal-kit` | A collection or global whose versions are on without a limit gets `maxPerDoc` / `max` (default 20); a limit already set wins. iapl() applies it to its own entities |
| `collectGrowth(payload)` → `GrowthStatus`, `growthRules`, `GROWTH_DEFAULTS`, `folderBytes(dir)` | `@intecion/ipal-kit/doctor` | What grows (1.18.0, performance.md §6): per collection documents, bytes (MongoDB) and the oldest record; versions per collection and global with their limit; `payload-kv` entries and expired ones; media no document points at (first 5000 documents) — counts only. The `growth` rules (`growth-size`, `-versions`, `-versions-config`, `-retention`, `-submissions`, `-kv`, `-media`, `-disk`) and their default thresholds (`iapl-doctor.json` → `growth`, type `GrowthThresholds`). |
| `performanceRules` | `@intecion/ipal-kit/doctor` | The doctor's `performance` group (`perf-images-config`, `perf-fonts`, `perf-render-blocking`, `perf-embeds`, `perf-animations`, `perf-budgets`, `perf-live`, `perf-images`) — part of `doctorRules`. |
| `buildDoctorEndpoint({ tokenVar, access })` | `@intecion/ipal-kit/doctor` | `GET /ipal/doctor` (`/api/ipal/doctor`): 404 until the token variable (default `IAPL_DOCTOR_TOKEN`, ≥ 32 chars) is set, Bearer token or `access`, rate-limited. Added by `iapl` unless `doctor: false`. |
| `jobsRunAccess({ secretVar? })` | `@intecion/ipal-kit` | The rule iapl puts on `jobs.access.run` when the project writes none: `cronSecretMatches(req, process.env[secretVar])` or an admin with the second factor. Reuse it in your own rule: `run: (a) => jobsRunAccess()(a) \|\| myCheck(a)`. Type `JobsRunAccessOptions`. |
| `withJobsRunAccess(config, options \| false)` / `jobsRunNotice(config)` | `@intecion/ipal-kit` | The config with that rule (only when `jobs.access.run` is missing; marks `custom.iapl.jobsRunDefault`); the start-up line when the queue is on and the secret is missing (null otherwise). |
| `cronSecretMatches(req, secret)`, `CRON_SECRET_ENV`, `CRON_SECRET_MIN_LENGTH` | `@intecion/ipal-kit` | `Authorization: Bearer <secret>` compared in constant time; an unset or shorter-than-16 secret never matches. Default variable `CRON_SECRET`. |
| `runRouteCheck({ config, appDir?, snapshot?, update?, graphql?, cwd?, log? })` | `@intecion/ipal-kit/doctor` | `routes:check`: every public route (REST, GraphQL, Next route files) against the judged snapshot (default `e2e/routes.snapshot.json`); returns 1 on a route nobody judged or an entry without a reason; `update` writes new routes with an empty reason. Template: `iapl-audit/resources/routes.template.ts` (security.md "Routes nobody has judged"). Type `RunRouteCheckOptions`. |
| `ATTACK_PROBES`, `runAttackProbes(ctx, probes?)`, `createProbeContext(base, { page?, secrets?, timeoutMs?, userAgent? })` | `@intecion/ipal-kit/doctor` | The HTTP attack probes (secret files, bundle secrets, proxy bypass, open redirect, host-header and negotiation cache poisoning, NoSQL operators in sign-in and sort, anonymous where / draft / GraphQL reads, error leaks, unbounded lists, `/_next/image`, headers, methods, 8 MB bodies). Each `{ id, class, title, live, finding?, run(ctx) → { ok, detail, skipped? } }`; `runAttackProbes` runs the `live` ones by default. The doctor's `live-probes` rule; the Playwright template `iapl-audit/resources/attack-probes.spec.template.ts`; your own probe = an object of the same shape (security.md "Security suites"). Types `AttackProbe`, `ProbeContext`, `ProbeAnswer`, `ProbeResult`. |
| `scanCode(path, code)`, `listCodeFiles(root, start)`, `codeFindings(ctx)`, `scanConfigs(next, payload)`, `securityCodeRules`, `SECURITY_OK_MARKER`, `LIVE_PROBE_IDS` | `@intecion/ipal-kit/doctor` | The static security rules behind `code-patterns` and `config-dangerous`: every hit `{ rule, file, line, severity, message, text }` (types `CodeHit`, `CodePatternId`). A correct place is marked `// iapl-security-ok: <why>`. Use `scanCode` in a test of your own to keep a judged allow-list, as the plugin does (`test/security-patterns.allow.json`). |
| `listPublicRoutes(config, { graphqlSchema?, routeFiles? })` | `@intecion/ipal-kit` | Stable ids of every door a built config opens: `GET /api/users/me`, `graphql mutation loginUser`, `next GET /sitemap.xml`. From the config only (same on every database). Types `RouteInventoryOptions`, `GraphqlSchemaLike` (`getQueryType` / `getMutationType`). |
| `listNextRouteFiles(files, read)` | `@intecion/ipal-kit` | Next route handlers of an app directory (`route.ts` with the methods it exports, `robots.ts`, `sitemap.ts`, `manifest.ts`; route groups left out). |
| `compareRouteSnapshot(current, snapshot)` / `updateRouteSnapshot(current, snapshot)` | `@intecion/ipal-kit` | `{ unjudged, unexplained, gone }` against a `RouteSnapshot` (route id → reason); the snapshot after `--update` (new routes with `''`, gone ones dropped). Type `RouteSnapshotDiff`. |
**Types:** `DoctorRule`, `DoctorFinding`, `RuleFinding`, `DoctorReport`, `DoctorConfig`, `DoctorRuleSetting`, `DoctorSeverity`,
**Types:** `AttackProbe`, `ProbeContext`, `ProbeAnswer`, `ProbeResult`, `CodeHit`, `CodePatternId`, `DoctorRule`, `DoctorFinding`, `RuleFinding`, `DoctorReport`, `DoctorConfig`, `DoctorRuleSetting`, `DoctorSeverity`,
`DoctorSource`, `DoctorStatus`, `DoctorContext`, `RunDoctorOptions`, `DoctorEndpointOptions`, `FrontendLayout`.
## Turnstile (`turnstile`) — details: `node_modules/@intecion/ipal-kit/docs/turnstile.md`
+19 -10
View File
@@ -94,14 +94,15 @@ legacy-peer-deps=true
pnpm add @intecion/ipal-kit @payloadcms/plugin-seo @payloadcms/plugin-form-builder \
@payloadcms/storage-s3 @clocklimited/payload-2fa@3.0.0-beta.7 tailwindcss @tailwindcss/postcss
```
**Next.js 16.4.5 or later** (minimum safe version: 16.0.0–16.4.0 have critical advisories, 16.3.0–16.4.4 have
GHSA-mfr8-8qww-v76h — AGENT.md §4 item 11): `pnpm add [email protected] [email protected] sharp@^0.35.5` when
**Next.js 16.4.6 or later** (minimum safe version: 16.0.0–16.4.0 have critical advisories, 16.3.0–16.4.4 have
GHSA-mfr8-8qww-v76h; 16.4.6 is the tested version — AGENT.md §4 item 11): `pnpm add [email protected] [email protected] sharp@^0.35.5` when
create-payload-app gave you an older one.
**Payload 3.94.1** (what the reference site and the starter use; the plugin accepts `^3.90.2`): every `payload` /
`@payloadcms/*` on the same exact version, `react` and `react-dom` 19.3.1 (Payload 3.94 requires `^19.3.1`), and
**Node.js 22.23.5 or later** on the 22 line (`"engines": { "node": ">=22.23.5 <23" }`, `.nvmrc` `22`) — Payload 3.94's
minimum, also in Coolify (Nixpacks picks the patch: check `node -v` in the app's Terminal after the first deploy). After the install, `pnpm audit --prod` → no high or critical; add the `dompurify` and `happy-dom` overrides
from AGENT.md §4 item 12 (`"happy-dom@<21.0.4": "^21.0.4"` fixes two high advisories Lexical still brings in). On an
minimum, also in Coolify (Nixpacks picks the patch: check `node -v` in the app's Terminal after the first deploy). After the install, `pnpm audit --prod` → no high or critical; add the `cross-spawn`, `dompurify`, `happy-dom` and `ws` overrides
from AGENT.md §4 item 12 (`"happy-dom@<21.0.4": "^21.0.4"` fixes two high advisories Lexical still brings in,
`"ws@>=8 <8.23.0": "^8.23.0"` one in Payload's `ws`; a Postgres site also the `esbuild` one listed there). On an
older Payload also the `mongoose` (MongoDB) and `undici` ones listed there. `pnpm exec iapl-doctor` → no
`transitive-min` finding.
`nodemailer`, `lucide-react`, `slugify`, `server-only` come with the plugin — do not add them (your own
@@ -111,7 +112,7 @@ plugin-seo, plugin-form-builder, storage-s3) in `pnpm.overrides` **to the exact
`"build": "cross-env NODE_OPTIONS=\"--max-old-space-size=3072\" next build --webpack"`.
**Check.** `ls node_modules/@intecion/ipal-kit/docs/agent/AGENT.md` exists;
`pnpm ls payload @payloadcms/ui @payloadcms/plugin-seo` — one, identical version; `pnpm ls next sharp` → next ≥ 16.4.5,
`pnpm ls payload @payloadcms/ui @payloadcms/plugin-seo` — one, identical version; `pnpm ls next sharp` → next ≥ 16.4.6,
sharp ≥ 0.35.5; `ls src/middleware.ts` → not found.
404 on `pnpm add` = missing `@intecion:registry` line; 401 = stale `_authToken` in `~/.npmrc` (PROGRAMISTA §1).
@@ -207,7 +208,7 @@ are never added to a new site. Local `.env` with `PAYLOAD_SECRET` ≥ 32 charact
One language: one entry in `locales`, no `[locale]` folder (i18n.md).
**Check.** `pnpm payload generate:importmap` (whiteLabel adds admin components) and `pnpm generate:types` without
errors (the import map lists `@intecion/ipal-kit/admin#TotpRedirectProvider`, `#SafeTotpView` and `#SignInLook`); `pnpm dev`, `/admin`: first-user screen → after saving, TOTP setup is enforced (`/admin/setup-totp?back=%2Fadmin`, QR, no reloading);
errors (the import map lists `@intecion/ipal-kit/admin#TotpRedirectProvider`, `#SafeTotpView` and `#SignInLook`); `pnpm dev`, `/admin`: first-user screen → after saving, TOTP setup is enforced (`/admin/setup-totp?back=%2Fadmin`, QR, no reloading; after the code the confirmation link is in the dev console — no mail set up yet — open it in the same browser, then sign in again);
the panel shows Site settings, Site integrations, Cookies, Form messages, the Forms group, Consent records.
`curl -s -o /dev/null -w '%{http_code}' -X POST localhost:3000/api/ipal/consent -H 'content-type: application/json'
-d '{"id":"0123456789abcdef","version":1,"state":{"necessary":true,"functional":false,"analytics":false,"marketing":false}}'` → `201`.
@@ -240,7 +241,14 @@ the panel shows Site settings, Site integrations, Cookies, Form messages, the Fo
opens everything its role allows. One entity reachable without the code: `custom.ipal.secondFactor`.
**Setup required** (`twoFactor.requireSetup`, default): an account without TOTP reaches only the setup screen; it
has 72 h from its creation (or an admin's "Reopen setup" on the account page), then it is blocked. So create an
account, hand over the password and have the owner set 2FA up at once. **Postgres/SQLite: `pnpm payload
account, hand over the password and have the owner set 2FA up at once.
**Confirmed by e-mail** (`twoFactor.confirmByEmail`, default since 1.18.0): the code only starts the set-up; a link
to the account's own address, opened in the same browser within 30 min, turns it on (then sign in again). So set
up e-mail (Site integrations → E-mail sending, "Send a test e-mail") BEFORE people enrol, and keep `serverURL`
(`NEXT_PUBLIC_SERVER_URL`). The first administrator of a fresh site, with no mail yet: the link is in the dev
server's console / Coolify Logs (`[iapl] 2FA: … Link`); open it in the browser that scanned the code. Check: the
screen says "we sent a link to e…@…", the API still answers 403 until the link is opened. Off:
`confirmByEmail: false` (security.md "Set-up confirmed by e-mail"). **Postgres/SQLite: `pnpm payload
migrate:create` and have the migration applied when the container starts, before the site serves** — `prodMigrations`
or the start command `pnpm payload migrate && pnpm start`, never a pre-deployment command (deployment.md §4.3)
(column `totp_setup_from`, there whenever 2FA is
@@ -480,7 +488,7 @@ and `rel="alternate" type="text/markdown"`; `/pl/nie-ma-takiej` → 404 with con
| `src/app/robots.ts` | `export { getRobots as default } from '@/lib/content'` + `force-dynamic` (AI crawler policy from Site settings → Search engines; `robots` = code only) |
| `src/app/manifest.ts` | `export { manifest as default } from '@/lib/content'` + `force-dynamic` |
| `src/app/api/health/route.ts` | `export { healthRoute as GET } from '@/lib/content'` + `force-dynamic` |
| `src/app/api/csp-report/route.ts` | `import { createCspReportRoute } from '@intecion/ipal-kit'` + `export const POST = createCspReportRoute()` (CSP violation reports → `[csp]` lines in the logs) |
| `src/app/api/csp-report/route.ts` | `import { createCspReportRoute } from '@intecion/ipal-kit'` + `export const POST = createCspReportRoute()` (CSP violation reports → `[csp]` lines in the logs: origins and paths only, 10 per request, 60 requests per client a minute; security.md "Collecting reports") |
```ts
// next.config.ts
@@ -574,7 +582,8 @@ Already wired and required: `markdown: true` (stage 6 proxy), `markdownAlternate
**Check.** `curl -s localhost:3000/llms.txt` → site name and a list of pages with descriptions (`aiSummary`);
`/llms-full.txt` → page content; `curl -s localhost:3000/md/pl` → Markdown of the home page; `curl -s -H 'Accept:
text/markdown' localhost:3000/pl` → the same Markdown; `curl -s -X POST localhost:3000/api/mcp -H 'content-type:
text/markdown' localhost:3000/pl` → the same Markdown, sent `cache-control: private, no-store` with `Vary: Accept`
(`curl -sD- -o/dev/null -H 'Accept: text/markdown' localhost:3000/pl`; 1.18.0, so no CDN stores it as the page); `curl -s -X POST localhost:3000/api/mcp -H 'content-type:
application/json' -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'` → `get_site_info`, `list_pages`,
`search_content`, `get_page`; `/indexnow-key.txt` → `404` until the key is generated in the panel, then the key.
@@ -661,7 +670,7 @@ scaling (5). `●` routes for pages need the database at build time (PROGRAMISTA
6. **Notifications**: form messages in every language.
7. **Site integrations → E-mail sending**: "Sender name" (the client's name; empty = the site name) and **"Sender
address"** (the client's address: with the mail service replies go there). "Sending method" stays **IWSN (built-in)**; choose **Own SMTP server** and fill in its fields **only** when the client asked
for its own server — what is chosen is what is used, an incomplete SMTP server sends nothing. A new site sends through IWSN with nothing picked; picking another option and saving stores it (the panel warns before the save when its settings are incomplete). On the production domain: the block "How e-mails are sent" must say "Connected to IWSN" ("waiting for approval": while the service runs with enrolment "pending" (from its launch until Intecion switches to open enrolment), every new site waits for approval — ask Intecion to approve the host; under open enrolment it is the exception; the real domain enrols by itself at launch although the site was connected on its development address — nothing to press; "The data comes from another site" = the site is non-public (its host matches `developmentHosts`, built in `*.dev.netscale.pl`, or `IAPL_NOINDEX=1`) and holds a copy of another site's data: press "Connect again" only if the copy should send — on the production domain it means `IAPL_NOINDEX` was left set. A development address under `*.dev.netscale.pl` needs nothing; a staging or test copy on any other host must have its host in `iapl({ developmentHosts: […] })` (an array of host patterns: a single string, an empty entry or a lone `*` stops the start) or `IAPL_NOINDEX=1`, or it mails the real addresses in its data), then **Send test e-mail** → "through IWSN". Turnstile (for testing site
for its own server — what is chosen is what is used, an incomplete SMTP server sends nothing. A new site sends through IWSN with nothing picked; picking another option and saving stores it (the panel warns before the save when its settings are incomplete). On the production domain: the block "How e-mails are sent" must say "Connected to IWSN" ("Waiting for confirmation": press "Połącz z IWSN" and have a person of Intecion confirm the site on the page that opens — the owner's step, @intecion.com sign-in; "waiting for approval" with no button: ask Intecion; the real domain enrols by itself at launch although the site was connected on its development address — nothing to press; "The data comes from another site" = the site is non-public (its host matches `developmentHosts`, built in `*.dev.netscale.pl`, or `IAPL_NOINDEX=1`) and holds a copy of another site's data: press "Connect again" only if the copy should send — on the production domain it means `IAPL_NOINDEX` was left set. A development address under `*.dev.netscale.pl` needs nothing; a staging or test copy on any other host must have its host in `iapl({ developmentHosts: […] })` (an array of host patterns: a single string, an empty entry or a lone `*` stops the start) or `IAPL_NOINDEX=1`, or it mails the real addresses in its data), then **Send test e-mail** → "through IWSN". Turnstile (for testing site
`1x00000000000000000000AA`, secret `1x0000000000000000000000000000000AA`; production keys from the client), analytics/pixel
IDs, IndexNow → generate key. Mail/Turnstile errors show up as a dashboard alert.
8. **Forms**: check the addresses in the Emails tab of the seeded forms.
+105 -6
View File
@@ -25,6 +25,92 @@ 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 "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
counted per client IP and address. Without it every visitor shares one bucket (20× the limit).
2. A staff collection with its own `auth.maxLoginAttempts` / `lockTime` keeps them; otherwise Payload's lock is now 50
failures for an hour (beside 5 per IP and address in 15 minutes). Payload's behaviour back: `accounts: { signInLimit: false }`.
3. A panel or front end that signs **staff** in from another domain: `accounts: { signInSameOrigin: { origins: ['https://…'] } }`
(or `false`). A proxy that rewrites `Host`: set `serverURL`. Customer / visitor logins are not affected.
4. Scripts or integrations that change their OWN e-mail or password over the API send `currentPassword`; editors
see "Current password" on their account page. Off: `accounts: { confirmOwnChanges: false }`.
**Check:** five wrong passwords for an editor from one address → `429` there, `200` from another; the account page
shows "Current password"; `curl -X POST <site>/api/users/login -H 'Origin: https://other.example' …` → `403`.
**→ 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
are not affected. Nothing to wire, no migration, no import-map change. Off: `twoFactor: { confirmByEmail: false }`.
**Check:** `pnpm exec iapl-doctor --deep` shows no `2fa-enrolment-mail` error; a test editor scans the code → the
screen says "we sent a link to …", the link opened in the same browser → "Two-step verification is on".
**→ 1.18.0, security audit fixes (CHANGELOG 1.18.0 "Security audit 2026-12"; security.md "Lists and sorting") — no
migration, no import-map change; check before deploying:** (1) **public lists are capped at 100** for callers that are
not staff (REST / GraphQL; the Local API and the panel are not touched): a client-side script that reads more than
100 documents anonymously gets `hasNextPage: true` — page through, or `listLimit: { max }` / `{ exclude: ['slug'] }`
/ `false`; (2) a `?sort=$…` answers `400` (`refuseOperatorSort: false` = Payload's way); (3) Payload's document locks
are staff only (`lockedDocuments: false` = Payload's default); (4) the negotiated Markdown at a page URL is
`private, no-store` + `Vary: Accept`, while HTML pages keep their caching (ISR unchanged) — a proxy of your own that
rewrites to `/md/…` copies the headers (content.md); `markdown: { negotiate: false }` turns negotiation off; (5) CSP
report log lines show origins and paths, at most 10 per request and 60 requests per client a minute (a log parser
that read full URLs adapts; `createCspReportRoute({ maxReports, rateLimit })`); (6) a text field of your own whose
value goes into `href` (social profiles, a website): `buildUrlField()` and `safeHref()` at render (no schema change);
(7) **access callbacks are strict:** `cookieScanner.access` and the doctor's `access` allow only on a literal `true`
— a callback that returns `req.user` now refuses (`403`): return `Boolean(req.user)` or a role check; the old reading
back: `iapl({ strictAccessAnswers: false })`; (8) the first `iapl-doctor --only security` run shows the new `code-*` / `config-dangerous` rules — judge each, mark a
correct place `// iapl-security-ok: <why>`. **Check:** `curl -s '<site>/api/pages?limit=100000' | jq .limit` → `100`;
`curl -s -o /dev/null -w '%{http_code}' '<site>/api/pages?sort=%24where'` → `400`;
`pnpm exec iapl-doctor --url <site> --only live-probes` → no finding.
**→ 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 <site>/api/pages/versions` as a visitor → 200 (published only), not 500.
**→ 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 <CRON_SECRET>` 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
the header, 200 with it. (2) A front end that posted to `/api/form-submissions` as a customer account (not through
`submitForm`): move it to `submitForm` / `createSubmitAction`, or set `forms.formSubmissionOverrides.access.create`.
(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.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
button, the last footer link can be tapped. Bottom padding a project added by hand for the button: remove it (the
plugin counts existing padding, so it is not doubled, but it is no longer needed). Amount by hand:
`--ipal-cookie-button-space` on the footer (`0` = none); no room: `reserve={false}`. The placement before:
`cookieButton={<CookieButton avoid={COOKIE_BUTTON_AVOID} />}` on `SiteProviders`. A project e2e that expects the button
above the footer, or an exact footer height after a decision: update it.
**→ 1.17.1:** (1) `src/proxy.ts`: replace the matcher literal with
`['/((?!(?:api|admin|_next)(?:/|$)|.*\\..*).*)']` (i18n.md "Next matcher"; `iapl-doctor` rule `proxy-matcher`).
The old one skipped every page whose first segment only starts with `api`, `admin` or `_next` (`/administracja`):
@@ -103,7 +189,7 @@ the banner → `<CookieBanner settings="detailed">` and remove the copy. With `d
`buildGlobalRevalidateHook({ revalidatePath })`; `consentFieldName` passed only because the option was ignored →
`forms.consentFieldName` works now; your own seed guard / upsert code → `@intecion/ipal-kit/seed` (`createSeeder`).
**Every upgrade — Next.js 16.4.5 or later** (AGENT.md §4 item 11): `pnpm ls next sharp`; below 16.4.5 →
**Every upgrade — Next.js 16.4.6 or later** (AGENT.md §4 item 11): `pnpm ls next sharp`; below 16.4.6 →
`pnpm add [email protected] [email protected] sharp@^0.35.5`, `rm -rf .next`, build, redeploy on Coolify
(a new image ships the fixed next and sharp). **Check:** `pnpm exec iapl-doctor` → no `next-min` finding; `pnpm dev`
prints no security-upgrade warning.
@@ -121,11 +207,15 @@ Postgres/SQLite run `pnpm payload migrate:create` anyway and commit it if it is
saves; `pnpm exec iapl-doctor` → no `versions` finding; Coolify app → Terminal → `node -v` → 22.23.5 or later.
**Every upgrade — dependency advisories** (AGENT.md §4 item 12): `pnpm audit --prod`; on Payload 3.94.x add the
`dompurify` and `happy-dom` overrides to `pnpm.overrides`; on an older Payload also `mongoose` (MongoDB sites; 3.90–3.93
`cross-spawn`, `dompurify`, `happy-dom` and `ws` overrides to `pnpm.overrides` (`ws`: GHSA-37g9-w4hg-h9qr, high;
`cross-spawn`: GHSA-ghv9-86vm-4v8m, critical, Windows only; both 1.18.0); a Postgres site also
`"esbuild@<0.25.0": "^0.25.12"` (via drizzle-kit, AGENT.md §4 item 12); on an older Payload also `mongoose` (MongoDB sites; 3.90–3.93
pin 8.24.1, which has a critical advisory, GHSA-pcrw-h46h-c93h, and four more) and `undici` (3.90–3.91):
```json
"cross-spawn@>=7 <7.1.0": "^7.1.2",
"dompurify@<3.4.17": "^3.4.17",
"happy-dom@<21.0.4": "^21.0.4",
"ws@>=8 <8.23.0": "^8.23.0",
"mongoose@>=8 <8.24.7": "~8.24.10",
"undici@>=7 <7.30.1": "^7.30.1"
```
@@ -144,7 +234,7 @@ panel opens and a document saves.
`engines`. Remove `nodemailer` and `@types/nodemailer` from the project's own `package.json` if someone added them
(the plugin's copy is the one `mailAdapter` uses). **Check:** Site integrations → E-mail sending → send a test
e-mail over SMTP (and over Microsoft Graph when the project uses it).
3. **Next.js** — the "Every upgrade — Next.js" step above (today 16.4.5 or later, `sharp@^0.35.5`).
3. **Next.js** — the "Every upgrade — Next.js" step above (today 16.4.6 or later, `sharp@^0.35.5`).
4. **Dependency advisories** — the "Every upgrade — dependency advisories" step above (`dompurify` / `graphql-scalars` /
`undici` overrides on payload 3.90.x). **Check:** `pnpm audit --prod` → no high or critical.
5. **Cookie list kept by hand** → offer `cookieScanner: true` (+ `crawl: true` with `IAPL_COOKIE_SCAN_URL`,
@@ -252,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.
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://<site>`), 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.
@@ -648,7 +738,7 @@ PROGRAMISTA §6, items 73–75; email.md; AGENT.md §7.2) — nothing to run; re
3. **For a site that will use the mail service:** `serverURL` is the public address the site answers on without a
redirect; no proxy or WAF rule blocks `/api/iapl/mail-relay/confirm`; `trailingSlash: true` or another `routes.api` →
Intecion sets the site's confirm address first; "Sender address" is filled in (replies go there); the client's
processing agreement names the service. Tell Intecion the host: while the service runs with enrolment "pending" (from its launch until Intecion switches to open enrolment), every new site waits for approval (the panel says "waiting for approval"); under open enrolment a site is active as soon as it enrols.
processing agreement names the service. A new site waits until a person of Intecion confirms it: "Połącz z IWSN" in the panel (contract 1.8.0).
**Launch and a domain move need nothing:** the real domain enrols by itself although the database holds the
development address's connection. **A staging or test copy of the database** neither enrols nor sends by itself
**when it is non-public**: its host matches `iapl({ developmentHosts })` — built in `*.dev.netscale.pl`, so the
@@ -670,7 +760,16 @@ PROGRAMISTA §6, items 73–75; email.md; AGENT.md §7.2) — nothing to run; re
**Check:** `pnpm exec iapl-doctor --deep --url <site>` → no `mail-transport` / `mail-relay-state` / `mail-reply-address` /
`mail-relay-route` finding (or only `mail-graph-deprecated` on a Graph site); Site integrations → E-mail sending →
**Send test e-mail** names the transport you expect; a form submission arrives. **The service is live at
`https://webservices.intecion.net/mail`; while the service runs with enrolment "pending" (from its launch until Intecion switches to open enrolment), every new site waits for approval — keep SMTP until it is approved, or `relay: false`.**
`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 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`
error after the upgrade): Site integrations → E-mail sending → **"Połącz z IWSN"** → a person of Intecion confirms
it on the page that opens (an @intecion.com sign-in — the owner's step, tell them) → the block says "Connected to
IWSN" by itself. Then send a test e-mail.
3. A project that does not want the button: `mail: { relay: { connectButton: false } }` (no button, no route).
**→ 1.17.1, e-mail (CHANGELOG 1.17.1 point 5; PROGRAMISTA §6, item 82; email.md "Which transport a send takes"; AGENT.md §7.2) — nothing to run, one check:**
1. **MongoDB: no migration. Postgres / SQLite: `pnpm payload migrate:create`** (the new field `emailMethod` is a column),
+4 -1
View File
@@ -180,7 +180,10 @@ plugin's components. `content` needs `resolveLink`; `getEntries` (entry list), `
`CMSLink` (a panel link → `Anchor`, with `buttonClass`; a link that wraps something — a logo, a card — and leads nowhere
keeps its content without a link, so an empty link group never hides it),
`buttonClass` / `BUTTON_CLASSES` (button looks by appearance), `Container` / `CONTAINER_WIDTHS`, `Card` / `CARD_CLASS` /
`CARD_INTERACTIVE_CLASS`. Helpers for the project's own blocks: `Buttons` (a block's button row), `headingId(block)`
`CARD_INTERACTIVE_CLASS` (1.18.0: the hover lift fades an `::after` shadow layer with `opacity` — drawn by the
compositor, no repaint per frame; the 1.17 `box-shadow` transition is `CARD_INTERACTIVE_SHADOW_CLASS`). `Media` pauses
a background video for visitors with "reduce motion" (`pauseForReducedMotion={false}` turns that off) and takes `eager`
for an image above the fold that is not the LCP image. Helpers for the project's own blocks: `Buttons` (a block's button row), `headingId(block)`
(the heading id for `aria-labelledby`), `TitleLink` (a card title that links when its link resolves), `GRID_COLUMNS`,
`cx`, `parts(defaults, overrides)`, `itemHeadingLevel(slug, props)` (the item heading tag) and `leadsWithImage(props)`
(whether the block's first image is the LCP image).
+55 -8
View File
@@ -113,12 +113,51 @@ 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'`) |
`CookieButton` props: `className` (replaces the default classes; position is then yours too),
`side` (`'left'` default or `'right'`), `avoid` (CSS selector, default `COOKIE_BUTTON_AVOID` =
`'footer, [role="contentinfo"]'`; `false` = never move). While the footer is on screen the button
moves up by its visible part (`bottomOverlap`), so it never covers footer links. Position tokens:
`--ipal-cookie-button-offset` (from the bottom, default `1rem`), `--ipal-cookie-button-inset` (from the
side, default `1rem`); z-index `--ipal-z-header`. Type `CookieButtonProps`.
### 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 `<body>` (never inside the footer) and it
no longer climbs above the footer when the footer scrolls into view (1.12.x–1.17.1 did that: on a phone with a tall
footer the button ended at the top of the screen, on a short page in the middle of it).
**Room under the footer.** A fixed button would, at the very end of a page, lie on whatever is in that corner — the
first link of the footer's last row — and a visitor could not scroll it free. So while the button is shown, the
plugin gives the page's last block (the footer) **bottom padding: just enough for its last row to end above the
button** (`reserveCookieButtonSpace`). The footer's background continues through it.
| | |
|---|---|
| How much | measured, not fixed: the button's height + its distance from the bottom + the device's safe area + 8 px, **minus what is already free** under the lowest text or control in the button's column. The footer's own bottom padding counts first — never double space. On the reference site: 42–43 px on phones and desktop |
| Where nothing is in the corner | nothing is added (a centred footer on a wide screen, the button on the other side) — so there is no breakpoint to configure |
| When | only while the button is shown: not before a decision, not while the banner is open (the footer is as the project made it), gone when the button is turned off (`cookieButton={false}`) |
| No layout shift | on a static page the HTML carries a small inline script next to the button's place: for a visitor who already decided it makes the room **before the first paint** (in a style sheet, so React hydrates the server's markup untouched), and the button's own measurement after hydration gives the same size. After a click in the banner the room appears with the button. Later changes (fonts, a form that grows, a resize) are followed |
| Which block | the last element matching `reserve` (default `COOKIE_BUTTON_RESERVE` = `'footer, [role="contentinfo"]'`); none on the page → `<body>` |
| Prop | Default | What it does |
|---|---|---|
| `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.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
padding instead of the measured amount; `0` = none, also per breakpoint:
```css
footer { --ipal-cookie-button-space: 4rem; }
@media (min-width: 64rem) { footer { --ipal-cookie-button-space: 0; } } /* nothing on desktop */
```
Position tokens: `--ipal-cookie-button-offset` (from the bottom, default `1rem`), `--ipal-cookie-button-inset`
(from the side, default `1rem`); the device's safe-area insets (bottom and the chosen side) are added. z-index
`--ipal-z-header` (default 40): above the page, below the banner, the settings window and the lightbox (50).
Hidden while the banner is showing. Keyboard: a `<button>` in the tab order with an `aria-label` from the panel.
Type `CookieButtonProps`.
Nonce CSP: the inline script takes the nonce given to `SiteProviders` / `ConsentProvider`; refused, the room is made
when the button appears (a footer pinned to the bottom of a page shorter than the window then moves once).
Building blocks: `reserveCookieButtonSpace({ selector, side, button?, release? })`, `COOKIE_BUTTON_SPACE_ATTRIBUTE`
(`/client`), `consentDecidedScript` (root).
## Compliance defaults (1.17.0)
@@ -449,7 +488,7 @@ New fields in the global = a migration in projects on Postgres/SQLite (`payload
The elements also have stable `data-ipal` handles for CSS and e2e tests (used by
`iapl-consent-check`): `banner` (while it waits for the first-paint script it carries `hidden`; a button clicked before hydration:
`data-ipal-pending`; live: `data-ipal-ready`), `banner-script`, `cookie-button` and the buttons `settings`, `reject`,
`data-ipal-pending`; live: `data-ipal-ready`), `banner-script`, `cookie-button` (`cookie-button-script`: its inline script in the server HTML; `data-ipal-cookie-space` on the footer while it holds the button's room) and the buttons `settings`, `reject`,
`accept`, `back`, `save`; in modal mode also `consent-overlay`, `consent-dialog`, `close`; in detailed mode
additionally `category-<category>` (card) and `cookies` (expandable list).
@@ -542,6 +581,13 @@ 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 `<ConsentProvider texts>` automatically.
- **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
with the Local API and `overrideAccess` may still lower it. Turn the rule off: `iapl({ cookieSettings:
{ allowLowerPolicyVersion: true } })`. Building blocks: `policyVersionNeverDown` (the field hook),
`buildCookieSettingsFields({ allowLowerPolicyVersion })`, `buildCookieSettings(options)`.
- **Withdrawing consent deletes the tools' cookies** (`_ga`, `_ga_*`, `_gid`, `_fbp`, `_gcl_*`, Clarity,
LinkedIn, TikTok, Hotjar…) — also on the parent domain (`.client.com`), where GA stores them.
The project's own cookies: `<ConsentProvider cookieMap={{ marketing: ['_my*'] }}>` (added to the
@@ -571,8 +617,9 @@ to add the hook to a config. Nothing to migrate.
| Item | Value |
|---|---|
| Option | `consentLog?: boolean \| { retentionDays?: number; collectionOverrides?: CollectionOverride }` (type `ConsentLogOptions`) |
| Option | `consentLog?: boolean \| { retentionDays?: number; ttlIndex?: boolean; collectionOverrides?: CollectionOverride }` (type `ConsentLogOptions`) |
| `retentionDays` | default `1095` (3 years) |
| `ttlIndex` | 1.18.0, MongoDB: default `true` — a TTL index (`iapl_ttl` on the hidden date `iaplTtlFrom`) deletes records older than `retentionDays` by itself, also when no new record comes; kept at the current retention at every start; `false` drops it at the next start (the purge after a new record stays). Postgres / SQLite: not used, no column |
| `collectionOverrides` | changes `consent-records`: an object merges `access` / `admin` / `hooks` key by key (your keys win), other keys replace; a function `(collection) => collection` takes over (keep the slug — the endpoint writes to it) |
| Collection | `consent-records` (`CONSENT_LOG_SLUG`), group *Privacy*; fields `consentId` (index), `version`, `choices.{necessary,functional,analytics,marketing}`, `createdAt` |
| Collection access | `read` / `delete` — admin (without `access`, i.e. no roles: any logged-in account — narrow it with `collectionOverrides`); `create` / `update` — nobody through the API (written only by the endpoint, `overrideAccess`) |
+53 -5
View File
@@ -108,6 +108,33 @@ ambiguous (the same entry under many URLs), so `/a/b/c` → null.
**Slug collision:** two collections with an archive with the same slug → the first one
in the `collections` list wins. A configuration error; the router does not warn.
## Drafts as related documents (1.18.0)
A page is read at depth 2, Site settings and archive entries at depth 1, and Payload fills in every related document
whatever its status. Before 1.18.0 a block, a menu or a System pages link that pointed at a page never published
brought that page's title, slug and text into what the helpers answered (and llms-full printed it). Now the helpers
leave such a related document out, as if it did not exist:
| Shape | Becomes |
|---|---|
| a single relationship | `null` — a link resolves to nothing, a menu item drops out |
| a list of relationships | the draft is removed from it |
| a polymorphic one `{ relationTo, value }` | `value: null` |
A related document counts as a draft when it carries `_status` other than `'published'` (a never-published or
unpublished document of a collection with drafts). Documents without `_status` (collections without drafts, media)
are never touched; the document itself is judged as before (only published pages are served). Applies to
`createContentHelpers` (`getSettings`, `resolveRoute`, `getEntries`, `getNotFoundPage`, the page route, Markdown,
MCP, llms-full), `resolveRoute`, `getArchiveEntries`, `resolveNotFoundPage`, `collectSiteIndex` and
`buildLlmsTxt` / `createLlmsTxtRoute`. A preview (`draft: true`) keeps them.
- **What an existing site sees:** a menu item, a card or a link whose page was never published disappears for
visitors instead of showing a title that leads to a 404. Publish the page, or point the link elsewhere.
- **Keep the old behaviour:** `createContentHelpers({ draftRelations: 'keep' })`, or `draftRelations: 'keep'` on
`resolveRoute` / `getArchiveEntries` / `resolveNotFoundPage` / `collectSiteIndex` / `buildLlmsTxt`.
- **Building blocks:** `withoutDraftRelations(value)` (returns the same object when nothing changes, copies only
the changed path), `applyDraftRelations(value, { draft, draftRelations })`, type `DraftRelations`.
## Front-end helpers — createContentHelpers
Instead of writing cached wrappers in every project:
@@ -317,8 +344,11 @@ blocksToMarkdown(page.layout, {
(default true — a YAML block with `locale`, `title`, `description`, `url`, `updated`), `baseUrl`
(gives `url:` — the canonical HTML address), `config` (i18n — with one language `url:` has no `/pl`).
`markdownResponse(md, { canonical? })` — `null` → 404 `text/plain`; otherwise `text/markdown`,
`x-robots-tag: noindex`, `s-maxage=3600`, optional `Link: <…>; rel="canonical"` header.
`markdownResponse(md, { canonical?, negotiated? })` — `null` → 404 `text/plain`; otherwise `text/markdown`,
`x-robots-tag: noindex`, `s-maxage=3600`, optional `Link: <…>; rel="canonical"` header. `negotiated: true` (the
answer goes out at the page's own URL, see "content negotiation" below) sends `cache-control: private, no-store` and
`Vary: Accept` instead of the public lifetime; `createMarkdownRoute` sets it by itself when the proxy marked the
request (`MARKDOWN_NEGOTIATED_HEADER`).
Shorter — the whole route in one line:
@@ -358,14 +388,32 @@ Without it, on a multi-language site the proxy redirects `/md/pl/o-nas` to
`/pl/md/pl/o-nas` (it treats `md` as a path without a language), so the Markdown route does not
work. The option lets `/md/…` paths through and does the `Accept` negotiation below.
**The negotiated answer is never cached as the page (1.18.0, security audit F3).** It shares the page's URL, so a
CDN that caches HTML ("Cache Everything" on Cloudflare, Varnish) would otherwise store the Markdown and serve it to
every visitor of that page. The proxy marks the rewritten request, the route answers `private, no-store` with
`Vary: Accept`, the rewrite carries the same headers. The proxy also asks for `Vary: Accept` on the pages it passes on, but a
Next page answers with Next's own `Vary`: what keeps a shared cache from storing the Markdown as the page is the
`private, no-store` on the Markdown answer.
`/md/…` keeps its public caching. Cloudflare ignores `Vary` for HTML — `no-store` is what keeps it out of the cache
there. Options: `markdown: { prefix: '/ai', negotiate: false }` — `negotiate: false` serves Markdown only at `/md/…`
(no rewrite, no `Vary: Accept` on pages). Verify:
`curl -sD- -o/dev/null -H 'Accept: text/markdown' https://<domain>/pl | grep -iE 'content-type|cache-control|vary'`
→ `text/markdown`, `private, no-store`, `Vary` with `Accept`; or `pnpm exec iapl-doctor --url https://<domain> --only live-probes`
(probe `markdown-vary`).
Manually (when you have your own proxy): the same URL serves Markdown on negotiation with the `Accept` header
(a rewrite in the proxy):
```ts
// proxy.ts
import { prefersMarkdown, markdownHref } from '@intecion/ipal-kit'
// proxy.ts — keep the answer out of shared caches: mark the request for createMarkdownRoute and say Vary: Accept
import { appendVary, MARKDOWN_NEGOTIATED_HEADER, markdownHref, NEGOTIATED_CACHE_CONTROL, prefersMarkdown } from '@intecion/ipal-kit'
if (prefersMarkdown(request)) {
return NextResponse.rewrite(new URL(markdownHref(request.nextUrl.pathname), request.url))
const headers = new Headers(request.headers)
headers.set(MARKDOWN_NEGOTIATED_HEADER, '1')
const res = NextResponse.rewrite(new URL(markdownHref(request.nextUrl.pathname), request.url), { request: { headers } })
res.headers.set('cache-control', NEGOTIATED_CACHE_CONTROL)
appendVary(res.headers, 'Accept')
return res
}
```
+2 -2
View File
@@ -176,7 +176,7 @@ run the tests, commit.
| `integrations` | built-ins | `(defaults) => integrations` — filter, change or add `CookieIntegration`s (each: `key`, `label` — one string or `{ en, pl, … }` per admin language, `declarations`, `isEnabled(ctx)`) |
| `database` | `true` | `false` = no Open Cookie Database lookup |
| `databaseCategories` | table above | Partial map from database category to consent category |
| `access` | editor and up | `({ req }) => boolean` — who may scan, start a crawl and read its status |
| `access` | editor and up | `({ req }) => boolean` — who may scan, start a crawl and read its status. Only a literal `true` allows (1.18.0): `({ req }) => req.user` refuses — return `Boolean(req.user)`; `iapl({ strictAccessAnswers: false })` gives the old truthy reading back (security.md "Access callbacks") |
| `collectionOverrides` | — | Change `cookie-review`: an object merges `access` / `admin` / `hooks` key by key (your keys win), a function takes over (keep the slug) |
| `labels` | `en`, `pl` | `{ de: { scanButton: 'Cookies scannen', … } }` — merged over the plugin's labels (`CookieScanLabels`) |
| `syncAccepted` | `true` | `false` = accepting or approving only marks the entry; nothing is written to Cookie banner |
@@ -259,7 +259,7 @@ All from `@intecion/ipal-kit` (server-safe), for your own admin view, a CLI or a
| `cookieScanContext(payload, plugin, req?)` | the `CookieScanContext` a scan uses |
| `parseCookieNames(input)` | the panel's text box → clean names |
| `mergeCookieReview(current, previous, next)`, `suggestionFor(finding, locales)` | the "never overwrite an edit" rule, pure |
| `addToCookieList({ payload, entry, req? })` | what accepting does: add the row or fill its empty text → `'added' \| 'filled' \| 'unchanged'`; a row with the same name or a covering pattern counts as the same cookie (`sameCookie(a, b)`) |
| `addToCookieList({ payload, entry, req? })` | what accepting does: add the row or fill its empty text → `'added' \| 'filled' \| 'unchanged'`; a row with the same name or a covering pattern counts as the same cookie (`sameCookie(a, b)`). The list is written whole: since 1.18.0 it is read again right before writing and, when an editor's save changed it since, the change is worked out again on what is there now (up to 5 times), so a row saved in between is not lost. A Cookies form left open in the panel and saved later still writes the whole list it shows (Payload's document lock warns the second editor) |
| `loadCookieApproval({ payload, locale, req? })` | the approval list → `CookieApprovalList` (`pending`, `gone`) |
| `approveCookies({ payload, ids?, unknownCategory?, addToList?, req? })` | what **Approve and add** does → `CookieApprovalResult` |
| `countPendingCookies(payload)`, `PENDING_WHERE` | how many wait / the query for them (drafts, and accepted cookies marked changed) |
+12
View File
@@ -690,6 +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.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: `<CookieButton reserve={false} />`; 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/<collection>/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 (`[email protected]`, 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`.
+179
View File
@@ -0,0 +1,179 @@
# Performance review 2026-12 — method, numbers, audit, decisions
The measurements and the audit behind [performance.md](../../performance.md) (1.18.0). Owner's brief (2026-12-01):
the site as light as possible, everything fast and optimised, good practice required, the audit and the doctor
check it, full documentation; page loading, elements, animations, resources, images.
## Method (repeatable)
```bash
docker run -d --rm --name iapl-perf-mongo -p 127.0.0.1:27277:27017 mongo:7 # any local MongoDB
# reference/.env: DATABASE_URI on that port, ALLOW_LOCAL_MEDIA=1, NEXT_PUBLIC_SERVER_URL=http://localhost:3370
pnpm build && (cd reference && pnpm install --ignore-workspace && pnpm seed && pnpm build)
pnpm perf:measure --label=webpack-after --mongo-container=iapl-perf-mongo # starts next start itself
(cd reference && pnpm exec next build --turbopack) && pnpm perf:measure --label=turbopack-after --mongo-container=iapl-perf-mongo
```
`scripts/perf-measure.mjs` + `reference/e2e/perf-lab.mjs`: Chromium (Playwright 1.65) with Lighthouse's profiles,
empty cache, median of 3 runs; eight page types × phone and desktop; `/admin/login`; cold start (spawn → `/api/health`),
RSS after the run, TTFB over 20 requests, and one render of each page with ISR bypassed (`x-prerender-revalidate`)
counted by MongoDB's profiler. Machine: Apple silicon, Node 22.23, MongoDB 7 in Docker, Next 16.4.6, Payload 3.94.1.
Raw results: `webpack-before.json`, `webpack-after.json`, `turbopack-before.json`, `turbopack-after.json` here.
"Before" = local main `ee241de` (1.17.2), "after" = this branch.
## Numbers
### Server: one render of a page (ISR bypassed), webpack build
| Page | Queries before → after (both bundlers) | Render ms webpack | Render ms Turbopack |
|---|---|---|---|
| home `/pl` | 43 → 24 | 95 → 51 | 57 → 41 |
| page `/pl/o-nas` | 34 → 21 | 54 → 34 | 41 → 38 |
| archive `/pl/blog` | 34 → 23 | 63 → 42 | 32 → 29 |
| post | 41 → 26 | 61 → 41 | 41 → 30 |
| case study | 37 → 22 | 33 → 31 | 33 → 24 |
| form `/pl/wycena` | 30 → 19 | 28 → 29 | 28 → 22 |
| showcase `/pl/bloki` | 42 → 27 | 68 → 62 | 73 → 50 |
| 404 | 25 → 20 | 29 → 26 | 27 → 19 |
| `/md/pl`, `/llms.txt`, `/llms-full.txt`, `/sitemap.xml` | 16, 22, 38, 0 — unchanged | — |
All query time on a local MongoDB is ≤ 1 ms per render: the count is what costs on a remote database (one round trip
each — on Coolify's Docker network ~0.2–0.5 ms, more on a managed database). A cached (ISR) page answers in
2.5–3.7 ms median, ≤ 5.4 ms p95, with 0 queries, before and after. Cold start (spawn → health) 1.0–1.6 s, no change.
Memory, measured on its own (`next start`, Turbopack build: boot → 100 cached requests → 40 renders): 1.17.2
282 → 295–318 → 417–421 MiB, this branch 282 → 295 → 394 MiB (two runs each). The RSS that `perf:measure` prints
after its whole run swings by ±100 MiB with garbage collection; do not compare it.
### Client: lab, median of 3, phone (Slow 4G, CPU 4×) / desktop
| | Before (webpack) | After (webpack) | Before (Turbopack) | After (Turbopack) |
|---|---|---|---|---|
| JS per page, compressed | 191.3 KB | 188.1 KB | 184.4 KB | 181.6 KB |
| JS, showcase (every block) | 219.6 KB | 216.4 KB | 212.7 KB | 209.9 KB |
| CSS | 11.0 KB | 11.0 KB | 12.0 KB | 12.0 KB |
| Fonts | 209.5 KB | 209.5 KB | 209.5 KB | 209.5 KB |
| HTML | 17.0–19.8 KB | 17.1–19.8 KB | 17.1–19.9 KB | 17.1–19.9 KB |
| Requests (home / page, phone) | 26 / 21 | 26 / 21 | 26 / 21 | 26 / 21 |
| LCP phone (pages) | 788–832 ms | 780–828 ms | 796–836 ms | 820–868 ms |
| LCP desktop | 284–316 ms | 288–300 ms | 284–300 ms | 288–304 ms |
| CLS | 0 (home 0.036) | 0 (home 0.036) | 0 (home 0.036) | 0 (home 0–0.036) |
| TBT phone | 22–25 ms | 16–23 ms | 6–13 ms | 1–7 ms |
| Tap response (INP proxy) | 32–40 ms | 32–48 ms | 32–48 ms | 32–40 ms |
| Script time (parse, run, hydrate), phone | 117–124 ms | 110–118 ms | 76–82 ms | 64–76 ms |
| Render-blocking | 1 (the stylesheet) | 1 | 1 | 1 |
| 404: LCP / CLS (phone) | 2.49 s / 0.319 | 2.50 s / 0.319 | 2.37 s / 0.319 | 2.31 s / 0.319 |
| `/admin/login` JS | 843 KB | 843 KB | — | — |
Lab numbers on localhost: LCP is the network profile plus render, so the differences between pages are small; the
budgets and the gate catch regressions, PageSpeed Insights shows the field.
On every page FCP = LCP: the first paint waits for the one stylesheet, which on the phone profile (1.6 Mbit/s) shares
the line with four preloaded font files (209 KB) and the async script chunks. With Turbopack the phone's first paint
came out 20–50 ms later after this branch (three runs on a quiet machine; webpack unchanged), although it ships 2.8 KB
less JS and nothing new blocks: Turbopack splits the client chunks differently once the barrels are no longer one
client boundary, and on that line the order of downloads moves the stylesheet a little. The fonts are the bigger
lever (decision 2 below: −36 to −52 ms).
### The owner's items (second branch, from main 076b3ef): before → after, median of 3
| | webpack | Turbopack |
|---|---|---|
| JS per page without a form (compressed) | 188.1 → 179.3 KB | 181.6 → 175.5 KB |
| JS on a page with a form (the form's chunk loads there) | 188.1 → 187.7 KB | 181.6 → 183.6 KB |
| JS on the showcase (every block) | 216.4 → 218.7 KB | 209.9 → 214.0 KB |
| LCP phone, pages | 796–848 → 740–776 ms | 820–868 → 780–820 ms |
| LCP desktop, pages | 280–304 → 272–288 ms | 288–308 → 276–292 ms |
| 404 phone: LCP / CLS | 2.52 s / 0.319 → 1.84 s / 0 | 2.31 s / 0.319 → 1.72 s / 0 |
| CLS home (the headings swap to their font) | 0.036 → 0.036 | 0 → 0.036 |
| Queries per render | unchanged (19–27) | unchanged |
Raw: `webpack-1180-before.json`, `webpack-1180-after.json`, `turbopack-1180-after.json` (Turbopack "before" =
`turbopack-after.json` of the first branch).
## Audit — what the plugin does, file and line, and the gain of each fix
Sources: web.dev (vitals, optimize-lcp, cls, optimize-inp, font-best-practices, animations-guide,
prefers-reduced-motion, third-party-facades, render-blocking-resources, serve-images-avif-webp,
lcp-lazy-loading), nextjs.org/docs (caching, fonts, image, lazy-loading, package bundling), payloadcms.com/docs
(queries/depth, queries/select, database/indexes).
### Built in this branch (no change to how a site looks or how editors work)
| # | Finding (before) | Fix | Measured gain |
|---|---|---|---|
| S1 | `resolveRoute` was `cache()`d but called with `segments ?? []` — a new array each time, so React's identity comparison missed; the homepage was read in full at depth 2 (≈ 6 queries) four times per render (`src/modules/frontend/createContentHelpers.ts` resolveRoute; callers `pageRoute.tsx:123`, `createContentHelpers.ts` getPageJsonLd, `seo/createPageMetadata.ts:152`) | key by `JSON.stringify(segments ?? [])` | home 43 → 24 queries with S2–S4 |
| S2 | `generatePageMetadata` uncached: the page's metadata, the reference page's alternate links and `getPageJsonLd` each built it — three × (homepage + document read in every locale) | `cache()` keyed by value | −6 queries on every page |
| S3 | `slugsAcrossLocales` and `readSiteMetaConfig` read whole documents (layout in every locale) for the slug map (`seo/slugsAcrossLocales.ts:28`, `seo/readSiteMetaConfig.ts:78`) | `select: { slug: true }` | smaller reads (same count) |
| S4 | `getConsentTexts` → `readPrivacyPage` read Site settings at depth 1 in every locale, populating every system page, archive and allowed page in full (`consent/getConsentTexts.ts:138`) | `select: { privacyPolicy: true }` | fewer populated pages per render |
| S5 | analytics and Turnstile each read Site integrations in the same `Promise.all` (`frontend/createContentHelpers.ts` getSiteShell, `analytics/getAnalyticsConfig.ts:14`, `turnstile/config.ts:90`) | one in-flight read shared (`payload/getSiteIntegrations.ts`), nothing kept after it | −1 query per render (−2 with a form that has file blocks) |
| S6 | reference: `siteJsonLd` read the Company global again instead of the cached `getCompany` (`reference/src/lib/content.ts`) | the cached getter | −1 query per render |
| S7 | reference: `slugHistory.slug` without an index — queried on every unknown URL (`content/resolveRedirect.ts:96`) | `index: true` (reference `Pages.ts`, hooks.md) | a collection scan avoided per 404; nothing measurable at 30 pages |
| C1 | `src/exports/client.ts` and six module barrels carried `'use client'`: the barrel was one client boundary, so every page shipped every component behind it | the directive only on the leaf components | with C2: −3.2 KB compressed JS on every page |
| C2 | `LightboxProvider` imported the viewer statically (`lightbox/LightboxProvider.tsx:10`) | `lazy()` — loaded on the first open (7.3 KB raw chunk) | in C1 |
| C3 | `TableOfContents` measured every heading on every scroll event (`richtext/TableOfContents.tsx:38`) | at most once per frame (rAF) | fewer forced layouts while scrolling a long article (INP) |
| C4 | `Turnstile` polled every 300 ms for the life of the form (`turnstile/Turnstile.tsx:100`) | stop once rendered | no idle timer on form pages |
| C5 | the cookie banner's switches, its details chevron and the cookie button animated with no regard for reduced motion (`consent/CookieBanner.tsx:139,171,361`, `CookieButton.tsx:82`) | `motion-reduce:transition-none` | WCAG 2.3.3; no change without the setting |
| C6 | the reference header logo had `priority` — a second high-priority preload next to the hero (`reference/src/components/layout/Header.tsx:27`) | `Media eager` (new option: eager, no high priority, no preload) | the hero gets the first round trip (a site with a logo) |
| C7 | the lazy 404 could not reserve space | `createNotFoundPage({ load, placeholder })` (default unchanged) | CLS 0.32 → 0 when the project sets its 404 height |
### Already right (kept)
ISR for every page and 0 queries for a cached page; no `headers()` / `cookies()` in the layout; the consent banner
in the first paint (`docs/consent.md`); theme client hints only on `/admin`; `next/font` self-hosted with
`display: 'swap'`; one render-blocking stylesheet (11 KB); `mediaImageProps` sets dimensions, `sizes`, lazy and
the LCP `priority`; `buildImagesConfig` serves AVIF / WebP with a 31-day cache; upload limits with an opt-in
conversion (metadata dropped); `YouTubeEmbed` is a facade; Meta, LinkedIn, TikTok and Clarity wait for consent;
the proxy does no database work; the 434 KB cookie database is loaded only by a scan; the sitemap has `select` and a
300 s memo.
### The owner's decisions (2026-12-01) — all in 1.18.0
| # | Item | Decision | What was built (measured on the reference site) |
|---|---|---|---|
| 1 | Lazy 404 moves the footer (CLS 0.319, LCP 2.5 s on a phone) | yes (a) | the reference `not-found.tsx` passes a `placeholder` of its content's height (`max(290px, calc(212px + 11.5vw))`, measured 360–1920 px): CLS 0.319 → 0, LCP 2.52 → 1.90 s |
| 2 | Heading font preloaded (four font files compete with the stylesheet) | yes | `preload: false` on Fraunces in the reference layout, and so in every new site (`iapl create` keeps the call's options): phone LCP −36 to −52 ms; home CLS stays 0.036 |
| 3 | Form code on every page | yes | `BuilderForm` / `Turnstile` from `/client` are lazy wrappers (same props; the server renders the whole form); the hooks behind them lost a needless `'use client'` (each was a client boundary the entry shipped); eager ones in `@intecion/ipal-kit/client/eager`, `RenderForm Form={…}`: −8.8 KB (webpack) / −6.1 KB (Turbopack) gzip on every page without a form; a form page loads the form's chunk as before. Found on the way: the Turnstile widget (72.6 px) appeared in an empty box and moved the form — its height is now kept (73 px, `turnstileReserveHeight`) |
| 4 | Background video ignores reduced motion | yes | `BackgroundVideo` (client) pauses it after hydration for `prefers-reduced-motion`, follows a change; `Media pauseForReducedMotion={false}` |
| 5 | Consent Mode `basic` as default | **no** (stays `advanced`) | — |
| 6 | Card hover animates `box-shadow` | yes | an `::after` shadow layer fades with `opacity`; `CARD_INTERACTIVE_SHADOW_CLASS` = the 1.17 class |
| 7 | Metadata on uploads | yes, no stored variants | lossless strip of JPEG APP1/APP13/COM and PNG text/eXIf/tIME (pixels and ICC byte for byte), EXIF rotation applied once; `stripMetadata: false` |
| 8 | Doctor performance rules: warnings or errors | **errors** | every `perf-*` rule is an error (none measures time, so none fails at random); lowered or silenced per rule in `iapl-doctor.json`; `growth-*` stay warnings and infos. `legacy:site` lists `perf-*` errors an old site meets (its Playwright without a budget test: `perf-budgets`) instead of failing on them |
## Growth review (owner's addition, 2026-12-01): what swells the site and its database
Measured on the reference site (MongoDB 7) after the full reference suite as traffic: 15 collections, the largest
`pages` (15 × 9 KB); consent record 185 B, form submission 647 B, KV entry 371 B on average, plus 2–6 indexes per
collection. `pnpm exec iapl-doctor --deep --only growth` on it: 2.6 s, two infos (3 submissions without a
retention; 1 of 17 media unused — `logo-example-studio-1.webp`, a duplicate logo a test uploaded).
| Store | Today (1.17.2 defaults) | file:line | 1.18.0 |
|---|---|---|---|
| consent-records | purged after 1095 days, once a day per process, only after a new record; one unbounded `deleteMany` | `consent/consentLog.ts:124,161`, `shared/purge.ts:16` | retention recorded for the doctor; `growth-retention` reports a purge that has not caught up |
| stats-visits (opt-in) | purged after 90 days, same mechanism | `stats/endpoint.ts:53,153` | same |
| form-submissions | **no retention, nothing deletes them**; files never stored | `forms/submitForm.ts:324` | opt-in `forms.submissionRetentionDays` (default: kept); `growth-submissions` |
| payload-kv: mail-service nonces | expiry checked only on read: a nonce whose call-back never came stayed for good | `email/relay/store.ts:174` | expired nonces swept (once a day, at the next enrolment) |
| payload-kv: 2FA counters, relay state | one per staff account / host; never deleted | `security/totp/verifyLimit.ts:84`, `relay/store.ts:114` | left alone: bounded; a sweep could race a live verify |
| versions | the plugin turns none on; Payload keeps 100 per document / global | `payload/dist/collections/config/sanitize.js:172` | `growth-versions` (0 = unlimited, or over 50 000) |
| cookie-review (opt-in) | upsert by name; `gone` rows kept | `consent/scanner/scan.ts:297` | documented |
| payload-preferences / locked-documents / jobs | Payload cleans them; the plugin queues no jobs | — | — |
| media | deleted with the document (disk and R2); nothing finds unused media | `storage/buildR2Storage.ts:140` | `growth-media` (counts, never deletes) |
| `.next/cache/images` | 31-day TTL, no size cap | `storage/buildImagesConfig.ts:56` | `growth-disk` (info); Coolify: no volume on `.next` |
| logs | the plugin writes no files | — | — |
Postgres / SQLite: the same purges through Drizzle's `deleteMany`; no TTL indexes; sizes not read (counts only).
### Growth — the owner's decisions (2026-12-01)
| # | Item | Decision | What was built |
|---|---|---|---|
| 9 | A default retention for form submissions | **no** | the opt-in `forms.submissionRetentionDays` stays; the doctor reports sites without one |
| 10 | MongoDB TTL indexes for the consent log and statistics | yes | `iapl_ttl` on a hidden `iaplTtlFrom` (Payload's own `createdAt` index cannot become a TTL one: Mongoose recreates it at every start — tested, IndexOptionsConflict); backfilled once from `createdAt` / `lastAt`, kept at the current `retentionDays` by `collMod` at every start; `ttlIndex: false` drops it; Postgres / SQLite unchanged. Checked in the reference gate against the real database |
| 11 | Delete `gone` cookie-review rows | **no** | — |
| 12 | Review and delete unused media in the panel | yes, manual, optional | `iapl({ unusedMedia: true })`: a notice above each upload list with a link to Payload's list filtered to the unused files (by id or by file name in a text; nothing listed when the site is too big to check every document there); deleting is Payload's bulk delete. Off by default (it adds an import-map entry); the reference site has it on; e2e `unused-media.spec.ts` |
| 13 | `maxPerDoc: 20` where versions are on | yes | the plugin's collections and globals whose versions a project turns on get 20 unless the project sets a limit; the doctor's `growth-versions-config` hints the project's own collections. Neither the plugin nor the reference site turns versions on |
### Shared with IAWL
Proposed for both products (performance.md §7): the Core Web Vitals targets and the lab profile; JS ≤ 250 KB,
CSS ≤ 50 KB, fonts ≤ 250 KB and two families, ≤ 40 requests on the phone, one render-blocking stylesheet, no
third-party origin before consent; images ≤ 1.5 MB and ≤ 2560 px at upload, AVIF / WebP in the width the screen
needs, one high-priority LCP image, lazy below the fold. Not shared: the database budget (MongoDB queries per render
here, SQL queries per request in WordPress).
+770
View File
@@ -0,0 +1,770 @@
{
"client": {
"mobile": {
"home": {
"bytes": {
"css": 12161,
"font": 209501,
"html": 19936,
"image": 9544,
"js": 175539,
"other": 0
},
"cls": 0.036,
"fcp": 812,
"inp": 40,
"interaction": "PL",
"lcp": 812,
"lcpElement": {
"fetchpriority": "high",
"loading": "eager",
"src": "data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 1000'%3",
"tag": "img"
},
"load": 2365,
"prefetches": 4,
"profile": "mobile",
"renderBlocking": [
"/_next/static/chunks/3_r2-9g9f0xzb.css"
],
"requests": 22,
"scriptMs": 80,
"status": 200,
"tbt": 7,
"thirdParty": [],
"ttfb": 151,
"url": "/pl",
"runs": 3
},
"page": {
"bytes": {
"css": 12161,
"font": 209501,
"html": 17074,
"image": 8457,
"js": 175539,
"other": 0
},
"cls": 0,
"fcp": 784,
"inp": 32,
"interaction": "PL",
"lcp": 784,
"lcpElement": {
"fetchpriority": "high",
"loading": "eager",
"src": "data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 1000'%3",
"tag": "img"
},
"load": 2374,
"prefetches": 2,
"profile": "mobile",
"renderBlocking": [
"/_next/static/chunks/3_r2-9g9f0xzb.css"
],
"requests": 19,
"scriptMs": 69,
"status": 200,
"tbt": 6,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/o-nas",
"runs": 3
},
"archive": {
"bytes": {
"css": 12161,
"font": 209501,
"html": 16563,
"image": 5322,
"js": 175539,
"other": 0
},
"cls": 0,
"fcp": 780,
"inp": 40,
"interaction": "PL",
"lcp": 780,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 2365,
"prefetches": 3,
"profile": "mobile",
"renderBlocking": [
"/_next/static/chunks/3_r2-9g9f0xzb.css"
],
"requests": 19,
"scriptMs": 75,
"status": 200,
"tbt": 5,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/blog",
"runs": 3
},
"post": {
"bytes": {
"css": 12161,
"font": 209501,
"html": 17107,
"image": 5322,
"js": 175539,
"other": 0
},
"cls": 0,
"fcp": 792,
"inp": 40,
"interaction": "PL",
"lcp": 792,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 2381,
"prefetches": 2,
"profile": "mobile",
"renderBlocking": [
"/_next/static/chunks/3_r2-9g9f0xzb.css"
],
"requests": 19,
"scriptMs": 76,
"status": 200,
"tbt": 6,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/blog/zanim-kupisz-dzialke",
"runs": 3
},
"caseStudy": {
"bytes": {
"css": 12161,
"font": 209501,
"html": 16528,
"image": 4376,
"js": 175539,
"other": 0
},
"cls": 0,
"fcp": 800,
"inp": 40,
"interaction": "PL",
"lcp": 800,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 2385,
"prefetches": 2,
"profile": "mobile",
"renderBlocking": [
"/_next/static/chunks/3_r2-9g9f0xzb.css"
],
"requests": 18,
"scriptMs": 78,
"status": 200,
"tbt": 8,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/realizacje/dom-pod-lasem",
"runs": 3
},
"form": {
"bytes": {
"css": 12161,
"font": 209501,
"html": 16819,
"image": 0,
"js": 183565,
"other": 0
},
"cls": 0,
"fcp": 800,
"inp": 32,
"interaction": "PL",
"lcp": 800,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 2551,
"prefetches": 2,
"profile": "mobile",
"renderBlocking": [
"/_next/static/chunks/3_r2-9g9f0xzb.css"
],
"requests": 17,
"scriptMs": 88,
"status": 200,
"tbt": 7,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/wycena",
"runs": 3
},
"showcase": {
"bytes": {
"css": 12161,
"font": 209501,
"html": 37329,
"image": 2018,
"js": 214068,
"other": 0
},
"cls": 0,
"fcp": 820,
"inp": 40,
"interaction": "PL",
"lcp": 820,
"lcpElement": {
"fetchpriority": "high",
"loading": "eager",
"src": "data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 1000'%3",
"tag": "img"
},
"load": 2384,
"prefetches": 4,
"profile": "mobile",
"renderBlocking": [
"/_next/static/chunks/3_r2-9g9f0xzb.css"
],
"requests": 23,
"scriptMs": 161,
"status": 200,
"tbt": 10,
"thirdParty": [
"https://challenges.cloudflare.com"
],
"ttfb": 151,
"url": "/pl/bloki",
"runs": 3
},
"notFound": {
"bytes": {
"css": 12161,
"font": 209501,
"html": 7740,
"image": 0,
"js": 175539,
"other": 2380
},
"cls": 0,
"fcp": 1724,
"inp": 32,
"interaction": "PL",
"lcp": 1724,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 2789,
"prefetches": 10,
"profile": "mobile",
"renderBlocking": [],
"requests": 17,
"scriptMs": 118,
"status": 404,
"tbt": 0,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/nie-ma-takiej-strony",
"runs": 3
}
},
"desktop": {
"home": {
"bytes": {
"css": 12161,
"font": 209501,
"html": 19936,
"image": 9286,
"js": 175539,
"other": 0
},
"cls": 0.001,
"fcp": 288,
"inp": 40,
"interaction": "PL",
"lcp": 288,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "h1"
},
"load": 464,
"prefetches": 11,
"profile": "desktop",
"renderBlocking": [
"/_next/static/chunks/3_r2-9g9f0xzb.css"
],
"requests": 22,
"scriptMs": 38,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl",
"runs": 3
},
"page": {
"bytes": {
"css": 12161,
"font": 209501,
"html": 17074,
"image": 10684,
"js": 175539,
"other": 0
},
"cls": 0,
"fcp": 284,
"inp": 40,
"interaction": "PL",
"lcp": 284,
"lcpElement": {
"fetchpriority": "high",
"loading": "eager",
"src": "/_next/image?url=http%3A%2F%2Flocalhost%3A3370%2Fapi%2Fmedia%2Ffile%2Flibrary-3.webp&w=750&q=75",
"tag": "img"
},
"load": 444,
"prefetches": 8,
"profile": "desktop",
"renderBlocking": [
"/_next/static/chunks/3_r2-9g9f0xzb.css"
],
"requests": 20,
"scriptMs": 18,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl/o-nas",
"runs": 3
},
"archive": {
"bytes": {
"css": 12161,
"font": 209501,
"html": 16563,
"image": 4815,
"js": 175539,
"other": 0
},
"cls": 0,
"fcp": 276,
"inp": 40,
"interaction": "PL",
"lcp": 276,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 454,
"prefetches": 11,
"profile": "desktop",
"renderBlocking": [
"/_next/static/chunks/3_r2-9g9f0xzb.css"
],
"requests": 19,
"scriptMs": 32,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl/blog",
"runs": 3
},
"post": {
"bytes": {
"css": 12161,
"font": 209501,
"html": 17107,
"image": 4815,
"js": 175539,
"other": 0
},
"cls": 0,
"fcp": 276,
"inp": 40,
"interaction": "PL",
"lcp": 276,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 437,
"prefetches": 8,
"profile": "desktop",
"renderBlocking": [
"/_next/static/chunks/3_r2-9g9f0xzb.css"
],
"requests": 19,
"scriptMs": 20,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl/blog/zanim-kupisz-dzialke",
"runs": 3
},
"caseStudy": {
"bytes": {
"css": 12161,
"font": 209501,
"html": 16528,
"image": 9286,
"js": 175539,
"other": 0
},
"cls": 0,
"fcp": 292,
"inp": 40,
"interaction": "PL",
"lcp": 292,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "h1"
},
"load": 445,
"prefetches": 8,
"profile": "desktop",
"renderBlocking": [
"/_next/static/chunks/3_r2-9g9f0xzb.css"
],
"requests": 20,
"scriptMs": 19,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl/realizacje/dom-pod-lasem",
"runs": 3
},
"form": {
"bytes": {
"css": 12161,
"font": 209501,
"html": 16819,
"image": 0,
"js": 183565,
"other": 0
},
"cls": 0,
"fcp": 280,
"inp": 40,
"interaction": "PL",
"lcp": 280,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 492,
"prefetches": 8,
"profile": "desktop",
"renderBlocking": [
"/_next/static/chunks/3_r2-9g9f0xzb.css"
],
"requests": 17,
"scriptMs": 39,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl/wycena",
"runs": 3
},
"showcase": {
"bytes": {
"css": 12161,
"font": 209501,
"html": 37329,
"image": 5267,
"js": 214011,
"other": 0
},
"cls": 0,
"fcp": 288,
"inp": 40,
"interaction": "PL",
"lcp": 288,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 447,
"prefetches": 8,
"profile": "desktop",
"renderBlocking": [
"/_next/static/chunks/3_r2-9g9f0xzb.css"
],
"requests": 24,
"scriptMs": 42,
"status": 200,
"tbt": 0,
"thirdParty": [
"https://challenges.cloudflare.com"
],
"ttfb": 41,
"url": "/pl/bloki",
"runs": 3
},
"notFound": {
"bytes": {
"css": 12161,
"font": 209501,
"html": 7740,
"image": 0,
"js": 175539,
"other": 2380
},
"cls": 0,
"fcp": 392,
"inp": 40,
"interaction": "PL",
"lcp": 444,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "h1"
},
"load": 518,
"prefetches": 14,
"profile": "desktop",
"renderBlocking": [],
"requests": 17,
"scriptMs": 34,
"status": 404,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl/nie-ma-takiej-strony",
"runs": 3
}
},
"admin": {
"bytes": {
"css": 98914,
"font": 0,
"html": 24294,
"image": 0,
"js": 876299,
"other": 1690
},
"cls": 0,
"fcp": 1048,
"inp": null,
"interaction": null,
"lcp": 1048,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "a"
},
"load": 970,
"prefetches": 0,
"profile": "desktop",
"renderBlocking": [
"/_next/static/chunks/3ebvnk7qs9043.css",
"/_next/static/chunks/1l9apu4iesvci.css",
"/_next/static/chunks/3c_6gydv624zb.css",
"/_next/static/chunks/2h0ajyj_brp--.css",
"/_next/static/chunks/3k6de-uhqm-in.css",
"/_next/static/chunks/2do7kfo662xwp.css",
"/_next/static/chunks/1z_mbvpkjhpd5.css"
],
"requests": 23,
"scriptMs": 411,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 85,
"url": "/admin/login",
"runs": 3
}
},
"date": "2026-12-01T14:43:52.891Z",
"label": "turbopack-1180-after",
"method": "scripts/perf-measure.mjs + reference/e2e/perf-lab.mjs",
"runs": 3,
"server": {
"coldStartHealthMs": 1081,
"coldStartFirstPageMs": 1101,
"firstPageMs": 18,
"ttfb_home": {
"median": 3,
"p95": 4.7
},
"ttfb_md": {
"median": 23.7,
"p95": 38.1
},
"ttfb_sitemap": {
"median": 1.6,
"p95": 2.6
},
"ttfb_llms": {
"median": 27.7,
"p95": 42.4
},
"render": {
"home": {
"medianMs": 39.6,
"queries": 24,
"queryMs": 0,
"byCollection": {
"globals": 27,
"pages": 33,
"media": 9,
"forms": 3
}
},
"page": {
"medianMs": 29.9,
"queries": 21,
"queryMs": 0,
"byCollection": {
"globals": 27,
"media": 6,
"pages": 27,
"forms": 3
}
},
"archive": {
"medianMs": 30.1,
"queries": 23,
"queryMs": 0,
"byCollection": {
"globals": 27,
"pages": 27,
"media": 6,
"forms": 3,
"posts": 6
}
},
"post": {
"medianMs": 27.9,
"queries": 26,
"queryMs": 0,
"byCollection": {
"globals": 27,
"media": 9,
"pages": 24,
"posts": 15,
"forms": 3
}
},
"caseStudy": {
"medianMs": 25.7,
"queries": 22,
"queryMs": 0,
"byCollection": {
"globals": 27,
"pages": 21,
"media": 6,
"casestudies": 9,
"forms": 3
}
},
"form": {
"medianMs": 23.7,
"queries": 19,
"queryMs": 0,
"byCollection": {
"globals": 27,
"media": 3,
"pages": 24,
"forms": 3
}
},
"showcase": {
"medianMs": 48.9,
"queries": 27,
"queryMs": 0,
"byCollection": {
"globals": 24,
"pages": 33,
"media": 12,
"forms": 6,
"posts": 6
}
},
"notFound": {
"medianMs": 31.3,
"queries": 20,
"queryMs": 0,
"byCollection": {
"globals": 27,
"pages": 27,
"media": 6
}
},
"md": {
"medianMs": 25,
"queries": 16,
"queryMs": 0,
"byCollection": {
"globals": 4,
"media": 5,
"pages": 6,
"forms": 1
}
},
"sitemap": {
"medianMs": 2,
"queries": 0,
"queryMs": 0,
"byCollection": {}
},
"llms": {
"medianMs": 40,
"queries": 22,
"queryMs": 0,
"byCollection": {
"globals": 4,
"media": 3,
"pages": 7,
"posts": 4,
"casestudies": 4
}
},
"llmsFull": {
"medianMs": 58,
"queries": 38,
"queryMs": 0,
"byCollection": {
"globals": 6,
"media": 9,
"pages": 13,
"forms": 2,
"posts": 4,
"casestudies": 4
}
}
},
"rssMiB": 472
}
}
+753
View File
@@ -0,0 +1,753 @@
{
"client": {
"mobile": {
"home": {
"bytes": {
"css": 12044,
"font": 209501,
"html": 19896,
"image": 9532,
"js": 181608,
"other": 24705
},
"cls": 0,
"fcp": 868,
"inp": 32,
"interaction": "PL",
"lcp": 868,
"lcpElement": {
"fetchpriority": "high",
"loading": "eager",
"src": "data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 1000'%3",
"tag": "img"
},
"load": 2457,
"profile": "mobile",
"renderBlocking": [
"/_next/static/chunks/1g084kp2cldky.css"
],
"requests": 26,
"scriptMs": 76,
"status": 200,
"tbt": 7,
"thirdParty": [],
"ttfb": 151,
"url": "/pl",
"runs": 3
},
"page": {
"bytes": {
"css": 12044,
"font": 209501,
"html": 17127,
"image": 8451,
"js": 181608,
"other": 13038
},
"cls": 0,
"fcp": 820,
"inp": 32,
"interaction": "PL",
"lcp": 820,
"lcpElement": {
"fetchpriority": "high",
"loading": "eager",
"src": "data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 1000'%3",
"tag": "img"
},
"load": 2438,
"profile": "mobile",
"renderBlocking": [
"/_next/static/chunks/1g084kp2cldky.css"
],
"requests": 21,
"scriptMs": 65,
"status": 200,
"tbt": 2,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/o-nas",
"runs": 3
},
"archive": {
"bytes": {
"css": 12044,
"font": 209501,
"html": 16491,
"image": 5316,
"js": 181608,
"other": 18546
},
"cls": 0,
"fcp": 828,
"inp": 32,
"interaction": "PL",
"lcp": 828,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 2431,
"profile": "mobile",
"renderBlocking": [
"/_next/static/chunks/1g084kp2cldky.css"
],
"requests": 22,
"scriptMs": 64,
"status": 200,
"tbt": 2,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/blog",
"runs": 3
},
"post": {
"bytes": {
"css": 12044,
"font": 209501,
"html": 17082,
"image": 5316,
"js": 181608,
"other": 13038
},
"cls": 0,
"fcp": 828,
"inp": 32,
"interaction": "PL",
"lcp": 828,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 2430,
"profile": "mobile",
"renderBlocking": [
"/_next/static/chunks/1g084kp2cldky.css"
],
"requests": 21,
"scriptMs": 64,
"status": 200,
"tbt": 2,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/blog/zanim-kupisz-dzialke",
"runs": 3
},
"caseStudy": {
"bytes": {
"css": 12044,
"font": 209501,
"html": 16599,
"image": 4372,
"js": 181608,
"other": 13038
},
"cls": 0,
"fcp": 848,
"inp": 40,
"interaction": "PL",
"lcp": 848,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 2418,
"profile": "mobile",
"renderBlocking": [
"/_next/static/chunks/1g084kp2cldky.css"
],
"requests": 20,
"scriptMs": 66,
"status": 200,
"tbt": 5,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/realizacje/dom-pod-lasem",
"runs": 3
},
"form": {
"bytes": {
"css": 12044,
"font": 209501,
"html": 16323,
"image": 0,
"js": 181608,
"other": 13038
},
"cls": 0,
"fcp": 828,
"inp": 32,
"interaction": "PL",
"lcp": 828,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 2387,
"profile": "mobile",
"renderBlocking": [
"/_next/static/chunks/1g084kp2cldky.css"
],
"requests": 18,
"scriptMs": 61,
"status": 200,
"tbt": 1,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/wycena",
"runs": 3
},
"showcase": {
"bytes": {
"css": 12044,
"font": 209501,
"html": 36962,
"image": 2016,
"js": 209854,
"other": 24820
},
"cls": 0,
"fcp": 860,
"inp": 32,
"interaction": "PL",
"lcp": 860,
"lcpElement": {
"fetchpriority": "high",
"loading": "eager",
"src": "data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 1000'%3",
"tag": "img"
},
"load": 2403,
"profile": "mobile",
"renderBlocking": [
"/_next/static/chunks/1g084kp2cldky.css"
],
"requests": 25,
"scriptMs": 125,
"status": 200,
"tbt": 3,
"thirdParty": [
"https://challenges.cloudflare.com"
],
"ttfb": 151,
"url": "/pl/bloki",
"runs": 3
},
"notFound": {
"bytes": {
"css": 12044,
"font": 209501,
"html": 7747,
"image": 0,
"js": 181608,
"other": 68180
},
"cls": 0.319,
"fcp": 2312,
"inp": 40,
"interaction": "PL",
"lcp": 2312,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 2694,
"profile": "mobile",
"renderBlocking": [],
"requests": 27,
"scriptMs": 119,
"status": 404,
"tbt": 0,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/nie-ma-takiej-strony",
"runs": 3
}
},
"desktop": {
"home": {
"bytes": {
"css": 12044,
"font": 209501,
"html": 19896,
"image": 9274,
"js": 181608,
"other": 71353
},
"cls": 0.001,
"fcp": 292,
"inp": 40,
"interaction": "PL",
"lcp": 292,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "h1"
},
"load": 448,
"profile": "desktop",
"renderBlocking": [
"/_next/static/chunks/1g084kp2cldky.css"
],
"requests": 33,
"scriptMs": 25,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl",
"runs": 3
},
"page": {
"bytes": {
"css": 12044,
"font": 209501,
"html": 17127,
"image": 10676,
"js": 181608,
"other": 47896
},
"cls": 0,
"fcp": 292,
"inp": 40,
"interaction": "PL",
"lcp": 292,
"lcpElement": {
"fetchpriority": "high",
"loading": "eager",
"src": "/_next/image?url=http%3A%2F%2Flocalhost%3A3370%2Fapi%2Fmedia%2Ffile%2Flibrary.webp&w=750&q=75",
"tag": "img"
},
"load": 466,
"profile": "desktop",
"renderBlocking": [
"/_next/static/chunks/1g084kp2cldky.css"
],
"requests": 28,
"scriptMs": 20,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl/o-nas",
"runs": 3
},
"archive": {
"bytes": {
"css": 12044,
"font": 209501,
"html": 16491,
"image": 4809,
"js": 181608,
"other": 64655
},
"cls": 0,
"fcp": 292,
"inp": 40,
"interaction": "PL",
"lcp": 292,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 458,
"profile": "desktop",
"renderBlocking": [
"/_next/static/chunks/1g084kp2cldky.css"
],
"requests": 30,
"scriptMs": 18,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl/blog",
"runs": 3
},
"post": {
"bytes": {
"css": 12044,
"font": 209501,
"html": 17082,
"image": 4809,
"js": 181608,
"other": 47896
},
"cls": 0,
"fcp": 296,
"inp": 48,
"interaction": "PL",
"lcp": 296,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 470,
"profile": "desktop",
"renderBlocking": [
"/_next/static/chunks/1g084kp2cldky.css"
],
"requests": 27,
"scriptMs": 20,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl/blog/zanim-kupisz-dzialke",
"runs": 3
},
"caseStudy": {
"bytes": {
"css": 12044,
"font": 209501,
"html": 16599,
"image": 9278,
"js": 181608,
"other": 47896
},
"cls": 0,
"fcp": 308,
"inp": 40,
"interaction": "PL",
"lcp": 308,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "h1"
},
"load": 462,
"profile": "desktop",
"renderBlocking": [
"/_next/static/chunks/1g084kp2cldky.css"
],
"requests": 28,
"scriptMs": 19,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl/realizacje/dom-pod-lasem",
"runs": 3
},
"form": {
"bytes": {
"css": 12044,
"font": 209501,
"html": 16323,
"image": 0,
"js": 181608,
"other": 47896
},
"cls": 0,
"fcp": 300,
"inp": 40,
"interaction": "PL",
"lcp": 300,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 465,
"profile": "desktop",
"renderBlocking": [
"/_next/static/chunks/1g084kp2cldky.css"
],
"requests": 24,
"scriptMs": 20,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl/wycena",
"runs": 3
},
"showcase": {
"bytes": {
"css": 12044,
"font": 209501,
"html": 36962,
"image": 5263,
"js": 209911,
"other": 47896
},
"cls": 0,
"fcp": 304,
"inp": 40,
"interaction": "PL",
"lcp": 304,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 457,
"profile": "desktop",
"renderBlocking": [
"/_next/static/chunks/1g084kp2cldky.css"
],
"requests": 30,
"scriptMs": 39,
"status": 200,
"tbt": 0,
"thirdParty": [
"https://challenges.cloudflare.com"
],
"ttfb": 41,
"url": "/pl/bloki",
"runs": 3
},
"notFound": {
"bytes": {
"css": 12044,
"font": 209501,
"html": 7747,
"image": 0,
"js": 181608,
"other": 84467
},
"cls": 0,
"fcp": 512,
"inp": 40,
"interaction": "PL",
"lcp": 572,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "h1"
},
"load": 507,
"profile": "desktop",
"renderBlocking": [],
"requests": 31,
"scriptMs": 40,
"status": 404,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl/nie-ma-takiej-strony",
"runs": 3
}
},
"admin": {
"bytes": {
"css": 98914,
"font": 0,
"html": 23019,
"image": 0,
"js": 876243,
"other": 1690
},
"cls": 0,
"fcp": 1036,
"inp": null,
"interaction": null,
"lcp": 1036,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "a"
},
"load": 957,
"profile": "desktop",
"renderBlocking": [
"/_next/static/chunks/3ebvnk7qs9043.css",
"/_next/static/chunks/1l9apu4iesvci.css",
"/_next/static/chunks/3c_6gydv624zb.css",
"/_next/static/chunks/2h0ajyj_brp--.css",
"/_next/static/chunks/3k6de-uhqm-in.css",
"/_next/static/chunks/1z_mbvpkjhpd5.css",
"/_next/static/chunks/2do7kfo662xwp.css"
],
"requests": 23,
"scriptMs": 413,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 92,
"url": "/admin/login",
"runs": 3
}
},
"date": "2026-12-01T12:54:41.262Z",
"label": "turbopack-after",
"method": "scripts/perf-measure.mjs + reference/e2e/perf-lab.mjs",
"runs": 3,
"server": {
"coldStartHealthMs": 1020,
"coldStartFirstPageMs": 1040,
"firstPageMs": 19,
"ttfb_home": {
"median": 3.3,
"p95": 4.6
},
"ttfb_md": {
"median": 19.5,
"p95": 31
},
"ttfb_sitemap": {
"median": 1.1,
"p95": 1.5
},
"ttfb_llms": {
"median": 28.6,
"p95": 38.8
},
"render": {
"home": {
"medianMs": 36.9,
"queries": 24,
"queryMs": 0,
"byCollection": {
"globals": 27,
"pages": 33,
"media": 9,
"forms": 3
}
},
"page": {
"medianMs": 25.2,
"queries": 21,
"queryMs": 0,
"byCollection": {
"globals": 27,
"pages": 27,
"media": 6,
"forms": 3
}
},
"archive": {
"medianMs": 29.1,
"queries": 23,
"queryMs": 0,
"byCollection": {
"globals": 27,
"pages": 27,
"media": 6,
"forms": 3,
"posts": 6
}
},
"post": {
"medianMs": 29,
"queries": 26,
"queryMs": 0,
"byCollection": {
"globals": 27,
"pages": 24,
"media": 9,
"posts": 15,
"forms": 3
}
},
"caseStudy": {
"medianMs": 25,
"queries": 22,
"queryMs": 0,
"byCollection": {
"globals": 27,
"pages": 21,
"media": 6,
"casestudies": 9,
"forms": 3
}
},
"form": {
"medianMs": 21,
"queries": 19,
"queryMs": 0,
"byCollection": {
"globals": 27,
"pages": 24,
"media": 3,
"forms": 3
}
},
"showcase": {
"medianMs": 48.7,
"queries": 27,
"queryMs": 0,
"byCollection": {
"globals": 24,
"pages": 33,
"media": 12,
"forms": 6,
"posts": 6
}
},
"notFound": {
"medianMs": 19.9,
"queries": 20,
"queryMs": 0,
"byCollection": {
"globals": 27,
"media": 6,
"pages": 27
}
},
"md": {
"medianMs": 30,
"queries": 16,
"queryMs": 0,
"byCollection": {
"globals": 4,
"media": 5,
"pages": 6,
"forms": 1
}
},
"sitemap": {
"medianMs": 4,
"queries": 0,
"queryMs": 0,
"byCollection": {}
},
"llms": {
"medianMs": 42,
"queries": 22,
"queryMs": 0,
"byCollection": {
"globals": 4,
"media": 3,
"pages": 7,
"posts": 4,
"casestudies": 4
}
},
"llmsFull": {
"medianMs": 74,
"queries": 38,
"queryMs": 0,
"byCollection": {
"globals": 6,
"media": 9,
"pages": 13,
"forms": 2,
"posts": 4,
"casestudies": 4
}
}
},
"rssMiB": 468
}
}
+753
View File
@@ -0,0 +1,753 @@
{
"client": {
"mobile": {
"home": {
"bytes": {
"css": 12004,
"font": 209501,
"html": 19872,
"image": 9532,
"js": 184428,
"other": 24705
},
"cls": 0.036,
"fcp": 816,
"inp": 40,
"interaction": "PL",
"lcp": 816,
"lcpElement": {
"fetchpriority": "high",
"loading": "eager",
"src": "data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 1000'%3",
"tag": "img"
},
"load": 2440,
"profile": "mobile",
"renderBlocking": [
"/_next/static/chunks/05jza-3-ce5bf.css"
],
"requests": 26,
"scriptMs": 76,
"status": 200,
"tbt": 6,
"thirdParty": [],
"ttfb": 151,
"url": "/pl",
"runs": 3
},
"page": {
"bytes": {
"css": 12004,
"font": 209501,
"html": 17099,
"image": 8451,
"js": 184428,
"other": 13035
},
"cls": 0,
"fcp": 800,
"inp": 32,
"interaction": "PL",
"lcp": 800,
"lcpElement": {
"fetchpriority": "high",
"loading": "eager",
"src": "data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 1000'%3",
"tag": "img"
},
"load": 2451,
"profile": "mobile",
"renderBlocking": [
"/_next/static/chunks/05jza-3-ce5bf.css"
],
"requests": 21,
"scriptMs": 82,
"status": 200,
"tbt": 7,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/o-nas",
"runs": 3
},
"archive": {
"bytes": {
"css": 12004,
"font": 209501,
"html": 16468,
"image": 5316,
"js": 184428,
"other": 18548
},
"cls": 0,
"fcp": 796,
"inp": 32,
"interaction": "PL",
"lcp": 796,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 2443,
"profile": "mobile",
"renderBlocking": [
"/_next/static/chunks/05jza-3-ce5bf.css"
],
"requests": 22,
"scriptMs": 74,
"status": 200,
"tbt": 6,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/blog",
"runs": 3
},
"post": {
"bytes": {
"css": 12004,
"font": 209501,
"html": 17059,
"image": 5316,
"js": 184428,
"other": 13035
},
"cls": 0,
"fcp": 796,
"inp": 32,
"interaction": "PL",
"lcp": 796,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 2450,
"profile": "mobile",
"renderBlocking": [
"/_next/static/chunks/05jza-3-ce5bf.css"
],
"requests": 21,
"scriptMs": 77,
"status": 200,
"tbt": 13,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/blog/zanim-kupisz-dzialke",
"runs": 3
},
"caseStudy": {
"bytes": {
"css": 12004,
"font": 209501,
"html": 16558,
"image": 4372,
"js": 184428,
"other": 13035
},
"cls": 0,
"fcp": 816,
"inp": 32,
"interaction": "PL",
"lcp": 816,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 2436,
"profile": "mobile",
"renderBlocking": [
"/_next/static/chunks/05jza-3-ce5bf.css"
],
"requests": 20,
"scriptMs": 82,
"status": 200,
"tbt": 12,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/realizacje/dom-pod-lasem",
"runs": 3
},
"form": {
"bytes": {
"css": 12004,
"font": 209501,
"html": 16307,
"image": 0,
"js": 184428,
"other": 13035
},
"cls": 0,
"fcp": 808,
"inp": 32,
"interaction": "PL",
"lcp": 808,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 2401,
"profile": "mobile",
"renderBlocking": [
"/_next/static/chunks/05jza-3-ce5bf.css"
],
"requests": 18,
"scriptMs": 77,
"status": 200,
"tbt": 7,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/wycena",
"runs": 3
},
"showcase": {
"bytes": {
"css": 12004,
"font": 209501,
"html": 36928,
"image": 2016,
"js": 212731,
"other": 24821
},
"cls": 0,
"fcp": 836,
"inp": 40,
"interaction": "PL",
"lcp": 836,
"lcpElement": {
"fetchpriority": "high",
"loading": "eager",
"src": "data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 1000'%3",
"tag": "img"
},
"load": 2424,
"profile": "mobile",
"renderBlocking": [
"/_next/static/chunks/05jza-3-ce5bf.css"
],
"requests": 25,
"scriptMs": 148,
"status": 200,
"tbt": 9,
"thirdParty": [
"https://challenges.cloudflare.com"
],
"ttfb": 151,
"url": "/pl/bloki",
"runs": 3
},
"notFound": {
"bytes": {
"css": 12004,
"font": 209501,
"html": 7733,
"image": 0,
"js": 184428,
"other": 68188
},
"cls": 0.319,
"fcp": 2372,
"inp": 32,
"interaction": "PL",
"lcp": 2372,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 2531,
"profile": "mobile",
"renderBlocking": [],
"requests": 27,
"scriptMs": 124,
"status": 404,
"tbt": 0,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/nie-ma-takiej-strony",
"runs": 3
}
},
"desktop": {
"home": {
"bytes": {
"css": 12004,
"font": 209501,
"html": 19872,
"image": 9274,
"js": 184428,
"other": 71365
},
"cls": 0.001,
"fcp": 292,
"inp": 32,
"interaction": "PL",
"lcp": 292,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "h1"
},
"load": 454,
"profile": "desktop",
"renderBlocking": [
"/_next/static/chunks/05jza-3-ce5bf.css"
],
"requests": 33,
"scriptMs": 26,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl",
"runs": 3
},
"page": {
"bytes": {
"css": 12004,
"font": 209501,
"html": 17099,
"image": 10676,
"js": 184428,
"other": 47905
},
"cls": 0,
"fcp": 284,
"inp": 32,
"interaction": "PL",
"lcp": 284,
"lcpElement": {
"fetchpriority": "high",
"loading": "eager",
"src": "/_next/image?url=http%3A%2F%2Flocalhost%3A3370%2Fapi%2Fmedia%2Ffile%2Flibrary.webp&w=750&q=75",
"tag": "img"
},
"load": 456,
"profile": "desktop",
"renderBlocking": [
"/_next/static/chunks/05jza-3-ce5bf.css"
],
"requests": 28,
"scriptMs": 17,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl/o-nas",
"runs": 3
},
"archive": {
"bytes": {
"css": 12004,
"font": 209501,
"html": 16468,
"image": 4809,
"js": 184428,
"other": 64679
},
"cls": 0,
"fcp": 284,
"inp": 32,
"interaction": "PL",
"lcp": 284,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 459,
"profile": "desktop",
"renderBlocking": [
"/_next/static/chunks/05jza-3-ce5bf.css"
],
"requests": 30,
"scriptMs": 17,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl/blog",
"runs": 3
},
"post": {
"bytes": {
"css": 12004,
"font": 209501,
"html": 17059,
"image": 4809,
"js": 184428,
"other": 47905
},
"cls": 0,
"fcp": 284,
"inp": 40,
"interaction": "PL",
"lcp": 284,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 459,
"profile": "desktop",
"renderBlocking": [
"/_next/static/chunks/05jza-3-ce5bf.css"
],
"requests": 27,
"scriptMs": 18,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl/blog/zanim-kupisz-dzialke",
"runs": 3
},
"caseStudy": {
"bytes": {
"css": 12004,
"font": 209501,
"html": 16558,
"image": 9278,
"js": 184428,
"other": 47905
},
"cls": 0,
"fcp": 300,
"inp": 40,
"interaction": "PL",
"lcp": 300,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "h1"
},
"load": 460,
"profile": "desktop",
"renderBlocking": [
"/_next/static/chunks/05jza-3-ce5bf.css"
],
"requests": 28,
"scriptMs": 19,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl/realizacje/dom-pod-lasem",
"runs": 3
},
"form": {
"bytes": {
"css": 12004,
"font": 209501,
"html": 16307,
"image": 0,
"js": 184428,
"other": 47905
},
"cls": 0,
"fcp": 284,
"inp": 40,
"interaction": "PL",
"lcp": 284,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 454,
"profile": "desktop",
"renderBlocking": [
"/_next/static/chunks/05jza-3-ce5bf.css"
],
"requests": 24,
"scriptMs": 18,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl/wycena",
"runs": 3
},
"showcase": {
"bytes": {
"css": 12004,
"font": 209501,
"html": 36928,
"image": 5263,
"js": 212674,
"other": 47905
},
"cls": 0,
"fcp": 296,
"inp": 40,
"interaction": "PL",
"lcp": 296,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 458,
"profile": "desktop",
"renderBlocking": [
"/_next/static/chunks/05jza-3-ce5bf.css"
],
"requests": 30,
"scriptMs": 41,
"status": 200,
"tbt": 0,
"thirdParty": [
"https://challenges.cloudflare.com"
],
"ttfb": 41,
"url": "/pl/bloki",
"runs": 3
},
"notFound": {
"bytes": {
"css": 12004,
"font": 209501,
"html": 7733,
"image": 0,
"js": 184428,
"other": 84492
},
"cls": 0,
"fcp": 516,
"inp": 40,
"interaction": "PL",
"lcp": 576,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "h1"
},
"load": 513,
"profile": "desktop",
"renderBlocking": [],
"requests": 31,
"scriptMs": 29,
"status": 404,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl/nie-ma-takiej-strony",
"runs": 3
}
},
"admin": {
"bytes": {
"css": 98914,
"font": 0,
"html": 23023,
"image": 0,
"js": 876243,
"other": 1690
},
"cls": 0,
"fcp": 1052,
"inp": null,
"interaction": null,
"lcp": 1052,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "a"
},
"load": 975,
"profile": "desktop",
"renderBlocking": [
"/_next/static/chunks/1l9apu4iesvci.css",
"/_next/static/chunks/3c_6gydv624zb.css",
"/_next/static/chunks/3ebvnk7qs9043.css",
"/_next/static/chunks/2h0ajyj_brp--.css",
"/_next/static/chunks/3k6de-uhqm-in.css",
"/_next/static/chunks/1z_mbvpkjhpd5.css",
"/_next/static/chunks/2do7kfo662xwp.css"
],
"requests": 23,
"scriptMs": 410,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 90,
"url": "/admin/login",
"runs": 3
}
},
"date": "2026-12-01T12:14:21.329Z",
"label": "turbopack-before",
"method": "scripts/perf-measure.mjs + reference/e2e/perf-lab.mjs",
"runs": 3,
"server": {
"coldStartHealthMs": 1455,
"coldStartFirstPageMs": 1478,
"firstPageMs": 22,
"ttfb_home": {
"median": 3.9,
"p95": 6.2
},
"ttfb_md": {
"median": 21,
"p95": 42.4
},
"ttfb_sitemap": {
"median": 0.9,
"p95": 1.5
},
"ttfb_llms": {
"median": 28.5,
"p95": 34
},
"render": {
"home": {
"medianMs": 56.6,
"queries": 43,
"queryMs": 0,
"byCollection": {
"globals": 39,
"media": 24,
"pages": 57,
"forms": 9
}
},
"page": {
"medianMs": 40.5,
"queries": 34,
"queryMs": 0,
"byCollection": {
"globals": 36,
"pages": 48,
"media": 12,
"forms": 6
}
},
"archive": {
"medianMs": 31.7,
"queries": 34,
"queryMs": 0,
"byCollection": {
"globals": 36,
"pages": 45,
"media": 9,
"forms": 6,
"posts": 6
}
},
"post": {
"medianMs": 40.9,
"queries": 41,
"queryMs": 0,
"byCollection": {
"globals": 36,
"pages": 39,
"media": 15,
"posts": 27,
"forms": 6
}
},
"caseStudy": {
"medianMs": 32.5,
"queries": 37,
"queryMs": 0,
"byCollection": {
"globals": 36,
"pages": 36,
"media": 12,
"casestudies": 21,
"forms": 6
}
},
"form": {
"medianMs": 28.2,
"queries": 30,
"queryMs": 0,
"byCollection": {
"globals": 36,
"media": 6,
"pages": 42,
"forms": 6
}
},
"showcase": {
"medianMs": 72.7,
"queries": 42,
"queryMs": 0,
"byCollection": {
"globals": 30,
"pages": 57,
"media": 21,
"forms": 12,
"posts": 6
}
},
"notFound": {
"medianMs": 26.6,
"queries": 25,
"queryMs": 0,
"byCollection": {
"globals": 33,
"pages": 33,
"media": 9
}
},
"md": {
"medianMs": 29,
"queries": 16,
"queryMs": 0,
"byCollection": {
"globals": 4,
"media": 5,
"pages": 6,
"forms": 1
}
},
"sitemap": {
"medianMs": 2,
"queries": 0,
"queryMs": 0,
"byCollection": {}
},
"llms": {
"medianMs": 33,
"queries": 22,
"queryMs": 0,
"byCollection": {
"globals": 4,
"media": 3,
"pages": 7,
"posts": 4,
"casestudies": 4
}
},
"llmsFull": {
"medianMs": 55,
"queries": 38,
"queryMs": 0,
"byCollection": {
"globals": 6,
"media": 9,
"pages": 13,
"forms": 2,
"posts": 4,
"casestudies": 4
}
}
},
"rssMiB": 308
}
}
+768
View File
@@ -0,0 +1,768 @@
{
"client": {
"mobile": {
"home": {
"bytes": {
"css": 11177,
"font": 209501,
"html": 19887,
"image": 9544,
"js": 179297,
"other": 0
},
"cls": 0.036,
"fcp": 768,
"inp": 40,
"interaction": "PL",
"lcp": 768,
"lcpElement": {
"fetchpriority": "high",
"loading": "eager",
"src": "data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 1000'%3",
"tag": "img"
},
"load": 2374,
"prefetches": 4,
"profile": "mobile",
"renderBlocking": [
"/_next/static/css/b2d8ea1877879cf5.css"
],
"requests": 21,
"scriptMs": 132,
"status": 200,
"tbt": 20,
"thirdParty": [],
"ttfb": 151,
"url": "/pl",
"runs": 3
},
"page": {
"bytes": {
"css": 11177,
"font": 209501,
"html": 17027,
"image": 8457,
"js": 179297,
"other": 0
},
"cls": 0,
"fcp": 752,
"inp": 40,
"interaction": "PL",
"lcp": 752,
"lcpElement": {
"fetchpriority": "high",
"loading": "eager",
"src": "data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 1000'%3",
"tag": "img"
},
"load": 2373,
"prefetches": 2,
"profile": "mobile",
"renderBlocking": [
"/_next/static/css/b2d8ea1877879cf5.css"
],
"requests": 18,
"scriptMs": 125,
"status": 200,
"tbt": 21,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/o-nas",
"runs": 3
},
"archive": {
"bytes": {
"css": 11177,
"font": 209501,
"html": 16588,
"image": 5322,
"js": 179297,
"other": 0
},
"cls": 0,
"fcp": 740,
"inp": 40,
"interaction": "PL",
"lcp": 740,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 2378,
"prefetches": 3,
"profile": "mobile",
"renderBlocking": [
"/_next/static/css/b2d8ea1877879cf5.css"
],
"requests": 18,
"scriptMs": 126,
"status": 200,
"tbt": 20,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/blog",
"runs": 3
},
"post": {
"bytes": {
"css": 11177,
"font": 209501,
"html": 17071,
"image": 5322,
"js": 179297,
"other": 0
},
"cls": 0,
"fcp": 744,
"inp": 40,
"interaction": "PL",
"lcp": 744,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 2374,
"prefetches": 2,
"profile": "mobile",
"renderBlocking": [
"/_next/static/css/b2d8ea1877879cf5.css"
],
"requests": 18,
"scriptMs": 121,
"status": 200,
"tbt": 21,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/blog/zanim-kupisz-dzialke",
"runs": 3
},
"caseStudy": {
"bytes": {
"css": 11177,
"font": 209501,
"html": 16486,
"image": 4376,
"js": 179297,
"other": 0
},
"cls": 0,
"fcp": 772,
"inp": 40,
"interaction": "PL",
"lcp": 772,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 2373,
"prefetches": 2,
"profile": "mobile",
"renderBlocking": [
"/_next/static/css/b2d8ea1877879cf5.css"
],
"requests": 17,
"scriptMs": 119,
"status": 200,
"tbt": 19,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/realizacje/dom-pod-lasem",
"runs": 3
},
"form": {
"bytes": {
"css": 11177,
"font": 209501,
"html": 16753,
"image": 0,
"js": 187749,
"other": 0
},
"cls": 0,
"fcp": 776,
"inp": 32,
"interaction": "PL",
"lcp": 776,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 2565,
"prefetches": 2,
"profile": "mobile",
"renderBlocking": [
"/_next/static/css/b2d8ea1877879cf5.css"
],
"requests": 16,
"scriptMs": 151,
"status": 200,
"tbt": 15,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/wycena",
"runs": 3
},
"showcase": {
"bytes": {
"css": 11177,
"font": 209501,
"html": 37304,
"image": 2018,
"js": 218738,
"other": 0
},
"cls": 0,
"fcp": 760,
"inp": 40,
"interaction": "PL",
"lcp": 760,
"lcpElement": {
"fetchpriority": "high",
"loading": "eager",
"src": "data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 1000'%3",
"tag": "img"
},
"load": 2415,
"prefetches": 4,
"profile": "mobile",
"renderBlocking": [
"/_next/static/css/b2d8ea1877879cf5.css"
],
"requests": 22,
"scriptMs": 213,
"status": 200,
"tbt": 23,
"thirdParty": [
"https://challenges.cloudflare.com"
],
"ttfb": 151,
"url": "/pl/bloki",
"runs": 3
},
"notFound": {
"bytes": {
"css": 11177,
"font": 209501,
"html": 7677,
"image": 0,
"js": 179297,
"other": 2450
},
"cls": 0,
"fcp": 1836,
"inp": 32,
"interaction": "PL",
"lcp": 1836,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 2802,
"prefetches": 10,
"profile": "mobile",
"renderBlocking": [],
"requests": 16,
"scriptMs": 167,
"status": 404,
"tbt": 0,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/nie-ma-takiej-strony",
"runs": 3
}
},
"desktop": {
"home": {
"bytes": {
"css": 11177,
"font": 209501,
"html": 19887,
"image": 9286,
"js": 179297,
"other": 0
},
"cls": 0.001,
"fcp": 280,
"inp": 40,
"interaction": "PL",
"lcp": 280,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "h1"
},
"load": 463,
"prefetches": 11,
"profile": "desktop",
"renderBlocking": [
"/_next/static/css/b2d8ea1877879cf5.css"
],
"requests": 21,
"scriptMs": 45,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl",
"runs": 3
},
"page": {
"bytes": {
"css": 11177,
"font": 209501,
"html": 17027,
"image": 10684,
"js": 179297,
"other": 0
},
"cls": 0,
"fcp": 276,
"inp": 40,
"interaction": "PL",
"lcp": 276,
"lcpElement": {
"fetchpriority": "high",
"loading": "eager",
"src": "/_next/image?url=http%3A%2F%2Flocalhost%3A3370%2Fapi%2Fmedia%2Ffile%2Flibrary-3.webp&w=750&q=75",
"tag": "img"
},
"load": 444,
"prefetches": 8,
"profile": "desktop",
"renderBlocking": [
"/_next/static/css/b2d8ea1877879cf5.css"
],
"requests": 19,
"scriptMs": 28,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl/o-nas",
"runs": 3
},
"archive": {
"bytes": {
"css": 11177,
"font": 209501,
"html": 16588,
"image": 4815,
"js": 179297,
"other": 0
},
"cls": 0,
"fcp": 272,
"inp": 40,
"interaction": "PL",
"lcp": 272,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 456,
"prefetches": 11,
"profile": "desktop",
"renderBlocking": [
"/_next/static/css/b2d8ea1877879cf5.css"
],
"requests": 18,
"scriptMs": 43,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl/blog",
"runs": 3
},
"post": {
"bytes": {
"css": 11177,
"font": 209501,
"html": 17071,
"image": 4815,
"js": 179297,
"other": 0
},
"cls": 0,
"fcp": 276,
"inp": 40,
"interaction": "PL",
"lcp": 276,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 441,
"prefetches": 8,
"profile": "desktop",
"renderBlocking": [
"/_next/static/css/b2d8ea1877879cf5.css"
],
"requests": 18,
"scriptMs": 30,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl/blog/zanim-kupisz-dzialke",
"runs": 3
},
"caseStudy": {
"bytes": {
"css": 11177,
"font": 209501,
"html": 16486,
"image": 9286,
"js": 179297,
"other": 0
},
"cls": 0,
"fcp": 288,
"inp": 40,
"interaction": "PL",
"lcp": 288,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "h1"
},
"load": 453,
"prefetches": 8,
"profile": "desktop",
"renderBlocking": [
"/_next/static/css/b2d8ea1877879cf5.css"
],
"requests": 19,
"scriptMs": 31,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl/realizacje/dom-pod-lasem",
"runs": 3
},
"form": {
"bytes": {
"css": 11177,
"font": 209501,
"html": 16753,
"image": 0,
"js": 187749,
"other": 0
},
"cls": 0,
"fcp": 284,
"inp": 40,
"interaction": "PL",
"lcp": 284,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 438,
"prefetches": 8,
"profile": "desktop",
"renderBlocking": [
"/_next/static/css/b2d8ea1877879cf5.css"
],
"requests": 16,
"scriptMs": 47,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl/wycena",
"runs": 3
},
"showcase": {
"bytes": {
"css": 11177,
"font": 209501,
"html": 37304,
"image": 5267,
"js": 218795,
"other": 0
},
"cls": 0,
"fcp": 288,
"inp": 40,
"interaction": "PL",
"lcp": 288,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 452,
"prefetches": 8,
"profile": "desktop",
"renderBlocking": [
"/_next/static/css/b2d8ea1877879cf5.css"
],
"requests": 23,
"scriptMs": 52,
"status": 200,
"tbt": 0,
"thirdParty": [
"https://challenges.cloudflare.com"
],
"ttfb": 41,
"url": "/pl/bloki",
"runs": 3
},
"notFound": {
"bytes": {
"css": 11177,
"font": 209501,
"html": 7677,
"image": 0,
"js": 179297,
"other": 2450
},
"cls": 0,
"fcp": 404,
"inp": 32,
"interaction": "PL",
"lcp": 464,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "h1"
},
"load": 523,
"prefetches": 14,
"profile": "desktop",
"renderBlocking": [],
"requests": 16,
"scriptMs": 47,
"status": 404,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl/nie-ma-takiej-strony",
"runs": 3
}
},
"admin": {
"bytes": {
"css": 98168,
"font": 0,
"html": 24043,
"image": 0,
"js": 843368,
"other": 1690
},
"cls": 0,
"fcp": 1016,
"inp": null,
"interaction": null,
"lcp": 1016,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "a"
},
"load": 944,
"prefetches": 0,
"profile": "desktop",
"renderBlocking": [
"/_next/static/css/de3d54fcc6ee5dc6.css",
"/_next/static/css/dc48c3ee3f159f65.css",
"/_next/static/css/c1e0b959dd828ab8.css",
"/_next/static/css/e5d1b6185968e333.css",
"/_next/static/css/4858144d3215dfc6.css"
],
"requests": 20,
"scriptMs": 348,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 87,
"url": "/admin/login",
"runs": 3
}
},
"date": "2026-12-01T14:38:54.097Z",
"label": "webpack-1180-after",
"method": "scripts/perf-measure.mjs + reference/e2e/perf-lab.mjs",
"runs": 3,
"server": {
"coldStartHealthMs": 984,
"coldStartFirstPageMs": 1003,
"firstPageMs": 18,
"ttfb_home": {
"median": 3.6,
"p95": 5.6
},
"ttfb_md": {
"median": 21.7,
"p95": 27.5
},
"ttfb_sitemap": {
"median": 1.1,
"p95": 1.4
},
"ttfb_llms": {
"median": 34.1,
"p95": 42
},
"render": {
"home": {
"medianMs": 52.1,
"queries": 24,
"queryMs": 0,
"byCollection": {
"globals": 27,
"media": 9,
"pages": 33,
"forms": 3
}
},
"page": {
"medianMs": 32.2,
"queries": 21,
"queryMs": 0,
"byCollection": {
"globals": 27,
"pages": 27,
"media": 6,
"forms": 3
}
},
"archive": {
"medianMs": 41.5,
"queries": 23,
"queryMs": 0,
"byCollection": {
"globals": 27,
"pages": 27,
"media": 6,
"forms": 3,
"posts": 6
}
},
"post": {
"medianMs": 27.5,
"queries": 26,
"queryMs": 0,
"byCollection": {
"globals": 27,
"pages": 24,
"media": 9,
"posts": 15,
"forms": 3
}
},
"caseStudy": {
"medianMs": 29.9,
"queries": 22,
"queryMs": 0,
"byCollection": {
"globals": 27,
"pages": 21,
"media": 6,
"casestudies": 9,
"forms": 3
}
},
"form": {
"medianMs": 21.5,
"queries": 19,
"queryMs": 0,
"byCollection": {
"globals": 27,
"pages": 24,
"media": 3,
"forms": 3
}
},
"showcase": {
"medianMs": 50,
"queries": 27,
"queryMs": 0,
"byCollection": {
"globals": 24,
"media": 12,
"pages": 33,
"forms": 6,
"posts": 6
}
},
"notFound": {
"medianMs": 26.6,
"queries": 20,
"queryMs": 0,
"byCollection": {
"globals": 27,
"pages": 27,
"media": 6
}
},
"md": {
"medianMs": 37,
"queries": 16,
"queryMs": 0,
"byCollection": {
"globals": 4,
"media": 5,
"pages": 6,
"forms": 1
}
},
"sitemap": {
"medianMs": 3,
"queries": 0,
"queryMs": 0,
"byCollection": {}
},
"llms": {
"medianMs": 43,
"queries": 22,
"queryMs": 0,
"byCollection": {
"globals": 4,
"media": 3,
"pages": 7,
"posts": 4,
"casestudies": 4
}
},
"llmsFull": {
"medianMs": 56,
"queries": 38,
"queryMs": 0,
"byCollection": {
"globals": 6,
"media": 9,
"pages": 13,
"forms": 2,
"posts": 4,
"casestudies": 4
}
}
},
"rssMiB": 410
}
}
+768
View File
@@ -0,0 +1,768 @@
{
"client": {
"mobile": {
"home": {
"bytes": {
"css": 11070,
"font": 209501,
"html": 19869,
"image": 9544,
"js": 188112,
"other": 0
},
"cls": 0.036,
"fcp": 812,
"inp": 40,
"interaction": "PL",
"lcp": 812,
"lcpElement": {
"fetchpriority": "high",
"loading": "eager",
"src": "data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 1000'%3",
"tag": "img"
},
"load": 2543,
"prefetches": 4,
"profile": "mobile",
"renderBlocking": [
"/_next/static/css/2419e69855bb1a63.css"
],
"requests": 22,
"scriptMs": 174,
"status": 200,
"tbt": 46,
"thirdParty": [],
"ttfb": 151,
"url": "/pl",
"runs": 3
},
"page": {
"bytes": {
"css": 11070,
"font": 209501,
"html": 17109,
"image": 8457,
"js": 188112,
"other": 0
},
"cls": 0,
"fcp": 812,
"inp": 48,
"interaction": "PL",
"lcp": 812,
"lcpElement": {
"fetchpriority": "high",
"loading": "eager",
"src": "data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 1000'%3",
"tag": "img"
},
"load": 2571,
"prefetches": 2,
"profile": "mobile",
"renderBlocking": [
"/_next/static/css/2419e69855bb1a63.css"
],
"requests": 19,
"scriptMs": 197,
"status": 200,
"tbt": 73,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/o-nas",
"runs": 3
},
"archive": {
"bytes": {
"css": 11070,
"font": 209501,
"html": 16552,
"image": 5322,
"js": 188112,
"other": 0
},
"cls": 0,
"fcp": 836,
"inp": 48,
"interaction": "PL",
"lcp": 836,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 2548,
"prefetches": 3,
"profile": "mobile",
"renderBlocking": [
"/_next/static/css/2419e69855bb1a63.css"
],
"requests": 19,
"scriptMs": 179,
"status": 200,
"tbt": 59,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/blog",
"runs": 3
},
"post": {
"bytes": {
"css": 11070,
"font": 209501,
"html": 17079,
"image": 5322,
"js": 188112,
"other": 0
},
"cls": 0,
"fcp": 796,
"inp": 40,
"interaction": "PL",
"lcp": 796,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 2511,
"prefetches": 2,
"profile": "mobile",
"renderBlocking": [
"/_next/static/css/2419e69855bb1a63.css"
],
"requests": 19,
"scriptMs": 128,
"status": 200,
"tbt": 27,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/blog/zanim-kupisz-dzialke",
"runs": 3
},
"caseStudy": {
"bytes": {
"css": 11070,
"font": 209501,
"html": 16570,
"image": 4376,
"js": 188112,
"other": 0
},
"cls": 0,
"fcp": 816,
"inp": 40,
"interaction": "PL",
"lcp": 816,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 2502,
"prefetches": 2,
"profile": "mobile",
"renderBlocking": [
"/_next/static/css/2419e69855bb1a63.css"
],
"requests": 18,
"scriptMs": 132,
"status": 200,
"tbt": 35,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/realizacje/dom-pod-lasem",
"runs": 3
},
"form": {
"bytes": {
"css": 11070,
"font": 209501,
"html": 16294,
"image": 0,
"js": 188112,
"other": 0
},
"cls": 0,
"fcp": 816,
"inp": 40,
"interaction": "PL",
"lcp": 816,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 2466,
"prefetches": 2,
"profile": "mobile",
"renderBlocking": [
"/_next/static/css/2419e69855bb1a63.css"
],
"requests": 16,
"scriptMs": 126,
"status": 200,
"tbt": 23,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/wycena",
"runs": 3
},
"showcase": {
"bytes": {
"css": 11070,
"font": 209501,
"html": 36926,
"image": 2018,
"js": 216415,
"other": 0
},
"cls": 0,
"fcp": 848,
"inp": 40,
"interaction": "PL",
"lcp": 848,
"lcpElement": {
"fetchpriority": "high",
"loading": "eager",
"src": "data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 1000'%3",
"tag": "img"
},
"load": 2485,
"prefetches": 4,
"profile": "mobile",
"renderBlocking": [
"/_next/static/css/2419e69855bb1a63.css"
],
"requests": 21,
"scriptMs": 207,
"status": 200,
"tbt": 31,
"thirdParty": [
"https://challenges.cloudflare.com"
],
"ttfb": 151,
"url": "/pl/bloki",
"runs": 3
},
"notFound": {
"bytes": {
"css": 11070,
"font": 209501,
"html": 7700,
"image": 0,
"js": 188112,
"other": 2470
},
"cls": 0.319,
"fcp": 2524,
"inp": 40,
"interaction": "PL",
"lcp": 2524,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 2594,
"prefetches": 10,
"profile": "mobile",
"renderBlocking": [],
"requests": 17,
"scriptMs": 232,
"status": 404,
"tbt": 0,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/nie-ma-takiej-strony",
"runs": 3
}
},
"desktop": {
"home": {
"bytes": {
"css": 11070,
"font": 209501,
"html": 19869,
"image": 9286,
"js": 188112,
"other": 0
},
"cls": 0.001,
"fcp": 292,
"inp": 40,
"interaction": "PL",
"lcp": 292,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "h1"
},
"load": 479,
"prefetches": 11,
"profile": "desktop",
"renderBlocking": [
"/_next/static/css/2419e69855bb1a63.css"
],
"requests": 22,
"scriptMs": 43,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl",
"runs": 3
},
"page": {
"bytes": {
"css": 11070,
"font": 209501,
"html": 17109,
"image": 10684,
"js": 188112,
"other": 0
},
"cls": 0,
"fcp": 284,
"inp": 40,
"interaction": "PL",
"lcp": 284,
"lcpElement": {
"fetchpriority": "high",
"loading": "eager",
"src": "/_next/image?url=http%3A%2F%2Flocalhost%3A3370%2Fapi%2Fmedia%2Ffile%2Flibrary-2.webp&w=750&q=75",
"tag": "img"
},
"load": 460,
"prefetches": 8,
"profile": "desktop",
"renderBlocking": [
"/_next/static/css/2419e69855bb1a63.css"
],
"requests": 20,
"scriptMs": 29,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl/o-nas",
"runs": 3
},
"archive": {
"bytes": {
"css": 11070,
"font": 209501,
"html": 16552,
"image": 4815,
"js": 188112,
"other": 0
},
"cls": 0,
"fcp": 288,
"inp": 40,
"interaction": "PL",
"lcp": 288,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 473,
"prefetches": 11,
"profile": "desktop",
"renderBlocking": [
"/_next/static/css/2419e69855bb1a63.css"
],
"requests": 19,
"scriptMs": 31,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl/blog",
"runs": 3
},
"post": {
"bytes": {
"css": 11070,
"font": 209501,
"html": 17079,
"image": 4815,
"js": 188112,
"other": 0
},
"cls": 0,
"fcp": 280,
"inp": 40,
"interaction": "PL",
"lcp": 280,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 461,
"prefetches": 8,
"profile": "desktop",
"renderBlocking": [
"/_next/static/css/2419e69855bb1a63.css"
],
"requests": 19,
"scriptMs": 29,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl/blog/zanim-kupisz-dzialke",
"runs": 3
},
"caseStudy": {
"bytes": {
"css": 11070,
"font": 209501,
"html": 16570,
"image": 9286,
"js": 188112,
"other": 0
},
"cls": 0,
"fcp": 304,
"inp": 40,
"interaction": "PL",
"lcp": 304,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "h1"
},
"load": 465,
"prefetches": 8,
"profile": "desktop",
"renderBlocking": [
"/_next/static/css/2419e69855bb1a63.css"
],
"requests": 20,
"scriptMs": 31,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl/realizacje/dom-pod-lasem",
"runs": 3
},
"form": {
"bytes": {
"css": 11070,
"font": 209501,
"html": 16294,
"image": 0,
"js": 188112,
"other": 0
},
"cls": 0,
"fcp": 280,
"inp": 40,
"interaction": "PL",
"lcp": 280,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 457,
"prefetches": 8,
"profile": "desktop",
"renderBlocking": [
"/_next/static/css/2419e69855bb1a63.css"
],
"requests": 16,
"scriptMs": 29,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl/wycena",
"runs": 3
},
"showcase": {
"bytes": {
"css": 11070,
"font": 209501,
"html": 36926,
"image": 5267,
"js": 216415,
"other": 0
},
"cls": 0,
"fcp": 304,
"inp": 40,
"interaction": "PL",
"lcp": 304,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 470,
"prefetches": 8,
"profile": "desktop",
"renderBlocking": [
"/_next/static/css/2419e69855bb1a63.css"
],
"requests": 22,
"scriptMs": 47,
"status": 200,
"tbt": 0,
"thirdParty": [
"https://challenges.cloudflare.com"
],
"ttfb": 41,
"url": "/pl/bloki",
"runs": 3
},
"notFound": {
"bytes": {
"css": 11070,
"font": 209501,
"html": 7700,
"image": 0,
"js": 188112,
"other": 2470
},
"cls": 0,
"fcp": 508,
"inp": 40,
"interaction": "PL",
"lcp": 564,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "h1"
},
"load": 500,
"prefetches": 14,
"profile": "desktop",
"renderBlocking": [],
"requests": 17,
"scriptMs": 43,
"status": 404,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl/nie-ma-takiej-strony",
"runs": 3
}
},
"admin": {
"bytes": {
"css": 98168,
"font": 0,
"html": 24044,
"image": 0,
"js": 843325,
"other": 1690
},
"cls": 0,
"fcp": 1012,
"inp": null,
"interaction": null,
"lcp": 1012,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "a"
},
"load": 942,
"prefetches": 0,
"profile": "desktop",
"renderBlocking": [
"/_next/static/css/de3d54fcc6ee5dc6.css",
"/_next/static/css/c1e0b959dd828ab8.css",
"/_next/static/css/e5d1b6185968e333.css",
"/_next/static/css/4858144d3215dfc6.css",
"/_next/static/css/dc48c3ee3f159f65.css"
],
"requests": 20,
"scriptMs": 348,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 86,
"url": "/admin/login",
"runs": 3
}
},
"date": "2026-12-01T14:02:14.941Z",
"label": "webpack-1180-before",
"method": "scripts/perf-measure.mjs + reference/e2e/perf-lab.mjs",
"runs": 3,
"server": {
"coldStartHealthMs": 1460,
"coldStartFirstPageMs": 1487,
"firstPageMs": 26,
"ttfb_home": {
"median": 3.5,
"p95": 6
},
"ttfb_md": {
"median": 38.1,
"p95": 54.6
},
"ttfb_sitemap": {
"median": 2,
"p95": 3.2
},
"ttfb_llms": {
"median": 53.1,
"p95": 83.3
},
"render": {
"home": {
"medianMs": 63.8,
"queries": 24,
"queryMs": 0,
"byCollection": {
"globals": 27,
"pages": 33,
"media": 9,
"forms": 3
}
},
"page": {
"medianMs": 38.7,
"queries": 21,
"queryMs": 0,
"byCollection": {
"globals": 27,
"pages": 27,
"media": 6,
"forms": 3
}
},
"archive": {
"medianMs": 40.8,
"queries": 23,
"queryMs": 0,
"byCollection": {
"globals": 27,
"media": 6,
"pages": 27,
"forms": 3,
"posts": 6
}
},
"post": {
"medianMs": 42.1,
"queries": 26,
"queryMs": 0,
"byCollection": {
"globals": 27,
"pages": 24,
"media": 9,
"posts": 15,
"forms": 3
}
},
"caseStudy": {
"medianMs": 45.1,
"queries": 22,
"queryMs": 0,
"byCollection": {
"globals": 27,
"pages": 21,
"media": 6,
"casestudies": 9,
"forms": 3
}
},
"form": {
"medianMs": 30.6,
"queries": 19,
"queryMs": 0,
"byCollection": {
"globals": 27,
"pages": 24,
"media": 3,
"forms": 3
}
},
"showcase": {
"medianMs": 75.5,
"queries": 27,
"queryMs": 0,
"byCollection": {
"globals": 24,
"pages": 33,
"media": 12,
"forms": 6,
"posts": 6
}
},
"notFound": {
"medianMs": 45.8,
"queries": 20,
"queryMs": 0,
"byCollection": {
"globals": 27,
"pages": 27,
"media": 6
}
},
"md": {
"medianMs": 38,
"queries": 16,
"queryMs": 0,
"byCollection": {
"globals": 4,
"media": 5,
"pages": 6,
"forms": 1
}
},
"sitemap": {
"medianMs": 2,
"queries": 0,
"queryMs": 0,
"byCollection": {}
},
"llms": {
"medianMs": 59,
"queries": 22,
"queryMs": 0,
"byCollection": {
"globals": 4,
"media": 3,
"pages": 7,
"posts": 4,
"casestudies": 4
}
},
"llmsFull": {
"medianMs": 71,
"queries": 38,
"queryMs": 0,
"byCollection": {
"globals": 6,
"media": 9,
"pages": 13,
"forms": 2,
"posts": 4,
"casestudies": 4
}
}
},
"rssMiB": 378
}
}
+751
View File
@@ -0,0 +1,751 @@
{
"client": {
"mobile": {
"home": {
"bytes": {
"css": 11042,
"font": 209501,
"html": 19849,
"image": 9532,
"js": 188111,
"other": 24978
},
"cls": 0.036,
"fcp": 800,
"inp": 40,
"interaction": "PL",
"lcp": 800,
"lcpElement": {
"fetchpriority": "high",
"loading": "eager",
"src": "data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 1000'%3",
"tag": "img"
},
"load": 2495,
"profile": "mobile",
"renderBlocking": [
"/_next/static/css/3ca5a494a33af0a8.css"
],
"requests": 26,
"scriptMs": 118,
"status": 200,
"tbt": 18,
"thirdParty": [],
"ttfb": 151,
"url": "/pl",
"runs": 3
},
"page": {
"bytes": {
"css": 11042,
"font": 209501,
"html": 17076,
"image": 8451,
"js": 188111,
"other": 13192
},
"cls": 0,
"fcp": 796,
"inp": 32,
"interaction": "PL",
"lcp": 796,
"lcpElement": {
"fetchpriority": "high",
"loading": "eager",
"src": "data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 1000'%3",
"tag": "img"
},
"load": 2502,
"profile": "mobile",
"renderBlocking": [
"/_next/static/css/3ca5a494a33af0a8.css"
],
"requests": 21,
"scriptMs": 114,
"status": 200,
"tbt": 19,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/o-nas",
"runs": 3
},
"archive": {
"bytes": {
"css": 11042,
"font": 209501,
"html": 16537,
"image": 5316,
"js": 188111,
"other": 18767
},
"cls": 0,
"fcp": 780,
"inp": 32,
"interaction": "PL",
"lcp": 780,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 2489,
"profile": "mobile",
"renderBlocking": [
"/_next/static/css/3ca5a494a33af0a8.css"
],
"requests": 22,
"scriptMs": 116,
"status": 200,
"tbt": 18,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/blog",
"runs": 3
},
"post": {
"bytes": {
"css": 11042,
"font": 209501,
"html": 17062,
"image": 5316,
"js": 188111,
"other": 13192
},
"cls": 0,
"fcp": 796,
"inp": 40,
"interaction": "PL",
"lcp": 796,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 2488,
"profile": "mobile",
"renderBlocking": [
"/_next/static/css/3ca5a494a33af0a8.css"
],
"requests": 21,
"scriptMs": 110,
"status": 200,
"tbt": 16,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/blog/zanim-kupisz-dzialke",
"runs": 3
},
"caseStudy": {
"bytes": {
"css": 11042,
"font": 209501,
"html": 16546,
"image": 4372,
"js": 188111,
"other": 13192
},
"cls": 0,
"fcp": 792,
"inp": 40,
"interaction": "PL",
"lcp": 792,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 2475,
"profile": "mobile",
"renderBlocking": [
"/_next/static/css/3ca5a494a33af0a8.css"
],
"requests": 20,
"scriptMs": 116,
"status": 200,
"tbt": 20,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/realizacje/dom-pod-lasem",
"runs": 3
},
"form": {
"bytes": {
"css": 11042,
"font": 209501,
"html": 16279,
"image": 0,
"js": 188111,
"other": 13192
},
"cls": 0,
"fcp": 792,
"inp": 32,
"interaction": "PL",
"lcp": 792,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 2447,
"profile": "mobile",
"renderBlocking": [
"/_next/static/css/3ca5a494a33af0a8.css"
],
"requests": 18,
"scriptMs": 119,
"status": 200,
"tbt": 23,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/wycena",
"runs": 3
},
"showcase": {
"bytes": {
"css": 11042,
"font": 209501,
"html": 36946,
"image": 2016,
"js": 216357,
"other": 25110
},
"cls": 0,
"fcp": 828,
"inp": 32,
"interaction": "PL",
"lcp": 828,
"lcpElement": {
"fetchpriority": "high",
"loading": "eager",
"src": "data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 1000'%3",
"tag": "img"
},
"load": 2464,
"profile": "mobile",
"renderBlocking": [
"/_next/static/css/3ca5a494a33af0a8.css"
],
"requests": 25,
"scriptMs": 170,
"status": 200,
"tbt": 20,
"thirdParty": [
"https://challenges.cloudflare.com"
],
"ttfb": 151,
"url": "/pl/bloki",
"runs": 3
},
"notFound": {
"bytes": {
"css": 11042,
"font": 209501,
"html": 7694,
"image": 0,
"js": 188111,
"other": 68916
},
"cls": 0.319,
"fcp": 2504,
"inp": 40,
"interaction": "PL",
"lcp": 2504,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 2587,
"profile": "mobile",
"renderBlocking": [],
"requests": 27,
"scriptMs": 194,
"status": 404,
"tbt": 0,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/nie-ma-takiej-strony",
"runs": 3
}
},
"desktop": {
"home": {
"bytes": {
"css": 11042,
"font": 209501,
"html": 19849,
"image": 9274,
"js": 188111,
"other": 72052
},
"cls": 0.001,
"fcp": 292,
"inp": 40,
"interaction": "PL",
"lcp": 292,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "h1"
},
"load": 482,
"profile": "desktop",
"renderBlocking": [
"/_next/static/css/3ca5a494a33af0a8.css"
],
"requests": 33,
"scriptMs": 46,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl",
"runs": 3
},
"page": {
"bytes": {
"css": 11042,
"font": 209501,
"html": 17076,
"image": 10676,
"js": 188111,
"other": 48402
},
"cls": 0,
"fcp": 292,
"inp": 32,
"interaction": "PL",
"lcp": 292,
"lcpElement": {
"fetchpriority": "high",
"loading": "eager",
"src": "/_next/image?url=http%3A%2F%2Flocalhost%3A3370%2Fapi%2Fmedia%2Ffile%2Flibrary.webp&w=750&q=75",
"tag": "img"
},
"load": 464,
"profile": "desktop",
"renderBlocking": [
"/_next/static/css/3ca5a494a33af0a8.css"
],
"requests": 28,
"scriptMs": 28,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl/o-nas",
"runs": 3
},
"archive": {
"bytes": {
"css": 11042,
"font": 209501,
"html": 16537,
"image": 4809,
"js": 188111,
"other": 65348
},
"cls": 0,
"fcp": 288,
"inp": 40,
"interaction": "PL",
"lcp": 288,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 468,
"profile": "desktop",
"renderBlocking": [
"/_next/static/css/3ca5a494a33af0a8.css"
],
"requests": 30,
"scriptMs": 32,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl/blog",
"runs": 3
},
"post": {
"bytes": {
"css": 11042,
"font": 209501,
"html": 17062,
"image": 4809,
"js": 188111,
"other": 48402
},
"cls": 0,
"fcp": 288,
"inp": 48,
"interaction": "PL",
"lcp": 288,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 469,
"profile": "desktop",
"renderBlocking": [
"/_next/static/css/3ca5a494a33af0a8.css"
],
"requests": 27,
"scriptMs": 32,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl/blog/zanim-kupisz-dzialke",
"runs": 3
},
"caseStudy": {
"bytes": {
"css": 11042,
"font": 209501,
"html": 16546,
"image": 9278,
"js": 188111,
"other": 48402
},
"cls": 0,
"fcp": 300,
"inp": 40,
"interaction": "PL",
"lcp": 300,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "h1"
},
"load": 468,
"profile": "desktop",
"renderBlocking": [
"/_next/static/css/3ca5a494a33af0a8.css"
],
"requests": 28,
"scriptMs": 28,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl/realizacje/dom-pod-lasem",
"runs": 3
},
"form": {
"bytes": {
"css": 11042,
"font": 209501,
"html": 16279,
"image": 0,
"js": 188111,
"other": 48402
},
"cls": 0,
"fcp": 300,
"inp": 40,
"interaction": "PL",
"lcp": 300,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 475,
"profile": "desktop",
"renderBlocking": [
"/_next/static/css/3ca5a494a33af0a8.css"
],
"requests": 24,
"scriptMs": 31,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl/wycena",
"runs": 3
},
"showcase": {
"bytes": {
"css": 11042,
"font": 209501,
"html": 36946,
"image": 5263,
"js": 216414,
"other": 48402
},
"cls": 0,
"fcp": 292,
"inp": 40,
"interaction": "PL",
"lcp": 292,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 457,
"profile": "desktop",
"renderBlocking": [
"/_next/static/css/3ca5a494a33af0a8.css"
],
"requests": 30,
"scriptMs": 50,
"status": 200,
"tbt": 0,
"thirdParty": [
"https://challenges.cloudflare.com"
],
"ttfb": 41,
"url": "/pl/bloki",
"runs": 3
},
"notFound": {
"bytes": {
"css": 11042,
"font": 209501,
"html": 7694,
"image": 0,
"js": 188111,
"other": 85469
},
"cls": 0,
"fcp": 512,
"inp": 48,
"interaction": "PL",
"lcp": 576,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "h1"
},
"load": 505,
"profile": "desktop",
"renderBlocking": [],
"requests": 31,
"scriptMs": 44,
"status": 404,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl/nie-ma-takiej-strony",
"runs": 3
}
},
"admin": {
"bytes": {
"css": 98168,
"font": 0,
"html": 23081,
"image": 0,
"js": 843270,
"other": 1690
},
"cls": 0,
"fcp": 1024,
"inp": null,
"interaction": null,
"lcp": 1024,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "a"
},
"load": 950,
"profile": "desktop",
"renderBlocking": [
"/_next/static/css/de3d54fcc6ee5dc6.css",
"/_next/static/css/c1e0b959dd828ab8.css",
"/_next/static/css/e5d1b6185968e333.css",
"/_next/static/css/4858144d3215dfc6.css",
"/_next/static/css/dc48c3ee3f159f65.css"
],
"requests": 20,
"scriptMs": 350,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 93,
"url": "/admin/login",
"runs": 3
}
},
"date": "2026-12-01T12:39:24.391Z",
"label": "webpack-after",
"method": "scripts/perf-measure.mjs + reference/e2e/perf-lab.mjs",
"runs": 3,
"server": {
"coldStartHealthMs": 1040,
"coldStartFirstPageMs": 1068,
"firstPageMs": 26,
"ttfb_home": {
"median": 3.7,
"p95": 5.4
},
"ttfb_md": {
"median": 26.7,
"p95": 31.9
},
"ttfb_sitemap": {
"median": 1.4,
"p95": 1.8
},
"ttfb_llms": {
"median": 36.4,
"p95": 53.7
},
"render": {
"home": {
"medianMs": 51,
"queries": 24,
"queryMs": 0,
"byCollection": {
"globals": 27,
"pages": 33,
"media": 9,
"forms": 3
}
},
"page": {
"medianMs": 33.8,
"queries": 21,
"queryMs": 0,
"byCollection": {
"globals": 27,
"pages": 27,
"media": 6,
"forms": 3
}
},
"archive": {
"medianMs": 42.1,
"queries": 23,
"queryMs": 0,
"byCollection": {
"globals": 27,
"media": 6,
"pages": 27,
"forms": 3,
"posts": 6
}
},
"post": {
"medianMs": 40.6,
"queries": 26,
"queryMs": 0,
"byCollection": {
"globals": 27,
"pages": 24,
"media": 9,
"posts": 15,
"forms": 3
}
},
"caseStudy": {
"medianMs": 30.8,
"queries": 22,
"queryMs": 0,
"byCollection": {
"globals": 27,
"pages": 21,
"media": 6,
"casestudies": 9,
"forms": 3
}
},
"form": {
"medianMs": 28.9,
"queries": 19,
"queryMs": 0,
"byCollection": {
"globals": 27,
"pages": 24,
"media": 3,
"forms": 3
}
},
"showcase": {
"medianMs": 61.8,
"queries": 27,
"queryMs": 0,
"byCollection": {
"globals": 24,
"pages": 33,
"media": 12,
"forms": 6,
"posts": 6
}
},
"notFound": {
"medianMs": 26.4,
"queries": 20,
"queryMs": 0,
"byCollection": {
"globals": 27,
"pages": 27,
"media": 6
}
},
"md": {
"medianMs": 30,
"queries": 16,
"queryMs": 0,
"byCollection": {
"globals": 4,
"media": 5,
"pages": 6,
"forms": 1
}
},
"sitemap": {
"medianMs": 3,
"queries": 0,
"queryMs": 0,
"byCollection": {}
},
"llms": {
"medianMs": 41,
"queries": 22,
"queryMs": 0,
"byCollection": {
"globals": 4,
"media": 3,
"pages": 7,
"posts": 4,
"casestudies": 4
}
},
"llmsFull": {
"medianMs": 65,
"queries": 38,
"queryMs": 0,
"byCollection": {
"globals": 6,
"media": 9,
"pages": 13,
"forms": 2,
"posts": 4,
"casestudies": 4
}
}
},
"rssMiB": 440
}
}
+751
View File
@@ -0,0 +1,751 @@
{
"client": {
"mobile": {
"home": {
"bytes": {
"css": 11023,
"font": 209501,
"html": 19829,
"image": 9532,
"js": 191323,
"other": 24973
},
"cls": 0.036,
"fcp": 800,
"inp": 32,
"interaction": "PL",
"lcp": 800,
"lcpElement": {
"fetchpriority": "high",
"loading": "eager",
"src": "data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 1000'%3",
"tag": "img"
},
"load": 2492,
"profile": "mobile",
"renderBlocking": [
"/_next/static/css/42cf443dc3526fb0.css"
],
"requests": 26,
"scriptMs": 124,
"status": 200,
"tbt": 24,
"thirdParty": [],
"ttfb": 151,
"url": "/pl",
"runs": 3
},
"page": {
"bytes": {
"css": 11023,
"font": 209501,
"html": 17074,
"image": 8451,
"js": 191323,
"other": 13185
},
"cls": 0,
"fcp": 788,
"inp": 40,
"interaction": "PL",
"lcp": 788,
"lcpElement": {
"fetchpriority": "high",
"loading": "eager",
"src": "data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 1000'%3",
"tag": "img"
},
"load": 2508,
"profile": "mobile",
"renderBlocking": [
"/_next/static/css/42cf443dc3526fb0.css"
],
"requests": 21,
"scriptMs": 117,
"status": 200,
"tbt": 22,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/o-nas",
"runs": 3
},
"archive": {
"bytes": {
"css": 11023,
"font": 209501,
"html": 16520,
"image": 5316,
"js": 191323,
"other": 18759
},
"cls": 0,
"fcp": 796,
"inp": 32,
"interaction": "PL",
"lcp": 796,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 2495,
"profile": "mobile",
"renderBlocking": [
"/_next/static/css/42cf443dc3526fb0.css"
],
"requests": 22,
"scriptMs": 118,
"status": 200,
"tbt": 22,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/blog",
"runs": 3
},
"post": {
"bytes": {
"css": 11023,
"font": 209501,
"html": 17019,
"image": 5316,
"js": 191323,
"other": 13185
},
"cls": 0,
"fcp": 788,
"inp": 32,
"interaction": "PL",
"lcp": 788,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 2502,
"profile": "mobile",
"renderBlocking": [
"/_next/static/css/42cf443dc3526fb0.css"
],
"requests": 21,
"scriptMs": 122,
"status": 200,
"tbt": 22,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/blog/zanim-kupisz-dzialke",
"runs": 3
},
"caseStudy": {
"bytes": {
"css": 11023,
"font": 209501,
"html": 16514,
"image": 4372,
"js": 191323,
"other": 13185
},
"cls": 0,
"fcp": 792,
"inp": 32,
"interaction": "PL",
"lcp": 792,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 2487,
"profile": "mobile",
"renderBlocking": [
"/_next/static/css/42cf443dc3526fb0.css"
],
"requests": 20,
"scriptMs": 121,
"status": 200,
"tbt": 24,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/realizacje/dom-pod-lasem",
"runs": 3
},
"form": {
"bytes": {
"css": 11023,
"font": 209501,
"html": 16262,
"image": 0,
"js": 191323,
"other": 13185
},
"cls": 0,
"fcp": 792,
"inp": 32,
"interaction": "PL",
"lcp": 792,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 2453,
"profile": "mobile",
"renderBlocking": [
"/_next/static/css/42cf443dc3526fb0.css"
],
"requests": 18,
"scriptMs": 118,
"status": 200,
"tbt": 23,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/wycena",
"runs": 3
},
"showcase": {
"bytes": {
"css": 11023,
"font": 209501,
"html": 36904,
"image": 2016,
"js": 219569,
"other": 25103
},
"cls": 0,
"fcp": 832,
"inp": 40,
"interaction": "PL",
"lcp": 832,
"lcpElement": {
"fetchpriority": "high",
"loading": "eager",
"src": "data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 1000'%3",
"tag": "img"
},
"load": 2474,
"profile": "mobile",
"renderBlocking": [
"/_next/static/css/42cf443dc3526fb0.css"
],
"requests": 25,
"scriptMs": 185,
"status": 200,
"tbt": 25,
"thirdParty": [
"https://challenges.cloudflare.com"
],
"ttfb": 151,
"url": "/pl/bloki",
"runs": 3
},
"notFound": {
"bytes": {
"css": 11023,
"font": 209501,
"html": 7675,
"image": 0,
"js": 191323,
"other": 68911
},
"cls": 0.319,
"fcp": 2488,
"inp": 32,
"interaction": "PL",
"lcp": 2488,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 2400,
"profile": "mobile",
"renderBlocking": [],
"requests": 27,
"scriptMs": 195,
"status": 404,
"tbt": 0,
"thirdParty": [],
"ttfb": 151,
"url": "/pl/nie-ma-takiej-strony",
"runs": 3
}
},
"desktop": {
"home": {
"bytes": {
"css": 11023,
"font": 209501,
"html": 19829,
"image": 9274,
"js": 191323,
"other": 72045
},
"cls": 0.001,
"fcp": 288,
"inp": 32,
"interaction": "PL",
"lcp": 288,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "h1"
},
"load": 471,
"profile": "desktop",
"renderBlocking": [
"/_next/static/css/42cf443dc3526fb0.css"
],
"requests": 33,
"scriptMs": 40,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl",
"runs": 3
},
"page": {
"bytes": {
"css": 11023,
"font": 209501,
"html": 17074,
"image": 10676,
"js": 191323,
"other": 48398
},
"cls": 0,
"fcp": 316,
"inp": 40,
"interaction": "PL",
"lcp": 316,
"lcpElement": {
"fetchpriority": "high",
"loading": "eager",
"src": "/_next/image?url=http%3A%2F%2Flocalhost%3A3370%2Fapi%2Fmedia%2Ffile%2Flibrary.webp&w=750&q=75",
"tag": "img"
},
"load": 488,
"profile": "desktop",
"renderBlocking": [
"/_next/static/css/42cf443dc3526fb0.css"
],
"requests": 28,
"scriptMs": 32,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl/o-nas",
"runs": 3
},
"archive": {
"bytes": {
"css": 11023,
"font": 209501,
"html": 16520,
"image": 4809,
"js": 191323,
"other": 65341
},
"cls": 0,
"fcp": 292,
"inp": 40,
"interaction": "PL",
"lcp": 292,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 472,
"profile": "desktop",
"renderBlocking": [
"/_next/static/css/42cf443dc3526fb0.css"
],
"requests": 30,
"scriptMs": 34,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl/blog",
"runs": 3
},
"post": {
"bytes": {
"css": 11023,
"font": 209501,
"html": 17019,
"image": 4809,
"js": 191323,
"other": 48398
},
"cls": 0,
"fcp": 292,
"inp": 40,
"interaction": "PL",
"lcp": 292,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 471,
"profile": "desktop",
"renderBlocking": [
"/_next/static/css/42cf443dc3526fb0.css"
],
"requests": 27,
"scriptMs": 33,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl/blog/zanim-kupisz-dzialke",
"runs": 3
},
"caseStudy": {
"bytes": {
"css": 11023,
"font": 209501,
"html": 16514,
"image": 9278,
"js": 191323,
"other": 48398
},
"cls": 0,
"fcp": 304,
"inp": 40,
"interaction": "PL",
"lcp": 304,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "h1"
},
"load": 468,
"profile": "desktop",
"renderBlocking": [
"/_next/static/css/42cf443dc3526fb0.css"
],
"requests": 28,
"scriptMs": 31,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl/realizacje/dom-pod-lasem",
"runs": 3
},
"form": {
"bytes": {
"css": 11023,
"font": 209501,
"html": 16262,
"image": 0,
"js": 191323,
"other": 48398
},
"cls": 0,
"fcp": 284,
"inp": 40,
"interaction": "PL",
"lcp": 284,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 470,
"profile": "desktop",
"renderBlocking": [
"/_next/static/css/42cf443dc3526fb0.css"
],
"requests": 24,
"scriptMs": 34,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl/wycena",
"runs": 3
},
"showcase": {
"bytes": {
"css": 11023,
"font": 209501,
"html": 36904,
"image": 5263,
"js": 219626,
"other": 48398
},
"cls": 0,
"fcp": 300,
"inp": 40,
"interaction": "PL",
"lcp": 300,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "p"
},
"load": 467,
"profile": "desktop",
"renderBlocking": [
"/_next/static/css/42cf443dc3526fb0.css"
],
"requests": 30,
"scriptMs": 44,
"status": 200,
"tbt": 0,
"thirdParty": [
"https://challenges.cloudflare.com"
],
"ttfb": 41,
"url": "/pl/bloki",
"runs": 3
},
"notFound": {
"bytes": {
"css": 11023,
"font": 209501,
"html": 7675,
"image": 0,
"js": 191323,
"other": 85467
},
"cls": 0,
"fcp": 516,
"inp": 32,
"interaction": "PL",
"lcp": 580,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "h1"
},
"load": 509,
"profile": "desktop",
"renderBlocking": [],
"requests": 31,
"scriptMs": 44,
"status": 404,
"tbt": 0,
"thirdParty": [],
"ttfb": 41,
"url": "/pl/nie-ma-takiej-strony",
"runs": 3
}
},
"admin": {
"bytes": {
"css": 98168,
"font": 0,
"html": 23080,
"image": 0,
"js": 843253,
"other": 1690
},
"cls": 0,
"fcp": 1044,
"inp": null,
"interaction": null,
"lcp": 1044,
"lcpElement": {
"fetchpriority": null,
"loading": null,
"src": null,
"tag": "a"
},
"load": 963,
"profile": "desktop",
"renderBlocking": [
"/_next/static/css/de3d54fcc6ee5dc6.css",
"/_next/static/css/dc48c3ee3f159f65.css",
"/_next/static/css/c1e0b959dd828ab8.css",
"/_next/static/css/e5d1b6185968e333.css",
"/_next/static/css/4858144d3215dfc6.css"
],
"requests": 20,
"scriptMs": 349,
"status": 200,
"tbt": 0,
"thirdParty": [],
"ttfb": 87,
"url": "/admin/login",
"runs": 3
}
},
"date": "2026-12-01T11:54:21.044Z",
"label": "webpack-before",
"method": "scripts/perf-measure.mjs + reference/e2e/perf-lab.mjs",
"runs": 3,
"server": {
"coldStartHealthMs": 1243,
"coldStartFirstPageMs": 1270,
"firstPageMs": 25,
"ttfb_home": {
"median": 3.5,
"p95": 5.3
},
"ttfb_md": {
"median": 30.4,
"p95": 40.8
},
"ttfb_sitemap": {
"median": 1.1,
"p95": 1.5
},
"ttfb_llms": {
"median": 26.8,
"p95": 39.6
},
"render": {
"home": {
"medianMs": 94.6,
"queries": 43,
"queryMs": 1,
"byCollection": {
"globals": 39,
"media": 24,
"pages": 57,
"forms": 9
}
},
"page": {
"medianMs": 54,
"queries": 34,
"queryMs": 1,
"byCollection": {
"globals": 36,
"pages": 48,
"media": 12,
"forms": 6
}
},
"archive": {
"medianMs": 62.8,
"queries": 34,
"queryMs": 0,
"byCollection": {
"globals": 36,
"pages": 45,
"media": 9,
"forms": 6,
"posts": 6
}
},
"post": {
"medianMs": 61.1,
"queries": 41,
"queryMs": 0,
"byCollection": {
"globals": 36,
"pages": 39,
"media": 15,
"posts": 27,
"forms": 6
}
},
"caseStudy": {
"medianMs": 32.6,
"queries": 37,
"queryMs": 0,
"byCollection": {
"globals": 36,
"pages": 36,
"media": 12,
"casestudies": 21,
"forms": 6
}
},
"form": {
"medianMs": 28.1,
"queries": 30,
"queryMs": 0,
"byCollection": {
"globals": 36,
"pages": 42,
"media": 6,
"forms": 6
}
},
"showcase": {
"medianMs": 68.3,
"queries": 42,
"queryMs": 0,
"byCollection": {
"globals": 30,
"pages": 57,
"media": 21,
"forms": 12,
"posts": 6
}
},
"notFound": {
"medianMs": 28.5,
"queries": 25,
"queryMs": 0,
"byCollection": {
"globals": 33,
"media": 9,
"pages": 33
}
},
"md": {
"medianMs": 24,
"queries": 16,
"queryMs": 0,
"byCollection": {
"globals": 4,
"media": 5,
"pages": 6,
"forms": 1
}
},
"sitemap": {
"medianMs": 2,
"queries": 0,
"queryMs": 0,
"byCollection": {}
},
"llms": {
"medianMs": 36,
"queries": 22,
"queryMs": 0,
"byCollection": {
"globals": 4,
"media": 3,
"pages": 7,
"posts": 4,
"casestudies": 4
}
},
"llmsFull": {
"medianMs": 63,
"queries": 38,
"queryMs": 0,
"byCollection": {
"globals": 6,
"media": 9,
"pages": 13,
"forms": 2,
"posts": 4,
"casestudies": 4
}
}
},
"rssMiB": 340
}
}
+53 -6
View File
@@ -2,7 +2,8 @@
`iapl-doctor` checks a site against the team's rules and lists every gap with a fix hint and a doc link. It covers
what drifts between sites: versions, Node, the folder layout, database names, env rules, security headers, 2FA, the
cookie scanner, the admin preview, the agent guide, seeds, the block library, and the running site.
cookie scanner, the admin preview, the agent guide, seeds, the block library, speed (images, fonts, embeds,
render-blocking resources, animations, budgets), and the running site.
Related: [AGENT.md §11](./agent/AGENT.md), the `iapl-doctor` skill, [deployment.md](./deployment.md),
[seeding.md](./seeding.md), [security.md](./security.md), [blocks.md](./blocks.md).
@@ -66,14 +67,22 @@ Added by `iapl` and **off until the site has `IAPL_DOCTOR_TOKEN`** (at least 32
returns counts only — never names, e-mails or values:
```json
{ "mail": { "graphEnv": false, "relay": { "connected": true, "disconnected": false, "nameReplaced": false, "state": "active" }, "replyAddress": true, "status": null, "transport": "relay" }, "node": "v22.20.0", "openSignUp": [], "pendingCookies": 0, "plugin": "1.15.0", "staffOnOwnRoles": [], "staffOpenToOthers": [], "turnstile": null, "turnstileSecretFromEnv": false, "usersSetupClosed": 0, "usersWithout2fa": 0 }
{ "mail": { "graphEnv": false, "relay": { "connected": true, "disconnected": false, "nameReplaced": false, "state": "active" }, "replyAddress": true, "status": null, "transport": "relay" }, "media": { "images": 42, "oversized": 0, "tooWide": 0 }, "node": "v22.20.0", "openSignUp": [], "pendingCookies": 0, "plugin": "1.15.0", "staffOnOwnRoles": [], "staffOpenToOthers": [], "turnstile": null, "turnstileSecretFromEnv": false, "usersSetupClosed": 0, "usersWithout2fa": 0 }
```
`growth` (since 1.18.0): per collection its documents, its size with indexes (MongoDB; `null` elsewhere) and the date
of its oldest record; versions per versioned collection and global with their limit; `payload-kv` entries and how
many have expired; media no document points at (`checked` documents read, at most 5000); the retention in days of
each plugin log — counts, sizes and dates only.
`media` (since 1.18.0): how many images the upload collections hold and how many are over the plugin's limits
(1.5 MB, 2560 px) — counts only, `null` without an upload collection.
`mail` (since 1.17.0): the e-mail transport in effect, the recorded state of sending and the site's state with the
Intecion mail service — states and codes only, never a token, a password or an address; `relay` is `null` when the
mail service is switched off.
Turn off: `iapl({ doctor: false })`. Adapt: `iapl({ doctor: { tokenVar: 'MY_TOKEN', access: ({ req }) => isAdmin(req.user, req.payload) } })` (a logged-in staff admin may read it too; the second factor is checked for you — never test `req.user.roles` by hand, an account of another collection can carry the same value)
Turn off: `iapl({ doctor: false })`. Adapt: `iapl({ doctor: { tokenVar: 'MY_TOKEN', access: ({ req }) => isAdmin(req.user, req.payload) } })` (only a literal `true` allows since 1.18.0 — `req.user` refuses; `strictAccessAnswers: false` = the old truthy reading) (a logged-in staff admin may read it too; the second factor is checked for you — never test `req.user.roles` by hand, an account of another collection can carry the same value)
(`access` lets a logged-in admin read it without the token). Building blocks: `buildDoctorEndpoint`,
`collectDoctorStatus` from `@intecion/ipal-kit/doctor`.
@@ -83,7 +92,7 @@ Turn off: `iapl({ doctor: false })`. Adapt: `iapl({ doctor: { tokenVar: 'MY_TOKE
|---|---|---|---|
| versions | `plugin-installed` | error | `node_modules` has `@intecion/ipal-kit` and it satisfies `package.json` |
| | `plugin-latest` | warning; error two or more minors behind | the installed plugin is the newest on the team registry (registry) |
| | `next-min` | error | `next` ≥ 16.4.5 (below 16.4.1: RCE/DoS advisories; 16.3.0–16.4.4: GHSA-mfr8-8qww-v76h); `eslint-config-next` on the same minor (warning) |
| | `next-min` | error | `next` ≥ 16.4.6 (below 16.4.1: RCE/DoS advisories; 16.3.0–16.4.4: GHSA-mfr8-8qww-v76h; 16.4.5: below the minimum since 1.18.0 — 16.4.6 is the tested version and its React copy carries the GHSA-xqc2-xf4c-x3h3 fix); `eslint-config-next` on the same minor (warning) |
| | `sharp-min` | error | `sharp` ≥ 0.35.5 |
| | `transitive-min` | error (`mongoose`), warning (`happy-dom`) | packages Payload pins below a security fix, in any depth of the tree (read from `pnpm-lock.yaml`, else `node_modules/.pnpm`): `mongoose` 8.x ≥ 8.24.7 (GHSA-pcrw-h46h-c93h and four more; Payload 3.90–3.93 pin 8.24.1, 3.94.0+ ship 8.24.7 — the fix it prints names the Payload upgrade first), `happy-dom` ≥ 21.0.4 (GHSA-c8p4-j97h-3vg8, GHSA-834v-8h66-3h79). The fix it prints is the `pnpm.overrides` line from AGENT.md §4 item 12 |
| | `node-22` | warning | `engines.node` only 22 (`">=22 <23"`), `.nvmrc` / `.node-version` = 22; with `--deep`, the running Node |
@@ -101,23 +110,29 @@ 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.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`) |
| | `2fa` | error | `twoFactor: { plugin: payloadTotp }` + the package; deep: 0 users without TOTP (the message says how many of them are blocked because their setup window has passed); error: a Postgres / SQLite project whose migrations do not mention the 2FA column `totp_setup_from` (every login would answer 500; a warning when there is no migrations folder — the doctor cannot see a schema that gets there another way); warning: `twoFactor.requireSetup: false`; info: no setup window (`windowHours: false`) |
| | `2fa-enrolment-mail` | error / info | (deep) `twoFactor.confirmByEmail` is on (the default since 1.18.0) and e-mail does not work (no transport, no method chosen, SMTP incomplete): nobody finishes setting up two-step verification alone — the link is only in the server log, or an admin confirms each set-up (error); set-ups waiting for their link (info; error while mail does not work) |
| | `access-missing` | warning | `iapl` has an `access` option — without it there are no roles and every panel account is an admin |
| | `csrf-empty` | warning | the config sets `serverURL` or `csrf` — otherwise Payload accepts the login cookie from any origin |
| | `csrf-empty` | warning | the config sets `serverURL` or `csrf` — otherwise Payload accepts the login cookie from any origin, and behind a proxy that rewrites `Host` the plugin's own-origin checks (2FA, panel actions) refuse the site's own panel. With `--url` (deep) the running config decides (`originKnown` in the status), not the file |
| | `open-signup` | info | (deep) auth collections whose `create` rule lets an anonymous request through: sign-up is open there (intended for a customer zone — silence with a reason) |
| | `staff-own-roles` | warning | (deep) a staff collection with role values of its own, neither `editor` nor `admin` among them, that runs on the plugin's default account rules: the plugin cannot rank those roles, so inside the collection every account may create an account with any role and change or delete another. Write the collection's own rules |
| | `staff-accounts-open` | error (warning for `read`, `readVersions`) | (deep) a staff collection that an account of another, non-staff auth collection may create in, read (also its versions), update, delete from or unlock — it can make itself staff, change a staff password, list the accounts or lift a login lock. The account rules are off (`accounts: false`, `adminOnlyCreate` / `adminOnlyWrite` / `staffOnlyRead: false`) or the project's own rule is wider. Asked with a made-up outside account; a rule that throws counts as closed |
| | `turnstile-degraded` | warning / error | (deep) Turnstile is checking forms; while it is not (wrong or missing secret, Cloudflare down) a warning, an error once it has lasted 24 hours (counted from the recorded start to now) |
| | `turnstile-env-key` | warning | (deep) the Turnstile secret key is in the panel, not in the deprecated `TURNSTILE_SECRET_KEY` environment variable |
| | `code-patterns` | error / warning | the project's own code (`src/`, seeds, migrations, scripts and tests left out where the rule is about requests): `dangerouslySetInnerHTML` / `innerHTML` with a value no sanitizer passed, JSON in a `<script>` without escaping `<` (`code-inner-html`); `eval` / `new Function` / `vm` (`code-eval`); a shell command from a template string (`code-shell`); a `NEXT_PUBLIC_` secret, or a server secret read in a `'use client'` file (`code-public-secret`); `overrideAccess: true` where a request reaches (`code-override-access`); the Local API given a `user` without `overrideAccess: false` — Payload then ignores the user (`code-local-api-user`); a `where` taken from the request (`code-raw-where`); a redirect (`code-open-redirect`) or a server-side `fetch` (`code-ssrf`) to an address from the request. One finding per rule and file. A correct place: `// iapl-security-ok: <why>` on the line or the line above; a file or folder: `iapl-doctor.json` `rules: { "code-override-access": { "files": ["src/lib/admin/**"], "off": true, "reason": "…" } }` (security.md "Security suites") |
| | `config-dangerous` | error / warning | `next.config`: `images.dangerouslyAllowSVG` without `images.contentSecurityPolicy` (error), `remotePatterns` hostname `**` / `*`, `serverActions.allowedOrigins` with `*` (error), `productionBrowserSourceMaps: true`; `payload.config`: `cors: '*'`, `debug: true`, GraphQL playground / introspection on in production, `maxDepth` above 20 |
| | `live-probes` | error / warning | (live, `--url`) the plugin's attack probes that change nothing: source / env / git files, secrets in the page scripts and public source maps, `x-middleware-subrequest` proxy bypass, open redirects, `X-Forwarded-Host` in redirects and links, Markdown / RSC answers a cache could store as the page, `$ne` operators in a sign-in, anonymous `where` / draft / versions / GraphQL reads, stack traces, unbounded `limit`, `/_next/image` to inner hosts or SVG, headers on every kind of answer, odd methods and an unknown Server Action. Reported as `live-probes:<id>`; the 8 MB-body probe runs only in the Playwright spec (security.md "Security suites") |
| | `storage-names` | warning | the visitor cookie the layout sets (`<PageStats visitorCookie>`, default `ipal_vid`) is the one the config makes the cookie scanner declare (`storageNames`, stats.md) |
| | `cookie-scanner` | error / warning / info | `cookieScanner` on (with `crawl`, else info); deep: nothing waits for approval (warning) |
| mail | `mail-method` | error / info | (deep) the chosen "Sending method" can be used — "Own SMTP server" with server, user name and password, "Microsoft Graph" with the `GRAPH_*` variables; otherwise e-mails are not sent and nothing is sent another way (error). On Postgres / SQLite: the column of `emailMethod` exists — the 1.17.1 migration has run (error). Nobody has chosen yet: the site picks a method from what is filled in until Site integrations is saved (info) |
| | `mail-transport` | error / warning | (deep) an e-mail transport is in effect (not: the mail service switched off and no SMTP server); the last sends worked — failing: warning, error once it has lasted 24 hours |
| | `mail-non-public` | info | (deep) on the mail service: says which signal makes the site a non-public copy — its host matches a development pattern (`developmentHosts`, named in the finding) or `IAPL_NOINDEX` is set — and what to change if the site is in fact the public one |
| | `mail-relay-state` | error / warning / info | (deep) on the Intecion mail service: not disconnected and not stopped (error), not waiting for approval, not refused at enrolment, not a non-public copy of another site's database that waits for "Connect again" (`client-other-host`), the sender name not replaced (warning); not enrolled yet, and a public site whose database also holds another host's connection — its own past after a launch or a move, or a copy that forgot `IAPL_NOINDEX=1` (info) |
| | `mail-relay-connect` | error | (deep) the sending method is IWSN and the site is connected and confirmed — not "not enrolled yet", not waiting for confirmation by Intecion (contract 1.8.0). The fix names "Połącz z IWSN", or Intecion when the service offers no confirmation page |
| | `mail-relay-state` | error / warning / info | (deep) on the Intecion mail service: not disconnected and not stopped (error), not refused at enrolment, not a non-public copy of another site's database that waits for "Connect again" (`client-other-host`), the sender name not replaced (warning); a public site whose database also holds another host's connection — its own past after a launch or a move, or a copy that forgot `IAPL_NOINDEX=1` (info) |
| | `mail-reply-address` | warning | (deep) on the mail service, "Sender address" is filled in: replies go there |
| | `mail-graph-deprecated` | warning | Microsoft Graph is not in use: no `GRAPH_*` variables on the site (deep), no `graphAdapter` / `emailGraph: true` in the config — deprecated, removed in 2.0 |
| | `mail-relay-route` | warning | nothing keeps the mail service from confirming the site: no `trailingSlash: true`, `routes.api` is `/api` (else Intecion sets the site's confirm address); live, on the mail service: `/api/iapl/mail-relay/confirm` answers without a redirect, a block or a server error. Skipped with `relay: false` |
@@ -133,6 +148,22 @@ Turn off: `iapl({ doctor: false })`. Adapt: `iapl({ doctor: { tokenVar: 'MY_TOKE
| | `blocks-duplicate` | warning | a project block whose `slug` (or `interfaceName`) matches a library block — also a slug renamed through the block's `slug` option — unless it is an override in `createBlockRegistry({ components })` |
| | `blocks-helper-copy` | warning | no local copy of a plugin field builder (`blockLibraryManifest.fieldBuilders`), `ctaHref`, `buildActionButtonsField` |
| | `blocks-tokens` | error / warning | from `iapl-audit`: hex colours, the token standard not wired, `iapl-tokens --check` |
| performance | `perf-images-config` | error | `next.config` uses `buildImagesConfig()` (AVIF / WebP, R2, long cache) — [performance.md](./performance.md) |
| | `perf-fonts` | error | no font from Google / Typekit hosts, no `font-display: block`, every `@font-face` has `font-display`, at most two `next/font` families |
| | `perf-render-blocking` | error | no `<script src>` without `async` / `defer`, no stylesheet `<link>` or CSS `@import` from another host |
| | `perf-embeds` | error | no `<iframe>` (map, widget) that loads with the page — a click-to-load facade, or `loading="lazy"`; YouTube is `iapl-audit`'s |
| | `perf-animations` | error | no transition of a layout property or `transition-all`, no `scroll` listener, something honours `prefers-reduced-motion` when the site animates |
| | `perf-budgets` | error | a project that runs Playwright has a performance budget test in `e2e/` (the `iapl-performance` skill's template) |
| | `perf-live` | error | (live) the home HTML is compressed, has no blocking `<script>` in `<head>`, preloads at most four fonts, its first image in `<main>` is not lazy, and is at most 150 KB |
| | `perf-images` | error | (deep) no stored image over 1.5 MB or 2560 px wide (`IMAGE_RULES`) |
| growth | `growth-size` | warning | (deep) no collection over `growth.maxDocs` (200 000) documents or `growth.maxMB` (512, data + indexes, MongoDB) — [performance.md](./performance.md) §6 |
| | `growth-versions` | warning | (deep) no collection or global keeps versions without a limit (`maxPerDoc` / `max`: 0), none over `growth.maxVersions` (50 000) |
| | `growth-retention` | warning | (deep) a log with a retention (consent log, statistics, form submissions with `submissionRetentionDays`) holds no record older than it — its purge runs |
| | `growth-submissions` | info / warning | (deep) form submissions kept without a retention; a warning when the oldest is over `growth.submissionDays` (730) |
| | `growth-kv` | warning | (deep) at most `growth.expiredKv` (1000) expired entries in `payload-kv` |
| | `growth-media` | info / warning | (deep) media no document or global points at; a warning over `growth.orphanedMedia` (25). From the first 5000 documents |
| | `growth-versions-config` | info | a collection or global in `src/collections` / `src/globals` turns versions on without `maxPerDoc` / `max` (Payload keeps 100) — the hint names the limit to add |
| | `growth-disk` | info | `.next/cache/images` over `growth.imageCacheMB` (1024), the local `media/` over `growth.uploadsMB` (2048), on the machine the doctor runs on |
| audit | `i18n-literals` | error / warning | from `iapl-audit`: hardcoded text in blocks (error) and components (warning), Polish literals in code (not the panel's `adminText()` / `{ en, pl }` labels in a schema file — the `iapl-audit` skill) |
| | `audit:<title>` | as reported | every other `iapl-audit --quick` finding, one per file |
| live | `live-reachable`, `live-health`, `live-noindex`, `live-seo` | error / warning | the URL answers; `/api/health` 200; production not noindex (staging must be); every `iapl-seo-check` error and warning |
@@ -143,6 +174,21 @@ Turn off: `iapl({ doctor: false })`. Adapt: `iapl({ doctor: { tokenVar: 'MY_TOKE
The block rules read `blockLibraryManifest` (`@intecion/ipal-kit/blocks`), so a new library block needs no doctor
change.
### The performance rules are errors (1.18.0)
`iapl-doctor` (and `--strict`) fails on every `perf-*` finding. None of them measures time — each reads the
project's files, the home page's HTML or stored counts — so the same site gives the same answer every run. A project
that accepts one for a reason lowers or silences it in `iapl-doctor.json`, per rule:
```json
{ "rules": {
"perf-fonts": { "severity": "warning", "reason": "the client's brand font, replaced in Q1" },
"perf-embeds": { "off": true, "reason": "the map is the page's content (client decision)", "files": ["src/components/Map.tsx"] },
"perf-budgets": { "off": true, "reason": "no e2e on this site yet", "until": "2027-03-01" }
} }
```
The `growth` group stays warnings and infos.
## Adapt it — `iapl-doctor.json`
Every rule can be silenced, lowered or raised — **with a reason** — in `iapl-doctor.json` in the project root
@@ -168,6 +214,7 @@ of the two exists, `iapl-doctor.json` when both do):
|---|---|
| `domain` | the production domain (dots allowed) — the base of the database names. Without it: a non-local `NEXT_PUBLIC_SERVER_URL`, else the folder name minus `-web` |
| `launched` | the site is live: seeds must then name their records. Also true when "Project decisions" has a line with "launch" and a date |
| `growth` | thresholds of the `growth` rules: `maxDocs`, `maxMB`, `maxVersions`, `submissionDays`, `expiredKv`, `orphanedMedia`, `imageCacheMB`, `uploadsMB` ([performance.md](./performance.md) §6) |
| `layout.allow` | more top-level `src/` entries the convention allows |
| `layout.frontend` | the folder that holds the site's pages, e.g. `src/app/(site)` — only for a layout the doctor cannot tell (two route groups with pages); the route group's name is otherwise free |
| `rules.<id>` | `off` (silence), `severity` (`error` / `warning` / `info`), `reason` (**required** — an entry without one is ignored and reported), `until` (ISO date; after it the entry stops applying and the report says so), `files` (globs: only findings in those files). The id is the rule (`csp`) or an audit finding (`audit:collections-present`); `audit` covers all audit findings |
+42 -16
View File
@@ -136,10 +136,28 @@ What the site needs for it:
443, **without a redirect** — the service follows none. No basic auth, no firewall rule, no maintenance page in
front of it. (Coolify: nothing to set; the route is part of Payload's API.)
- **Outbound HTTPS** from the server to `webservices.intecion.net`.
- **A site that passes the call-back is active at once.** Waiting for approval is the exception: the service
holds a new site back when many new sites appear at once (more than a few a day from one address or domain, or
more than its daily number in all), or when Intecion has set it to approve by hand. Mail is then not sent until
Intecion approves the site; the same token works afterwards, and the panel says so.
- **A new site is connected by a person of Intecion** (contract 1.8.0 §2.1, the service's `connect` policy). It
enrols as before, then **waits** (`pending`): its mail is refused with `site-pending` (status `relay-pending`), not
sent and not kept. On Site integrations → E-mail sending, with "IWSN (built-in)" as the method, an administrator
presses **"Połącz z IWSN"** ("Connect to IWSN"). The site's **server** asks the service for a link
(`POST /v1/connect`) and the panel opens it **in a new tab** (`noopener noreferrer`). A person of Intecion signs
in there with an `@intecion.com` address (Cloudflare Access) and presses "Potwierdź". The panel asks the service
every 5 seconds for at most 10 minutes and shows "Connected to IWSN" by itself; every load of the panel asks too
while the site waits. Mail sent after that leaves; mail refused before it is not sent again.
- The link is valid 15 minutes, for one confirmation; each press makes a new one. It is opened only when it begins
with the service's own `{base}/connect?` (the plugin checks it on the server and in the browser), and it is
never stored, logged or fetched by the server.
- What the block says: **"Waiting for confirmation"** with the button (the service offers the page:
`connectAvailable`); **"waiting for approval"** with no button (no confirmation page — an operator confirms the
site); **"Connected to IWSN"**; **stopped** (suspended). A site that has not enrolled yet shows the button too:
pressing it enrols first.
- When the service has no confirmation page right now (`503 connect-unavailable`) the panel says "ask your
administrator to have the site confirmed"; more than 10 links an hour (`429`) says when to try again.
- The dashboard alert shows a waiting site; `iapl-doctor --deep` reports it as an **error** (`mail-relay-connect`).
- No token or paste field is involved. Sites on SMTP or Microsoft Graph see nothing of this.
- **Opt-out:** `mail: { relay: { connectButton: false } }` — no button and no route; the site is then confirmed by
an operator, or by the project's own button with `requestRelayConnectLink(payload)` (open the answered
`connectUrl` in a new tab; `isRelayConnectUrl(url, base)` checks it).
A site on `localhost`, on a private address or without `serverURL` is refused **by the plugin itself**, before any
call leaves the server — development machines do not contact the service. To test mail locally use SMTP (a local
@@ -191,9 +209,11 @@ is read — and is renewed after a send, once an hour; until the site has enroll
plugin has no number of its own).
**Account mail is limited by the site itself.** "Forgot password" is a visitor's lever like a form, and the
service lets account mail use the whole hour. So the relay transport holds back more than **5 account e-mails to
one address** and more than **10 asked for by one visitor** within an hour (`mail.relay.accountMail`:
`{ perAddress, perVisitor, windowMinutes }`, or `false`). A held-back message is reported as `relay-quota` in the
service lets account mail use the whole hour. So the relay transport holds back, within an hour, more than **5 account
e-mails to one address asked for by one visitor**, more than **20 to one address from everybody** and more than **10
asked for by one visitor** (`mail.relay.accountMail`: `{ perAddress, perAddressTotal, perVisitor, windowMinutes }`, or
`false`). Since 1.18.0 `perAddress` counts per visitor (the requesting IP): before, five requests from anybody used
the address's hour up, and its owner's own reset mail was held back too. A held-back message is reported as `relay-quota` in the
log and the panel; the visitor is told nothing. Pin the address header for it: `IAPL_IP_HEADER`
([security.md](./security.md)).
@@ -390,18 +410,19 @@ await runWithMailKind('account', () => sendWelcomeMails(payload, user))
Site integrations → E-mail sending starts with "How e-mails are sent" (component `MailRelayStatus` from `/admin`,
rendered by the tab's status banner — **no import-map entry of its own, so nothing to regenerate**): the
transport in effect; for the mail service the state (connected, waiting for approval, stopped, not connected and
why), the address mail leaves from, where replies go, what is left of the hour and the day, and a sender name the
transport in effect; for the mail service the state (connected, waiting for confirmation — with "Połącz z IWSN" —,
waiting for approval, stopped, not connected and why), the address mail leaves from, where replies go, what is left of the hour and the day, and a sender name the
service replaced. Buttons: **Check now**, **Connect again**, **Disconnect** — and **Enter an access key** only
with `mail.relay.accessKeyField: true` ("The token" above).
Routes (all three need the `admin` role: not logged in → 401, other role → 403; none ever answers with a token):
Routes (all four need the `admin` role: not logged in → 401, other role → 403; none ever answers with a token):
| Route | What |
|---|---|
| `GET /api/iapl/mail-relay/status` | the transport and the stored state; `?refresh=1` asks the service |
| `POST /api/iapl/mail-relay/connect` | enrol now; with `{ token }` store a token issued by hand — only with `accessKeyField: true`, otherwise `403` |
| `POST /api/iapl/mail-relay/disconnect` | give the token up |
| `POST /api/iapl/mail-relay/connect-link` | "Połącz z IWSN": asks the service for the confirmation link (`POST /v1/connect`, enrolling first when there is no token) and answers it as `connectUrl` + `expiresAt`, `Cache-Control: no-store`; nothing is stored. Admin only, from the site's own origin (`adminSameOrigin`). Absent with `connectButton: false` (`RELAY_CONNECT_LINK_PATH`) |
| `POST /api/iapl/mail-relay/confirm` | **public** — the service's call-back. `404` and no change unless the site itself started an enrolment in the last 5 minutes; **refused** calls are rate-limited (10 a minute per address, `mail.relay.confirmRateLimit`) — a call that carries the nonce is never turned away by the limit, so junk from the same address cannot keep the site from enrolling |
These are the first routes under `/api/iapl/`; the others stay under `/api/ipal/` until 2.0. The confirm path is
@@ -417,7 +438,7 @@ the service), each with a text in the editor's language:
| Code | Meaning | What to do |
|---|---|---|
| `relay-pending` | enrolled, but held for approval by Intecion — the rule while the service runs with enrolment "pending" (from its launch until Intecion switches to open enrolment), every new site waits for approval; after that the exception (many new sites at once, or approval by hand) | Intecion approves the host; nothing to do on the site |
| `relay-pending` | enrolled, waiting for confirmation by a person of Intecion (contract 1.8.0) | "Połącz z IWSN" in the panel and the confirmation on the page that opens; without the button (no confirmation page), Intecion confirms the host |
| `relay-suspended` | stopped by Intecion | contact Intecion; SMTP in the panel sends meanwhile |
| `relay-refused` | the site could not enrol; or a token issued by hand stopped working (new server address, token no longer valid) | "When the site cannot be confirmed" below; hand-issued: ask Intecion for the address to be added or for a new token |
| `relay-disconnected` | an admin pressed "Disconnect" | "Connect again", or fill in SMTP |
@@ -462,11 +483,12 @@ message); "Connect again" asks at once. Other causes: `host-not-allowed` (not a
| `otherHosts` | `'auto'` | a database that holds another host's connection. `'auto'`: a public site enrols by itself (launch, a domain move); a non-public one (`IAPL_NOINDEX=1` or `developmentHosts`) neither enrols nor sends until "Connect again". A list = those hosts are this site's own. `'wait'` = a public site without a connection of its own waits too. `'enrol'` = no rule |
| `developmentHosts` | the plugin's list: `iapl({ developmentHosts })`, default `['*.dev.netscale.pl']` (`pluginDevelopmentHosts(payload)`) | host patterns (`*` = any characters) of development, staging and preview addresses, for the mail service alone: a site on such a host is non-public for `otherHosts`, like one with `IAPL_NOINDEX=1`, with no environment variable (`siteIsNonPublic`, `siteNonPublicSignal`, `matchDevelopmentHost`, `isDevelopmentHost`). `[]` = none |
| `enrol` | `'auto'` | `'manual'`: only "Connect again" or `enrolRelay()` enrols. `false`: never (the token comes from `token` or `setRelayToken`) |
| `connectButton` | `true` | `false`: no "Połącz z IWSN" in the state block and no `connect-link` route; the site is confirmed by an operator or by the project's own code (`requestRelayConnectLink`) |
| `accessKeyField` | `false` | `true` shows "Enter an access key" in the state block and lets its route store a hand-issued token an admin pastes |
| `token` | — | a token from elsewhere (`string` or a function): the stored token is not used and the site does not enrol |
| `senderName` | panel, then site name | a fixed name, or a function |
| `kind` | — | the kind of a message nobody marked |
| `accountMail` | `{ perAddress: 5, perVisitor: 10, windowMinutes: 60 }` | the site's own limit on account mail; `false` = none |
| `accountMail` | `{ perAddress: 5, perAddressTotal: 20, perVisitor: 10, windowMinutes: 60 }` | the site's own limit on account mail: per address and visitor, per address from everybody (1.18.0), per visitor; `false` = none |
| `confirmRateLimit` | `{ max: 10, windowMs: 60000 }` | calls to the public confirm route per address |
| `totalTimeoutMs` | `10000`; `30000` with files | everything one message may take — enrolment, attempts and waits together. Somebody waits for the request that sends the mail; after it the message is reported ("not confirmed" when an attempt was cut off). A number, or `{ plain, files }` |
| `timeoutMs` | `30000` | one attempt of a send; never more than what is left of `totalTimeoutMs` |
@@ -514,7 +536,9 @@ await payload.sendEmail({ to: '[email protected]', subject: 'Hi', html: '<p>Hi</p>'
expect(relay.outbox[0]).toMatchObject({ kind: 'system', to: ['a@example.org'] })
```
- `allow` / `relay.allow(host)`: hosts that are active at once; others wait for approval. `relay.setSite(host, state)`,
- `allow` / `relay.allow(host)`: hosts that are active at once; others wait (`pending`). `connect: 'unavailable'` makes
`/v1/connect` answer `503 connect-unavailable`; `relay.confirmConnect(connectUrl)` stands in for the person who
confirms a link (true when it was the site's current one, not expired). `relay.setSite(host, state)`,
`relay.issueToken(host)`, `relay.backend = 'failure'`, `relay.intercept`, `relay.limits`, `relay.clientAddress`
arrange what a test needs; `relay.listen(port)` serves it over HTTP for a site in another process
(`allowLocalHosts: true` lets it call back `http://localhost:<port>`).
@@ -645,7 +669,8 @@ Works on any `text` field. After wiring it in a project you may need
To the mail service (when the owner says so):
1. Upgrade; check that `serverURL` is the site's public address.
2. Tell Intecion the host: while the service runs with enrolment "pending" (from its launch until Intecion switches to open enrolment), every new site waits for approval; the panel says so. Under open enrolment the site is active as soon as it enrols.
2. After the first e-mail the site waits for confirmation: press "Połącz z IWSN" in Site integrations → E-mail
sending and have a person of Intecion confirm it on the page that opens (keep Graph until then).
3. Site integrations → E-mail sending → "Sending method": choose **IWSN (built-in)** and save. Then remove the four
`GRAPH_*` variables in Coolify and redeploy.
4. Site integrations → E-mail sending → send a test e-mail: the answer says "through IWSN".
@@ -827,8 +852,9 @@ send (e.g. **Send test e-mail**) the current one appears.
## Doctor
`iapl-doctor` ([doctor.md](./doctor.md)): `mail-transport` (nothing set up; sending is failing), `mail-relay-state`
(waiting for approval, stopped, refused, disconnected, a replaced sender name), `mail-reply-address`,
`iapl-doctor` ([doctor.md](./doctor.md)): `mail-transport` (nothing set up; sending is failing), `mail-relay-connect`
(error: the method is IWSN and the site is not connected or not confirmed), `mail-relay-state` (stopped, refused,
disconnected, a held copy, a replaced sender name), `mail-reply-address`,
`mail-graph-deprecated`, `mail-relay-route` (trailing slashes, another API route, a redirect or a block in front of
the confirm route on the live site).
+2 -1
View File
@@ -113,7 +113,8 @@ finding the names it was written for. Both accept both spellings in the environm
The plugin also reads (outside the preset — add your own rules if you want to validate them):
`INDEXNOW_KEY` (seo.md), `IAPL_NOINDEX` (`1`/`true`/`yes` — staging, seo.md), `IAPL_DOCTOR_TOKEN` (≥ 32 characters —
turns `GET /api/ipal/doctor` on, doctor.md). Full table:
turns `GET /api/ipal/doctor` on, doctor.md), `CRON_SECRET` (≥ 16 characters — a cron runs Payload's job queue over
HTTP with `Authorization: Bearer <CRON_SECRET>`, security.md "Payload's job queue"). Full table:
[deployment.md](./deployment.md).
Extending with your own variables — spread:
+22 -2
View File
@@ -60,6 +60,7 @@ iapl({
| `formOverrides` / `formSubmissionOverrides` | — | collection overrides (`fields` as a function + any collection settings) |
| `emailLayout` | `false` | nice emails + the Site settings → E-mails tab |
| `beforeEmail` | — | the form-builder's `beforeEmail` (after the layout, when `emailLayout`) |
| `submissionRetentionDays` | — (kept) | 1.18.0: delete submissions older than this many days (checked at most once a day, after a new submission). Submissions are personal data — set it on the client's decision (AGENTS.md → Project decisions); the doctor's `growth-submissions` reports a site without one ([performance.md](./performance.md) §6) |
| `consentFieldName` | `'consent'` | name of the GDPR consent field for `submitForm` / `createSubmitAction` (the call's argument wins) |
`payment` is always off — `fields: { payment: true }` does **not** turn it on (the value `true`
@@ -98,6 +99,13 @@ the action to the form and the language, resolves the redirect and gives the bro
form** — the Local API reads with `overrideAccess`, so the document has the Emails tab (company addresses);
a hand-written `<FormRenderer form={form}>` used to send them in the HTML. Underneath it is `BuilderForm` (client).
**The form's code loads only on pages that show a form (1.18.0).** `RenderForm` renders a lazy `BuilderForm`, and
`BuilderForm` / `Turnstile` from `@intecion/ipal-kit/client` are the lazy wrappers (same props): the server renders the
whole form, the browser fetches the code while it hydrates — every other page carries none of it (reference site: −8.8 KB gzip with webpack, −6.1 KB with
Turbopack). The eager component, in every page's bundle: `import { BuilderForm } from
'@intecion/ipal-kit/client/eager'` and `<RenderForm Form={BuilderForm} …>`. The Turnstile widget's height is kept free
before Cloudflare draws it: `turnstileReserveHeight` (default 73, `0` for an invisible widget).
### Field types in the panel
text, email, textarea, number, **date**, **time** (1.11.1), select, **radio**, checkbox, **Checkbox group**,
message, **Step** (+ country/state as text), and **File** when `forms.attachments` is on ("Files" below).
@@ -436,6 +444,18 @@ A missing IP (the proxy strips the header, a wrong `IAPL_IP_HEADER`) does **not*
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.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
(`::ffff:1.2.3.4`) counts as its IPv4. One home network shares the budget, as an IPv4 home behind one router always
did. Change it once at start (root export): `setIpv6Grouping({ prefix: 128 })` = per address (as before);
`setIpv6Grouping({ prefix: 56 })` another network size; `setIpv6Grouping({ wide: 48, wideFactor: 10 })` adds a
second counter per /48 at 10× the limit (a hosting customer often holds a /48 — off by default, because a mobile
carrier can put many phones in one /48). A value out of range throws. `ipRateKey(ip)` gives the key a limiter of
your own should count by (`consumeRateLimit` already applies it to a key that is an IP address).
**Check:** fifty requests to a limited route with `X-Real-IP: 2001:db8:1:1::1` … `::32` → `429` after the limit.
Without a pinned header the order
`cf-connecting-ip` → `x-real-ip` → XFF stays (switching to XFF-only, from the right, would put every visitor
behind Cloudflare into the bucket of the edge node) — that is why `IAPL_IP_HEADER` is mandatory in production
@@ -547,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 "logged-in users only"; 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
@@ -861,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.<type>: 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`: logged-in users, `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.
+1
View File
@@ -38,6 +38,7 @@ and shared by the helpers (generateMetadata and the page share queries).
| `mcp` | — | `{ serverName, serverVersion, rateLimit, maxBatch, clientIp, isPathVisible }` for `mcpGET`/`mcpPOST` (mcp.md) |
| `pageJsonLd` | — | default `getPageJsonLd` options: `breadcrumbs`, `entryType`, `entries`, `faq`, `pageType` |
| `robots` | — | `RobotsOptions` for `robots` and `getRobots` (seo.md); `aiBotRules: [{ userAgent, access }]` = per-bot exceptions from code (the panel's rules come after them) |
| `draftRelations` | `'hide'` | related documents that are drafts are left out of what the helpers answer (1.18.0); `'keep'` as before (content.md "Drafts as related documents") |
| `settingsDepth` | `1` | depth of `getSettings`: Site settings relations arrive as documents, theirs as ids (the archive page is read separately at depth 2); `2` = every request pays for more |
| `siteJsonLd` | WebSite + Organization from Site settings | a function replaces it, `false` = none |
| `sitemapEntries` | — | `(entries) => entries` — final sitemap list: add URLs of your own routes, remove some, set `priority` |
+1 -1
View File
@@ -163,7 +163,7 @@ export const Pages: CollectionConfig = {
fields: [
// ...
{ name: 'slugHistory', type: 'array', admin: { readOnly: true },
fields: [{ name: 'slug', type: 'text' }] },
fields: [{ name: 'slug', type: 'text', index: true }] }, // index: asked on every unknown URL (resolveRedirect)
],
hooks: { beforeChange: [trackSlugHistoryHook] },
}
+1 -1
View File
@@ -141,7 +141,7 @@ See [proxy in this section](#proxy-formerly-middleware) below.
| Option | Default | What it does |
|---|---|---|
| `NextResponse` | — (required) | injected from `next/server` (the plugin does not import it) |
| `markdown` | off | `true` = prefix `/md`, a string = a different one; paths under the prefix pass without a redirect, `Accept: text/markdown` → rewrite (content.md) |
| `markdown` | off | `true` = prefix `/md`, a string = a different one, `{ prefix?, negotiate? }` the object form; paths under the prefix pass without a redirect, `Accept: text/markdown` → rewrite answered `private, no-store` + `Vary: Accept` (1.18.0); `negotiate: false` = no rewrite (content.md "content negotiation") |
| `exposeHeaders` | `true` | request headers `x-locale` (language from the URL or `defaultLocale`) and `x-pathname` |
| `consentCategory` | `'functional'` | consent category required to write the language cookie; `'necessary'` = always write |
| `consentCookieName` | `CONSENT_COOKIE` | consent cookie to read |
+5
View File
@@ -37,6 +37,11 @@ The state block above it reads `GET /api/iapl/mail-relay/status` and acts throug
or at most every 10 min while an error lasts; it never throws. The same change already being written (many sends
failing at once) is written once; while every transaction place of a Postgres pool is taken
([deployment.md](./deployment.md) §4.3a) the write goes on in the background instead of holding the caller.
- **The status is written alone (1.18.0).** `updateGlobal` reads the whole document, merges and writes it whole: a
status written after a visitor's form submit put back an admin's SMTP or Turnstile change saved in the same
moment. The status field is now written through the database adapter on its own (`writeGlobalFields(payload,
slug, data)`, exported): no read of the rest, no hooks, no new version (fit for bookkeeping fields only). A global
that does not exist yet is created the usual way.
- **Changing keys in the admin panel** (Turnstile, the sending method / `smtp*`) clears that integration's old status.
- **`emailStatus.code`** of a send through the Intecion mail service is one of the `relay-…` codes (`relay-pending`,
`relay-quota`, `relay-unreachable`, …), each with a text in the editor's language — the list and what to do:
+2 -1
View File
@@ -12,7 +12,8 @@ schema until you use it.
with a `srcSet` from every Payload image size.
- `RenderRichText lightbox` (`/rsc`) — click-to-enlarge for images in rich text.
- `useLightbox()` (`/client`) — open, close, next, previous for your own controls.
- `<LightboxDialog>` (`/client`) — the viewer itself, controlled, for full control.
- `<LightboxDialog>` (`/client`) — the viewer itself, controlled, for full control. Since 1.18.0 the provider loads it
the first time an image is opened (a separate chunk), so a page carries only the small provider and the triggers.
## What the visitor gets
+18 -1
View File
@@ -50,6 +50,21 @@ export const Media: CollectionConfig = {
}
```
**Metadata (1.18.0).** Every JPEG and PNG upload that passes the limits loses its metadata — camera, date, GPS
position, comments — without re-encoding: `stripImageMetadata` drops the JPEG APP1 (EXIF, XMP), APP13 (IPTC) and
comment segments and the PNG text, eXIf and tIME chunks; the pixels and the colour profile stay byte for byte. A photo
whose EXIF says "rotate" is turned once (sharp, JPEG quality 92) so it does not show sideways. Only new uploads; no
stored variants are added. Off: `buildOptimizeUploadHook({ stripMetadata: false })`. Building blocks:
`stripImageMetadata(buffer, mimeType)` → `{ buffer, changed, orientation }`, `exifOrientation(app1)`.
**Unused media in the panel (1.18.0, opt-in).** `iapl({ unusedMedia: true })` (or `{ collections: ['media'] }`) puts a
notice above the list of each upload collection: how many files no page, entry or setting uses — by id (relations,
uploads in rich text and blocks, drafts and every language) or by file name inside a text — with a link that opens
Payload's own list filtered to them. The editor checks them and deletes them there (bulk delete, with its confirmation
and access rules); nothing is deleted by itself. Editors and admins see it; on a site with more than 5000 documents it
shows only a hint to run `iapl-doctor --deep` (`growth-media`). After turning it on: `pnpm generate:importmap`
(`@intecion/ipal-kit/admin#UnusedMediaNotice`).
`buildOptimizeUploadHook` and `buildMediaPlaceholderHook` use the `sharp` passed to
`buildConfig({ sharp })` — the plugin does not import it. Postgres with migrations: new fields →
`pnpm payload migrate:create`.
@@ -132,12 +147,14 @@ export function Media({ resource, priority, className }: Props) {
}
```
**`mediaImageProps(resource, { alt?, sizes?, priority?, placeholderColor? })`** → `next/image`
**`mediaImageProps(resource, { alt?, sizes?, priority?, eager?, placeholderColor? })`** → `next/image`
props or `null` (video, PDF, a bare id, no `width`/`height`):
- `width`/`height` from the document (no layout shift), `alt` from the document (override: `alt`, `''` for decoration);
- `sizes` defaults to `'100vw'` — give the real width (`MEDIA_SIZES`);
- `priority: true` (one LCP image per page) → `loading="eager"`, `fetchPriority="high"`, `preload`
(Next 16); otherwise `loading="lazy"`;
- `eager: true` (1.18.0; above the fold but not the LCP image — a header logo) → `loading="eager"` without
`fetchPriority` or a preload, so it does not compete with the one `priority` image; the library's `<Media eager>` too;
- focal point (≠ 50/50) → `style.objectPosition`;
- `placeholder.blurDataURL` → `placeholder="blur"`;
- `placeholder.color` → `style.backgroundColor` per `placeholderColor`: `'auto'` (default — JPEG only,
+5
View File
@@ -104,6 +104,11 @@ export default createNotFoundPage(content, { load: loadNotFoundView })
```
(`fallback` with JSX → file `notFoundView.tsx`.)
**Layout shift (1.18.0: `placeholder`).** The lazy content comes after hydration, so the footer moves when it arrives
(measured on the reference site: CLS 0.32 and LCP 2.5 s on a phone, [performance.md](./performance.md)). A block as tall
as your 404 content keeps the footer still: `createNotFoundPage(content, { load, placeholder: <div style={{ minHeight: '36rem' }} /> })`.
Default: nothing, as before. A fixed one-screen block is no fix: shorter content then pulls the footer up into view.
**Why lazy:** Next puts the layout's `not-found` tree into the RSC data (`self.__next_f`) of **every** page
under it — the router needs it for a client-side 404. The immediate variant renders the 404 page from the admin panel there
in every language, so every page carries it in its HTML (404 = home page with 2 languages: home page HTML
+201
View File
@@ -0,0 +1,201 @@
# Performance — a light, fast site by default
What the plugin does for speed without any project work, what a project must still do, the budgets every site is
held to, how to measure, and how to read the doctor's findings. The agent's short version is AGENT.md §6.11b and the
`iapl-performance` skill. The measurements and the audit behind this page: [dev/perf/README.md](./dev/perf/README.md).
Related: [media.md](./media.md), [frontend.md](./frontend.md), [consent.md](./consent.md), [doctor.md](./doctor.md),
[design-tokens.md](./design-tokens.md).
Targets on the built site, a phone on a slow connection (the numbers Google uses, [web.dev/articles/vitals](https://web.dev/articles/vitals)):
**LCP < 2.5 s, CLS < 0.1, INP < 200 ms.** The reference site measures LCP 0.8 s, CLS 0–0.04 and a 32–48 ms tap
response on that profile (the 404 page is the exception, below).
## 1. What the plugin does for you
| Area | Default | Change it |
|---|---|---|
| Static pages | `createPageRoute` + `generateStaticParams` + `revalidate`: every page is prerendered (ISR); nothing in the layout reads `headers()` or `cookies()`, so the HTML is cached and the server answers in ~4 ms | your own `render`; never call `headers()` in the layout ([nextjs.org/docs/app/guides/caching](https://nextjs.org/docs/app/guides/caching)) |
| Data per render | the `lib/content` helpers cache every read per request (`getSettings`, `resolveRoute`, `generatePageMetadata`, `getSiteShell`), keyed by value; Site settings at depth 1; one Site integrations read shared by analytics and Turnstile; reads that need one field `select` it | `createContentHelpers({ settingsDepth })`; your own getters with `cache()` |
| LCP image | `<Media priority>`: `fetchpriority="high"`, `loading="eager"` and a preload; everything else lazy with `sizes` | `priority` / `eager` / `sizes` per image (`MEDIA_SIZES`) |
| Image formats | `buildImagesConfig()`: AVIF and WebP, the width the screen needs, a 31-day cache, R2 allowed | `buildImagesConfig({ … })` ([media.md](./media.md)) |
| Upload limits | `buildOptimizeUploadHook()`: images over 1.5 MB or 2560 px wide are stopped; the editor may let the plugin shrink them (WebP, metadata dropped) | `maxImageBytes`, `maxImageWidth`, `quality` |
| Upload metadata | every JPEG and PNG that passes the limits loses its metadata (camera, date, GPS, comments) without re-encoding — pixels and colour profile byte for byte; an EXIF "rotate" is applied once (JPEG q92) | `buildOptimizeUploadHook({ stripMetadata: false })`; the building block `stripImageMetadata(buffer, mime)` |
| No layout shift from images | width and height always from the document; a blur placeholder and the dominant colour (`buildMediaPlaceholderHook`) | `placeholderColor` |
| Embeds | `<YouTubeEmbed>`: a picture and a button; the iframe only after a click, from youtube-nocookie.com | `poster` |
| Client JavaScript | small client leaves; a page ships only the client components it renders (the `/client` barrels are no longer one client boundary); the lightbox viewer loads on the first open; the form engine and the Turnstile widget load only on pages that show a form (`BuilderForm` / `Turnstile` from `/client` are lazy wrappers, the server renders the whole form) — 6–9 KB gzip less JavaScript on every other page of the reference site (webpack −8.8, Turbopack −6.1) | `@intecion/ipal-kit/client/eager` → `<RenderForm Form={BuilderForm}>` |
| Turnstile | its 73 px are kept free before Cloudflare draws the widget: the form does not jump | `turnstileReserveHeight={0}` (an invisible widget) |
| Third parties before consent | none besides Google's tag in Consent Mode `advanced` (all signals denied); Meta, LinkedIn, TikTok and Clarity wait for consent; Turnstile only on a form's last step | `analytics={{ consentMode: 'basic' }}` — no request to Google before consent; `analytics={{ defer: true }}` — the tag after the first interaction |
| Fonts | the reference layout (and every new site from `iapl create`) uses `next/font` (self-hosted, `display: 'swap'`, fallback metrics against layout shift) and does not preload the heading font: the stylesheet and the hero get the first round trips (phone: first paint and LCP 36–52 ms sooner) | the project's own fonts; `preload: true` on the heading font |
| Motion | the token durations (`duration-fast`, `-base`, `-slow`) are 0 ms with `prefers-reduced-motion: reduce`; the cookie banner, its switches and the cookie button stop their transitions too; a background video (`<Media videoMode="background">`) is paused for those visitors; the card hover fades a shadow layer (`opacity`, compositor-only) instead of animating `box-shadow` | `motion-reduce:` classes; `<Media pauseForReducedMotion={false}>`; `CARD_INTERACTIVE_SHADOW_CLASS` (the 1.17 hover) |
| 404 | the lazy 404 (`createNotFoundPage({ load })`) keeps its content's height with `placeholder` — the reference site sets it (phone: CLS 0.319 → 0, LCP 2.5 → 1.9 s) | the placeholder's height follows your 404 content |
| Admin only | Payload's colour-scheme client hints only on `/admin`, so a public page is requested once | `withSecurityConfig(…, { adminClientHints: false })` |
## 2. What a project must do
Every row is something the plugin cannot decide for you. `iapl-doctor --only performance` finds most of them.
**Page loading** ([web.dev/articles/optimize-lcp](https://web.dev/articles/optimize-lcp))
- Exactly one `<Media priority>` per page: the first image a visitor sees (the library's hero does this itself via
`leadsWithImage`). A header logo is `<Media eager>` — at once, but without competing with the hero.
- Nothing render-blocking but the one stylesheet: no `<script src>` without `async` in the layout (use `next/script`
or the plugin's `ConsentScript` / `Analytics`), no stylesheet or `@import` from another host
([web.dev/articles/render-blocking-resources](https://web.dev/articles/render-blocking-resources)).
- Keep the page static: no `headers()`, `cookies()` or `searchParams` in the layout or page tree.
**Elements** ([web.dev/articles/cls](https://web.dev/articles/cls))
- Images through `Media` (dimensions, `sizes`, lazy below the fold, never lazy for the LCP image —
[web.dev/articles/lcp-lazy-loading](https://web.dev/articles/lcp-lazy-loading)).
- Content that arrives after the first paint reserves its space. The lazy 404 is the plugin's own case: the
reference `not-found.tsx` passes `placeholder: <div aria-hidden style={{ minHeight: 'max(290px, calc(212px + 11.5vw))' }} />`
— its 404 content's height, measured from 360 to 1920 px wide. Measure yours the same way when the 404 content
changes (the footer must not move when it arrives).
- Maps, videos and widgets behind a click: a picture and a button ([web.dev/articles/third-party-facades](https://web.dev/articles/third-party-facades)).
**Fonts** ([web.dev/articles/font-best-practices](https://web.dev/articles/font-best-practices),
[nextjs.org/docs/app/getting-started/fonts](https://nextjs.org/docs/app/getting-started/fonts))
- `next/font` only, at most two families, variable fonts, `subsets: ['latin', 'latin-ext']` for Polish,
`display: 'swap'`. Every subset of every family is a preloaded file: two variable families with two subsets are
four files (the reference site: 209 KB). The heading font gets `preload: false` (the starter's default): its files
still come, after the stylesheet and the hero. A third family or a second weight file is the first thing to cut.
**Animations** ([web.dev/articles/animations-guide](https://web.dev/articles/animations-guide),
[web.dev/articles/prefers-reduced-motion](https://web.dev/articles/prefers-reduced-motion))
- Only `transform` and `opacity`; never `height`, `top`, `margin`, `transition-all`.
- Reduced motion honoured: the token durations do it; anything else gets `motion-reduce:` or a media query.
- No work per `scroll` event: IntersectionObserver for "is it on screen", at most one update per frame
(`requestAnimationFrame`) for a reading position (the plugin's `TableOfContents` does this since 1.18.0).
**Resources** ([web.dev/articles/reduce-javascript-payloads-with-code-splitting](https://web.dev/articles/reduce-javascript-payloads-with-code-splitting))
- Server components by default; `'use client'` on the small interactive leaf, not the section.
- Compression on: Next compresses by itself; behind Coolify's proxy check that the HTML arrives with
`Content-Encoding` (`iapl-doctor --url` does). Next names its static files by content and serves them
`immutable` — nothing to do.
- No third-party request before consent (the consent rules, [consent.md](./consent.md)).
**Images** ([web.dev/articles/serve-images-avif-webp](https://web.dev/articles/serve-images-avif-webp),
[nextjs.org/docs/app/api-reference/components/image](https://nextjs.org/docs/app/api-reference/components/image))
- `images: buildImagesConfig()` in `next.config`; `buildOptimizeUploadHook()` and `buildMediaPlaceholderHook()` on the
media collection (the reference `Media.ts`).
- `sizes` = the width on screen (`MEDIA_SIZES.half`, `.third`, …): without it a phone downloads the full width.
- Images uploaded before the limits: `iapl-doctor --deep` counts those over 1.5 MB or 2560 px.
**Server** ([payloadcms.com/docs/queries/depth](https://payloadcms.com/docs/queries/depth),
[payloadcms.com/docs/queries/select](https://payloadcms.com/docs/queries/select))
- Read through `lib/content` (cached per request). Your own getters: `cache()` with primitive arguments — React
compares arguments by identity, so an array or an object argument never hits the cache.
- `depth` as low as the page needs; `select` when you need one field; no `findByID` in a loop.
- An index on fields you query: `index: true` on the slug (the plugin's `buildSlugField` does), on `slugHistory.slug`
(old addresses, asked on every unknown URL), on anything you filter a list by.
## 3. Budgets
The plugin's defaults (`PERF_BUDGETS` from `@intecion/ipal-kit/doctor`), per page, first visit:
| | Phone (Slow 4G, CPU 4×) | Desktop |
|---|---|---|
| LCP | 2500 ms | 1200 ms |
| CLS | 0.1 | 0.1 |
| INP (one scripted tap, Event Timing) | 200 ms | 100 ms |
| Total Blocking Time | 200 ms | 100 ms |
| JavaScript (compressed) | 250 KB | 250 KB |
| CSS (compressed) | 50 KB | 50 KB |
| Fonts | 250 KB | 250 KB |
| Requests | 40 | 50 |
| Render-blocking resources | 2 | 2 |
| Third-party origins before consent | none | none |
| Database queries per render (`SERVER_BUDGET`) | 40 | |
A project tightens them to what it measured (`perfBudgets({ mobile: { jsBytes: 200_000 } })`) in
`e2e/performance.spec.ts` (the `iapl-performance` skill's template): from then on the test fails when a change
makes a page slower. The reference site's gate (`reference/e2e/performance.spec.ts`, run by `pnpm e2e:built` with
both bundlers) holds each page type to its own numbers and counts the database queries of one render.
## 4. How to measure
- **The lab, per page** — `perf-lab.mjs` (the skill's `resources/`, the reference site's `e2e/`): Chromium with
Lighthouse's profiles (phone 412×823, Slow 4G — 150 ms, 1.6 Mbit/s — and a 4× slower CPU; desktop 1350×940,
40 ms, 10 Mbit/s), an empty cache, the median of several runs. It returns TTFB, FCP, LCP and the LCP element, CLS,
TBT, the response to one tap, script time, bytes per type, requests, render-blocking resources and third-party
origins.
- **The plugin repository** — `pnpm perf:measure --label=<name> --mongo-container=<docker name>` on the built
reference site: the lab numbers for eight page types on both profiles, the panel's sign-in page, cold start,
memory, TTFB, and the database queries of one render of each page (MongoDB's profiler; the render bypasses the ISR
cache with Next's own `x-prerender-revalidate` header). JSON in `docs/dev/perf/`.
- **The running site** — `pnpm exec iapl-doctor --url https://example.pl --only perf-live`, and PageSpeed Insights
for the field data of real visitors (28 days).
- Never measure `next dev`: it compiles on request and ships unminified code.
## 5. The doctor's findings
All in the `performance` group (`iapl-doctor --only performance`), **errors** since 1.18.0: `iapl-doctor` fails on them. None measures time, so they do not fail at random. Lower one to a warning or silence it with a reason in `iapl-doctor.json` (`"rules": { "perf-fonts": { "severity": "warning", "reason": "…" } }`, [doctor.md](./doctor.md)):
| Rule | Source | It means | Fix |
|---|---|---|---|
| `perf-images-config` | static | `next.config` has no `buildImagesConfig()` | `images: buildImagesConfig()` |
| `perf-fonts` | static | a font from Google / Typekit, `font-display: block`, `@font-face` without `font-display`, more than two families | `next/font`, `display: 'swap'`, two families |
| `perf-render-blocking` | static | a `<script src>` without `async` / `defer`, a stylesheet or `@import` from another host | `next/script`, the plugin's script components, self-host |
| `perf-embeds` | static | an `<iframe>` (map, widget) that loads with the page (YouTube is `iapl-audit`'s) | a facade (picture + button), or `loading="lazy"` below the fold |
| `perf-animations` | static | a transition of a layout property, `transition-all`, a `scroll` listener, animations with nothing for reduced motion | `transform` / `opacity`, IntersectionObserver, `motion-reduce:` |
| `perf-budgets` | static | the project runs Playwright but has no performance budget test in `e2e/` | the skill's template |
| `perf-live` | `--url` | the HTML is not compressed; blocking scripts in `<head>`; more than four preloaded fonts; the first image in `<main>` is lazy; the home HTML over 150 KB | proxy compression; `async`; fewer font files; `priority`; less data to client components |
| `perf-images` | `--deep` | images stored over 1.5 MB or 2560 px wide | re-upload prepared, or tick "Optimise large image" |
Lower or silence a finding with a reason in `iapl-doctor.json` like any other ([doctor.md](./doctor.md)); the `growth` group (below) stays warnings and infos.
## 6. What grows — keeping the site and its database small over the years
Measured on the reference site after a full test run (MongoDB; average record without indexes): a consent record
185 B, a form submission 647 B, a key-value entry 371 B, a page 9 KB. Every collection also carries 2–6 indexes.
| What | Grows with | What the plugin does (1.18.0) | What the project decides |
|---|---|---|---|
| Consent log (`consent-records`) | one record per banner choice | deleted after `retentionDays` (default 1095 — three years, the proof-of-consent period): on MongoDB by a TTL index (`iapl_ttl` on the hidden `iaplTtlFrom`, kept at the current retention at every start), also on a quiet site; everywhere also by the purge after a new record (at most once a day) | `consentLog: { retentionDays, ttlIndex: false }` |
| Statistics (`stats-visits`, opt-in) | one record per visit | deleted after `retentionDays` (default 90) since the visit's last page view: TTL index on MongoDB, the same purge | `stats: { retentionDays, ttlIndex: false }` |
| Form submissions | one per sent form (files are never stored: they go out by e-mail) | **kept** until deleted in the panel — unless `forms: { submissionRetentionDays }` is set (1.18.0), then deleted after that many days, once a day after a new submission | the retention: personal data, a client decision (AGENTS.md → Project decisions) |
| Versions and drafts | every save | the plugin turns versions on nowhere; when a project turns them on for one of the plugin's collections or globals (overrides) without a limit, it keeps 20 per document (Payload's default is 100) | your own limit wins (`max`, `maxPerDoc`); on your own collections `versions: { maxPerDoc: 20 }` (the doctor's `growth-versions-config` hint); never `0` |
| `payload-kv` | 2FA attempt counters (one per staff account), the mail service state (one per host), enrolment nonces | expired mail-service nonces are swept (at most once a day, when the next enrolment starts); counters and state are bounded by accounts and hosts | — |
| Cookie review (opt-in) | distinct cookie names | upserted by name; a cookie that disappears is marked `gone`, not deleted (the history of what the site set) | delete old `gone` rows in the panel when the client agrees |
| `payload-preferences`, `payload-locked-documents`, `payload-jobs` | panel users, open documents, queued jobs | Payload removes them with the user, on save, and on completion (`deleteJobOnComplete`); the plugin queues no jobs | — |
| Media | uploads | Payload deletes the files (and R2 objects) with the document; nothing deletes media by itself. `iapl({ unusedMedia: true })` shows above the Media list how many files no page, entry or setting uses (by id, or by file name inside a text) and links to Payload's list filtered to them; the editor checks and deletes them there | turn it on (then `pnpm generate:importmap`); the doctor's `growth-media` counts them either way |
| `.next/cache/images` | each image × width × format (AVIF + WebP) | kept 31 days per variant (`minimumCacheTTL`); Next caps nothing by size | no persistent volume on `.next` in Coolify: every deploy starts empty |
| ISR output | pages × languages | rewritten in place on each revalidation | — |
| Logs | — | the plugin writes no files; it logs to stdout (Coolify keeps the container's log) | Coolify's log retention |
**Postgres and SQLite:** the same purges (one `DELETE … WHERE created_at < …`); no TTL index and no `iaplTtlFrom`
column (no migration); the doctor reports counts but not sizes. A consent log without its migration records nothing and so never purges.
**What a project schedules:** nothing for the plugin's own logs — on MongoDB the TTL indexes delete by themselves,
elsewhere the purges run inside the site after a new record. A SQL site that gets no new consent records (or
submissions) for a long time keeps the old ones until the next one comes; the doctor's `growth-retention` rule says so. Database backups are the hosting's job (Coolify → the MongoDB resource → Backups).
**How to check:** `pnpm exec iapl-doctor --deep --only growth` (or `--url` with `IAPL_DOCTOR_TOKEN`): document
counts, sizes (MongoDB), the oldest record, versions per collection and global, expired KV entries, media no
document points at; and on the machine it runs on, the image cache and the local upload folder. Thresholds in
`iapl-doctor.json`:
```json
{ "growth": { "maxDocs": 200000, "maxMB": 512, "maxVersions": 50000, "submissionDays": 730, "expiredKv": 1000, "orphanedMedia": 25, "imageCacheMB": 1024, "uploadsMB": 2048 } }
```
| Rule | Source | It means |
|---|---|---|
| `growth-size` | deep | a collection over `maxDocs` documents or `maxMB` (data + indexes, MongoDB) |
| `growth-versions` | deep | a collection or global keeps versions without a limit, or over `maxVersions` |
| `growth-retention` | deep | a log with a retention holds records older than it: its purge has not run |
| `growth-submissions` | deep | form submissions kept without a retention (info; a warning when the oldest is over `submissionDays`) |
| `growth-kv` | deep | more than `expiredKv` expired entries in `payload-kv` |
| `growth-media` | deep | media nothing points at (info; a warning over `orphanedMedia`). Counted from the first 5000 documents |
| `growth-versions-config` | static | a collection or global of the project turns versions on without `maxPerDoc` / `max` (info: Payload keeps 100) |
| `growth-disk` | static | `.next/cache/images` over `imageCacheMB`, the local `media/` folder over `uploadsMB` (info) |
None of these rules deletes anything; the plugin never deletes media or submissions by itself.
## 7. Shared with IAWL
IAWL (the WordPress line) holds its sites to the same numbers where the measurement is the same: the Core Web Vitals
targets and lab profile, JS ≤ 250 KB, CSS ≤ 50 KB, fonts ≤ 250 KB and two families, requests ≤ 40 on the phone,
one render-blocking stylesheet, no third-party origin before consent, and the image rules (`IMAGE_RULES`): uploads
≤ 1.5 MB and ≤ 2560 px, served as AVIF / WebP in the width the screen needs, metadata dropped on conversion, one
high-priority LCP image, lazy below the fold. The database budget is per product (Payload counts MongoDB queries per
render; WordPress counts SQL queries per request).
+311 -8
View File
@@ -287,12 +287,23 @@ With a custom `adminRoute` (e.g. `/its`), use that path in `source`.
### Collecting reports
`createCspReportRoute({ onReport?, maxBytes = 16384 })` — a `POST` handler for `reportUri`. It accepts
both formats (`application/csp-report` from `report-uri`, `application/reports+json` from `report-to`),
caps the body (a larger one → `413`; since 1.17.1 the stream is read only up to `maxBytes`, also when the browser
sends no `content-length`), always answers `204`, and by default logs one `console.warn` line per violation:
`[csp] report script-src-elem blocked=https://x.example/a.js page=https://site/pl`. Read them in the
Coolify app's **Logs**. Plug `onReport` into `payload.logger`, Sentry or a database for more.
`createCspReportRoute({ onReport?, maxBytes = 16384, maxReports = 10, rateLimit })` — a `POST` handler for
`reportUri`. It accepts both formats (`application/csp-report` from `report-uri`, `application/reports+json` from
`report-to`), caps the body (a larger one → `413`; since 1.17.1 the stream is read only up to `maxBytes`, also when
the browser sends no `content-length`), always answers `204`, and by default logs one `console.warn` line per
violation: `[csp] report script-src-elem blocked=https://x.example page=/pl src=https://site/_next/a.js:3`. Read them
in the Coolify app's **Logs**. Plug `onReport` into `payload.logger`, Sentry or a database for more.
**What the default line holds (1.18.0, security audit F1).** Anyone can post a report, so its strings never reach the
log as sent: the blocked resource is reduced to its origin (`inline`, `eval` stay), the page to its path (no query — it
may hold an e-mail address), the script to origin and path; control characters and line separators are removed and
every value is cut at `CSP_LOG_VALUE_MAX` (128) — a report cannot write a forged line of its own. One request handles
at most `maxReports` (10) violations, and one client (`clientIp`, IPv6 per /64) at most 60 requests a minute
(`rateLimit: { max, windowMs }`; `false` = no limit); over it the route answers `204` and handles nothing. A project's
own `onReport` still gets every value exactly as the browser sent it — escape it before you log it, or call
`cspLogLine(violation)` for the plugin's line. **What changes for an existing site:** the log lines show origins and
paths instead of full URLs (a log parser that read full URLs must adapt), and at most 10 violations per request reach
`onReport` (was 50: `maxReports: 50` keeps it).
```ts
// app/api/csp-report/route.ts (a fixed route wins over Payload's /api/[...slug])
@@ -412,13 +423,50 @@ Changing the path makes automated scans harder, but it is NOT a safeguard.
Real panel protection:
- **2FA** for every user (enforced by the plugin — section below)
- Strong passwords
- Rate limiting on login
- Rate limiting on login — failed staff sign-ins per IP and address (`accounts.signInLimit`, 1.18.0), staff sign-in
only from the site's own origin (`accounts.signInSameOrigin`), the current password for one's own e-mail / password
change (`accounts.confirmOwnChanges`) — [access.md](./access.md)
- IP allowlist (if the panel is for the team only)
- buildSecurityHeaders (headers)
`/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.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.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
host the request came in on (`Host`, `X-Forwarded-Host`), `serverURL`, Payload's `csrf` and `cors` lists, and
`adminSameOrigin.origins`. A request with neither header (a script, `curl`, a server) passes: it rides on nobody's
cookie. The panel's own buttons are on the site's origin and are not affected. A project's own endpoint on one of
these paths is left as it is. The 2FA endpoints keep their own switch (`twoFactor.sameOrigin`).
```ts
iapl({
// adminSameOrigin: { origins: ['https://panel.example.com'] }, // the panel served from another origin
// adminSameOrigin: false, // no check (as before 1.18.0)
})
```
- **Behind a proxy that rewrites `Host`** and sends no `X-Forwarded-Host`, without `serverURL`, the site's own
panel buttons are refused. It is not silent: the first refusal of each origin is logged
(`[iapl] a panel action from origin "…" was refused … pass iapl({ adminSameOrigin: { origins: [...] } })`), and
`iapl-doctor` warns when the running config has neither `serverURL` nor `csrf` (`csrf-empty`). Set
`serverURL: process.env.NEXT_PUBLIC_SERVER_URL`.
- **Any other value** than `true`, `false` or an object with `origins` (a list of strings) stops the start.
- **Building blocks:** `requireOwnOrigin(endpoint, origins?)` for an endpoint of your own,
`guardAdminEndpoints(config, projectEndpoints, option)`, `ADMIN_POST_ENDPOINTS` (the list), and the 2FA ones:
`requestFromOwnOrigin`, `ownOrigins`, `reportRefusedOrigin(req, origins?, { what, option, docs }?)`.
- **Check:** `curl -X POST <site>/api/ipal/test-email -H 'Origin: https://other.example' -H 'Content-Type: text/plain'
-b <admin cookies> -d '{"to":"a@example.com"}'` → `403`; "Send test e-mail" in the panel still works.
## 2FA (TOTP) — ENFORCED for every user
The plugin enforces two-factor authentication (TOTP) for ALL panel users —
@@ -755,6 +803,79 @@ for p in globals/site-integrations form-submissions users; do
done
```
### Set-up confirmed by e-mail (`twoFactor.confirmByEmail`, 1.18.0)
**Why.** Inside an account's setup window the password alone used to be enough to enrol an authenticator — so
whoever learned the password (phishing, a reused password) could enrol THEIR OWN app first: they were in with full
rights, and the owner was locked out. The window opens for every existing account at the first start after an
upgrade to 1.16.6 or later, for every new account, and after every reset (security audit 2026-12, finding F0).
**What happens now (on by default):**
1. The person scans the code and types it on the setup screen (`POST /api/setup-totp`). IAPL checks the code like
the 2FA package does, but **does not turn the factor on**: it keeps the secret aside (payload-kv), sends a link
to the **account's own e-mail address**, and gives this browser a random cookie (`<cookiePrefix>-iapl-enrol`,
HttpOnly). The screen says where the link went (`p…@example.com`); after a reload a notice shows it too.
2. Opening the link (`GET /api/iapl/two-factor/confirm?u=…&t=…`) shows a page with one button — a mail scanner that
opens links changes nothing. The button posts it back.
3. The POST checks: the link's token (stored as a hash; single use; **30 minutes**), that no newer set-up replaced it,
the site's own origin, and — `sameBrowser`, on by default — the cookie of the browser that scanned the code. Then
the factor is written, **every session of the account ends**, and nobody is signed in: the person signs in again
with the password and the code.
- Until then the account stays in its setup state: nothing but the setup screen, as before. The window keeps running.
- A new set-up (scanning again) replaces a waiting one; its link stops working. At most **5 confirmation mails per
account and hour** (`429` after that).
- The link is made from Payload's `serverURL` (`NEXT_PUBLIC_SERVER_URL`), never from the request's `Host`; without
`serverURL` no link is made (logged).
- Why the same browser: someone with the password who starts a set-up gets the link sent to the OWNER, who may open
it thinking it is theirs. With `sameBrowser` that click is refused ("open this link in the browser where you scanned
the code"); the mail also says "if it was not you, do not open the link: someone knows your password".
**Notices.** The account's address gets a mail whenever its factor is turned on (with who confirmed it, when an
administrator did), changed, or removed / reset (with the administrator's address) — whatever path wrote it: the
setup screen, the package's remove and admin endpoints, IAPL's reset, the Local API. Mails never carry the secret.
They go in the language of the panel's fallback language (`i18n.fallbackLanguage`), as kind `account` (the link) or
`security-alert` (notices) through the site's mail (the mail service or SMTP, [email.md](./email.md)).
**When mail does not work** (no sending method chosen, the mail service still pending, SMTP incomplete, or no mail
transport at all) nobody is locked out, and the doctor says it loudly:
- the person's screen says the e-mail could not be sent and to ask an administrator;
- the **link is written to the server log** (one `[iapl] 2FA: … Link (valid 30 min, single use): …` line; Coolify →
Logs) — for the team that runs the site. With `sameBrowser` it still works only in the browser that scanned the
code (the person at the keyboard opens what the team reads out to them). A fresh site's first administrator, who
has no mail yet, finishes this way;
- an **administrator** who is fully signed in (password and code) opens the account page and chooses **"Confirm the
waiting set-up"** (`POST /api/iapl/two-factor/confirm-pending { userId }`; same rule as the reset: `resetAccess`,
own origin) — only after checking with the person, outside the panel, that they started it;
- `iapl-doctor --deep` (or `--url` with `IAPL_DOCTOR_TOKEN`): rule `2fa-enrolment-mail` — **error** while mail does
not work, and the number of set-ups waiting.
**What to do on a site:** make sure e-mail works BEFORE people set up two-step verification (Site integrations →
E-mail sending → "Send a test e-mail"); after an upgrade, tell the staff that the set-up now ends with a link in their
mailbox. Nothing to wire: the endpoints and hooks come with `twoFactor`, the import map does not change.
**Options** — `twoFactor.confirmByEmail`:
| Option | Default | Role |
|---|---|---|
| (the whole) | on | `false` = the 2FA package's behaviour: the code alone turns the factor on (no link, no notices) |
| `linkMinutes` | `30` | how long a link works (1–1440) |
| `sameBrowser` | `true` | the link works only in the browser that scanned the code; `false` = any browser (weaker: the owner can confirm an attacker's set-up by clicking) |
| `adminConfirm` | `true` | an administrator can confirm a waiting set-up from the account page |
| `logLinkWhenMailFails` | `true` | write the link to the server log when the mail cannot be sent |
| `notices` | `true` | notice mails on enrolment, change, removal / reset |
| `maxMailsPerHour` | `5` | confirmation mails per account and hour |
A value that is not understood stops the start (like every switch since 1.17.1). **Building blocks** (exported):
`startEnrolment`, `buildEnrolmentEndpoints`, `buildTotpNoticeHooks`, `sendTwoFactorNotice`, `verifyTotpCode`,
`readPendingEnrolment`, `pendingEnrolmentInfo`, `dropPendingEnrolment`, `countPendingEnrolments`,
`pendingEnrolmentKey`, `mailConfigured`, `resolveConfirmByEmail`, `ENROL_CONFIRM_PATH`, `ENROL_ADMIN_CONFIRM_PATH`.
**Verify:** a new editor signs in, scans the code → the screen says "we sent a link to e…@…" and
`curl -s -o /dev/null -w '%{http_code}' -b <its cookies> <site>/api/globals/site-integrations` is still `403`; the
mail arrives; opened in another browser it answers "open this link in the browser where you scanned the code"; in the
same browser → "Two-step verification is on", then sign-in with password and code works and the mailbox has the
"turned on" notice. The built reference site runs this in `e2e/two-factor-enrolment.spec.ts` (`pnpm e2e:built`).
### Import map (required)
The 2FA screens and the redirect to them are admin components. After adding `twoFactor`, and after every
@@ -1197,6 +1318,176 @@ 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.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.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 <CRON_SECRET>`**
(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.
**A project with jobs keeps its cron working** — check which of these it uses:
- jobs run **in-process** (`jobs.autoRun`, `pnpm payload jobs:run`, `payload.jobs.run()` in code): nothing changes;
- a **Coolify scheduled task** (or any cron) that calls the run route: set `CRON_SECRET` in the app's environment and
in the task, and send the header —
`curl -fsS -H "Authorization: Bearer $CRON_SECRET" "$NEXT_PUBLIC_SERVER_URL/api/payload-jobs/run"`;
- a cron that signs in with an **admin's API key**: works as before; with a **non-admin** account's key: switch to
`CRON_SECRET`, or write your own rule;
- the project's **own** `jobs.access.run`: always wins, nothing changes.
At start, when the queue is on, the rule is iapl's and `CRON_SECRET` is missing or short, the log says so in one
line. Overrides: `iapl({ jobsRunAccess: false })` keeps Payload's default; `{ secretVar: 'MY_VAR' }` reads another
variable; `jobsRunAccess()` is exported to reuse in a rule of your own. Verify: without the header
`/api/payload-jobs/run` answers 401, with it 200 (the closed-doors spec does both on the built reference site).
## Visitor accounts (customers, members) and Payload's default write rules
Payload fills every missing access rule with **"any signed-in account"** — an account of a visitor login collection
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.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
gets 403 on every write door.
## Lists and sorting (`listLimit`, `refuseOperatorSort`, `lockedDocuments`, 1.18.0)
Three defaults for what a caller from outside (REST, GraphQL) may ask of a collection. The Local API — the frontend,
seeds, the project's own code (`req.payloadAPI === 'local'`) — is never touched, and neither is a read with
`overrideAccess: true` that server code makes while it passes an outside request on (`payload.find({ req,
overrideAccess: true })`, e.g. the cookie scanner's scheduled crawl, which has no account): it is the server's own read,
not the caller's. A read with `overrideAccess: false` and the caller's `req` is the caller's and is capped.
- **`listLimit` (security audit F4).** A list (`find`, versions, distinct values) asked by a caller that is not staff
gets at most **100** documents per request; `pagination=false` and `limit=0` become one page of 100. Before, one
anonymous `GET /api/posts?limit=100000&depth=10` read a whole collection with its relations. Staff accounts (any
role) are not capped — the panel asks for at most 100 per page itself. Adapt: `listLimit: { max: 250 }`,
`{ exclude: ['products'] }` (that collection as Payload has it), `{ staff: true }` (staff capped too);
`listLimit: false` = Payload's behaviour. **What changes for an existing site:** a client-side script that reads more
than 100 documents anonymously over REST or GraphQL now gets the first 100 and `hasNextPage: true` — page through
(`page=2`) or raise `max`.
- **`refuseOperatorSort` (security audit F5).** A `sort` that names a database operator (`?sort=$where`, `-$natural`,
`title.$ne`) answers **400** "This sort field is not allowed." for everyone, staff too — before, MongoDB got it and
the request ended in a 500 with a stack trace in the log. The refusal is logged as one `info` line
(`RefusedSortError`; `loggingLevels: { RefusedSortError: false }` in the Payload config hides it). A field name sorts
as before. `refuseOperatorSort: false` = Payload's behaviour. Reported upstream to Payload (the MongoDB adapter).
- **`lockedDocuments`.** Payload's document locks ("who edits what", `payload-locked-documents`) run on Payload's
default — any signed-in account — so a visitor account (a shop's customer) could read who edits which document and
write or delete locks. Since 1.18.0 they are for staff accounts only, with the second factor when 2FA is on
(`staffOnlyLocks`). The panel works as before. Payload adds this collection after every plugin has run, so the
rule is set on the live config (at start and after a dev reload). Your own rule per operation:
`lockedDocuments: { access: { read: myRule } }` (the others stay staff only); `lockedDocuments: false` = Payload's
default.
Both hooks are added to every collection in the config when iapl runs — the project's, the plugin's and those of
plugins listed before iapl. A collection a plugin listed **after** iapl adds has neither: put
`buildQueryGuardHook({ listLimit, refuseOperatorSort })` into its `hooks.beforeOperation`, or list iapl last.
Exported: `buildQueryGuardHook`, `applyQueryGuard`, `capListLimit`, `isOperatorSort`, `isStaffRequest`,
`isQueryGuardHook` / `QUERY_GUARD_MARK` (to tell the hook apart when you count a collection's hooks),
`RefusedSortError`, `DEFAULT_LIST_LIMIT`, `applyLockedDocumentsAccess`, `staffOnlyLocks`, `LOCKED_DOCUMENTS_SLUG`.
Verify: `curl -s 'https://<domain>/api/pages?limit=100000' | jq .limit` → `100`;
`curl -s -o /dev/null -w '%{http_code}' 'https://<domain>/api/pages?sort=%24where'` → `400`; the closed-doors spec's
customer gets 403 on `/api/payload-locked-documents`; `iapl-doctor --url … --only live-probes` passes
`unbounded-list` and `sort-operator`.
## Addresses rendered into `href` (`buildUrlField`, 1.18.0)
A text field whose value goes into `<a href>` (a social profile, a website, a map link) must refuse `javascript:`,
`data:` and `vbscript:` — an editor's link would otherwise run script as whoever clicks it on the public site, an
admin included (security audit F2: the reference site's Company → Profiles was a plain text field).
`buildUrlField({ name?, label?, required?, schemes?, description?, overrides? })` is that field: `https://` and
`http://` pass, plus the kinds you list in `schemes` (`mailto`, `tel`, `sms`, `hash`, `relative`); protocol-relative
`//host` never passes. `isAllowedUrl(value, schemes)` is the same check for your own code. Render the stored value
through `safeHref()` as well — an import, a seed or an older version may hold anything. The reference site and every
new site from `iapl create` use both (`src/globals/Company.ts`, `Footer.tsx`, the `sameAs` of the JSON-LD).
**For an existing site:** nothing changes by itself; replace `{ name: 'url', type: 'text' }` in your own globals with
`buildUrlField()` (no schema change: still a text column) and wrap the render in `safeHref`. Verify: entering
`javascript:alert(1)` in the field shows "Enter a full address" and nothing is saved.
## Access callbacks (`cookieScanner.access`, the doctor's `access`)
A project's callback says who may use the cookie scanner's endpoints or read the doctor's status. **Since 1.18.0 only
a literal `true` allows** — like `twoFactor.requireSetup.resetAccess` already did. A callback that returns
`req.user` (an account object), `1`, `'yes'`, `{}` or a Promise it did not await now **refuses** the request; before
1.18.0 any truthy answer let it in. The first answer that is not a boolean is reported once per option in the server
log, with the fix:
`[iapl] cookieScanner.access returned an object, not true or false, so the request was refused (only true allows since 1.18.0). Return a boolean, e.g. ({ req }) => Boolean(req.user) …`.
Return a boolean: `({ req }) => Boolean(req.user)`, `({ req }) => isAdmin(req.user, req.payload)`; an `async`
callback is awaited, so `async ({ req }) => true` works. A project that needs the old reading back:
`iapl({ strictAccessAnswers: false })` — any truthy answer allows again (still reported once). One function reads
every answer: `accessAllowed(option, answer, { strict })`, and `strictAccessAnswers(req)` tells which reading the
request's config uses (both exported). The second factor is checked before the callback, as before. **Verify:** call
the doctor status (`GET /api/ipal/doctor` as an admin with its code) with a callback that returns `req.user`: `403` and
one `[iapl] doctor.access returned an object …` line; with `Boolean(req.user)`: `200`.
## Threat list (security audit 2026-12)
What most often hits Payload / Next.js / Node sites, ranked by how often it appeared in the advisories of the last three
years (Dec 2023 – Dec 2026: 71 for `next`, 9 for React Server Components, 58 for `payload` / `@payloadcms/*`, 147 in the
usual transitive dependencies; GitHub Security Advisories, NVD) and by what it costs a client site. OWASP Top 10:2025
and ASVS 5.0 name the categories. Each row says where IAPL covers it and which suite checks it.
| # | Class | Seen in | IAPL covers it with | Checked by |
|---|---|---|---|---|
| 1 | Denial of service (body size, ReDoS, Server Actions, image optimizer, unbounded lists, GraphQL) | 27 core + 46 deps; Next GHSA-p3m5-59mp-jv5r (Server Actions, Oct 2026) | body caps on every public plugin route (`readCappedBody`), MCP batch cap, rate limits; Payload `maxDepth`; public lists capped at 100 (`listLimit`, audit F4, 1.18.0) | probes `body-size`, `unbounded-list`; per-class tests |
| 2 | Access control (REST / GraphQL / Local API `overrideAccess`, drafts, versions, field access) | 17 Payload (A01) | account rules, `readPublished`, 2FA wrapper, jobs rule, `visitor-writes` | closed-doors spec, `routes:check`, probes `rest-where`, `graphql`; rules `code-override-access`, `code-local-api-user` |
| 3 | Cache poisoning and cross-user leaks (ISR, RSC, CDN, host headers) | 18 Next (CVE-2024-46982 …) | no host header read for URLs (`NEXT_PUBLIC_SERVER_URL`), `no-store` on personal answers; the negotiated Markdown at an HTML URL is `private, no-store` + `Vary: Accept` (audit F3, 1.18.0) | probes `host-header`, `markdown-vary`, `rsc-vary` |
| 4 | Remote code execution (RSC Flight, `use cache`, image optimizer + libvips/librsvg) | 10 core (React2Shell CVE-2025-55182, GHSA-2464-fhr4-w9xw, GHSA-673q-mjm6-r5xr, GHSA-xqc2-xf4c-x3h3) | minimum Next / sharp in AGENT.md §4; no `eval` | `deps-audit`, `code-eval` |
| 5 | Information disclosure (errors, source maps, secrets in bundles and files) | 14 core | no stack traces in plugin answers, write-only secrets, no manifest in `.next/static` | probes `error-leak`, `bundle-secrets`, `secret-files`; rule `code-public-secret` |
| 6 | SSRF (Server Actions Host header, middleware redirects, image optimizer, URL uploads) | 9 core (CVE-2024-34351, CVE-2025-57822) | `buildImagesConfig` (listed hosts only), `safeFetch` for brand images, the crawl only of the site's own URL | probe `image-optimizer`; rule `code-ssrf` |
| 7 | Authentication and session (JWT after logout, fixation, 2FA bypass, enumeration, CSRF) | 8 + 3 (CVE-2025-4643, CVE-2025-4644) | 2FA enforced and wrapped around plugin entities, own-origin checks, `serverURL` for Payload's CSRF list, verify limit | spec "attack probes with a session" (CSRF, cookie flags), 2FA specs |
| 8 | XSS (rich text, links, JSON-LD, SVG uploads, `dangerouslySetInnerHTML`) | 7 core + 39 deps (dompurify, sanitize-html) | `RenderRichText` / `safeHref` drop `javascript:`, `buildUrlField` refuses it on save (audit F2), `JsonLdGraph` escapes `<`, upload CSP `sandbox`, CSP | per-class tests; rule `code-inner-html`; `config-dangerous` (`dangerouslyAllowSVG`) |
| 9 | Middleware / proxy bypass (`x-middleware-subrequest`, path normalisation) | 7 Next (CVE-2025-29927) | the plugin makes NO access decision in the proxy (locale and CSP nonce only); matcher ends at `/` | probe `middleware-subrequest`; doctor `proxy-matcher` |
| 10 | Injection (NoSQL operators, `$where`, SQL in raw queries, CRLF, logs) | 5 Payload + 16 deps (mongoose CVE-2024-53900, CVE-2025-23061) | no `where` from request input in plugin routes; typed values in queries; operator names in `sort` refused (`refuseOperatorSort`, audit F5); CSP report log lines normalised and capped (audit F1); both 1.18.0 | probes `login-operators`, `sort-operator`; rule `code-raw-where`; per-class tests |
| 11 | Supply chain (npm worms: Shai-Hulud 2025, chalk/debug 2025, Mini Shai-Hulud 2026) | 13 incidents | exact pins of the plugin's own deps, lockfile, `pnpm.overrides` advice (AGENT.md §4 item 12) | `deps-audit` (doctor), `pnpm security:gate` |
| 12 | Open redirect | 1 Payload | `safeAdminBack`, `adminPathFromReferer`, locale redirect keeps the host | probe `open-redirect`; rule `code-open-redirect` |
| 13 | Security headers and CSP | — (misconfiguration, A02) | `buildSecurityHeaders`, `buildCsp`, `withSecurityConfig` | probe `headers-everywhere`; doctor `security-headers`, `csp`, `config-dangerous` |
## Security suites
Four suites, each runnable by a project on its own site. The plugin repository runs all of them before a release.
| Suite | In a project | In the plugin repository |
|---|---|---|
| **Static rules** over the project's own code and config | `pnpm exec iapl-doctor --only security` (rules `code-patterns`, `config-dangerous`) | `test/securityPatterns.test.ts`: every hit in `src/`, `bin/`, `scripts/` and the reference site must be judged in `test/security-patterns.allow.json` (one reason per file and rule; a new place or a higher count fails) |
| **Per-class tests** of the building blocks | — (the plugin's own) | `test/securityClasses.test.ts`: XSS payloads into JSON-LD, first-paint scripts, links, rich text, sitemap; open redirects; prototype pollution; log injection; body and batch caps; cache poisoning |
| **HTTP attack probes** against a running site | live: `pnpm exec iapl-doctor --url https://<domain> --only live-probes` (changes nothing); local / staging: `.agents/skills/iapl-audit/resources/attack-probes.spec.template.ts` → `tests/attack-probes.spec.ts` | `reference/e2e/attack-probes.spec.ts` in `pnpm e2e:built`, after a webpack and a Turbopack production build, beside the closed-doors spec |
| **Dependency audit** | the doctor's `deps-audit` (`pnpm audit --prod`, error on high / critical) | `pnpm security:gate` (also in `prepublishOnly`): `pnpm audit` with no moderate, high or critical advisory in the production tree and the dev tooling (lows reported; `--audit-level high` = only high / critical fail, `--audit-level low` = lows too, `--prod-only` = the dev tooling only reported), then the two vitest suites; `--zap <url>` adds an OWASP ZAP baseline scan when the image `ghcr.io/zaproxy/zaproxy:stable` is already on the machine (offline; never pulled by the script) |
**Static rules** (`code-*`, one finding per rule and file, seeds / migrations / scripts / tests left out where the
rule is about requests):
| Rule | Severity | Finds |
|---|---|---|
| `code-inner-html` | error | `dangerouslySetInnerHTML` / `innerHTML` / `insertAdjacentHTML` / `document.write` with a value no sanitizer passed; JSON in a `<script>` without `.replace(/</g, '\\u003c')` (use `JsonLdGraph`) |
| `code-eval` | error | `eval`, `new Function`, `vm.run*`, `setTimeout("…")` |
| `code-shell` | error (warning offline) | `exec` / `execSync` with a template string |
| `code-public-secret` | error | a `NEXT_PUBLIC_…SECRET / PASSWORD / TOKEN / PRIVATE / DATABASE…` name; a server secret read in a `'use client'` file |
| `code-override-access` | warning | `overrideAccess: true` in code a request reaches |
| `code-local-api-user` | warning | `payload.find({ user })` without `overrideAccess: false` — Payload then IGNORES the user's rules |
| `code-raw-where` | error | `where:` taken from `req.query`, a body, `searchParams` or `JSON.parse` |
| `code-open-redirect` | warning | `redirect()` / `NextResponse.redirect()` to an address from the request (`?next=`, `?redirect=`) |
| `code-ssrf` | warning | a server-side `fetch()` of an address from the request |
| `config-dangerous` | error / warning | `dangerouslyAllowSVG` without `contentSecurityPolicy`, `remotePatterns` `**`, `serverActions.allowedOrigins` `*`, public source maps; `cors: '*'`, `debug: true`, GraphQL introspection or playground on in production, `maxDepth` above 20 |
A place that is correct on purpose: `// iapl-security-ok: <why>` on the same line or the line above. A whole file or
folder: `iapl-doctor.json` → `"rules": { "code-override-access": { "files": ["src/lib/admin/**"], "off": true, "reason": "…" } }`.
Verify: add `eval(x)` to a page and `pnpm exec iapl-doctor --only code-patterns` reports `code-eval` with the line.
**Attack probes** (`ATTACK_PROBES` in `@intecion/ipal-kit/doctor`; each answers on status codes and headers, a 500 is
never "closed"): `secret-files`, `bundle-secrets` (with the spec: also the site's own secret values), `middleware-subrequest`,
`open-redirect`, `host-header`, `markdown-vary`, `rsc-vary`, `login-operators`, `sort-operator`, `rest-where`, `graphql`,
`error-leak`, `unbounded-list`, `image-optimizer`, `headers-everywhere`, `methods`, `body-size` (spec only: 8 MB
bodies). The spec adds, with a signed-in editor: the session cookie is `HttpOnly` and `SameSite`, and from another
origin the same cookie neither reads `/api/users/me`, writes a global, nor runs a GraphQL mutation. A probe tied to an
open audit finding carries `finding` and is expected to fail (`test.fail`) until the fix lands; every finding of the
2026-12 audit is fixed in 1.18.0, so none carries it now. Your own probe: an object `{ id, class, title, live, run(ctx) }`
in the template's `EXTRA`. Verify: run the doctor with `--url` against `pnpm start` of a fresh starter site — no
`live-probes` finding. A site that turned a fix off (`listLimit: false`, `refuseOperatorSort: false`,
`markdown: { negotiate }` with a proxy of its own) gets that probe's finding back: silence it in `iapl-doctor.json`
with the reason.
## Turn off, override, extend
- **Stored secrets:** `secrets: { writeOnly: false }`, `secrets: { reenterOnChange: false }`; `writeOnlySecret` /
@@ -1215,6 +1506,15 @@ the first step of `pnpm e2e:built`; the test fixtures are switched off for it.
`safeAdminBack`, `wrapTotpViews`, `copyViews`, `changedViewKeys`, `SAFE_TOTP_VIEW`, `SafeTotpView` are exported.
The stale import-map notice that comes with it: `twoFactor.importMapCheck: false`; its parts
(`findImportMapFile`, `missingImportMapEntries`) are exported too.
- **Lists and sorting:** `listLimit: false` or `{ max, staff, exclude }`; `refuseOperatorSort: false`;
`lockedDocuments: false` or `{ access }`; the hooks and rules above for collections added after iapl.
- **Markdown negotiation:** `createProxy(…, { markdown: { negotiate: false } })` (Markdown only at `/md/…`);
`MARKDOWN_NEGOTIATED_HEADER`, `NEGOTIATED_CACHE_CONTROL`, `appendVary` for your own proxy ([content.md](./content.md)).
- **CSP report log:** `createCspReportRoute({ maxReports, rateLimit: false | { max, windowMs }, onReport })`;
`cspLogLine` for the plugin's line in your own sink.
- **Addresses in `href`:** `buildUrlField({ schemes, overrides })`, `isAllowedUrl`, `safeHref`.
- **Set-up confirmed by e-mail:** `twoFactor.confirmByEmail: false` (off), or `{ linkMinutes, sameBrowser, adminConfirm,
logLinkWhenMailFails, notices, maxMailsPerHour }`; the building blocks above.
- **Setup required:** `twoFactor.requireSetup: false` (off), `{ windowHours }` (another window, `false` / `0` = none),
`{ exempt }` (a service account), `{ dashboardNotice: false }`, `{ statusField: false }`, `{ setupNotice: false }`,
`twoFactor.resetAccess` (who reopens); exported: `twoFactorSetupState`, `twoFactorSetupDeadline`,
@@ -1231,7 +1531,7 @@ the first step of `pnpm e2e:built`; the test fixtures are switched off for it.
2FA — `twoFactor: false` (discouraged).
- **Override:** `additional` (the same key overrides the plugin's header and the `csp` ones),
`buildCsp({ extra, override, mode, strictDynamic })`, `buildAdminCsp({ extra, override })`,
`createCspReportRoute({ onReport, maxBytes })`;
`createCspReportRoute({ onReport, maxBytes, maxReports, rateLimit })`;
2FA — `collectionSlug`, `allowCollectionMismatch`, your own TOTP options by wrapping `plugin`,
`provider` (your own redirect component, or `false` for the package's);
access — `access.authAccess`, `access.firstUserAdmin`, `globalOverrides` ([access.md](./access.md)).
@@ -1239,6 +1539,9 @@ the first step of `pnpm e2e:built`; the test fixtures are switched off for it.
`buildCsp` / `buildCspHeaders` / `buildReportingEndpoints` / `cspHeaderKey` /
`parseCspReports` / `createCspNonce` (`CSP_NONCE_HEADER`, `DEFAULT_CSP_REPORT_GROUP`) for your own proxy
or collector; `buildUploadSecurityHeaders({ collections })` for your own upload collections.
- **Security suites:** `iapl-doctor --skip code-patterns,config-dangerous,live-probes`, or one rule per file / folder in
`iapl-doctor.json`; the building blocks `ATTACK_PROBES`, `runAttackProbes`, `createProbeContext`, `scanCode`,
`scanConfigs` (`@intecion/ipal-kit/doctor`) for your own CI.
- **Check:** `curl -sI https://domain/pl | grep -iE "strict-transport|x-frame|referrer|permissions|cross-origin|content-security|x-powered-by"`
(no `x-powered-by`; `content-security-policy-report-only` while rolling out);
on staging also `x-robots-tag`; startup with a wrong `twoFactor.collectionSlug` fails with `[iapl] twoFactor…`.
+2 -1
View File
@@ -43,6 +43,7 @@ iapl({
| Option (`StatsOptions`) | Default | Description |
|---|---|---|
| `retentionDays` | `90` | older visits (by `lastAt`) are deleted |
| `ttlIndex` | `true` | 1.18.0, MongoDB: a TTL index deletes visits whose last page view is older than `retentionDays`, also on a quiet site; `false` drops it at the next start. Postgres / SQLite: not used |
| `timeZone` | `'Europe/Warsaw'` | day boundary (`day` field, salt rotation, charts) |
| `dashboard` | `true` | `false` removes only `StatsWidget` from the dashboard — the view and the nav link stay |
| `collectionOverrides` | none | changes `stats-visits`: an object merges `access` / `admin` / `hooks` key by key (your keys win), a function `(collection) => collection` takes over (keep the slug). Its `access.read` also decides who sees the stats view and the dashboard chart |
@@ -124,7 +125,7 @@ A sequence of page views with gaps under 30 minutes, within one day. A server re
instances (each has its own salt) can split an ongoing visit in two — irrelevant for statistics. Do
**not** store the salt in the database to "fix" this: then yesterday's hashes could be reversed to IPs.
Visits older than `retentionDays` are deleted automatically — at most once a day per server process,
On MongoDB a TTL index deletes them by itself (`ttlIndex`, 1.18.0). Everywhere, visits older than `retentionDays` are also deleted — at most once a day per server process,
on a page view, with one `db.deleteMany` query **in the background** (the page view does not wait for
the cleanup; an error goes to the log and the cleanup is retried on the next page view). The salt
changes when `day` changes in the `timeZone` zone.
+5
View File
@@ -231,6 +231,11 @@ provider: change its `resetSignal` prop to get the same.
| `onToken` | `(token: string \| null) => void` | — | token once solved; `null` on expiry / error / theme change |
| `theme` | `'page' \| 'auto' \| 'light' \| 'dark'` | `'page'` | `'page'` = the site's theme (`data-theme`, ThemeScript), no theme → `'auto'` |
| `resetSignal` | `number` | `0` | change the value → the widget issues a new token (what `reset()` does for the provider's widget) |
| `reserveHeight` | `number` | `73` | 1.18.0: the widget's height kept free before Cloudflare draws it (the form below does not jump); `0` for an invisible widget. Through a form: `turnstileReserveHeight` on `RenderForm` / `BuilderForm`, `TurnstileWidget({ reserveHeight })` |
`<Turnstile>` from `@intecion/ipal-kit/client` is a lazy wrapper since 1.18.0 (same props): the widget's code loads
where a form shows it, not with every page; the provider in the layout loads it the same way. The eager component:
`@intecion/ipal-kit/client/eager`.
### Why Turnstile is NOT fully "drop in and forget" like CookieBanner
+17 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@intecion/ipal-kit",
"version": "1.17.1",
"version": "1.18.0",
"description": "Intecion Advanced Payload Library — a Payload CMS 3 plugin: i18n, SEO, forms, consent, analytics, blog/archives.",
"license": "MIT",
"repository": {
@@ -19,6 +19,11 @@
"types": "./dist/exports/client.d.ts",
"default": "./dist/exports/client.js"
},
"./client/eager": {
"import": "./dist/exports/client-eager.js",
"types": "./dist/exports/client-eager.d.ts",
"default": "./dist/exports/client-eager.js"
},
"./rsc": {
"import": "./dist/exports/rsc.js",
"types": "./dist/exports/rsc.d.ts",
@@ -118,19 +123,21 @@
"cookie-db:refresh": "node scripts/refresh-cookie-database.mjs",
"copyfiles": "copyfiles -u 1 \"src/**/*.{html,css,scss,ttf,woff,woff2,eot,svg,jpg,png,json}\" dist/",
"dev": "next dev dev --turbo",
"e2e:built": "node scripts/e2e-built.mjs",
"legacy:site": "node scripts/legacy-site-check.mjs",
"dev:generate-importmap": "pnpm dev:payload generate:importmap",
"dev:generate-types": "pnpm dev:payload generate:types",
"dev:payload": "cross-env PAYLOAD_CONFIG_PATH=./dev/payload.config.ts payload",
"e2e:built": "node scripts/e2e-built.mjs",
"generate:importmap": "pnpm dev:generate-importmap",
"generate:types": "pnpm dev:generate-types",
"legacy:site": "node scripts/legacy-site-check.mjs",
"lint": "eslint ./src ./test",
"lint:fix": "eslint ./src ./test --fix",
"perf:measure": "node scripts/perf-measure.mjs",
"prepare": "pnpm build",
"prepublishOnly": "pnpm clean && pnpm build && pnpm build:starter && pnpm test:int && pnpm starter:gate",
"prepublishOnly": "pnpm clean && pnpm build && pnpm build:starter && pnpm test:int && pnpm starter:gate && pnpm security:gate",
"reference:index": "node scripts/reference-index.mjs",
"routes:check": "node scripts/routes-check.mjs",
"security:gate": "node scripts/security-gate.mjs",
"starter:gate": "node scripts/starter-gate.mjs",
"test": "pnpm test:int && pnpm test:e2e",
"test:e2e": "playwright test",
@@ -217,13 +224,18 @@
"overrides": {
"baseline-browser-mapping@<2.11.0": "^2.11.0",
"browserslist@<4.28.7": "^4.28.7",
"cross-spawn@>=7 <7.1.0": "^7.1.2",
"dompurify@<3.4.17": "^3.4.17",
"esbuild@<0.25.0": "^0.25.12",
"eslint@>=9 <9.39.4": "^9.39.4",
"fast-copy@<3.1.0": "^3.1.0",
"fast-uri@<3.1.9": "^3.1.9",
"happy-dom@<21.0.4": "^21.0.4",
"js-yaml@>=4 <4.3.2": "^4.3.2",
"minimatch@>=7 <11.0.8": "^11.0.10",
"source-map-js@<1.2.2": "^1.2.2",
"undici@>=7 <7.30.1": "^7.30.1"
"undici@>=7 <7.30.1": "^7.30.1",
"ws@>=8 <8.23.0": "^8.23.0"
}
},
"peerDependenciesMeta": {
+211 -573
View File
File diff suppressed because it is too large Load Diff
+18 -1
View File
@@ -42,6 +42,13 @@ classes (warnings), `styles.css` without `@intecion/ipal-kit/tokens.css` (warnin
next/font in `--font-body` with the preset (warning), and with `src/design/tokens.ts`: no `DESIGN.md` (warning) and
`iapl-tokens --check` — a stale `src/design/tokens.css` or a WCAG AA contrast failure is an error.
## Speed (AGENT.md §6.11b, docs/performance.md)
The full run (not `--quick`) lists the doctor's `performance` group as errors (since 1.18.0; a rule the project lowered in `iapl-doctor.json` shows as a warning): `next.config` without
`buildImagesConfig()`, fonts from Google or with `display: 'block'`, more than two families, a blocking `<script src>`
or a remote stylesheet, an `<iframe>` that loads with the page, transitions of layout properties, `transition-all`,
`scroll` listeners, animations with nothing for reduced motion. The `iapl-performance` skill measures the built site and
adds the budget test.
## iapl-audit and iapl-doctor
`iapl-audit` checks the **code** inside the edit loop (and tsc + build). `pnpm exec iapl-doctor` checks the **site**
against the team standard: it runs this script (`--quick`) from the installed package, reports its findings under its
@@ -58,6 +65,15 @@ names, env, admin, AGENTS.md, skills, seeds and — with `--url` / `--deep` —
`pnpm payload run tests/routes.ts` fails on a route nobody has judged). A new custom endpoint, collection or
route file of the project = a new snapshot entry with its reason, and a door in `DOORS` if it must stay closed.
- **Attack probes and static security rules** (security.md "Security suites"): `resources/attack-probes.spec.template.ts`
→ `tests/attack-probes.spec.ts`, run on a production build or staging (`BASE_URL=… PAGE=/pl pnpm exec playwright test
tests/attack-probes.spec.ts`): the plugin's ATTACK_PROBES, plus the project's own in `EXTRA` for every custom
endpoint. On the live site: `pnpm exec iapl-doctor --url https://<domain> --only live-probes`. The code side:
`pnpm exec iapl-doctor --only security` (`code-patterns`, `config-dangerous`); a correct place gets
`// iapl-security-ok: <why>`. Dependencies: `pnpm audit --prod` (the doctor's `deps-audit`) — no high or critical.
Every address field rendered into `href` (social profiles, a website) is `buildUrlField()` and rendered through
`safeHref()` (security.md "Addresses rendered into `href`"); the static rules do not flag an `href` from data.
- **Editor test** (AGENT.md §11): every text, image, button, section,
menu, footer and SEO field can be changed in the panel, in every language.
- **Cookie consent:** in Network, before accepting, there are no requests to
@@ -78,7 +94,8 @@ names, env, admin, AGENTS.md, skills, seeds and — with `--url` / `--deep` —
- **Drafts and locales over the API** (a collection with `versions: { drafts: true }`): without a session,
`curl -s "$U/api/<slug>?draft=true&limit=100" | grep -c '"_status":"draft"'` → `0`, else ERROR: give it
`access: { read: readPublished(), readVersions: readPublished() }` (access.md). `curl -sI "$U/md/xx"` → `404`
`access: { read: readPublished(), readVersions: readPublishedVersions() }` (access.md). `curl -s -o /dev/null -w '%{http_code}' "$U/api/<slug>/versions?limit=10"`
→ `200` (a `500` = a rule with the document's `_status` path on `readVersions`: ERROR). `curl -sI "$U/md/xx"` → `404`
(no stand-in locale); a 404 page assigned in System pages must be published.
- **Secrets out of queries** (as an admin, with versions on for Site integrations or a collection using
`writeOnlySecret`): `curl -s -H "Authorization: JWT $T" "$U/api/globals/site-integrations/versions?where[version.smtpPassword][exists]=true"`
@@ -0,0 +1,30 @@
/**
* Attack probes from outside — the requests attackers send to Payload / Next.js sites, asked on a PRODUCTION build
* (`pnpm build && pnpm start`) or a staging copy (IAPL docs/security.md "Security suites"). Copy to
* tests/attack-probes.spec.ts and run:
*
* BASE_URL=http://localhost:3000 PAGE=/pl pnpm exec playwright test tests/attack-probes.spec.ts
*
* The probes come from the plugin (ATTACK_PROBES, @intecion/ipal-kit/doctor), so an IAPL upgrade brings new ones.
* On a LIVE site use `pnpm exec iapl-doctor --url https://<domain> --only live-probes` instead: it runs only the
* probes that change nothing (no 8 MB bodies). This spec runs all of them — local or staging only.
* The bundle check looks for this site's own secret VALUES: they are read from the environment (.env of the local
* build) and never printed. Add the project's own probes to EXTRA.
*/
import { ATTACK_PROBES, type AttackProbe, createProbeContext } from '@intecion/ipal-kit/doctor'
import { expect, test } from '@playwright/test'
const BASE = (process.env.BASE_URL ?? 'http://localhost:3000').replace(/\/$/, '')
const PAGE = process.env.PAGE ?? '/'
const secrets = ['PAYLOAD_SECRET', 'CRON_SECRET', 'R2_SECRET_ACCESS_KEY', 'TURNSTILE_SECRET_KEY', 'IAPL_DOCTOR_TOKEN', 'IAPL_COOKIE_SCAN_TOKEN'].map((k) => process.env[k]).filter((v): v is string => !!v && v.length >= 8)
/** The project's own probes, e.g. a custom endpoint that must refuse an 8 MB body or an operator in its query. */
const EXTRA: AttackProbe[] = []
for (const probe of [...ATTACK_PROBES, ...EXTRA]) {
test(`${probe.class}: ${probe.title}`, async () => {
const result = await probe.run(createProbeContext(BASE, { page: PAGE, secrets }))
test.skip(!!result.skipped, result.skipped)
expect(result.ok, result.detail).toBe(true)
})
}
@@ -46,12 +46,16 @@ 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.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: '[email protected]', password: 'Door-Password-1234', roles: ['admin'] }, closedFor: ALL, method: 'POST', name: 'nobody creates a staff account', path: '/api/users', closed: status(403) },
{ body: { email: '[email protected]', 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)' },
{ closedFor: ALL, name: 'Payload\'s job queue (a site without jobs)', path: '/api/payload-jobs/run', closed: status(404) },
// a site without jobs: 404. A site WITH jobs (IAPL 1.18.0): refused (401) for everybody but an admin and
// `Authorization: Bearer <CRON_SECRET>` — 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
// { closedFor: OUTSIDERS, body: {}, method: 'PATCH', name: 'pages cannot be changed', path: `/api/pages/${NO_ID}`, closed: status(403) },
]
@@ -362,6 +362,16 @@ if [ -n "$UI" ]; then
done
fi
# --- Speed (§6.11b, performance.md) — the doctor's performance group (errors since 1.18.0): images config, fonts,
# render-blocking, embeds, animations, a budget test. Full mode only: the doctor itself runs this audit with --quick.
if [ "$QUICK" -eq 0 ] && [ -x node_modules/.bin/iapl-doctor ]; then
# errors since 1.18.0; a rule the project lowered in iapl-doctor.json comes back as a warning, a silenced one not at all
PERF=$(node_modules/.bin/iapl-doctor --only performance --offline --json 2>/dev/null \
| node -e 'let s="";process.stdin.on("data",(d)=>(s+=d)).on("end",()=>{try{for(const f of JSON.parse(s).findings){if(!f.silenced&&f.severity!=="info"){console.log(`${f.severity==="error"?"E":"W"}|${f.file??"(site)"} [${f.rule}] ${f.message}`)}}}catch{}})')
report ERROR "speed (iapl-doctor --only performance)" "§6.11b / performance.md — each line names the rule; lower or silence one with a reason in iapl-doctor.json" "$(printf '%s\n' "$PERF" | sed -n 's/^E|//p')"
report WARNING "speed, lowered to a warning in iapl-doctor.json" "§6.11b / performance.md" "$(printf '%s\n' "$PERF" | sed -n 's/^W|//p')"
fi
# --- Compile & build ---
if [ "$QUICK" -eq 0 ]; then
echo
@@ -46,9 +46,11 @@ Ask only when the brief leaves a business question open (e.g. "do posts have aut
**No URL prefix in code** — the editor assigns the archive page in
Site settings (`<slug>Archive`). The plugin handles routing, sitemap,
generateStaticParams, hreflang.
**With drafts** (`versions: { drafts: true }`): `access: { read: readPublished(), readVersions: readPublished() }`
**With drafts** (`versions: { drafts: true }`): `access: { read: readPublished(), readVersions: readPublishedVersions() }`
(`readPublished` is for `read`, `readPublishedVersions` for `readVersions` — the version list asks for `version._status`)
— Payload's open `read: () => true` answers `?draft=true` with the draft over REST and GraphQL. Check:
`curl -i <site>/api/<slug>/<draft id>?draft=true` without a session → `404`; the same with an editor's token → the draft.
`curl -i <site>/api/<slug>/<draft id>?draft=true` without a session → `404`; the same with an editor's token → the draft;
`curl -s -o /dev/null -w '%{http_code}' <site>/api/<slug>/versions?limit=10` without a session → `200`, never `500`.
3. Entry list = a block (EntriesList) with `getEntries`; the entry page uses
`resolveRoute` (type `entry`); JSON-LD per seo.md (e.g. Article).
4. **An auth collection for visitors** (`auth: true`: customers, members) only when the client requires it
@@ -55,6 +55,14 @@ before analytics or marketing consent — check the project's choice in "Project
`nonce` to `<SiteProviders>`. 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.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:
`[data-ipal-cookie-space]` on it). Before a decision and while the banner is open the footer has its own padding
only. Tab reaches the button and Enter reopens the banner. A project scroll handler, a button rendered inside
the footer or hand-made bottom padding for it → remove (AGENT.md §7). Too much or too little room:
`--ipal-cookie-button-space` on the footer; none: `reserve={false}`.
The script needs buttons with `data-ipal="accept"` / `"reject"` — the plugin's
`CookieBanner` has them in every `settings` mode (`inline`, `modal`, `detailed`). A custom banner in the project violates AGENT.md §7.
+13 -1
View File
@@ -34,11 +34,23 @@ 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.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` |
| the 2FA code screen answers "Too many codes were tried…" (`429` from `/api/verify-totp`) | more than 5 wrong codes for that account in 10 minutes (`twoFactor.verifyLimit`; right codes do not count since 1.17.1). "…being checked right now. Try again in a moment." (`Retry-After: 2`) = several attempts of one account at the same moment, nothing is locked; repeated lines `[iapl] 2FA: too many verify attempts` in the log without the owner trying = someone has the password | wait for the window, enter the current code once; unexplained attempts: change that account's password. Tests that log in often: `verifyLimit: { max: … }` for that environment |
| `isAdmin(req.user)` says `false` for a real administrator on the server, in a process that loads two Payload configs (tests, a multi-site script) | a call without a source counts only collections that are staff in **every** config of the process | pass the source: `isAdmin(req.user, req.payload)` — with it each config gets its own answer |
| `isAdmin(user)` / `isEditor(user)` is always `false` in a client component or in `proxy.ts` | the staff collections are not known there (no config in the browser bundle / middleware), and the predicates fail closed | `isAdmin(user, config)` with `useConfig()`, imported from `@intecion/ipal-kit/client`; in middleware `isAdmin(user, { staffCollections: ['users'] })` |
| `next build --webpack`: `'server-only' cannot be imported from a Client Component module … caused by importing '@intecion/ipal-kit/dist/index.js'` | a `'use client'` file imports the main entry (Turbopack lets it pass) | import from `@intecion/ipal-kit/client` (role predicates are there since 1.16.7; types: `import type` from the main entry is fine); data the browser needs → a prop from a server component |
| an account logs in but every page and request answers 403 / the setup screen says "The time to set up two-step verification has passed" | 2FA setup required: the account did not set TOTP up within the window (72 h from its creation, an admin's reset, or the first start after the upgrade) | an administrator opens the account in the panel → Two-step verification → "Reopen setup" (or `POST /api/ipal/two-factor/reset` `{ userId }`); every administrator is blocked: security.md "Every administrator is blocked" — a script with the Local API, `payload.update({ collection: 'users', id, data: { totpSetupFrom: new Date().toISOString() } })` (`pnpm payload run`), then log in and set TOTP up; or `requireSetup: { windowHours: false }`, redeploy, set up, put it back |
| a REST / GraphQL list from the front end returns only 100 documents (`hasNextPage: true`) although `limit` asks for more | `listLimit` (1.18.0, audit F4): callers that are not staff get at most 100 per request; staff and the Local API are not capped | page through (`page=2`), read on the server with the Local API, or `iapl({ listLimit: { max: 500 } })` / `{ exclude: ['slug'] }` / `false` (security.md "Lists and sorting") |
| `GET /api/<collection>?sort=$…` answers `400` "This sort field is not allowed." | `refuseOperatorSort` (1.18.0, audit F5): a sort naming a database operator is refused | sort by a field name; `refuseOperatorSort: false` = Payload's behaviour |
| a visitor account (customer) gets `403` on `/api/payload-locked-documents` | `lockedDocuments` (1.18.0): Payload's document locks are for staff only | intended; your own rule: `lockedDocuments: { access: { read } }`, or `false` |
| `[csp]` log lines show only `blocked=https://host` and `page=/path` (no query), or some reports are missing | `createCspReportRoute` (1.18.0, audit F1): the default line keeps origins and paths, at most 10 violations per request and 60 requests per client a minute | your own `onReport` gets the raw values; `maxReports`, `rateLimit: false` |
| a CDN or Varnish serves Markdown to visitors of an HTML page, or `Accept: text/markdown` answers `public, s-maxage` | a proxy of your own rewrites to `/md/…` without the 1.18.0 headers, or IAPL < 1.18.0 | `createProxy({ markdown: true })`, or copy `MARKDOWN_NEGOTIATED_HEADER` / `appendVary` into your proxy (content.md "content negotiation"); purge the CDN |
| saving a social profile / website address answers "Enter a full address, e.g. https://example.com." | `buildUrlField` (1.18.0, audit F2) accepts `https://` / `http://` and the `schemes` you list | type the full address; `buildUrlField({ schemes: ['mailto', 'tel'] })` for more kinds |
| after typing the code the setup screen says "we sent a link to …" / "the confirmation e-mail could not be sent", and nothing opens | 1.18.0 `twoFactor.confirmByEmail`: the first set-up waits for the link sent to the account's e-mail, opened in the browser that scanned the code | open the link in that browser, then sign in again; no mail: the link is in the server log (`[iapl] 2FA: … Link`), or an admin opens the account → "Confirm the waiting set-up"; fix e-mail (doctor `2fa-enrolment-mail`); "open this link in the browser where you scanned the code" = scan again in the browser you read mail in |
| a new account gets `403` from the API although its role allows the request | 2FA setup required: until TOTP is set up the account reaches only the setup screen | set TOTP up (log in to the panel); an integration: use an API key, or `twoFactor.requireSetup.exempt` |
| after an upgrade EVERY panel login answers `500` (also `/api/users/init`), administrators with 2FA included; log: `[iapl] 2FA: the column for "totpSetupFrom" is missing … NOBODY CAN LOG IN` or `column users.totp_setup_from does not exist` | Postgres/SQLite: the migration that adds the 2FA column has not run (needed whenever 2FA is on) | `pnpm payload migrate:create` if no migration has it, commit, and redeploy with migrations run when the new container starts — `prodMigrations` in the adapter or the start command `pnpm payload migrate && pnpm start` (deployment.md §4.3; not Coolify's Pre-deployment command, which runs in the old container); nothing is lost. `iapl-doctor` reports a project whose migrations lack `totp_setup_from` |
| the site does not start: `[iapl] twoFactor.requireSetup.exempt must not be async` / `…windowHours must be a number` | `exempt` is an `async` function, or `windowHours` is a string / negative | `exempt: ({ user }) => user.email === '…'` (returns `true` / `false` at once); `windowHours: 72` or `false` |
@@ -110,7 +122,7 @@ through this procedure. Ask only when you are missing something you cannot get y
| a site sends nothing: "The data comes from another site (…), so this copy does not send e-mails by itself" / `relay-refused`, cause `client-other-host` | the site is non-public — its host matches `developmentHosts` (built in: `*.dev.netscale.pl`) or `IAPL_NOINDEX=1` is set; `iapl-doctor --deep` says which (`mail-non-public`) — and its database holds another host's connection: a staging copy of production, or production's data copied back onto the development address. Expected — a copy with production's data must not mail real people by itself | should it send: "Connect again" in the state block, once (until the data is replaced). A copy that must never send: `mail: { relay: false }` or SMTP to a catcher. **The production site itself says this:** `IAPL_NOINDEX` was left set after launch — remove it; or its host matches a development pattern — take it out of `iapl({ developmentHosts })` |
| the site does not start: "[iapl] … developmentHosts must be an array of host patterns …" | the list is not an array of non-empty host patterns (a single string, `null`, `['']`), or holds a lone `*` | write it as `['*.dev.netscale.pl', 'staging.client.pl']`; `[]` = none; to change who waits use `mail.relay.otherHosts` |
| a staging or test copy **does** send, to real addresses | its host matches no development pattern and it has no `IAPL_NOINDEX=1`, so it looks like a launch (a public site enrols by itself); the doctor's deep run notes "the database also holds the mail-service connection of another host" | name its host in `iapl({ developmentHosts: ['*.dev.netscale.pl', '<the copy's pattern>'] })`, or `IAPL_NOINDEX=1` on the copy; to be sure: `mail: { relay: false }` or SMTP to a catcher |
| `relay-pending` / "waiting for approval" | while the service runs with enrolment "pending" (from its launch until Intecion switches to open enrolment), every new site waits for approval; after that, the exception (many new sites at once, or approval by hand) | Intecion approves it on the service; nothing to change on the site; the same token then works |
| `relay-pending` / "Waiting for confirmation" / doctor `mail-relay-connect` | a new site waits until a person of Intecion confirms it (contract 1.8.0) | Site integrations → E-mail sending → "Połącz z IWSN"; the person signs in with an @intecion.com address on the page that opens and presses "Potwierdź"; the block turns "Connected" by itself. "Waiting for approval" with no button, or "the confirmation page is not available": Intecion confirms the host by hand. "Too many confirmation links": wait the minutes it says. The same token works afterwards |
| `relay-suspended` | Intecion stopped the site (abuse, a flood from a form) | contact Intecion; fill in SMTP meanwhile |
| `relay-disconnected` | an admin pressed "Disconnect" | "Connect again", or SMTP |
| `relay-quota` | the site's hour or day is used up (30 / 200 by default), more than 10 recipients, more than 10 confirmations to one address a day, too many new addresses, or the site's own limit on account mail (`mail.relay.accountMail`) | the server log names the limit; look for a form being abused (Turnstile on? rate limit?); a site that really sends more: Intecion raises the limits, or SMTP |
+22 -2
View File
@@ -1,6 +1,6 @@
---
name: iapl-doctor
description: Checks the whole site against the IAPL team standard with one command (`pnpm exec iapl-doctor`) — plugin, Next, sharp and Node versions, the AGENT.md §3 folder layout and naming, database names (<domain>_dev/_prod), env rules, security headers, X-Powered-By, CSP, 2FA, the cookie scanner, adminMeta/agency, AGENTS.md "Project decisions", current iapl-* skills, seeds (createSeeder, SEED_ONLY, no deletes), the block library, pnpm audit, hardcoded texts, and with --url / --deep the running site and the database. Use after setting up a site, after an IAPL upgrade, before a deploy, in CI of a new site, and when asked whether a site follows the team rules.
description: Checks the whole site against the IAPL team standard with one command (`pnpm exec iapl-doctor`) — plugin, Next, sharp and Node versions, the AGENT.md §3 folder layout and naming, database names (<domain>_dev/_prod), env rules, security headers, X-Powered-By, CSP, 2FA, the cookie scanner, adminMeta/agency, AGENTS.md "Project decisions", current iapl-* skills, seeds (createSeeder, SEED_ONLY, no deletes), the block library, pnpm audit, hardcoded texts, speed (the performance rules — errors) and what grows (sizes, versions, retention, unused media), and with --url / --deep the running site and the database. Use after setting up a site, after an IAPL upgrade, before a deploy, in CI of a new site, and when asked whether a site follows the team rules.
---
# iapl-doctor
@@ -25,11 +25,16 @@ Full reference: `node_modules/@intecion/ipal-kit/docs/doctor.md`.
with the Intecion mail service (IWSN in the panel): waiting for approval, stopped, refused, disconnected, a replaced sender name),
`mail-reply-address`, `mail-graph-deprecated`, `mail-relay-route` (trailing slashes, another API route, a redirect or a
block in front of `/api/iapl/mail-relay/confirm`) — fixes: `iapl-debug` "Consent / analytics / forms / email".
**Speed (`perf-*`) findings are errors since 1.18.0** (images config, fonts, render-blocking, embeds, animations,
a budget test; `--url`: compression, blocking scripts, font preloads, a lazy first image, HTML size; `--deep`:
oversized stored images) — the `iapl-performance` skill. The `growth-*` findings stay warnings and infos.
4. A deliberate exception (the owner's decision) goes into `iapl-doctor.json` **with a reason** — the same reason as in
AGENTS.md "Project decisions". Never silence a rule just to make the run pass:
```json
{ "rules": { "i18n-literals": { "off": true, "files": ["src/components/design/**"], "reason": "approved exception: styleguide labels" } } }
```
A speed rule the client accepts is lowered rather than silenced, so it stays in the report:
`"perf-fonts": { "severity": "warning", "reason": "the client's brand font, replaced in Q1" }`.
Keys: `off`, `severity`, `reason` (required), `until` (ISO date), `files` (globs). Top level: `domain`, `launched`,
`layout.allow`, `layout.frontend` (the pages' folder, e.g. `src/app/(site)` — found by structure otherwise; any route
group name works), `seen` (written by the doctor), `extraRules`.
@@ -41,6 +46,19 @@ Full reference: `node_modules/@intecion/ipal-kit/docs/doctor.md`.
`--url <url>` · `--staging` (must be noindex) · `--admin-route <path>` · `--deep` · `--env-file <prod export>` (checks
`<domain>_prod`) · `--only` / `--skip <ids,groups>` · `--sites '../*-web'` (a read-only rule × site table, exit 0).
**Security checks only** (security.md "Security suites"): `pnpm exec iapl-doctor --only security` — headers, CSP,
2FA, account rules, plus the static rules over the project's own code (`code-patterns`: unescaped HTML / JSON-LD,
`overrideAccess: true` or a Local API `user` without `overrideAccess: false` where a request reaches, a `where` from
the request, `eval`, `NEXT_PUBLIC_` secrets, redirects and fetches to an address from the request) and its configs
(`config-dangerous`). With `--url https://<domain>` also `live-probes`: the plugin's attack probes that change
nothing, run against the real site (secret files, bundle secrets, proxy bypass, open redirects, cache poisoning,
NoSQL operators, anonymous where / draft / GraphQL reads, error leaks, unbounded lists, `/_next/image`). Verify: on a
fresh starter site the run lists no `code-*` finding; add `eval(x)` to a page and `code-eval` appears. A correct
place is marked `// iapl-security-ok: <why>`. From 1.18.0 a site on IAPL's defaults passes every probe; `markdown-vary`,
`unbounded-list` or `sort-operator` on such a site means a fix was turned off (`markdown: { negotiate }` with a proxy
of its own, `listLimit: false`, `refuseOperatorSort: false`) — security.md "Lists and sorting"; silence the rule with
the reason when that was the decision.
Exit `0` ok · `1` findings at or above `--fail-on` · `2` could not run · `3` a rule crashed.
## CI of a new site (starter, reference site)
@@ -56,7 +74,9 @@ Existing client sites are not gated on it; run it there as a report only.
`GET /api/ipal/doctor` is added by `iapl` and answers 404 until the site has `IAPL_DOCTOR_TOKEN` (≥ 32 characters).
Then `Authorization: Bearer <token>`; counts and states only (`usersWithout2fa`, `usersSetupClosed` = of those, blocked because the 2FA setup window has passed, `pendingCookies`, `openSignUp` = slugs of auth collections with open sign-up, `turnstile` = the recorded state of the Turnstile check, `turnstileSecretFromEnv`, `plugin`, `node`) — never a key or a name. With the same
`IAPL_DOCTOR_TOKEN` in the doctor's environment, `--url` reads it. Off: `iapl({ doctor: false })`; adapt:
`iapl({ doctor: { tokenVar, access } })`.
`iapl({ doctor: { tokenVar, access } })`. `access` returns a boolean (`({ req }) => isAdmin(req.user, req.payload)`):
since 1.18.0 only a literal `true` allows — `({ req }) => req.user` (an object) refuses — and any other answer is
reported once in the server log (`strictAccessAnswers: false` gives the old truthy reading back).
## Env the doctor reads
+3 -1
View File
@@ -35,4 +35,6 @@ Requires the UI primitives from `../iapl-block/resources/section-code.md` (like
## Verification
The **iapl-audit** skill. By hand: a menu item added in the panel is visible right after
saving; the mobile menu works with the keyboard (Tab, Enter, Esc).
saving; the mobile menu works with the keyboard (Tab, Enter, Esc). A menu item that points at a page never
published is not shown (since 1.18.0 the helpers leave draft pages out; `createContentHelpers({ draftRelations:
'keep' })` shows it as before): publish the page and the item appears.
@@ -0,0 +1,72 @@
---
name: iapl-performance
description: Makes and keeps an IAPL site fast — page loading (LCP image, fonts, nothing render-blocking, static rendering), elements (lazy below the fold, reserved space, click-to-load embeds), animations (transform/opacity, reduced motion, no scroll handlers), resources (only the JS a page uses, compression, no third-party request before consent), images (AVIF/WebP, sizes, upload limits) and the server (queries per render, depth, select, caching); what grows in the database and on disk over the years (logs and their retention, form submissions, versions, KV, unused media, the image cache). Measures the built site, runs the doctor's performance group, and adds the budget gate that fails when a change makes the site slower. Use when building pages or blocks, before handing over, after an IAPL upgrade, and whenever "slow", PageSpeed, Lighthouse, Core Web Vitals, LCP, CLS, INP, a growing database or disk come up.
---
# iapl-performance
The handbook is `node_modules/@intecion/ipal-kit/docs/performance.md`: what the plugin does for you, what the project
must do, how to measure, how to read the findings. This skill is the order of work.
## 1. Check what the plugin cannot do for you (code)
```bash
pnpm exec iapl-doctor --only performance # images config, fonts, render-blocking, embeds, animations, budget test
bash .agents/skills/iapl-audit/scripts/audit.sh --quick # <img>/<video> outside Media, priority outside the hero, YouTube iframe, h-screen
```
These are **errors** since 1.18.0 (`iapl-doctor` fails). Fix each — it names the file, the fix and the doc. When the
client accepts one (a brand font, a map that is the page's content), lower it with a reason in `iapl-doctor.json`
(`"perf-fonts": { "severity": "warning", "reason": "…" }`) or silence it (`"off": true`, optionally `until`), and record
it in AGENTS.md → Project decisions. The rules that matter most:
| Area | Do | Never |
|---|---|---|
| LCP image | `<Media priority>` on the first image of the page — **one** per page; a header logo gets `eager` | `priority` on many images; a lazy hero; the hero as a CSS background |
| layout shift | content that arrives late keeps its space: the lazy 404's `placeholder` (its content's height), the Turnstile widget's 73 px (kept by the plugin) | an empty box a widget or a server action fills later |
| other images | `<Media sizes={MEDIA_SIZES.third}>` — the width on screen; lazy by default | no `sizes`; a plain `<img>` |
| fonts | `next/font` (self-hosted), ≤ 2 families, variable, `display: 'swap'`, the heading font `preload: false` | a `<link>` to Google Fonts; `display: 'block'` |
| scripts | the plugin's `Analytics` / `ConsentScript`; `next/script` for anything else | a `<script src>` without `async` in the layout |
| embeds | `<YouTubeEmbed>`; a map or widget behind a click (a picture + a button) | an `<iframe>` that loads with the page |
| animations | `transform` / `opacity` only; the token durations (`duration-fast`) or `motion-reduce:` | animating `height`, `top`, `margin`; `transition-all`; a `scroll` listener (use IntersectionObserver) |
| client code | small `'use client'` leaves; server components by default; forms through `RenderForm` / `BuilderForm` from `/client` (their code loads only where a form is shown) | a whole section `'use client'`; importing `/client/eager` without a reason |
| server | the plugin's cached helpers (`lib/content`), `depth` as low as the page needs, `select` for one field | `findGlobal` without `cache()`; `depth: 2` "to be safe"; a query per list item |
## 2. Measure the built site
```bash
pnpm build && pnpm start # dev numbers mean nothing
pnpm exec iapl-doctor --url http://localhost:3000 --only perf-live # compression, blocking scripts, preloads, lazy hero, HTML size
pnpm exec iapl-doctor --deep --only perf-images # stored images over 1.5 MB / 2560 px
```
Lab numbers per page (phone on Slow 4G with a 4× slower CPU, and desktop): copy `resources/perf-lab.mjs` and
`resources/performance.spec.template.ts` (→ `e2e/performance.spec.ts`), list one page of each template, run
`pnpm test:e2e e2e/performance.spec`, then set each budget to what you measured plus ~20 %. From then on the test fails when
a change makes a page slower. PageSpeed Insights on the deployed site shows the field data (real visitors).
## 3. Read the result
- **LCP** > 2.5 s on the phone: the LCP element is named in the measurement (`lcpElement`). An image → `priority`,
`sizes`, a smaller upload; text → a font that arrives late (fewer preloaded files).
- **CLS** > 0.1: an image without dimensions (use `Media`), content that arrives after hydration (the lazy 404 —
`createNotFoundPage({ load, placeholder })`), a font swap (next/font sets fallback metrics).
- **TBT / INP**: long tasks — a big client component, a scroll handler, a third-party widget at start.
- **JS bytes**: what the page ships; import client components from `@intecion/ipal-kit/client` freely — since
1.18.0 a page carries only the ones it renders.
- **Queries per render** (the reference gate counts them): over 30 for an ordinary page → a missing `cache()`, a
`depth` too high, or a loop of `findByID`.
## 4. What grows (performance.md §6)
```bash
pnpm exec iapl-doctor --deep --only growth # counts and sizes per collection, oldest records, versions, expired KV, unused media, disk
```
- Logs purge themselves (consent log 1095 days, statistics 90). Form submissions are kept unless
`iapl({ forms: { submissionRetentionDays } })` — ask the client (personal data) and record it in AGENTS.md.
- Versions: where you turn them on, `versions: { maxPerDoc: 20 }` (globals `max`); never `0`.
- Unused media: `iapl({ unusedMedia: true })` (then `pnpm generate:importmap`) shows them above the Media list with a
link to Payload's filtered list; the editor deletes them there. The plugin never deletes media or submissions by itself.
- MongoDB: the consent log and statistics are deleted by TTL indexes at their retention (`ttlIndex: false` turns that off).
- Coolify: no persistent volume on `.next` (the image cache starts empty on each deploy); database backups on the
MongoDB resource.
- Thresholds of the findings: `iapl-doctor.json` → `growth`.
## 5. Before "done"
`iapl-doctor --only performance` without errors (each exception lowered or silenced with a reason in `iapl-doctor.json`),
the budget test green, and the numbers in `AGENTS.md` → "Project decisions" when the client accepted an exception
(a heavy font, a third-party widget).
@@ -0,0 +1,175 @@
/**
* Lab measurements of one page in Chromium (Playwright + the DevTools protocol) — used by `pnpm perf:measure`
* (scripts/perf-measure.mjs, numbers for docs/performance.md) and by the budget gate (e2e/performance.spec.ts).
*
* Profiles follow Lighthouse's defaults so the numbers compare with PageSpeed Insights' lab data:
* - mobile: 412×823 at DPR 1.75, "Slow 4G" (150 ms RTT, 1.6 Mbit/s down, 750 kbit/s up), CPU 4× slower;
* - desktop: 1350×940, 40 ms RTT, 10 Mbit/s, CPU 1×.
* Every run is a fresh browser context (empty HTTP cache, no cookies): a first visit, the worst ordinary case.
*
* What is measured (all from the browser itself, web.dev/articles/vitals):
* ttfb, fcp, lcp (+ the LCP element: tag, src, loading, fetchpriority), cls (session windows, as web-vitals does),
* tbt (sum of long-task time over 50 ms between FCP and the end of the run: the lab stand-in for INP),
* inp (the longest Event Timing entry of one scripted interaction: a click on the page's first visible button),
* scriptMs (CDP Performance.ScriptDuration: parse, compile, run and hydrate), requests, bytes per type
* (transfer size, compressed), renderBlocking (resource timing renderBlockingStatus), thirdParty (requests to
* another origin before any consent is given). Next's link prefetches (`?_rsc=`, made when the browser is idle) are
* counted apart (`prefetches`): they are not part of the page's load and come at a different moment each run.
* Option `blockThirdParty` (the gate): requests to another origin are recorded, then aborted — a slow external host
* cannot hold the page's load event, and the numbers are the site's own.
*/
import { chromium } from '@playwright/test'
export const PROFILES = {
desktop: { cpu: 1, network: { downloadThroughput: (10 * 1024 * 1024) / 8, latency: 40, uploadThroughput: (10 * 1024 * 1024) / 8 }, viewport: { deviceScaleFactor: 1, height: 940, isMobile: false, width: 1350 } },
mobile: { cpu: 4, network: { downloadThroughput: (1.6 * 1024 * 1024) / 8, latency: 150, uploadThroughput: (750 * 1024) / 8 }, viewport: { deviceScaleFactor: 1.75, hasTouch: true, height: 823, isMobile: true, width: 412 } },
}
const OBSERVERS = `(() => {
const v = (window.__perf = { cls: 0, events: [], lcp: null, longTasks: [] })
let win = 0, winStart = 0, winLast = 0
new PerformanceObserver((l) => { for (const e of l.getEntries()) {
const el = e.element
v.lcp = { at: e.startTime, size: e.size, tag: el ? el.tagName.toLowerCase() : null, src: e.url || null,
loading: el && el.getAttribute ? el.getAttribute('loading') : null,
fetchpriority: el && el.getAttribute ? el.getAttribute('fetchpriority') : null }
} }).observe({ buffered: true, type: 'largest-contentful-paint' })
new PerformanceObserver((l) => { for (const e of l.getEntries()) {
if (e.hadRecentInput) continue
if (win && e.startTime - winLast < 1000 && e.startTime - winStart < 5000) { win += e.value } else { win = e.value; winStart = e.startTime }
winLast = e.startTime
v.cls = Math.max(v.cls, win)
} }).observe({ buffered: true, type: 'layout-shift' })
new PerformanceObserver((l) => { for (const e of l.getEntries()) v.longTasks.push([e.startTime, e.duration]) }).observe({ buffered: true, type: 'longtask' })
new PerformanceObserver((l) => { for (const e of l.getEntries()) v.events.push({ d: e.duration, n: e.name }) }).observe({ buffered: true, durationThreshold: 16, type: 'event' })
})()`
/**
* @typedef {{ bytes: { css: number, font: number, html: number, image: number, js: number, other: number }, cls: number,
* fcp: null | number, inp: null | number, interaction: null | string, lcp: null | number,
* lcpElement: null | { fetchpriority: null | string, loading: null | string, src: null | string, tag: null | string },
* load: null | number, prefetches: number, profile: string, renderBlocking: string[], requests: number, runs?: number, scriptMs: null | number,
* status: null | number, tbt: null | number, thirdParty: string[], ttfb: null | number, url: string }} PageMeasurement
*/
const typeOf = (resourceType, mime = '') => {
if (resourceType === 'Document') {return 'html'}
if (resourceType === 'Script') {return 'js'}
if (resourceType === 'Stylesheet') {return 'css'}
if (resourceType === 'Font') {return 'font'}
if (resourceType === 'Image' || mime.startsWith('image/')) {return 'image'}
return 'other'
}
/**
* @param {import('@playwright/test').Browser} browser
* @param {string} url
* @param {'mobile'|'desktop'} profileName
* @param {{ blockThirdParty?: boolean, interact?: boolean, settleMs?: number }} [options]
* @returns {Promise<PageMeasurement>}
*/
export async function measurePage(browser, url, profileName, options = {}) {
const profile = PROFILES[profileName]
const context = await browser.newContext({ ...profile.viewport, viewport: { height: profile.viewport.height, width: profile.viewport.width } })
const page = await context.newPage()
const cdp = await context.newCDPSession(page)
await cdp.send('Network.enable')
await cdp.send('Network.setCacheDisabled', { cacheDisabled: true })
await cdp.send('Network.emulateNetworkConditions', { offline: false, ...profile.network })
await cdp.send('Emulation.setCPUThrottlingRate', { rate: profile.cpu })
await cdp.send('Performance.enable')
await page.addInitScript(OBSERVERS)
const origin = new URL(url).origin
if (options.blockThirdParty) {await context.route((u) => u.origin !== origin, (route) => route.abort())}
const requests = new Map()
let prefetches = 0
cdp.on('Network.requestWillBeSent', (e) => {
if (e.request.url.startsWith('data:')) {return}
if (/[?&]_rsc=/.test(e.request.url)) {prefetches++; return}
requests.set(e.requestId, { bytes: 0, type: typeOf(e.type), url: e.request.url })
})
cdp.on('Network.responseReceived', (e) => { const r = requests.get(e.requestId); if (r) {r.type = typeOf(e.type, e.response.mimeType); r.status = e.response.status} })
cdp.on('Network.loadingFinished', (e) => { const r = requests.get(e.requestId); if (r) {r.bytes = e.encodedDataLength} })
const response = await page.goto(url, { timeout: 60_000, waitUntil: 'load' })
await page.waitForLoadState('networkidle', { timeout: 15_000 }).catch(() => {})
await page.waitForTimeout(options.settleMs ?? 1000)
let interaction = null
if (options.interact !== false) {
// INP stand-in: one click on the first visible button (menu toggle, cookie settings, theme): a real handler runs
const button = page.locator('button:visible').first()
if (await button.count()) {
interaction = (await button.getAttribute('aria-label')) ?? (await button.innerText()).slice(0, 40)
await button.click({ timeout: 5000 }).catch(() => { interaction = null })
await page.waitForTimeout(500)
}
}
const nav = await page.evaluate(() => {
const n = performance.getEntriesByType('navigation')[0]
const fcp = performance.getEntriesByName('first-contentful-paint')[0]
const blocking = performance.getEntriesByType('resource').filter((r) => r.renderBlockingStatus === 'blocking').map((r) => r.name)
return { blocking, domContentLoaded: n.domContentLoadedEventEnd, fcp: fcp ? fcp.startTime : null, load: n.loadEventEnd, ttfb: n.responseStart }
})
const vitals = await page.evaluate(() => window.__perf)
const { metrics } = await cdp.send('Performance.getMetrics')
const metric = (name) => metrics.find((m) => m.name === name)?.value ?? 0
await context.close()
const list = [...requests.values()]
const bytes = { css: 0, font: 0, html: 0, image: 0, js: 0, other: 0 }
for (const r of list) {bytes[r.type] += r.bytes}
const fcp = nav.fcp ?? 0
const tbt = vitals.longTasks.filter(([start]) => start >= fcp).reduce((sum, [, d]) => sum + Math.max(0, d - 50), 0)
const round = (n) => (n == null ? null : Math.round(n))
return {
bytes: Object.fromEntries(Object.entries(bytes).map(([k, b]) => [k, Math.round(b)])),
cls: Math.round(vitals.cls * 1000) / 1000,
fcp: round(nav.fcp),
inp: vitals.events.length ? round(Math.max(...vitals.events.map((e) => e.d))) : interaction ? 0 : null,
interaction,
lcp: round(vitals.lcp?.at),
lcpElement: vitals.lcp ? { fetchpriority: vitals.lcp.fetchpriority, loading: vitals.lcp.loading, src: vitals.lcp.src ? vitals.lcp.src.replace(origin, '') : null, tag: vitals.lcp.tag } : null,
load: round(nav.load),
prefetches,
profile: profileName,
renderBlocking: nav.blocking.map((u) => u.replace(origin, '')),
requests: list.length,
scriptMs: round(metric('ScriptDuration') * 1000),
status: response?.status() ?? null,
tbt: round(tbt),
thirdParty: [...new Set(list.filter((r) => !r.url.startsWith(origin)).map((r) => new URL(r.url).origin))],
ttfb: round(nav.ttfb),
url: url.replace(origin, ''),
}
}
export const median = (values) => {
const sorted = values.filter((v) => typeof v === 'number').sort((a, b) => a - b)
if (!sorted.length) {return null}
const mid = Math.floor(sorted.length / 2)
return sorted.length % 2 ? sorted[mid] : Math.round(((sorted[mid - 1] + sorted[mid]) / 2) * 1000) / 1000
}
/**
* The median of `runs` measurements for every number; the rest from the last run.
* @param {import('@playwright/test').Browser} browser
* @param {string} url
* @param {'mobile'|'desktop'} profileName
* @param {number} [runs]
* @param {{ blockThirdParty?: boolean, interact?: boolean, settleMs?: number }} [options]
* @returns {Promise<PageMeasurement>}
*/
export async function measureMedian(browser, url, profileName, runs = 3, options = {}) {
const all = []
for (let i = 0; i < runs; i++) {all.push(await measurePage(browser, url, profileName, options))}
const last = all.at(-1)
const out = { ...last, runs }
for (const key of ['cls', 'fcp', 'inp', 'lcp', 'load', 'requests', 'scriptMs', 'tbt', 'ttfb']) {out[key] = median(all.map((r) => r[key]))}
out.bytes = Object.fromEntries(Object.keys(last.bytes).map((k) => [k, median(all.map((r) => r.bytes[k]))]))
return out
}
export const launch = () => chromium.launch()
@@ -0,0 +1,48 @@
// e2e/performance.spec.ts — the project's performance budget gate (iapl-performance skill, docs/performance.md).
// Copy this file and perf-lab.mjs (same folder) to e2e/. Runs against the BUILT site: pnpm build && pnpm test:e2e.
// It fails when a page breaks a budget: the plugin's defaults (Core Web Vitals "good", bytes, requests), tightened
// below to what this site measured, so a change that makes it slower fails. Loosen a number only with a reason.
import type { Browser } from '@playwright/test'
import { overBudget, perfBudgets } from '@intecion/ipal-kit/doctor'
import { chromium, expect, test } from '@playwright/test'
// a plain ES module (JSDoc types) — perf-lab.mjs from the skill's resources
import { measureMedian } from './perf-lab.mjs'
const runs = Number(process.env.PERF_RUNS ?? 1)
// Start from the defaults; after the first run, set each number to what you measured plus ~20 % (the lab is noisy).
const budgets = perfBudgets({
desktop: {},
mobile: {},
})
// One page of each template the site has (AGENTS.md → Site map). `budget` changes a number for one page, with a reason.
const PAGES: Array<{ budget?: Partial<typeof budgets.mobile>; name: string; path: string }> = [
{ name: 'home', path: '/pl' },
// { name: 'page', path: '/pl/o-nas' },
// { name: 'post', path: '/pl/blog/<a-post>' },
// { name: 'form', path: '/pl/kontakt', budget: { thirdParty: ['https://challenges.cloudflare.com'] } }, // Turnstile
]
let browser: Browser
test.beforeAll(async () => {
browser = await chromium.launch()
})
test.afterAll(async () => {
await browser?.close()
})
for (const page of PAGES) {
for (const profile of ['mobile', 'desktop'] as const) {
test(`${page.name} (${profile}) stays within its performance budget`, async ({ baseURL }) => {
test.setTimeout(120_000)
// third-party requests are recorded, then aborted: an external host cannot fail or hang the test
const measured = await measureMedian(browser, `${baseURL}${page.path}`, profile, runs, { blockThirdParty: true })
test.info().annotations.push({ description: JSON.stringify({ bytes: measured.bytes, cls: measured.cls, inp: measured.inp, lcp: measured.lcp, requests: measured.requests }), type: 'measured' })
expect(overBudget(measured, { ...budgets[profile], ...page.budget }), `${page.path} ${profile}`).toEqual([])
if (measured.lcpElement?.tag === 'img') {expect(measured.lcpElement.loading, 'the LCP image is lazy').not.toBe('lazy')}
})
}
}
@@ -38,10 +38,19 @@ 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/<slug>/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.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` |
| `secrets.writeOnly` | on | `smtpPassword` and `turnstileSecretKey` (Site integrations) are never returned: REST, GraphQL and the panel get `'********'` when a value is stored; a save with nothing / empty / the mask keeps it, a new value replaces it, `'[[clear]]'` removes it; the Local API with access control off reads the real value. The panel is the source of these secrets — no env variable. A restore of a version is masked too | `false` = returned to whoever may read the global, as before |
| "Sending method" (`emailMethod`; `getMailMethod` / `setMailMethod`) | nobody has chosen: the order of 1.17.0, shown as selected | `relay` (IWSN), `smtp`, `graph` (deprecated): what is chosen is what is used, no fallback; a stored field (Postgres / SQLite: one migration) |
| `secrets.reenterOnChange` | on | a save through access control that changes `smtpHost`, `smtpPort` or `smtpUser` while a password is stored must send the password again or remove it (`400` on the field otherwise), whatever `emailTransport` says — so an admin session cannot send the stored password to a server of its own. A change of the transport alone, and the Local API with access control off, are not asked | `false` = the stored password follows the new server |
| `dashboardAlerts` | `{ integrations: 'admin', cookies: 'editor' }` | who sees the plugin's dashboard alerts: integration details (error text, link) for `integrations` and above, a neutral "ask an administrator" for editors below it, nothing for others; the cookie crawl / approval alert for `cookies` and above. With a role, a session that owes its second factor sees none | `integrations: 'editor' | 'all'`, `cookies: 'all'` (`'all'` = as before: no role and no second factor is checked) |
| `strictAccessAnswers` | `true` (1.18.0) | a project's access callback (`cookieScanner.access`, the doctor's `access`) allows only on a literal `true`; `req.user`, `1`, a string, an un-awaited Promise refuse; a non-boolean answer is reported once per option | `false` = any truthy answer allows (as before 1.18.0) |
| `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.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)/<route>/` 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 | — |
@@ -93,15 +102,17 @@ 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") | `<type>: 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: logged-in, 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 |
| `forms.turnstileOnConfigError` | `{ text: 'allow', files: 'reject' }` | what a form does while Turnstile CANNOT check (wrong / missing secret, Cloudflare down): a text form is accepted, a submission to the file endpoint is refused. Not involved while Turnstile is off | `'allow'` / `'reject'` for every form, or `{ text, files }`; `turnstileOnConfigError` at a call site (`createSubmitAction`, `attachments.submit`) wins |
| `forms.attachments` | off | **File** field in the form builder; a file is checked (size, count, type by content, refused extensions), attached to the company e-mail and dropped — **never stored**; adds `POST /api/ipal/forms/submit`, the fields `submissionFiles` / `filesDelivery` / `filesDeliveryNote` / `attemptKey` on `form-submissions`, and the **Files** texts in Form messages | `true` / `FormAttachmentsOption`: `maxSizeMB` (10), `maxTotalMB`, `maxFiles` (3), `fileTypes`, `allowRisky`, `scan` (antivirus hook — none built in), `strictPdf`, `notice`, `maxConcurrent` (2), `path`, `submit` (`maxPerMinute`, `clientIp`, `honeypotField`, `turnstileHostnames`, `turnstileOnConfigError`, `allowedOrigins`, `idleTimeoutMs`, `timeoutMs`); block only: `forms.fields.file: false` or `buildFileBlock(…)`. Postgres: `migrate:create`. Check: submit a PDF → attached to the company e-mail, absent from the customer e-mail, submission shows *File delivery: Handed to the mail server* (forms.md "Files") |
| `forms.consentFieldName` | `'consent'` | name of the GDPR consent field `submitForm` requires (read from `config.custom.ipal`) | `createSubmitAction({ consentFieldName })` / `submitForm` argument wins |
| `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 | `false` / `{ retentionDays }` (default 1095) |
| `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 === '[email protected]' } }` — narrows who reads records in a project without roles |
| `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 <CRON_SECRET>` (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 `<CookieTable>` 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` |
@@ -212,6 +223,7 @@ Mandatory set: AGENT.md §0b, skill **iapl-setup**; checks: **iapl-audit**, **ia
| storage | `payload.config.ts` | `buildR2Storage(['media'], { s3Storage })` — always (without `R2_*` = local disk) | upload → URL from `R2_PUBLIC_URL` | storage.md |
| e-mail | `payload.config.ts` | `email: mailAdapter()` (SMTP from the panel / Graph from env; also `panelSmtpAdapter`, `graphAdapter`, `sendEmail` from `/server`) | Site integrations → E-mail sending → **Send test** | email.md |
| forms — action | `app/(frontend)/[locale]/actions.ts` | `'use server'`; `export const sendForm = createSubmitAction({ getCachedPayload, headers })` (`/server`) | submit → document in Form Submissions + e-mails | forms.md, skill **iapl-form** |
| forms — retention | config (client decision) | `forms: { submissionRetentionDays: 365 }` (1.18.0; default: kept) | `iapl-doctor --deep --only growth-submissions` quiet; old submissions gone a day after the next submission | performance.md §6, forms.md |
| forms — files | config + panel | `forms: { attachments: true }`; a **File** field on the form; an e-mail with fixed recipients in Forms → E-mails; `mailAdapter({ graph: { largeAttachments } })` when Graph must stay under 3 MB; Azure: `Mail.ReadWrite` limited to the forms mailbox for files of 3 MB and more over Graph | Test e-mail with "Attach a 10 MB test file" arrives; a submission with a PDF arrives with the attachment; nothing in Media | forms.md "Files", email.md "Attachments" |
| forms — render | form block | `<RenderForm form={form} action={sendForm} locale={locale} texts={formTexts} classNames={formClasses} />` (`/rsc`) | form from the panel, Turnstile, message from Notifications | forms.md |
| Turnstile | panel / env | `SiteProviders` wires `TurnstileProvider`; keys in Site integrations → Spam protection or env; server: `verifyTurnstile` (`/server`) | widget in the form; dashboard alert on a bad key | turnstile.md |
@@ -277,6 +289,7 @@ The plugin's own variables are `IAPL_<NAME>`; a deploy that sets the spelling fr
| `IAPL_IP_HEADER` | `ipHeader: true` + production | rate limit trusts any IP header (spoofing) + warning in prod | env: `cf-connecting-ip` (Cloudflare) / `x-forwarded-for` (Traefik/nginx) |
| `IAPL_COOKIE_SCAN_URL`, `IAPL_COOKIE_SCAN_TOKEN` | `cookieScanner.crawl` (`iaplEnvRules({ cookieCrawl: true })` requires both in production; token ≥ 16 chars) | **Check site** disabled, the box names the missing variable | env; the token also goes into the scanner service's `IAPL_CRAWLER_SITES` as `host=token` |
| `IAPL_DOCTOR_TOKEN` | no; ≥ 32 characters | `GET /api/ipal/doctor` answers 404; with it the endpoint answers a Bearer token, and `iapl-doctor --url` with the same variable reads the deep counts | env (Coolify) and the doctor's shell; also read by the doctor: `CI`, `NO_COLOR`, `PAYLOAD_CONFIG_PATH` (`--deep`), `IAPL_DOCTOR_IMPORT_MAP` (internal) — doctor.md |
| `CRON_SECRET` | no; ≥ 16 characters (name: `jobsRunAccess.secretVar`) | Payload's job queue runs over HTTP only for an admin; the start log says so when the queue is on | env (Coolify); the cron sends `Authorization: Bearer <CRON_SECRET>` to `/api/payload-jobs/run` |
| `IAPL_NOINDEX` | no; `1`/`true`/`yes` **staging/preview only** | — (when set: robots Disallow, meta noindex, `X-Robots-Tag`, IndexNow sends nothing) | staging env |
| `NEXT_PHASE` | set by Next | only tells `next build` from runtime: during the build an unreachable database gives an empty sitemap; at runtime the sitemap throws (route → 503) | do not set by hand |
| `NEXT_RUNTIME` | set by Next | `instrumentation.ts` checks for `nodejs`; missing (scripts, seed) → `buildRevalidateHook` does not revalidate | do not set by hand |
@@ -1,7 +1,7 @@
# IAPL — export index
Every public export of `@intecion/ipal-kit` (all entries: root, `/client`, `/rsc`,
`/server`, `/seed`, `/starter`, `/next/middleware`, `/admin`, `/env`, `/blocks`, `/blocks/rsc`, `/templates`, `/tokens`, `/doctor`), grouped by module. Search with grep
`/client/eager`, `/server`, `/seed`, `/starter`, `/next/middleware`, `/admin`, `/env`, `/blocks`, `/blocks/rsc`, `/templates`, `/tokens`, `/doctor`), grouped by module. Search with grep
(`grep -n "name" .agents/skills/iapl-reference/resources/api.md`) before you write anything yourself.
"Import from" column — the first entry is preferred. Plugin options, env, routes and what the
project wires: `../SKILL.md`. Module details: `node_modules/@intecion/ipal-kit/docs/<page>.md`.
@@ -13,7 +13,7 @@ project wires: `../SKILL.md`. Module details: `node_modules/@intecion/ipal-kit/d
| `ipalKit`, `IpalOptions`, `ipalEnvRules`, `IpalEnvFeatures`, `ipalT`, `ipalVar`, `IPAL_TOKENS`, `IPAL_BREAKPOINTS`, `IpalTokenName`, `IpalGlobalSlug` | as their new names | The names before 1.17.0 of `iapl`, `IaplOptions`, `iaplEnvRules`, `IaplEnvFeatures`, `iaplT`, `iaplVar`, `IAPL_TOKENS`, `IAPL_BREAKPOINTS`, `IaplTokenName`, `IaplGlobalSlug`: the same values, deprecated, removed in 2.0. Existing code keeps them; new code uses the new names (AGENT.md "Names: IAPL and ipal-kit"). |
| `iapl(options)` | `@intecion/ipal-kit` | Payload 3 plugin (`plugins: [iapl({...})]`) — the only wiring point: adds globals (SiteSettings, SiteIntegrations, CookieSettings, Notifications), roles, enforced 2FA, SEO, forms, i18n (localization), white-label, stats, consent log, `/api/ipal/*` endpoints; no auth collection → injects a simple `users`. Validates `i18n` right away (fail fast). `enabled: false` = schema stays, behaviour off. |
**Types:** `IaplOptions` — `iapl()` options: `i18n`, `access`, `twoFactor` (`{ issuer, plugin: payloadTotp }` or `false`), `whiteLabel`, `adminRoute`, `consentLog`, `content`, `cookieScanner`, `forms`, `pages`, `seo`, `searchSettings`, `stats`, `indexNow`, `siteSettingsFields`, `integrationsFields`, `globalOverrides`, `revalidatePath`, `enabled`. `GlobalOverride`, `GlobalOverrides`, `IaplGlobalSlug` — see Payload globals below.
**Types:** `IaplOptions` — `iapl()` options: `i18n`, `access`, `twoFactor` (`{ issuer, plugin: payloadTotp }` or `false`), `whiteLabel`, `adminRoute`, `consentLog`, `content`, `cookieScanner`, `forms`, `pages`, `seo`, `searchSettings`, `stats`, `indexNow`, `siteSettingsFields`, `integrationsFields`, `globalOverrides`, `revalidatePath`, `unusedMedia`, `enabled`. `GlobalOverride`, `GlobalOverrides`, `IaplGlobalSlug` — see Payload globals below.
## Admin (import map) (`admin`, `branding`, `admin-ui`, `globals/SiteIntegrations`) — details: `node_modules/@intecion/ipal-kit/docs/white-label.md`, `…/docs/integrations.md`, `…/docs/email.md`, `…/docs/links.md`
@@ -85,7 +85,12 @@ 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. |
**Types:** `AccountsOptions` (`accounts`: `panelRole`, `adminOnlyCreate`, `adminOnlyWrite`, `staffOnlyRead`, `firstUserRoute`, `password`), `StaffAccountAccessOptions` (`{ create?, write?, read?, pluginRoles? }`), `StaffRuleMark` (`{ slug, self }`), `AccountsMarker` (`{ slug, staff, own? }`, in `custom.ipalAccounts`; `own`: the operations that had a rule of the project's at config time, kept when the collection becomes staff later), `LateAdoption` (`{ slug, applied, kept, known, password, firstUser }`; `known`: in the config when iapl ran and staff only afterwards, `kept`: its operations whose own rule was left as written), `StaffAccountRules` (what the plugin put on a staff collection, in `custom.ipalAccountRules`: `{ applied, ownRoles }`), `WriteOnlySecretOptions` (`{ boundTo?, appliesWhen? }`), `PasswordRuleOptions` (`{ minLength? }`), `FirstUserRouteOption` (`'panel' \| 'all' \| string[]`), `TurnstileOnConfigError` / `TurnstileOnConfigErrorOption` / `TurnstileFormKind` (`@intecion/ipal-kit/server`), `VerifyLimitOptions` (`twoFactor.verifyLimit`: `{ max?, windowMinutes?, store? }`), `RequireSetupOptions` (`twoFactor.requireSetup`), `TwoFactorResetOptions`, `TwoFactorSetupState`, `SafeBackRule` / `SafeBackContext` (`twoFactor.safeBack` as a function: `(back, { adminRoute, origin? }) => string`), `TotpViewComponent` (a view component as registered: a path or `{ path, exportName?, clientProps?, serverProps? }`), `SafeTotpViewProps` (`@intecion/ipal-kit/admin`), `Role` (`'user' \| 'editor' \| 'admin'`), `AccessOption` (the plugin's `access` option: `authCollection`, `defaultRole`, `authAccess`, `firstUserAdmin`, `staffCollections`).
| `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. |
**Types:** `AccountsOptions` (`accounts`: `panelRole`, `adminOnlyCreate`, `adminOnlyWrite`, `staffOnlyRead`, `firstUserRoute`, `password`, `lockedAnswer`, `signInLimit`, `signInSameOrigin`, `confirmOwnChanges`), `LockedAnswerOption`, `StaffAccountAccessOptions` (`{ create?, write?, read?, pluginRoles? }`), `StaffRuleMark` (`{ slug, self }`), `AccountsMarker` (`{ slug, staff, own? }`, in `custom.ipalAccounts`; `own`: the operations that had a rule of the project's at config time, kept when the collection becomes staff later), `LateAdoption` (`{ slug, applied, kept, known, password, firstUser }`; `known`: in the config when iapl ran and staff only afterwards, `kept`: its operations whose own rule was left as written), `StaffAccountRules` (what the plugin put on a staff collection, in `custom.ipalAccountRules`: `{ applied, ownRoles }`), `WriteOnlySecretOptions` (`{ boundTo?, appliesWhen? }`), `PasswordRuleOptions` (`{ minLength? }`), `FirstUserRouteOption` (`'panel' \| 'all' \| string[]`), `TurnstileOnConfigError` / `TurnstileOnConfigErrorOption` / `TurnstileFormKind` (`@intecion/ipal-kit/server`), `VerifyLimitOptions` (`twoFactor.verifyLimit`: `{ max?, windowMinutes?, store? }`), `RequireSetupOptions` (`twoFactor.requireSetup`), `TwoFactorResetOptions`, `TwoFactorSetupState`, `SafeBackRule` / `SafeBackContext` (`twoFactor.safeBack` as a function: `(back, { adminRoute, origin? }) => string`), `TotpViewComponent` (a view component as registered: a path or `{ path, exportName?, clientProps?, serverProps? }`), `SafeTotpViewProps` (`@intecion/ipal-kit/admin`), `Role` (`'user' \| 'editor' \| 'admin'`), `AccessOption` (the plugin's `access` option: `authCollection`, `defaultRole`, `authAccess`, `firstUserAdmin`, `staffCollections`).
## Accessibility — widget (`accessibility`) — details: `node_modules/@intecion/ipal-kit/docs/accessibility.md`
@@ -150,7 +155,7 @@ Fifteen ready blocks and ten page templates. **Use a library block (or a variant
| `HeroBlock`, `TextMediaBlock`, `FeatureGridBlock`, `GalleryBlock`, `FaqBlock`, `CtaBlock`, `ContactBlock`, `TeamBlock`, `PricingBlock`, `LogosBlock`, `TestimonialsBlock`, `StatsBlock`, `RichTextBlock`, `StepsBlock`, `EntryListBlock` | `@intecion/ipal-kit/blocks/rsc` | The block components (server; props `LibraryBlockProps`: data + `locale`, `isFirst`, `ui`, `ctx`, `classNames`). |
| `HERO_PARTS`, `TEXT_MEDIA_PARTS`, `FEATURE_GRID_PARTS`, `GALLERY_PARTS`, `FAQ_PARTS`, `CTA_PARTS`, `CONTACT_PARTS`, `TEAM_PARTS`, `PRICING_PARTS`, `LOGOS_PARTS`, `TESTIMONIALS_PARTS`, `STATS_PARTS`, `RICH_TEXT_PARTS`, `STEPS_PARTS`, `ENTRY_LIST_PARTS` | `@intecion/ipal-kit/blocks/rsc` | Default token classes per block part — the keys of `classNames`. |
| `defaultEntryCard(doc)`, `defaultTestimonial(doc)` | `@intecion/ipal-kit/blocks/rsc` | Default mapping of a collection document to an entry card / a testimonial (`entryCard`, `mapTestimonial` replace them). |
| `Section`, `SECTION_BACKGROUNDS`, `SectionHeader`, `Media`, `CMSLink`, `Anchor`, `buttonClass`, `BUTTON_CLASSES`, `Container`, `CONTAINER_WIDTHS`, `Card`, `CARD_CLASS`, `CARD_INTERACTIVE_CLASS` | `@intecion/ipal-kit/blocks/rsc` | UI primitives, token utilities only: section (anchor, background, `data-surface`), heading group, image/video, panel link, link element, button looks, page column, card. |
| `Section`, `SECTION_BACKGROUNDS`, `SectionHeader`, `Media`, `CMSLink`, `Anchor`, `buttonClass`, `BUTTON_CLASSES`, `Container`, `CONTAINER_WIDTHS`, `Card`, `CARD_CLASS`, `CARD_INTERACTIVE_CLASS`, `CARD_INTERACTIVE_SHADOW_CLASS` | `@intecion/ipal-kit/blocks/rsc` | UI primitives, token utilities only: section (anchor, background, `data-surface`), heading group, image/video (`Media`: `priority`, `eager`, `sizes`, `videoMode`, `pauseForReducedMotion` — a background video paused for "reduce motion", default true), panel link, link element, button looks, page column, card (hover: an `::after` shadow layer fading with `opacity`; the 1.17 `box-shadow` transition is `CARD_INTERACTIVE_SHADOW_CLASS`). |
| `itemHeadingLevel(slug, props)`, `leadsWithImage(props)` | `@intecion/ipal-kit/blocks/rsc` | Item heading tag (one below the section heading; `h2` without one; `itemHeadings` overrides) and whether the block's first image is the page's LCP image (`isFirst` / `firstImage`; `priorityImage: false` turns it off). |
| `Buttons`, `headingId(block)`, `TitleLink`, `GRID_COLUMNS`, `cx`, `parts(defaults, overrides)` | `@intecion/ipal-kit/blocks/rsc` | Helpers for own blocks: button row, heading id for `aria-labelledby`, card title link (plain text when the link is dead), grid columns, class joining, part classes. |
| `BLOCK_TEXTS`, `blockTexts(locale, own?)`, `fillText(text, value)` | `@intecion/ipal-kit/blocks/rsc` | Visitor texts the blocks write (rating, step) in en/pl; override with `texts`. |
@@ -165,8 +170,10 @@ 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. Props `className`, `side` (`'left' \| 'right'`), `avoid` (selector it lifts above, default `COOKIE_BUTTON_AVOID` = footer; `false`). Tokens `--ipal-cookie-button-offset`, `--ipal-cookie-button-inset`. Type `CookieButtonProps`. |
| `COOKIE_BUTTON_AVOID`, `bottomOverlap(tops, viewportHeight)` | `@intecion/ipal-kit/client` | Default footer selector; pixels the footer covers at the bottom of the screen (how far the button moves up) |
| `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 (`<CookieButton avoid={COOKIE_BUTTON_AVOID} />`); 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 |
| `ConsentScript` | `@intecion/ipal-kit/client` | Loads an external script (`src` or `code`) only after consent for `category` — for vendors without Consent Mode (chat, Plausible etc.). Inside `ConsentProvider`. |
| `CookieTable` | `@intecion/ipal-kit/rsc` | Server Component: cookie table for the cookie policy page — `{ rows, labels?, locale?, categories?, caption?, classNames?, storageColumn?, storageTypes? }`; `rows` from `getCookieTable()`; a **Type** column when a row is local / session storage (`storageColumn: 'auto' \| boolean`). |
@@ -197,7 +204,7 @@ Fifteen ready blocks and ten page templates. **Use a library block (or a variant
| `readEffectiveConsent(version, gpc?)` | `@intecion/ipal-kit/client` | The stored choice under `version` with Global Privacy Control applied, read live from the cookie and `navigator` (not React state) — for your own tag loader's effects. |
| `signalVendors(prev, next)` / `clarityConsent(state)` | `@intecion/ipal-kit/client` | Tells the running Meta Pixel (`fbq('consent', …)`), TikTok (`ttq.revokeConsent` / `grantConsent`) and Clarity (`consentv2` / `consent false`) about a change; `useConsent` calls it on every decision — for your own banner. `clarityConsent` → Clarity's `{ ad_Storage, analytics_Storage }`. |
| `buildConsentLogCollection()` | `@intecion/ipal-kit` | Consent log collection (id, choices, version, time — no IP/personal data; proof of consent under GDPR Art. 7(1)). The plugin wires it itself with `consentLog: true` — do not call. |
| `buildConsentLogEndpoint({ retentionDays? })` | `@intecion/ipal-kit` | `POST /api/ipal/consent` endpoint that saves decisions and deletes records older than `retentionDays` (default 1095). The plugin wires it itself with `consentLog` — do not call. |
| `buildConsentLogEndpoint({ retentionDays? })` | `@intecion/ipal-kit` | `POST /api/ipal/consent` endpoint that saves decisions and deletes records older than `retentionDays` (default 1095). The plugin wires it itself with `consentLog` — do not call. On MongoDB a TTL index (`consentLog.ttlIndex`, default true) deletes them too, also without new records. |
**Built-in texts:** `CONSENT_FALLBACK`, `CONSENT_FALLBACK_PL`, `consentFallback(locale)` (banner defaults by page language), `CONSENT_CATEGORY_LABELS` / `consentCategoryOptions()` (category names `{ en, pl }`), `COOKIE_TABLE_LABELS` (`/rsc`, `<CookieTable locale>` defaults), `COOKIE_STORAGE_LABELS` (`/rsc`, type names per language).
@@ -294,6 +301,7 @@ Opt-in with `iapl({ cookieScanner: true })`; the plugin wires the collection, en
| `MARKDOWN_PREFIX` | `@intecion/ipal-kit` | constant `'/md'` — default prefix of Markdown routes |
| `markdownHref(pathname, prefix?)` | `@intecion/ipal-kit` | page path → Markdown version address (`/pl/o-nas` → `/md/pl/o-nas`), e.g. for `alternates.types` |
| `prefersMarkdown(request \| headers \| accept)` | `@intecion/ipal-kit` | whether the `Accept` header prefers `text/markdown` (q-values); for your own proxy — `createProxy({ markdown: true })` does it itself |
| `MARKDOWN_NEGOTIATED_HEADER`, `NEGOTIATED_CACHE_CONTROL`, `appendVary(headers, token)` | `@intecion/ipal-kit` | 1.18.0 (audit F3): the request marker the proxy sets on a negotiated rewrite (the route then answers `private, no-store` + `Vary: Accept`), that cache-control, and `Vary` with a token added once — for your own proxy (content.md "content negotiation"). `markdownResponse(md, { negotiated: true })` gives the same headers. `createProxy({ markdown: { prefix?, negotiate? } })`: `negotiate: false` = no rewrite. |
| `searchContent({ payload, query, config, locale?, limit?, baseUrl?, collection?, summaryField? })` | `@intecion/ipal-kit` | searches published, indexable pages by title/description → `SearchResult[]`; does not throw |
| `listContent({ payload, config, locale?, limit? })` | `@intecion/ipal-kit` | list of published, indexable pages (no query) — used by MCP `list_pages` |
| `createSearchRoute({ getCachedPayload, config, baseUrl, defaultLimit?, rateLimit?, clientIp?, isPathVisible? })` | `@intecion/ipal-kit` | `GET` handler for the JSON search endpoint (`?q=&locale=&limit=`), with a per-IP rate limit; pass `isPathVisible` from `@/lib/content` so construction mode hides pages here too |
@@ -331,7 +339,7 @@ Opt-in with `iapl({ cookieScanner: true })`; the plugin wires the collection, en
|---|---|---|
| `createContentHelpers({ config, content?, i18n?, baseUrl?, … })` | `@intecion/ipal-kit` | factory for `src/lib/content.ts`: cached `getCachedPayload`, `getSettings`, `resolveRoute`, `getEntries`, `generatePageMetadata`, `getSiteShell`, `sitemap`, `robots`, `getRobots`, `isPathVisible`, `markdownRoute`, `healthRoute`, `mcpGET`/`mcpPOST`… — do not write these wrappers yourself |
| `createPageRoute(content, { blocks, notFound, permanentRedirect, redirect?, … })` | `@intecion/ipal-kit/rsc` | ready `[[...slug]]` catch-all page → `{ Page, generateMetadata, generateStaticParams }` (blocks, slug history redirects, JSON-LD, under-construction mode); does not paginate `?page=` |
| `createNotFoundPage(content, { load } \| { blocks, fallback?, … })` | `@intecion/ipal-kit/rsc` | default export of `not-found.tsx` — the 404 page chosen in the panel or a fallback (the lazy `load` variant is recommended) |
| `createNotFoundPage(content, { load, placeholder? } \| { blocks, fallback?, … })` | `@intecion/ipal-kit/rsc` | default export of `not-found.tsx` — the 404 page chosen in the panel or a fallback (the lazy `load` variant is recommended; `placeholder` (1.18.0) reserves the 404 content's height until it arrives — no layout shift, performance.md) |
| `renderNotFoundView(content, { blocks, fallback?, blockProps?, layoutField? }, locale)` | `@intecion/ipal-kit/rsc` | 404 content in one language — called from a server action for the lazy `createNotFoundPage({ load })` (pages.md) |
| `SiteProviders` | `@intecion/ipal-kit/rsc` | layout component: `shell={await getSiteShell(locale)}` mounts consent, cookie banner, analytics, Turnstile, site JSON-LD, theme script (and `lightbox` → `LightboxProvider`); `nonce` (from `x-nonce`) goes on the theme script and the GA4/GTM tag; does not mount `AlternateLinksProvider` |
@@ -394,6 +402,7 @@ Full option lists of `createContentHelpers` / `createPageRoute` / `SiteProviders
| `recordIntegrationStatus(payload, field, previous, { state, code?, message? })` | `@intecion/ipal-kit` | saves the state of your own integration in Site integrations (only on change / every 10 min); does not throw. For e-mail and Turnstile the plugin calls it itself — do not call |
| `buildIntegrationStatusField(name)` | `@intecion/ipal-kit` | hidden status group field (`state`, `code`, `message`, `since`, `checkedAt`) for `integrationsFields` |
| `buildIntegrationStatusBanner(statusField, label, texts?)` | `@intecion/ipal-kit` | UI field with a status banner on the integration tab (`label` string or `{ en, pl }`; `texts` = `{ failing, hint }` keys of your own `ipal` translations) (`integrationsFields`; then `pnpm generate:importmap`) |
| `UnusedMediaNotice`, `UNUSED_MEDIA_LINK_LIMIT` | `@intecion/ipal-kit/admin` | `iapl({ unusedMedia })` (1.18.0, opt-in): above an upload collection's list, how many files nothing uses (`findUnusedMedia` from `/doctor`) and a link to Payload's list filtered to them (first 100); editors and admins; deletes nothing; a hint only when the site is too big to check here |
| `IntegrationAlerts` | `@intecion/ipal-kit/admin` | dashboard alert about integrations in the `degraded` state; always injected by the plugin (`beforeDashboard`); your own integrations: a second instance with `checks`. By role: the detail (error text, link) for `details` and above (`'admin'` default, `'editor'`, `'all'`), a neutral "ask an administrator" for editors below it, nothing for others or for a session that owes its second factor (`dashboardAlerts.integrations`). `CookieCrawlAlert` takes `audience: 'editor' \| 'all'` the same way |
| `IntegrationStatusBanner` | `@intecion/ipal-kit/admin` | status banner on the tab; injected by the plugin / `buildIntegrationStatusBanner` through the import map (`pnpm generate:importmap`), the project does not import it |
@@ -424,10 +433,11 @@ The editor builds forms in the panel (Forms collection). The project does NOT wr
| Export | Import from | What it does / when |
|---|---|---|
| `RenderForm({ form, action, locale, texts, classNames?, values?, … })` | `@intecion/ipal-kit/rsc` | A panel form in a block in one line (RSC): renders message blocks and the confirmation, binds `sendForm` to the form and language, resolves the redirect, sends only `publicForm` to the browser; `form` not populated → nothing |
| `RenderForm({ form, action, locale, texts, classNames?, values?, Form?, turnstileReserveHeight?, … })` | `@intecion/ipal-kit/rsc` | A panel form in a block in one line (RSC): renders message blocks and the confirmation, binds `sendForm` to the form and language, resolves the redirect, sends only `publicForm` to the browser; `form` not populated → nothing. Renders the lazy `BuilderForm` (its code only on pages with a form, the HTML complete); `Form` swaps the component (the eager one from `/client/eager`); `turnstileReserveHeight` (default 73, 0 for an invisible widget) |
| `prepareBuilderForm({ form, action, locale, … })` | `@intecion/ipal-kit/rsc` | The server half of `RenderForm` without markup → `PreparedBuilderForm` (or `null`) to spread into `<BuilderForm>` in a client component (e.g. a configurator with changing `values`) |
| `publicForm(form)` | `@intecion/ipal-kit/rsc` | Public part of the form document (no Emails tab, no message rich text, safe redirect URL) — when you pass the form to the client yourself; never pass the raw document |
| `BuilderForm(props)` | `@intecion/ipal-kit/client` | Client renderer for any panel form (steps, all field types, Turnstile, honeypot, a11y), unstyled — look via `classNames`, field replacement via `renderField`; usually used indirectly through `RenderForm` |
| `BuilderForm(props)` | `@intecion/ipal-kit/client` | Client renderer for any panel form (steps, all field types, Turnstile, honeypot, a11y), unstyled — look via `classNames`, field replacement via `renderField`; usually used indirectly through `RenderForm`. Since 1.18.0 the `/client` export is a lazy wrapper with the same props (the code loads where a form is shown; SSR complete); `turnstileReserveHeight` keeps the widget's space |
| `BuilderForm`, `Turnstile` | `@intecion/ipal-kit/client/eager` | The same components without lazy loading — in every page's bundle. Only when a project needs them eager: `<RenderForm Form={BuilderForm}>` |
| `useBuilderForm({ form, action, texts, values?, onSuccess?, navigate?, redirectHref? })` | `@intecion/ipal-kit/client` | Panel form engine without markup (steps, `next/back/goTo`, per-step validation, server errors, redirect, analytics, `getInputProps`/`getSelectProps`/…, `TurnstileWidget`) — for your own markup of an unusual form |
### Pure panel form logic (client and server)
@@ -447,7 +457,7 @@ The editor builds forms in the panel (Forms collection). The project does NOT wr
| Export | Import from | What it does / when |
|---|---|---|
| `createSubmitAction({ getCachedPayload, headers, … })` | `@intecion/ipal-kit/server` | Creates the server action `sendForm(formId, locale, values, token?)`: honeypot → `clientIp` → `submitForm` → text from Notifications; returns `SubmitActionResult`. Standard: `export const sendForm = createSubmitAction({ getCachedPayload, headers })` in `actions.ts` |
| `submitForm({ payload, formId, data, files?, attemptKey?, turnstileToken?, ip?, locale?, maxPerMinute?, consentFieldName?, turnstileHostnames? })` | `@intecion/ipal-kit/server` | Server core (`consentFieldName`: argument → `iapl({ forms: { consentFieldName } })` → `'consent'`; `turnstileHostnames` rejects a token solved on another domain): rate limit → Turnstile → validation against the panel definition (+ GDPR consent) → saves the submission; returns a `SubmitFormResult` code, not text. Usually through `createSubmitAction`; server-only |
| `submitForm({ payload, formId, data, files?, attemptKey?, turnstileToken?, ip?, locale?, maxPerMinute?, consentFieldName?, turnstileHostnames? })` | `@intecion/ipal-kit/server` | Server core (`consentFieldName`: argument → `iapl({ forms: { consentFieldName } })` → `'consent'`; `turnstileHostnames` rejects a token solved on another domain): rate limit → Turnstile → validation against the panel definition (+ GDPR consent) → saves the submission (and, with `forms.submissionRetentionDays`, deletes older ones at most once a day); returns a `SubmitFormResult` code, not text. Usually through `createSubmitAction`; server-only |
### Honeypot
@@ -494,6 +504,7 @@ The editor builds forms in the panel (Forms collection). The project does NOT wr
| `resolveSystemLinks(settings, { locale, config, roles?, … })` | `@intecion/ipal-kit` | Links to system pages from Site settings (privacy/cookies/terms) with the page title as the label → `SystemLink[]`; in a project usually `getSystemLinks` from `lib/content` |
| `homeSlugFrom(settings, field?)` | `@intecion/ipal-kit` | Homepage slug from `SiteSettings.homepage` (populated) or `undefined` |
| `safeHref(url)` | `@intecion/ipal-kit` | The URL when safe (http(s), mailto, tel, sms, #, `/` path), otherwise `null` — blocks `javascript:`/`data:` |
| `buildUrlField({ name?, label?, required?, schemes?, description?, overrides? })`, `isAllowedUrl(value, schemes?)` | `@intecion/ipal-kit` | 1.18.0 (audit F2): a text field for an address rendered into `href` — `https://` / `http://` pass, plus the `schemes` you list (`mailto`, `tel`, `sms`, `hash`, `relative`); `javascript:`, `data:`, `//host` never. Render the value with `safeHref` too. Types `BuildUrlFieldOptions`, `UrlScheme`. |
**Types:** `BuildLinkFieldOptions`, `BuildLinksFieldOptions`, `LinkAppearance`, `LinkAppearanceOption` — link field options and styles; `LinkValue`, `ResolveLinkHrefOptions`, `ResolvedLink`, `NavItem`, `ResolveNavOptions`, `SystemLink` — panel link value, resolver options and results.
@@ -525,12 +536,13 @@ The editor builds forms in the panel (Forms collection). The project does NOT wr
| Export | Import from | What it does / when |
|---|---|---|
| `mediaImageProps(resource, { sizes?, priority?, alt?, placeholderColor? })` | `@intecion/ipal-kit` | `next/image` props for an image upload (dimensions, focal point → `objectPosition`, blur placeholder, `preload` for LCP) or `null` (video/PDF/ID) — for your own `<Media>` |
| `mediaImageProps(resource, { sizes?, priority?, eager?, alt?, placeholderColor? })` | `@intecion/ipal-kit` | `next/image` props for an image upload (dimensions, focal point → `objectPosition`, blur placeholder, `preload` for LCP) or `null` (video/PDF/ID) — for your own `<Media>`. `eager` (1.18.0): above the fold but not the LCP image (a logo) — eager without high priority or a preload |
| `videoProps(resource, { mode?, poster?, reducedMotion? })` | `@intecion/ipal-kit` | `<video>` attributes for a video upload (`'background'`: autoplay/muted/loop; `'player'`: controls, `preload="none"`) or `null` |
| `MEDIA_SIZES` | `@intecion/ipal-kit` | Ready constant `sizes` values: `full`, `half`, `third`, `quarter`, `thumb` |
| `normalizeFilename(filename)` | `@intecion/ipal-kit` | Slugifies a file name, keeping the extension (`"Zdjęcie 1.JPG"` → `"zdjecie-1.jpg"`) |
| `normalizeFilenameHook` | `@intecion/ipal-kit` | `beforeOperation` hook for an upload collection (Media) that normalizes the file name; the project adds it to its Media collection |
| `buildOptimizeUploadHook(options?)` | `@intecion/ipal-kit` | `beforeOperation` hook: blocks oversized JPG/PNG/video, converts the image to WebP after the editor agrees (sharp from `buildConfig`); the project adds it to Media |
| `buildOptimizeUploadHook(options?)` | `@intecion/ipal-kit` | `beforeOperation` hook: blocks oversized JPG/PNG/video, converts the image to WebP after the editor agrees (sharp from `buildConfig`); removes the metadata of JPEG/PNG uploads that pass without re-encoding (`stripMetadata`, default true; 1.18.0); the project adds it to Media |
| `stripImageMetadata(buffer, mimeType)`, `exifOrientation(app1)` | `@intecion/ipal-kit` | Lossless metadata removal: JPEG APP1/APP13/COM, PNG tEXt/zTXt/iTXt/eXIf/tIME → `{ buffer, changed, orientation }` (the EXIF rotation, to apply before); anything unreadable comes back unchanged. Type `StripResult` |
| `buildOptimizeUploadField(name?)` | `@intecion/ipal-kit` | "Optimize this upload" consent checkbox (default `optimizeOnUpload`) for Media, paired with `buildOptimizeUploadHook` |
| `buildMediaPlaceholderHook({ field?, size? })` | `@intecion/ipal-kit` | `beforeOperation` hook that computes a tiny blur preview (base64 WebP) and the dominant colour on upload; the project adds it to Media |
| `buildMediaPlaceholderField(name?)` | `@intecion/ipal-kit` | Hidden field group for the placeholder (read by `mediaImageProps`), paired with `buildMediaPlaceholderHook` |
@@ -621,6 +633,9 @@ Server only (`pnpm payload run`); never import it from client code, the Payload
| `SAFE_TOTP_VIEW` / `totpViewImportKey(component)` | `@intecion/ipal-kit` | `'@intecion/ipal-kit/admin#SafeTotpView'`, the wrapper's import-map path (the default `wrapper` of `wrapTotpViews`); and the import-map key (`path#export`) of a component given as a string or `{ path, exportName }`. |
| `findImportMapFile(config, cwd?)` / `missingImportMapEntries(config, entries, cwd?)` | `@intecion/ipal-kit` | Where the project's `importMap.js` is on disk (`admin.importMap.importMapFile`, else `app/(payload)<admin route>/` or `src/app/…` under `admin.importMap.baseDir` / the working directory; `null` when not found), and which of `entries` its text does not contain (`{ file, missing }`). A hint from the file on disk, not the map in the build: warn on it, never block on it. Behind `twoFactor.importMapCheck`. |
| `buildSetupFields({ statusField? })`, `stampSetupFrom`, `backfillSetupFrom(payload, collection)` | `@intecion/ipal-kit` | The parts of "2FA setup required" for a project that wires them itself: the fields for the 2FA collection (`totpSetupFrom`, and the panel's `totpSetupStatus` unless `statusField: false`), the `beforeChange` hook that stamps the window start (on create, and when an account loses its TOTP secret), and the start-up step that gives accounts without TOTP and without a start their window (returns how many; once per account). |
| `resolveConfirmByEmail(option)`, `startEnrolment(req, { collection, options, totp? })`, `buildEnrolmentEndpoints({ collection, options, ownOrigin?, resetAccess? })`, `ENROL_CONFIRM_PATH`, `ENROL_ADMIN_CONFIRM_PATH` | `@intecion/ipal-kit` | `twoFactor.confirmByEmail` (1.18.0, on by default; security.md "Set-up confirmed by e-mail"): the option read strictly (null = off); the `/setup-totp` answer for an account without a factor (checks the code, keeps the secret pending, mails the link, sets the browser cookie, `202 { ok: false, pending: true, mailed, message }`); the link's page `GET /api/iapl/two-factor/confirm`, its button `POST` (single use, 30 min, same browser, own origin; writes the factor, ends the sessions, signs nobody in) and the admin's `POST /api/iapl/two-factor/confirm-pending { userId }`. Types `ConfirmByEmailOptions`, `ResolvedConfirmByEmail`, `EnrolmentContext`, `EnrolmentEndpointsOptions`. |
| `readPendingEnrolment(payload, collection, id)`, `pendingEnrolmentInfo(…)`, `dropPendingEnrolment(…)`, `countPendingEnrolments(payload, collection)`, `pendingEnrolmentKey(collection, id)` | `@intecion/ipal-kit` | The waiting set-up in payload-kv (`iapl:2fa-enrol:<collection>:<id>`; memory when there is no kv): read (null when expired), `{ createdAt, expiresAt }` for screens, end it, count them (the doctor). Type `PendingEnrolment` (`{ secret, token, browser, createdAt, expiresAt }`, token and browser as sha256). |
| `buildTotpNoticeHooks(collection, { notices })`, `sendTwoFactorNotice(payload, account, 'on' \| 'off' \| 'changed', by?)`, `verifyTotpCode(secret, token, { algorithm?, digits?, period? })`, `mailConfigured(payload)` | `@intecion/ipal-kit` | beforeChange + afterChange for the 2FA collection: a notice mail on every enrolment, change, removal / reset (any path; a removal ends a waiting set-up); the notice itself; RFC 6238 check with one period either side (as the 2FA package); whether Payload has a real mail transport (its `console` fallback = false). |
| `buildTwoFactorResetEndpoint(collection, { access?, ownOrigin? })`, `TWO_FACTOR_RESET_PATH` | `@intecion/ipal-kit` | `POST /api/ipal/two-factor/reset` `{ userId }`: clears the account's TOTP secret and sessions and starts a new window. `ownOrigin(req)` false → `403` before anything changes (the plugin passes the `twoFactor.sameOrigin` rule; wire `requestFromOwnOrigin` when you build it yourself). Default: a staff admin whose session entered its own TOTP code; `access` replaces that (only `true` allows; a session that owes its code is always refused). `iapl` registers it only with `twoFactor.guard` on. |
| `countAccountsWithoutTotp(payload, collection, setupWindowMs?)` | `@intecion/ipal-kit` | `{ without, blocked }` — accounts of the 2FA collection without TOTP, and how many are past their window. |
| `resolveRequireSetup(option)`, `strictExempt(fn)`, `SETUP_FROM_FIELD`, `DEFAULT_SETUP_WINDOW_HOURS` | `@intecion/ipal-kit` | `twoFactor.requireSetup` → `{ requireSetup, setupWindowMs, exempt? }` as the guard reads it (throws on a `windowHours` that is not a number ≥ 0 or `false`, and on an `async` `exempt`); the wrapper that makes an `exempt` function answer `true` only for exactly `true`; the field name `'totpSetupFrom'`; `72`. |
@@ -637,7 +652,11 @@ Server only (`pnpm payload run`); never import it from client code, the Payload
| `buildCsp({ mode?, reportUri?, reportGroup?, r2Url?, analytics?, metaPixel?, linkedIn?, tiktok?, clarity?, turnstile?, youtube?, googleMaps?, nonce?, strictDynamic?, dev?, extra?, override? })` | `@intecion/ipal-kit` | Returns `{ key, value }` with a hardened CSP (`base-uri`, `object-src`, `frame-ancestors`, `form-action`) + sources for the enabled integrations. `mode: 'report-only'` → `…-Report-Only` (start here), `'enforce'` later. `extra` adds to any directive, `override` replaces / drops one (`null`). `dev` (default `NODE_ENV === 'development'`) adds `'unsafe-eval'`. `nonce` → `'nonce-…' 'strict-dynamic'`. |
| `buildCspHeaders(args)` | `@intecion/ipal-kit` | `[csp, Reporting-Endpoints]` (the second only with `reportUri`). |
| `buildAdminCsp(args)` / `buildAdminCspHeaders(args)` | `@intecion/ipal-kit` | Looser policy for Payload's admin: Monaco from `cdn.jsdelivr.net`, `blob:` workers, `https:` images, Live Preview `frame-src 'self'`, `frame-ancestors 'self'`. Rule `{ source: '/admin/:path*', headers: buildAdminCspHeaders({ mode, reportUri }) }` AFTER the site-wide rule. |
| `createCspReportRoute({ onReport?, maxBytes? })` | `@intecion/ipal-kit` | `POST` handler for `reportUri` (`src/app/api/csp-report/route.ts`): both report formats, body cap 16 KB, always `204`; default sink = one `[csp] …` `console.warn` line per violation (Coolify logs). |
| `createCspReportRoute({ onReport?, maxBytes?, maxReports?, rateLimit? })` | `@intecion/ipal-kit` | `POST` handler for `reportUri` (`src/app/api/csp-report/route.ts`): both report formats, body cap 16 KB, always `204`; default sink = one `[csp] …` `console.warn` line per violation (Coolify logs) made by `cspLogLine` — origin / path only, no control characters, values ≤ `CSP_LOG_VALUE_MAX` (128) (1.18.0, audit F1); at most `maxReports` (10) per request, `rateLimit` 60 / min per client (`false` = none); your `onReport` gets the raw values. |
| `accessAllowed(option, answer, { strict?, warn? })`, `strictAccessAnswers(req)` | `@intecion/ipal-kit` | how the plugin reads a project's access callback (`cookieScanner.access`, the doctor's `access`): since 1.18.0 only a literal `true` allows (`strict`, default; `iapl({ strictAccessAnswers: false })` = any truthy answer); a non-boolean answer is reported once per option with the fix `Boolean(req.user)`. `strictAccessAnswers(req)` = the reading of the request's config. Type `AccessAnswerOptions`. |
| `cspLogLine(violation)`, `CSP_LOG_VALUE_MAX` | `@intecion/ipal-kit` | the default CSP log line (safe to log) for your own sink, and its value cap. |
| `buildQueryGuardHook({ listLimit?, refuseOperatorSort? })`, `applyQueryGuard(config, options)`, `capListLimit(args, max?)`, `isOperatorSort(sort)`, `isStaffRequest(req)`, `RefusedSortError`, `DEFAULT_LIST_LIMIT`, `isQueryGuardHook`, `QUERY_GUARD_MARK` | `@intecion/ipal-kit` | 1.18.0 (audit F4, F5; security.md "Lists and sorting"): the `beforeOperation` hook iapl adds to every collection — lists from a non-staff caller over REST / GraphQL capped at 100 (`pagination=false`, `limit=0` included), a `sort` naming a database operator → `400` (logged as `info`). Options `listLimit: false \| { max, staff, exclude }`, `refuseOperatorSort: false`. Put the hook on a collection a plugin adds after iapl. Type `ListLimitOptions`. |
| `applyLockedDocumentsAccess(config, access?)`, `staffOnlyLocks`, `LOCKED_DOCUMENTS_SLUG` | `@intecion/ipal-kit` | 1.18.0: Payload's document locks (`payload-locked-documents`) for staff accounts only (with the second factor); iapl sets it at start (`lockedDocuments: false` = Payload's default, `{ access }` = your rule per operation). Type `LockedDocumentsAccess`. |
| `parseCspReports(body)` | `@intecion/ipal-kit` | Normalises a report body (`csp-report` object or Reporting API array) to `CspViolation[]` — for your own collector. |
| `buildReportingEndpoints(url, group?)`, `cspHeaderKey(mode?)`, `DEFAULT_CSP_REPORT_GROUP` | `@intecion/ipal-kit` | Building blocks: the `Reporting-Endpoints` header, the header name for a mode, the default `report-to` group (`'csp-endpoint'`). |
| `createCspNonce()`, `CSP_NONCE_HEADER` | `@intecion/ipal-kit/next/middleware`, `@intecion/ipal-kit` | A per-request nonce and the request header (`x-nonce`) `createProxy({ csp })` passes it in — for your own proxy. Nonces make pages dynamic (no ISR). |
@@ -744,6 +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.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 }`).
@@ -870,14 +890,25 @@ Bin: `iapl-doctor` (`pnpm exec iapl-doctor [dir] [--json] [--md] [--strict] [--f
| `findFrontend(ctx)` | `@intecion/ipal-kit/doctor` | The folder of the site's pages (`FrontendLayout`: `dir`, `multi`, `ambiguous`, `missingOverride`) — found by structure (any route group with the catch-all page, a localized one first); `layout.frontend` in `iapl-doctor.json` wins. |
| `createLiveFetcher(url, { adminRoute, staging })` | `@intecion/ipal-kit/doctor` | Cached GET-only fetcher for the live rules. |
| `runDeepProbe(ctx)` | `@intecion/ipal-kit/doctor` | `pnpm exec payload run …/dist/modules/doctor/probe.js` in the project → `DoctorStatus`. |
| `collectDoctorStatus(payload)` | `@intecion/ipal-kit/doctor` | Read-only counts: `usersWithout2fa`, `pendingCookies`, `plugin`, `node`. |
| `collectDoctorStatus(payload)` | `@intecion/ipal-kit/doctor` | Read-only counts: `usersWithout2fa`, `pendingCookies`, `media` (images over `IMAGE_RULES`, 1.18.0), `plugin`, `node`. |
| `PERF_BUDGETS`, `SERVER_BUDGET`, `perfBudgets(overrides)`, `overBudget(measured, budget)`, `IMAGE_RULES` | `@intecion/ipal-kit/doctor` | Performance budgets (1.18.0, performance.md): the defaults per profile (`mobile`, `desktop`: `lcp`, `cls`, `inp`, `tbt`, `jsBytes`, `cssBytes`, `fontBytes`, `requests`, `renderBlocking`, `thirdParty`) and per render (`queriesPerRender`); a project's own on top; the broken budgets of one measurement as lines (empty = within budget); the image limits (1.5 MB, 2560 px, AVIF/WebP). Types `PerfBudget`, `PerfMeasurement`, `PerfProfile`, `ServerBudget`. The gate: `iapl-performance/resources/performance.spec.template.ts` + `perf-lab.mjs`. |
| `findUnusedMedia(payload, { limit?, only? })` → `UnusedMedia \| null` | `@intecion/ipal-kit/doctor` | Media of the upload collections no document or global mentions — by id or by file name in a text; `{ byCollection, checked, complete, total }`; reads only. The panel notice lists them only when `complete` |
| `syncTtlIndex(payload, slug, { days, enabled, from })`, `ttlField()`, `TTL_FIELD`, `TTL_INDEX`, `isMongo(config)` | `@intecion/ipal-kit` | The MongoDB TTL index the plugin keeps for the consent log and statistics (1.18.0): created / moved to the current retention (`collMod`) / dropped; records backfilled once from `from`. For a log collection of your own: add `ttlField()`, call it in `onInit`. Type `TtlSyncResult` |
| `withVersionLimit(entity, 'collection' \| 'global', limit?)`, `PLUGIN_VERSION_LIMIT` | `@intecion/ipal-kit` | A collection or global whose versions are on without a limit gets `maxPerDoc` / `max` (default 20); a limit already set wins. iapl() applies it to its own entities |
| `collectGrowth(payload)` → `GrowthStatus`, `growthRules`, `GROWTH_DEFAULTS`, `folderBytes(dir)` | `@intecion/ipal-kit/doctor` | What grows (1.18.0, performance.md §6): per collection documents, bytes (MongoDB) and the oldest record; versions per collection and global with their limit; `payload-kv` entries and expired ones; media no document points at (first 5000 documents) — counts only. The `growth` rules (`growth-size`, `-versions`, `-versions-config`, `-retention`, `-submissions`, `-kv`, `-media`, `-disk`) and their default thresholds (`iapl-doctor.json` → `growth`, type `GrowthThresholds`). |
| `performanceRules` | `@intecion/ipal-kit/doctor` | The doctor's `performance` group (`perf-images-config`, `perf-fonts`, `perf-render-blocking`, `perf-embeds`, `perf-animations`, `perf-budgets`, `perf-live`, `perf-images`) — part of `doctorRules`. |
| `buildDoctorEndpoint({ tokenVar, access })` | `@intecion/ipal-kit/doctor` | `GET /ipal/doctor` (`/api/ipal/doctor`): 404 until the token variable (default `IAPL_DOCTOR_TOKEN`, ≥ 32 chars) is set, Bearer token or `access`, rate-limited. Added by `iapl` unless `doctor: false`. |
| `jobsRunAccess({ secretVar? })` | `@intecion/ipal-kit` | The rule iapl puts on `jobs.access.run` when the project writes none: `cronSecretMatches(req, process.env[secretVar])` or an admin with the second factor. Reuse it in your own rule: `run: (a) => jobsRunAccess()(a) \|\| myCheck(a)`. Type `JobsRunAccessOptions`. |
| `withJobsRunAccess(config, options \| false)` / `jobsRunNotice(config)` | `@intecion/ipal-kit` | The config with that rule (only when `jobs.access.run` is missing; marks `custom.iapl.jobsRunDefault`); the start-up line when the queue is on and the secret is missing (null otherwise). |
| `cronSecretMatches(req, secret)`, `CRON_SECRET_ENV`, `CRON_SECRET_MIN_LENGTH` | `@intecion/ipal-kit` | `Authorization: Bearer <secret>` compared in constant time; an unset or shorter-than-16 secret never matches. Default variable `CRON_SECRET`. |
| `runRouteCheck({ config, appDir?, snapshot?, update?, graphql?, cwd?, log? })` | `@intecion/ipal-kit/doctor` | `routes:check`: every public route (REST, GraphQL, Next route files) against the judged snapshot (default `e2e/routes.snapshot.json`); returns 1 on a route nobody judged or an entry without a reason; `update` writes new routes with an empty reason. Template: `iapl-audit/resources/routes.template.ts` (security.md "Routes nobody has judged"). Type `RunRouteCheckOptions`. |
| `ATTACK_PROBES`, `runAttackProbes(ctx, probes?)`, `createProbeContext(base, { page?, secrets?, timeoutMs?, userAgent? })` | `@intecion/ipal-kit/doctor` | The HTTP attack probes (secret files, bundle secrets, proxy bypass, open redirect, host-header and negotiation cache poisoning, NoSQL operators in sign-in and sort, anonymous where / draft / GraphQL reads, error leaks, unbounded lists, `/_next/image`, headers, methods, 8 MB bodies). Each `{ id, class, title, live, finding?, run(ctx) → { ok, detail, skipped? } }`; `runAttackProbes` runs the `live` ones by default. The doctor's `live-probes` rule; the Playwright template `iapl-audit/resources/attack-probes.spec.template.ts`; your own probe = an object of the same shape (security.md "Security suites"). Types `AttackProbe`, `ProbeContext`, `ProbeAnswer`, `ProbeResult`. |
| `scanCode(path, code)`, `listCodeFiles(root, start)`, `codeFindings(ctx)`, `scanConfigs(next, payload)`, `securityCodeRules`, `SECURITY_OK_MARKER`, `LIVE_PROBE_IDS` | `@intecion/ipal-kit/doctor` | The static security rules behind `code-patterns` and `config-dangerous`: every hit `{ rule, file, line, severity, message, text }` (types `CodeHit`, `CodePatternId`). A correct place is marked `// iapl-security-ok: <why>`. Use `scanCode` in a test of your own to keep a judged allow-list, as the plugin does (`test/security-patterns.allow.json`). |
| `listPublicRoutes(config, { graphqlSchema?, routeFiles? })` | `@intecion/ipal-kit` | Stable ids of every door a built config opens: `GET /api/users/me`, `graphql mutation loginUser`, `next GET /sitemap.xml`. From the config only (same on every database). Types `RouteInventoryOptions`, `GraphqlSchemaLike` (`getQueryType` / `getMutationType`). |
| `listNextRouteFiles(files, read)` | `@intecion/ipal-kit` | Next route handlers of an app directory (`route.ts` with the methods it exports, `robots.ts`, `sitemap.ts`, `manifest.ts`; route groups left out). |
| `compareRouteSnapshot(current, snapshot)` / `updateRouteSnapshot(current, snapshot)` | `@intecion/ipal-kit` | `{ unjudged, unexplained, gone }` against a `RouteSnapshot` (route id → reason); the snapshot after `--update` (new routes with `''`, gone ones dropped). Type `RouteSnapshotDiff`. |
**Types:** `DoctorRule`, `DoctorFinding`, `RuleFinding`, `DoctorReport`, `DoctorConfig`, `DoctorRuleSetting`, `DoctorSeverity`,
**Types:** `AttackProbe`, `ProbeContext`, `ProbeAnswer`, `ProbeResult`, `CodeHit`, `CodePatternId`, `DoctorRule`, `DoctorFinding`, `RuleFinding`, `DoctorReport`, `DoctorConfig`, `DoctorRuleSetting`, `DoctorSeverity`,
`DoctorSource`, `DoctorStatus`, `DoctorContext`, `RunDoctorOptions`, `DoctorEndpointOptions`, `FrontendLayout`.
## Turnstile (`turnstile`) — details: `node_modules/@intecion/ipal-kit/docs/turnstile.md`
+19 -10
View File
@@ -94,14 +94,15 @@ legacy-peer-deps=true
pnpm add @intecion/ipal-kit @payloadcms/plugin-seo @payloadcms/plugin-form-builder \
@payloadcms/storage-s3 @clocklimited/payload-2fa@3.0.0-beta.7 tailwindcss @tailwindcss/postcss
```
**Next.js 16.4.5 or later** (minimum safe version: 16.0.0–16.4.0 have critical advisories, 16.3.0–16.4.4 have
GHSA-mfr8-8qww-v76h — AGENT.md §4 item 11): `pnpm add [email protected] [email protected] sharp@^0.35.5` when
**Next.js 16.4.6 or later** (minimum safe version: 16.0.0–16.4.0 have critical advisories, 16.3.0–16.4.4 have
GHSA-mfr8-8qww-v76h; 16.4.6 is the tested version — AGENT.md §4 item 11): `pnpm add [email protected] [email protected] sharp@^0.35.5` when
create-payload-app gave you an older one.
**Payload 3.94.1** (what the reference site and the starter use; the plugin accepts `^3.90.2`): every `payload` /
`@payloadcms/*` on the same exact version, `react` and `react-dom` 19.3.1 (Payload 3.94 requires `^19.3.1`), and
**Node.js 22.23.5 or later** on the 22 line (`"engines": { "node": ">=22.23.5 <23" }`, `.nvmrc` `22`) — Payload 3.94's
minimum, also in Coolify (Nixpacks picks the patch: check `node -v` in the app's Terminal after the first deploy). After the install, `pnpm audit --prod` → no high or critical; add the `dompurify` and `happy-dom` overrides
from AGENT.md §4 item 12 (`"happy-dom@<21.0.4": "^21.0.4"` fixes two high advisories Lexical still brings in). On an
minimum, also in Coolify (Nixpacks picks the patch: check `node -v` in the app's Terminal after the first deploy). After the install, `pnpm audit --prod` → no high or critical; add the `cross-spawn`, `dompurify`, `happy-dom` and `ws` overrides
from AGENT.md §4 item 12 (`"happy-dom@<21.0.4": "^21.0.4"` fixes two high advisories Lexical still brings in,
`"ws@>=8 <8.23.0": "^8.23.0"` one in Payload's `ws`; a Postgres site also the `esbuild` one listed there). On an
older Payload also the `mongoose` (MongoDB) and `undici` ones listed there. `pnpm exec iapl-doctor` → no
`transitive-min` finding.
`nodemailer`, `lucide-react`, `slugify`, `server-only` come with the plugin — do not add them (your own
@@ -111,7 +112,7 @@ plugin-seo, plugin-form-builder, storage-s3) in `pnpm.overrides` **to the exact
`"build": "cross-env NODE_OPTIONS=\"--max-old-space-size=3072\" next build --webpack"`.
**Check.** `ls node_modules/@intecion/ipal-kit/docs/agent/AGENT.md` exists;
`pnpm ls payload @payloadcms/ui @payloadcms/plugin-seo` — one, identical version; `pnpm ls next sharp` → next ≥ 16.4.5,
`pnpm ls payload @payloadcms/ui @payloadcms/plugin-seo` — one, identical version; `pnpm ls next sharp` → next ≥ 16.4.6,
sharp ≥ 0.35.5; `ls src/middleware.ts` → not found.
404 on `pnpm add` = missing `@intecion:registry` line; 401 = stale `_authToken` in `~/.npmrc` (PROGRAMISTA §1).
@@ -207,7 +208,7 @@ are never added to a new site. Local `.env` with `PAYLOAD_SECRET` ≥ 32 charact
One language: one entry in `locales`, no `[locale]` folder (i18n.md).
**Check.** `pnpm payload generate:importmap` (whiteLabel adds admin components) and `pnpm generate:types` without
errors (the import map lists `@intecion/ipal-kit/admin#TotpRedirectProvider`, `#SafeTotpView` and `#SignInLook`); `pnpm dev`, `/admin`: first-user screen → after saving, TOTP setup is enforced (`/admin/setup-totp?back=%2Fadmin`, QR, no reloading);
errors (the import map lists `@intecion/ipal-kit/admin#TotpRedirectProvider`, `#SafeTotpView` and `#SignInLook`); `pnpm dev`, `/admin`: first-user screen → after saving, TOTP setup is enforced (`/admin/setup-totp?back=%2Fadmin`, QR, no reloading; after the code the confirmation link is in the dev console — no mail set up yet — open it in the same browser, then sign in again);
the panel shows Site settings, Site integrations, Cookies, Form messages, the Forms group, Consent records.
`curl -s -o /dev/null -w '%{http_code}' -X POST localhost:3000/api/ipal/consent -H 'content-type: application/json'
-d '{"id":"0123456789abcdef","version":1,"state":{"necessary":true,"functional":false,"analytics":false,"marketing":false}}'` → `201`.
@@ -240,7 +241,14 @@ the panel shows Site settings, Site integrations, Cookies, Form messages, the Fo
opens everything its role allows. One entity reachable without the code: `custom.ipal.secondFactor`.
**Setup required** (`twoFactor.requireSetup`, default): an account without TOTP reaches only the setup screen; it
has 72 h from its creation (or an admin's "Reopen setup" on the account page), then it is blocked. So create an
account, hand over the password and have the owner set 2FA up at once. **Postgres/SQLite: `pnpm payload
account, hand over the password and have the owner set 2FA up at once.
**Confirmed by e-mail** (`twoFactor.confirmByEmail`, default since 1.18.0): the code only starts the set-up; a link
to the account's own address, opened in the same browser within 30 min, turns it on (then sign in again). So set
up e-mail (Site integrations → E-mail sending, "Send a test e-mail") BEFORE people enrol, and keep `serverURL`
(`NEXT_PUBLIC_SERVER_URL`). The first administrator of a fresh site, with no mail yet: the link is in the dev
server's console / Coolify Logs (`[iapl] 2FA: … Link`); open it in the browser that scanned the code. Check: the
screen says "we sent a link to e…@…", the API still answers 403 until the link is opened. Off:
`confirmByEmail: false` (security.md "Set-up confirmed by e-mail"). **Postgres/SQLite: `pnpm payload
migrate:create` and have the migration applied when the container starts, before the site serves** — `prodMigrations`
or the start command `pnpm payload migrate && pnpm start`, never a pre-deployment command (deployment.md §4.3)
(column `totp_setup_from`, there whenever 2FA is
@@ -480,7 +488,7 @@ and `rel="alternate" type="text/markdown"`; `/pl/nie-ma-takiej` → 404 with con
| `src/app/robots.ts` | `export { getRobots as default } from '@/lib/content'` + `force-dynamic` (AI crawler policy from Site settings → Search engines; `robots` = code only) |
| `src/app/manifest.ts` | `export { manifest as default } from '@/lib/content'` + `force-dynamic` |
| `src/app/api/health/route.ts` | `export { healthRoute as GET } from '@/lib/content'` + `force-dynamic` |
| `src/app/api/csp-report/route.ts` | `import { createCspReportRoute } from '@intecion/ipal-kit'` + `export const POST = createCspReportRoute()` (CSP violation reports → `[csp]` lines in the logs) |
| `src/app/api/csp-report/route.ts` | `import { createCspReportRoute } from '@intecion/ipal-kit'` + `export const POST = createCspReportRoute()` (CSP violation reports → `[csp]` lines in the logs: origins and paths only, 10 per request, 60 requests per client a minute; security.md "Collecting reports") |
```ts
// next.config.ts
@@ -574,7 +582,8 @@ Already wired and required: `markdown: true` (stage 6 proxy), `markdownAlternate
**Check.** `curl -s localhost:3000/llms.txt` → site name and a list of pages with descriptions (`aiSummary`);
`/llms-full.txt` → page content; `curl -s localhost:3000/md/pl` → Markdown of the home page; `curl -s -H 'Accept:
text/markdown' localhost:3000/pl` → the same Markdown; `curl -s -X POST localhost:3000/api/mcp -H 'content-type:
text/markdown' localhost:3000/pl` → the same Markdown, sent `cache-control: private, no-store` with `Vary: Accept`
(`curl -sD- -o/dev/null -H 'Accept: text/markdown' localhost:3000/pl`; 1.18.0, so no CDN stores it as the page); `curl -s -X POST localhost:3000/api/mcp -H 'content-type:
application/json' -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'` → `get_site_info`, `list_pages`,
`search_content`, `get_page`; `/indexnow-key.txt` → `404` until the key is generated in the panel, then the key.
@@ -661,7 +670,7 @@ scaling (5). `●` routes for pages need the database at build time (PROGRAMISTA
6. **Notifications**: form messages in every language.
7. **Site integrations → E-mail sending**: "Sender name" (the client's name; empty = the site name) and **"Sender
address"** (the client's address: with the mail service replies go there). "Sending method" stays **IWSN (built-in)**; choose **Own SMTP server** and fill in its fields **only** when the client asked
for its own server — what is chosen is what is used, an incomplete SMTP server sends nothing. A new site sends through IWSN with nothing picked; picking another option and saving stores it (the panel warns before the save when its settings are incomplete). On the production domain: the block "How e-mails are sent" must say "Connected to IWSN" ("waiting for approval": while the service runs with enrolment "pending" (from its launch until Intecion switches to open enrolment), every new site waits for approval — ask Intecion to approve the host; under open enrolment it is the exception; the real domain enrols by itself at launch although the site was connected on its development address — nothing to press; "The data comes from another site" = the site is non-public (its host matches `developmentHosts`, built in `*.dev.netscale.pl`, or `IAPL_NOINDEX=1`) and holds a copy of another site's data: press "Connect again" only if the copy should send — on the production domain it means `IAPL_NOINDEX` was left set. A development address under `*.dev.netscale.pl` needs nothing; a staging or test copy on any other host must have its host in `iapl({ developmentHosts: […] })` (an array of host patterns: a single string, an empty entry or a lone `*` stops the start) or `IAPL_NOINDEX=1`, or it mails the real addresses in its data), then **Send test e-mail** → "through IWSN". Turnstile (for testing site
for its own server — what is chosen is what is used, an incomplete SMTP server sends nothing. A new site sends through IWSN with nothing picked; picking another option and saving stores it (the panel warns before the save when its settings are incomplete). On the production domain: the block "How e-mails are sent" must say "Connected to IWSN" ("Waiting for confirmation": press "Połącz z IWSN" and have a person of Intecion confirm the site on the page that opens — the owner's step, @intecion.com sign-in; "waiting for approval" with no button: ask Intecion; the real domain enrols by itself at launch although the site was connected on its development address — nothing to press; "The data comes from another site" = the site is non-public (its host matches `developmentHosts`, built in `*.dev.netscale.pl`, or `IAPL_NOINDEX=1`) and holds a copy of another site's data: press "Connect again" only if the copy should send — on the production domain it means `IAPL_NOINDEX` was left set. A development address under `*.dev.netscale.pl` needs nothing; a staging or test copy on any other host must have its host in `iapl({ developmentHosts: […] })` (an array of host patterns: a single string, an empty entry or a lone `*` stops the start) or `IAPL_NOINDEX=1`, or it mails the real addresses in its data), then **Send test e-mail** → "through IWSN". Turnstile (for testing site
`1x00000000000000000000AA`, secret `1x0000000000000000000000000000000AA`; production keys from the client), analytics/pixel
IDs, IndexNow → generate key. Mail/Turnstile errors show up as a dashboard alert.
8. **Forms**: check the addresses in the Emails tab of the seeded forms.
+105 -6
View File
@@ -25,6 +25,92 @@ 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 "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
counted per client IP and address. Without it every visitor shares one bucket (20× the limit).
2. A staff collection with its own `auth.maxLoginAttempts` / `lockTime` keeps them; otherwise Payload's lock is now 50
failures for an hour (beside 5 per IP and address in 15 minutes). Payload's behaviour back: `accounts: { signInLimit: false }`.
3. A panel or front end that signs **staff** in from another domain: `accounts: { signInSameOrigin: { origins: ['https://…'] } }`
(or `false`). A proxy that rewrites `Host`: set `serverURL`. Customer / visitor logins are not affected.
4. Scripts or integrations that change their OWN e-mail or password over the API send `currentPassword`; editors
see "Current password" on their account page. Off: `accounts: { confirmOwnChanges: false }`.
**Check:** five wrong passwords for an editor from one address → `429` there, `200` from another; the account page
shows "Current password"; `curl -X POST <site>/api/users/login -H 'Origin: https://other.example' …` → `403`.
**→ 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
are not affected. Nothing to wire, no migration, no import-map change. Off: `twoFactor: { confirmByEmail: false }`.
**Check:** `pnpm exec iapl-doctor --deep` shows no `2fa-enrolment-mail` error; a test editor scans the code → the
screen says "we sent a link to …", the link opened in the same browser → "Two-step verification is on".
**→ 1.18.0, security audit fixes (CHANGELOG 1.18.0 "Security audit 2026-12"; security.md "Lists and sorting") — no
migration, no import-map change; check before deploying:** (1) **public lists are capped at 100** for callers that are
not staff (REST / GraphQL; the Local API and the panel are not touched): a client-side script that reads more than
100 documents anonymously gets `hasNextPage: true` — page through, or `listLimit: { max }` / `{ exclude: ['slug'] }`
/ `false`; (2) a `?sort=$…` answers `400` (`refuseOperatorSort: false` = Payload's way); (3) Payload's document locks
are staff only (`lockedDocuments: false` = Payload's default); (4) the negotiated Markdown at a page URL is
`private, no-store` + `Vary: Accept`, while HTML pages keep their caching (ISR unchanged) — a proxy of your own that
rewrites to `/md/…` copies the headers (content.md); `markdown: { negotiate: false }` turns negotiation off; (5) CSP
report log lines show origins and paths, at most 10 per request and 60 requests per client a minute (a log parser
that read full URLs adapts; `createCspReportRoute({ maxReports, rateLimit })`); (6) a text field of your own whose
value goes into `href` (social profiles, a website): `buildUrlField()` and `safeHref()` at render (no schema change);
(7) **access callbacks are strict:** `cookieScanner.access` and the doctor's `access` allow only on a literal `true`
— a callback that returns `req.user` now refuses (`403`): return `Boolean(req.user)` or a role check; the old reading
back: `iapl({ strictAccessAnswers: false })`; (8) the first `iapl-doctor --only security` run shows the new `code-*` / `config-dangerous` rules — judge each, mark a
correct place `// iapl-security-ok: <why>`. **Check:** `curl -s '<site>/api/pages?limit=100000' | jq .limit` → `100`;
`curl -s -o /dev/null -w '%{http_code}' '<site>/api/pages?sort=%24where'` → `400`;
`pnpm exec iapl-doctor --url <site> --only live-probes` → no finding.
**→ 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 <site>/api/pages/versions` as a visitor → 200 (published only), not 500.
**→ 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 <CRON_SECRET>` 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
the header, 200 with it. (2) A front end that posted to `/api/form-submissions` as a customer account (not through
`submitForm`): move it to `submitForm` / `createSubmitAction`, or set `forms.formSubmissionOverrides.access.create`.
(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.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
button, the last footer link can be tapped. Bottom padding a project added by hand for the button: remove it (the
plugin counts existing padding, so it is not doubled, but it is no longer needed). Amount by hand:
`--ipal-cookie-button-space` on the footer (`0` = none); no room: `reserve={false}`. The placement before:
`cookieButton={<CookieButton avoid={COOKIE_BUTTON_AVOID} />}` on `SiteProviders`. A project e2e that expects the button
above the footer, or an exact footer height after a decision: update it.
**→ 1.17.1:** (1) `src/proxy.ts`: replace the matcher literal with
`['/((?!(?:api|admin|_next)(?:/|$)|.*\\..*).*)']` (i18n.md "Next matcher"; `iapl-doctor` rule `proxy-matcher`).
The old one skipped every page whose first segment only starts with `api`, `admin` or `_next` (`/administracja`):
@@ -103,7 +189,7 @@ the banner → `<CookieBanner settings="detailed">` and remove the copy. With `d
`buildGlobalRevalidateHook({ revalidatePath })`; `consentFieldName` passed only because the option was ignored →
`forms.consentFieldName` works now; your own seed guard / upsert code → `@intecion/ipal-kit/seed` (`createSeeder`).
**Every upgrade — Next.js 16.4.5 or later** (AGENT.md §4 item 11): `pnpm ls next sharp`; below 16.4.5 →
**Every upgrade — Next.js 16.4.6 or later** (AGENT.md §4 item 11): `pnpm ls next sharp`; below 16.4.6 →
`pnpm add [email protected] [email protected] sharp@^0.35.5`, `rm -rf .next`, build, redeploy on Coolify
(a new image ships the fixed next and sharp). **Check:** `pnpm exec iapl-doctor` → no `next-min` finding; `pnpm dev`
prints no security-upgrade warning.
@@ -121,11 +207,15 @@ Postgres/SQLite run `pnpm payload migrate:create` anyway and commit it if it is
saves; `pnpm exec iapl-doctor` → no `versions` finding; Coolify app → Terminal → `node -v` → 22.23.5 or later.
**Every upgrade — dependency advisories** (AGENT.md §4 item 12): `pnpm audit --prod`; on Payload 3.94.x add the
`dompurify` and `happy-dom` overrides to `pnpm.overrides`; on an older Payload also `mongoose` (MongoDB sites; 3.90–3.93
`cross-spawn`, `dompurify`, `happy-dom` and `ws` overrides to `pnpm.overrides` (`ws`: GHSA-37g9-w4hg-h9qr, high;
`cross-spawn`: GHSA-ghv9-86vm-4v8m, critical, Windows only; both 1.18.0); a Postgres site also
`"esbuild@<0.25.0": "^0.25.12"` (via drizzle-kit, AGENT.md §4 item 12); on an older Payload also `mongoose` (MongoDB sites; 3.90–3.93
pin 8.24.1, which has a critical advisory, GHSA-pcrw-h46h-c93h, and four more) and `undici` (3.90–3.91):
```json
"cross-spawn@>=7 <7.1.0": "^7.1.2",
"dompurify@<3.4.17": "^3.4.17",
"happy-dom@<21.0.4": "^21.0.4",
"ws@>=8 <8.23.0": "^8.23.0",
"mongoose@>=8 <8.24.7": "~8.24.10",
"undici@>=7 <7.30.1": "^7.30.1"
```
@@ -144,7 +234,7 @@ panel opens and a document saves.
`engines`. Remove `nodemailer` and `@types/nodemailer` from the project's own `package.json` if someone added them
(the plugin's copy is the one `mailAdapter` uses). **Check:** Site integrations → E-mail sending → send a test
e-mail over SMTP (and over Microsoft Graph when the project uses it).
3. **Next.js** — the "Every upgrade — Next.js" step above (today 16.4.5 or later, `sharp@^0.35.5`).
3. **Next.js** — the "Every upgrade — Next.js" step above (today 16.4.6 or later, `sharp@^0.35.5`).
4. **Dependency advisories** — the "Every upgrade — dependency advisories" step above (`dompurify` / `graphql-scalars` /
`undici` overrides on payload 3.90.x). **Check:** `pnpm audit --prod` → no high or critical.
5. **Cookie list kept by hand** → offer `cookieScanner: true` (+ `crawl: true` with `IAPL_COOKIE_SCAN_URL`,
@@ -252,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.
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://<site>`), 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.
@@ -648,7 +738,7 @@ PROGRAMISTA §6, items 73–75; email.md; AGENT.md §7.2) — nothing to run; re
3. **For a site that will use the mail service:** `serverURL` is the public address the site answers on without a
redirect; no proxy or WAF rule blocks `/api/iapl/mail-relay/confirm`; `trailingSlash: true` or another `routes.api` →
Intecion sets the site's confirm address first; "Sender address" is filled in (replies go there); the client's
processing agreement names the service. Tell Intecion the host: while the service runs with enrolment "pending" (from its launch until Intecion switches to open enrolment), every new site waits for approval (the panel says "waiting for approval"); under open enrolment a site is active as soon as it enrols.
processing agreement names the service. A new site waits until a person of Intecion confirms it: "Połącz z IWSN" in the panel (contract 1.8.0).
**Launch and a domain move need nothing:** the real domain enrols by itself although the database holds the
development address's connection. **A staging or test copy of the database** neither enrols nor sends by itself
**when it is non-public**: its host matches `iapl({ developmentHosts })` — built in `*.dev.netscale.pl`, so the
@@ -670,7 +760,16 @@ PROGRAMISTA §6, items 73–75; email.md; AGENT.md §7.2) — nothing to run; re
**Check:** `pnpm exec iapl-doctor --deep --url <site>` → no `mail-transport` / `mail-relay-state` / `mail-reply-address` /
`mail-relay-route` finding (or only `mail-graph-deprecated` on a Graph site); Site integrations → E-mail sending →
**Send test e-mail** names the transport you expect; a form submission arrives. **The service is live at
`https://webservices.intecion.net/mail`; while the service runs with enrolment "pending" (from its launch until Intecion switches to open enrolment), every new site waits for approval — keep SMTP until it is approved, or `relay: false`.**
`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 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`
error after the upgrade): Site integrations → E-mail sending → **"Połącz z IWSN"** → a person of Intecion confirms
it on the page that opens (an @intecion.com sign-in — the owner's step, tell them) → the block says "Connected to
IWSN" by itself. Then send a test e-mail.
3. A project that does not want the button: `mail: { relay: { connectButton: false } }` (no button, no route).
**→ 1.17.1, e-mail (CHANGELOG 1.17.1 point 5; PROGRAMISTA §6, item 82; email.md "Which transport a send takes"; AGENT.md §7.2) — nothing to run, one check:**
1. **MongoDB: no migration. Postgres / SQLite: `pnpm payload migrate:create`** (the new field `emailMethod` is a column),
+1 -1
View File
@@ -47,7 +47,7 @@ Write everything in this file in English.
<!-- /starter:decisions -->
<!-- iapl:start -->
## IAPL 1.17.1 — agent guide
## IAPL 1.18.0 — agent guide
<!-- Managed by `pnpm exec iapl-skills` — edits between the markers are overwritten. -->
This project is built on `@intecion/ipal-kit` (a Payload CMS 3 plugin). Before you write code:
+68
View File
@@ -0,0 +1,68 @@
import { ATTACK_PROBES, createProbeContext } from '@intecion/ipal-kit/doctor'
import { expect, test } from '@playwright/test'
import { editorTestAccount, totp } from './totp'
/**
* Attack probes on the BUILT site (security audit 2026-12; docs/security.md → "Security suites"): every probe of
* the plugin's ATTACK_PROBES, the live-safe ones and those only for a local build (8 MB bodies), then what needs a
* signed-in session: CSRF on the API and the session cookie's flags. `pnpm e2e:built` runs it after a webpack and a
* Turbopack build. A probe tied to an open audit finding is expected to fail (test.fail) until the fix lands.
*
* The secrets the bundle check looks for are this site's own values from reference/.env.
*/
const env = process.env
const dbPassword = (() => {
try {
return decodeURIComponent(new URL(env.DATABASE_URI ?? '').password)
} catch {
return ''
}
})()
const secrets = [env.PAYLOAD_SECRET, env.CRON_SECRET, env.IAPL_COOKIE_SCAN_TOKEN, env.IAPL_DOCTOR_TOKEN, env.R2_SECRET_ACCESS_KEY, env.E2E_ADMIN_PASSWORD, env.E2E_TOTP_SECRET, dbPassword].filter((s): s is string => !!s && s.length >= 8)
test.describe('attack probes', () => {
for (const probe of ATTACK_PROBES) {
test(`${probe.class}: ${probe.title}`, async ({ baseURL }) => {
if (probe.finding) {test.fail(true, `audit finding ${probe.finding} is open (security-audit-2026-12-findings.md)`)}
const { result } = { result: await probe.run(createProbeContext(baseURL!, { page: '/pl', secrets })) }
test.skip(!!result.skipped, result.skipped)
expect(result.ok, result.detail).toBe(true)
})
}
})
test.describe('attack probes with a session', () => {
test('CSRF: the editor\'s cookie does not work from another origin (REST write, GraphQL mutation)', async ({ baseURL, playwright }) => {
const { E2E_ADMIN_EMAIL: adminEmail, E2E_ADMIN_PASSWORD: password, E2E_TOTP_SECRET: secret } = env
test.skip(!adminEmail || !password || !secret, 'E2E_* test admin not configured')
const api = await playwright.request.newContext({ baseURL, extraHTTPHeaders: { origin: baseURL! } })
expect((await api.post('/api/users/login', { data: { email: editorTestAccount(adminEmail!), password } })).status()).toBe(200)
expect((await (await api.post('/api/verify-totp', { data: { token: totp(secret!) } })).json()).ok).toBe(true)
// the same session, same origin: the write is allowed (proves the cookie works), with a body that changes nothing
const own = await api.get('/api/users/me')
expect(((await own.json()) as { user?: unknown }).user).toBeTruthy()
const foreign = { origin: 'https://evil.example', referer: 'https://evil.example/', 'sec-fetch-site': 'cross-site' }
const me = await api.get('/api/users/me', { headers: foreign })
expect([me.status(), ((await me.json()) as { user?: unknown }).user ?? null], 'a cross-site request must not be signed in').toEqual([200, null])
const write = await api.post('/api/globals/header', { data: {}, headers: foreign })
expect([401, 403]).toContain(write.status())
const gql = await api.post('/api/graphql', { data: { query: 'mutation { updateHeader(data: {}) { id } }' }, headers: foreign })
expect(gql.status()).toBeLessThan(500)
expect(await gql.text()).not.toMatch(/"updateHeader"\s*:\s*\{/)
await api.dispose()
})
test('session cookie: HttpOnly and SameSite, never readable by script', async ({ baseURL, playwright }) => {
const { E2E_ADMIN_EMAIL: adminEmail, E2E_ADMIN_PASSWORD: password } = env
test.skip(!adminEmail || !password, 'E2E_* test admin not configured')
const api = await playwright.request.newContext({ baseURL, extraHTTPHeaders: { origin: baseURL! } })
const res = await api.post('/api/users/login', { data: { email: editorTestAccount(adminEmail!), password } })
expect(res.status()).toBe(200)
const cookie = res.headersArray().filter((h) => h.name.toLowerCase() === 'set-cookie').map((h) => h.value).find((v) => /-token=/.test(v))
expect(cookie, 'the login sets the session cookie').toBeTruthy()
expect(cookie).toMatch(/;\s*HttpOnly/i)
expect(cookie).toMatch(/;\s*SameSite=(?:Lax|Strict)/i)
await api.dispose()
})
})
+11 -1
View File
@@ -36,7 +36,7 @@ async function signIn(caller: Caller, baseURL: string, playwright: { request: {
async function ask(api: APIRequestContext, door: (typeof DOORS)[number]): Promise<DoorAnswer> {
const res = door.graphql
? await api.post('/api/graphql', { data: { query: door.graphql } })
: await api.fetch(door.path!, { data: door.body, maxRedirects: 0, method: door.method ?? 'GET' })
: await api.fetch(door.path!, { data: door.body, headers: door.headers, maxRedirects: 0, method: door.method ?? 'GET' })
const text = await res.text()
let body: unknown = text
try {
@@ -72,6 +72,16 @@ for (const caller of ['anonymous', 'customer', 'editor'] as const) {
})
}
test.describe('closed doors: the cron secret opens the job queue (IAWL idea 35, 1.18.0)', () => {
test('Authorization: Bearer <CRON_SECRET> 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}` } })
const res = await cron.get('/api/payload-jobs/run?limit=1')
expect([res.status(), await res.text()]).toEqual([200, expect.any(String)])
await cron.dispose()
})
})
test.describe('closed doors: the proxy skips /api, /admin and /_next as whole segments only (IAWL idea 36)', () => {
test('the admin and the API are not sent to a locale; a page that only starts with those letters is', async ({ request }) => {
for (const path of ['/admin', '/api/health']) {
+19 -21
View File
@@ -24,6 +24,8 @@ export type Door = {
closed?: (answer: DoorAnswer, ctx: { email?: string }) => boolean
closedFor: Caller[]
graphql?: string
/** Extra request headers (e.g. a wrong bearer token). */
headers?: Record<string, string>
method?: 'DELETE' | 'GET' | 'PATCH' | 'POST'
name: string
/** Open for these callers while the owner decides (the finding's question). */
@@ -56,7 +58,11 @@ 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) ---------------------------------------------------------
{ closedFor: ALL, name: 'Payload\'s job queue has no run route (no jobs on this site)', path: '/api/payload-jobs/run', closed: notFound },
// 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' },
{ closedFor: ALL, name: 'a wrong cron secret runs nothing', path: '/api/payload-jobs/run', headers: { authorization: 'Bearer not-the-cron-secret-not-the-cron-secret' } },
{ 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 cannot be started without the schedule\'s token', path: '/api/ipal/cookie-crawl' },
{ closedFor: OUTSIDERS, name: 'the crawl status', path: '/api/ipal/cookie-crawl' },
@@ -73,6 +79,8 @@ export const DOORS: Door[] = [
{ closedFor: ALL, method: 'POST', name: 'the mail service cannot be disconnected', path: '/api/iapl/mail-relay/disconnect' },
{ closedFor: ALL, method: 'POST', name: 'the confirm route answers 404 without a nonce of this site', path: '/api/iapl/mail-relay/confirm', body: { nonce: 'n'.repeat(40), state: 'active', token: `ims_${'a'.repeat(43)}` }, closed: notFound },
{ body: { id: NO_ID }, closedFor: ALL, method: 'POST', name: 'another account\'s 2FA cannot be reset', path: '/api/ipal/two-factor/reset' },
{ body: { userId: NO_ID }, closedFor: ALL, method: 'POST', name: 'another account\'s waiting 2FA set-up cannot be confirmed (1.18.0)', path: '/api/iapl/two-factor/confirm-pending' },
{ body: 'u=1&t=' + 'x'.repeat(43), closedFor: ['anonymous'], headers: { 'content-type': 'application/x-www-form-urlencoded' }, method: 'POST', name: 'a made-up 2FA confirmation link turns nothing on (1.18.0)', path: '/api/iapl/two-factor/confirm', closed: ({ status }) => status === 400 || status === 403 },
// payload-2fa refuses with HTTP 200 and `{ ok: false }` (its own convention), so the body is what is judged
{ body: { id: NO_ID }, closedFor: ALL, method: 'POST', name: 'another account\'s 2FA cannot be removed (payload-2fa)', path: '/api/admin/remove-user-totp', closed: refusedOrNotOk },
{ body: { id: NO_ID }, closedFor: ALL, method: 'POST', name: 'another account\'s 2FA cannot be reset (payload-2fa)', path: '/api/admin/reset-user-totp', closed: refusedOrNotOk },
@@ -94,30 +102,20 @@ 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' },
{
body: { form: NO_ID, submissionData: [] },
closedFor: ['anonymous'],
method: 'POST',
name: 'a submission cannot be posted past submitForm (rate limit, Turnstile, consent, validation)',
openFor: { callers: ['customer'], question: 'Q1 (iawl-ideas-c-findings.md): any signed-in account may POST /api/form-submissions' },
path: '/api/form-submissions',
closed: forbidden,
},
// 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.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 },
{ body: {}, closedFor: OUTSIDERS, method: 'POST', name: 'the company data cannot be saved', path: '/api/globals/company', closed: forbidden },
{
body: {},
closedFor: ['anonymous'],
method: 'PATCH',
name: 'pages cannot be changed',
openFor: { callers: ['customer'], question: 'Q3: collections without their own write rules run on Payload\'s default (any signed-in account)' },
path: `/api/pages/${NO_ID}`,
closed: forbidden,
},
{
closedFor: ['anonymous'],
closedFor: OUTSIDERS,
name: 'who edits what (Payload\'s document locks, with the editor\'s account)',
openFor: { callers: ['customer'], question: 'Q3: payload-locked-documents runs on Payload\'s default (any signed-in account)' },
// Payload's own collection: staff only since 1.18.0 (iapl `lockedDocuments`, the owner's Q3 answer (a)); Payload's
// default let any signed-in account in
path: '/api/payload-locked-documents',
closed: forbidden,
},
+32
View File
@@ -0,0 +1,32 @@
import type { SinkMessage } from './smtp-sink'
/**
* twoFactor.confirmByEmail (IAPL 1.18.0, on by default): the first set-up of two-step verification waits for a link
* sent to the account's e-mail. The specs read that link from the mail sink (e2e/smtp-sink.ts; create-test-admin.ts
* points the site's SMTP at it).
*/
/** A raw message body as text: quoted-printable soft breaks and escapes undone. */
export const decodeMail = (raw: string): string =>
raw.replace(/=\r?\n/g, '').replace(/=([0-9A-F]{2})/g, (_, hex: string) => String.fromCharCode(parseInt(hex, 16)))
/** The confirmation link of the latest message to `email`, or null. */
export function enrolmentLink(messages: SinkMessage[], email: string): null | URL {
for (const message of [...messages].reverse()) {
if (!message.to.some((to) => to.toLowerCase().includes(email.toLowerCase()))) {continue}
const found = decodeMail(message.data).match(/https?:\/\/[^\s"<>]+\/two-factor\/confirm\?u=[^\s"<>&]+&(?:amp;)?t=[\w-]+/)
if (found) {return new URL(found[0].replace('&amp;', '&'))}
}
return null
}
/** Waits until a message with the confirmation link for `email` arrives (mail goes out right after the request). */
export async function waitForEnrolmentLink(messages: SinkMessage[], email: string, timeoutMs = 10_000): Promise<URL> {
const until = Date.now() + timeoutMs
for (;;) {
const link = enrolmentLink(messages, email)
if (link) {return link}
if (Date.now() > until) {throw new Error(`no confirmation e-mail for ${email} in the mail sink`)}
await new Promise((r) => setTimeout(r, 200))
}
}
+3
View File
@@ -20,6 +20,9 @@ export const e2eEarlyStaff: Plugin = (config: Config) =>
E2E_LATE_STAFF
? {
...config,
// one do-nothing task turns Payload's job queue on, so the closed-doors spec can ask its run route
// (no `jobs.access.run` here: iapl's default applies — an admin with the second factor, or Bearer CRON_SECRET)
jobs: { ...config.jobs, tasks: [...(config.jobs?.tasks ?? []), { slug: 'e2eNoop', handler: () => ({ output: {} }) }] },
collections: [
...(config.collections ?? []),
{ slug: 'e2e-crew', auth: true, fields: [{ name: 'roles', type: 'select', hasMany: true, options: ['user', 'editor', 'admin', 'boss'], saveToJWT: true }] },
+2 -1
View File
@@ -91,7 +91,8 @@ test.describe('a late staff collection on a built site', () => {
}]).toEqual([slug, { create: 403, integrations: 403, patch: 403, users: 403, zDelete: 403 }])
await api.patch(`/api/${slug}/${itsUserId}`, { data: { roles: ['admin'] } })
expect((await (await admin.get(`/api/${slug}/${itsUserId}`)).json()).roles, `${slug}: its own roles`).toEqual(['user'])
expect((await api.patch(`/api/${slug}/${itsUserId}`, { data: { password: `own-${PASSWORD}` } })).status(), `${slug}: its own password`).toBe(200)
// 1.18.0: with the current password (accounts.confirmOwnChanges)
expect((await api.patch(`/api/${slug}/${itsUserId}`, { data: { currentPassword: PASSWORD, password: `own-${PASSWORD}` } })).status(), `${slug}: its own password`).toBe(200)
for (const id of [itsAdminId, itsUserId]) {expect((await admin.delete(`/api/${slug}/${id}`)).status()).toBe(200)}
await api.dispose()
}
+35
View File
@@ -104,4 +104,39 @@ test.describe('the mail service', () => {
await page.waitForLoadState('networkidle')
for (const body of [await page.content(), await status.text(), ...seen]) {expect(body).not.toContain('ims_')}
})
test('"Connect to IWSN" (contract 1.8.0 §2.1): the link opens in a new tab, the person confirms, the block sees it by itself', async ({ page }) => {
// the site enrolled above; the service now holds it for confirmation by a person of Intecion
relay.site(site)!.state = 'pending'
await page.goto('/admin/login')
await page.fill('#field-email', email!)
await page.fill('#field-password', password!)
await page.click('.form-submit button')
await page.waitForURL(/verify-totp|\/admin(\?|$)/, { waitUntil: 'commit' })
if (page.url().includes('verify-totp')) {
await page.getByRole('textbox').first().click()
await page.keyboard.type(totp(secret!))
}
await expect(page).toHaveTitle(/Dashboard|Pulpit/, { timeout: 20_000 })
await page.goto('/admin/globals/site-integrations')
await page.getByRole('tab', { name: /E-mail sending|Wysyłka e-mail/ }).or(page.getByRole('button', { name: /E-mail sending|Wysyłka e-mail/ })).first().click()
const block = page.locator('[data-mail-transport]')
await block.getByRole('button', { name: /Check now|Sprawdź teraz/ }).click()
const connect = block.locator('[data-mail-relay-connect]')
await expect(connect).toBeVisible({ timeout: 20_000 })
await expect(block).toContainText(/Waiting for confirmation|Oczekuje na potwierdzenie/)
// no link was asked for by the page itself
expect(relay.requests.filter((r) => r.path === '/v1/connect')).toEqual([])
const [tab] = await Promise.all([page.waitForEvent('popup'), connect.click()])
const url = tab.url()
expect(url.startsWith(`${server.url}/connect?ref=`)).toBe(true)
expect(await tab.evaluate(() => window.opener)).toBeNull()
// the person of Intecion signs in and presses "Potwierdź" on the service's page (the stand-in does it here)
expect(relay.confirmConnect(url)).toBe(true)
await tab.close()
// the block asks every 5 s and shows the result without a reload
await expect(block).toContainText(/Connected to IWSN|Połączono z IWSN/, { timeout: 20_000 })
await expect(connect).toHaveCount(0)
})
})
+95
View File
@@ -0,0 +1,95 @@
import { expect, test } from '@playwright/test'
import { randomUUID } from 'node:crypto'
import { waitForEnrolmentLink } from './enrolment'
import { startSmtpSink } from './smtp-sink'
import { totp } from './totp'
/**
* On the BUILT site (pnpm e2e:built, webpack and Turbopack), what 1.18.0 changed for one's own account and the
* sign-in of staff:
* - the account page has a "Current password" field; saving a new e-mail without it is refused on that field,
* with it the e-mail changes (accounts.confirmOwnChanges);
* - five failed sign-ins from one place for an address answer 429 there, the owner elsewhere still signs in
* (accounts.signInLimit); a staff sign-in from another origin gets 403 (accounts.signInSameOrigin).
* The accounts are fresh ones made here (the test admins are never touched). Needs the E2E_* test admin.
*/
const { E2E_ADMIN_EMAIL: adminEmail, E2E_ADMIN_PASSWORD: adminPassword, E2E_TOTP_SECRET: secret } = process.env
const SECRET = 'JPURUZNWYTZX2L42MT4SS7736WWNQWBM'
test('own account: a new e-mail needs the current password, in the panel', async ({ baseURL, browser, playwright }) => {
test.skip(!adminEmail || !adminPassword || !secret, 'E2E_* test admin not configured')
test.setTimeout(120_000)
const email = `own-${randomUUID().slice(0, 8)}@example.com`
const password = `O-${randomUUID()}`
// made by the test admin; its TOTP set up over the API with a secret of our own
const admin = await playwright.request.newContext({ baseURL, extraHTTPHeaders: { origin: baseURL! } })
expect((await admin.post('/api/users/login', { data: { email: adminEmail, password: adminPassword } })).status()).toBe(200)
expect((await (await admin.post('/api/verify-totp', { data: { token: totp(secret!) } })).json()).ok).toBe(true)
expect((await admin.post('/api/users', { data: { email, password, roles: ['editor'] } })).status()).toBe(201)
await admin.dispose()
const own = await playwright.request.newContext({ baseURL, extraHTTPHeaders: { origin: baseURL! } })
expect((await own.post('/api/users/login', { data: { email, password } })).status()).toBe(200)
// the first set-up waits for its e-mail link (twoFactor.confirmByEmail): read it from the mail sink, confirm it here
const sink = await startSmtpSink(Number(process.env.E2E_SMTP_PORT ?? 2526))
try {
expect((await (await own.post('/api/setup-totp', { data: { secret: SECRET, token: totp(SECRET) } })).json()).pending).toBe(true)
const link = await waitForEnrolmentLink(sink.messages, email)
const done = await own.post('/api/iapl/two-factor/confirm', { form: { t: link.searchParams.get('t')!, u: link.searchParams.get('u')! } })
expect(done.status()).toBe(200)
} finally {
await sink.close()
}
await own.dispose()
const context = await browser.newContext({ baseURL })
const page = await context.newPage()
await page.goto('/admin/login')
await page.fill('#field-email', email)
await page.fill('#field-password', password)
await page.click('.form-submit button')
await page.waitForURL(/verify-totp/, { waitUntil: 'commit' })
await page.getByRole('textbox').first().click()
await page.keyboard.type(totp(SECRET))
await expect(page).toHaveTitle(/Dashboard|Pulpit/, { timeout: 20_000 })
await page.goto('/admin/account')
const current = page.locator('#field-currentPassword')
await expect(current).toBeVisible({ timeout: 20_000 })
await expect(current).toHaveAttribute('type', 'password')
const renamed = `renamed-${randomUUID().slice(0, 8)}@example.com`
await page.fill('#field-email', renamed)
await page.click('#action-save')
await expect(page.getByText(/Enter your current password|Wpisz obecne hasło/).first()).toBeVisible({ timeout: 20_000 })
await current.fill(password)
await page.click('#action-save')
await expect.poll(async () => {
const check = await playwright.request.newContext({ baseURL })
const status = (await check.post('/api/users/login', { data: { email: renamed, password } })).status()
await check.dispose()
return status
}, { timeout: 20_000 }).toBe(200)
await context.close()
})
test('staff sign-in: five failures from one place answer 429 there, not elsewhere; another origin gets 403', async ({ baseURL, playwright }) => {
test.skip(!adminEmail || !adminPassword || !secret, 'E2E_* test admin not configured')
const email = `limit-${randomUUID().slice(0, 8)}@example.com`
const password = `S-${randomUUID()}`
const admin = await playwright.request.newContext({ baseURL, extraHTTPHeaders: { origin: baseURL! } })
expect((await admin.post('/api/users/login', { data: { email: adminEmail, password: adminPassword } })).status()).toBe(200)
expect((await (await admin.post('/api/verify-totp', { data: { token: totp(secret!) } })).json()).ok).toBe(true)
expect((await admin.post('/api/users', { data: { email, password, roles: ['editor'] } })).status()).toBe(201)
await admin.dispose()
// the site reads the client address from IAPL_IP_HEADER (reference/.env: x-forwarded-for, one proxy)
const from = async (ip: string) => playwright.request.newContext({ baseURL, extraHTTPHeaders: { 'x-forwarded-for': ip } })
const stranger = await from('198.51.100.123')
for (let i = 0; i < 5; i++) {expect((await stranger.post('/api/users/login', { data: { email, password: 'a-wrong-password' } })).status()).toBe(401)}
expect((await stranger.post('/api/users/login', { data: { email, password } })).status()).toBe(429)
const owner = await from('203.0.113.123')
expect((await owner.post('/api/users/login', { data: { email, password } })).status()).toBe(200)
const foreign = await owner.post('/api/users/login', { data: { email, password }, headers: { origin: 'https://blog.example.test', 'sec-fetch-site': 'same-site' } })
expect(foreign.status()).toBe(403)
await stranger.dispose()
await owner.dispose()
})
+175
View File
@@ -0,0 +1,175 @@
/**
* Lab measurements of one page in Chromium (Playwright + the DevTools protocol) — used by `pnpm perf:measure`
* (scripts/perf-measure.mjs, numbers for docs/performance.md) and by the budget gate (e2e/performance.spec.ts).
*
* Profiles follow Lighthouse's defaults so the numbers compare with PageSpeed Insights' lab data:
* - mobile: 412×823 at DPR 1.75, "Slow 4G" (150 ms RTT, 1.6 Mbit/s down, 750 kbit/s up), CPU 4× slower;
* - desktop: 1350×940, 40 ms RTT, 10 Mbit/s, CPU 1×.
* Every run is a fresh browser context (empty HTTP cache, no cookies): a first visit, the worst ordinary case.
*
* What is measured (all from the browser itself, web.dev/articles/vitals):
* ttfb, fcp, lcp (+ the LCP element: tag, src, loading, fetchpriority), cls (session windows, as web-vitals does),
* tbt (sum of long-task time over 50 ms between FCP and the end of the run: the lab stand-in for INP),
* inp (the longest Event Timing entry of one scripted interaction: a click on the page's first visible button),
* scriptMs (CDP Performance.ScriptDuration: parse, compile, run and hydrate), requests, bytes per type
* (transfer size, compressed), renderBlocking (resource timing renderBlockingStatus), thirdParty (requests to
* another origin before any consent is given). Next's link prefetches (`?_rsc=`, made when the browser is idle) are
* counted apart (`prefetches`): they are not part of the page's load and come at a different moment each run.
* Option `blockThirdParty` (the gate): requests to another origin are recorded, then aborted — a slow external host
* cannot hold the page's load event, and the numbers are the site's own.
*/
import { chromium } from '@playwright/test'
export const PROFILES = {
desktop: { cpu: 1, network: { downloadThroughput: (10 * 1024 * 1024) / 8, latency: 40, uploadThroughput: (10 * 1024 * 1024) / 8 }, viewport: { deviceScaleFactor: 1, height: 940, isMobile: false, width: 1350 } },
mobile: { cpu: 4, network: { downloadThroughput: (1.6 * 1024 * 1024) / 8, latency: 150, uploadThroughput: (750 * 1024) / 8 }, viewport: { deviceScaleFactor: 1.75, hasTouch: true, height: 823, isMobile: true, width: 412 } },
}
const OBSERVERS = `(() => {
const v = (window.__perf = { cls: 0, events: [], lcp: null, longTasks: [] })
let win = 0, winStart = 0, winLast = 0
new PerformanceObserver((l) => { for (const e of l.getEntries()) {
const el = e.element
v.lcp = { at: e.startTime, size: e.size, tag: el ? el.tagName.toLowerCase() : null, src: e.url || null,
loading: el && el.getAttribute ? el.getAttribute('loading') : null,
fetchpriority: el && el.getAttribute ? el.getAttribute('fetchpriority') : null }
} }).observe({ buffered: true, type: 'largest-contentful-paint' })
new PerformanceObserver((l) => { for (const e of l.getEntries()) {
if (e.hadRecentInput) continue
if (win && e.startTime - winLast < 1000 && e.startTime - winStart < 5000) { win += e.value } else { win = e.value; winStart = e.startTime }
winLast = e.startTime
v.cls = Math.max(v.cls, win)
} }).observe({ buffered: true, type: 'layout-shift' })
new PerformanceObserver((l) => { for (const e of l.getEntries()) v.longTasks.push([e.startTime, e.duration]) }).observe({ buffered: true, type: 'longtask' })
new PerformanceObserver((l) => { for (const e of l.getEntries()) v.events.push({ d: e.duration, n: e.name }) }).observe({ buffered: true, durationThreshold: 16, type: 'event' })
})()`
/**
* @typedef {{ bytes: { css: number, font: number, html: number, image: number, js: number, other: number }, cls: number,
* fcp: null | number, inp: null | number, interaction: null | string, lcp: null | number,
* lcpElement: null | { fetchpriority: null | string, loading: null | string, src: null | string, tag: null | string },
* load: null | number, prefetches: number, profile: string, renderBlocking: string[], requests: number, runs?: number, scriptMs: null | number,
* status: null | number, tbt: null | number, thirdParty: string[], ttfb: null | number, url: string }} PageMeasurement
*/
const typeOf = (resourceType, mime = '') => {
if (resourceType === 'Document') {return 'html'}
if (resourceType === 'Script') {return 'js'}
if (resourceType === 'Stylesheet') {return 'css'}
if (resourceType === 'Font') {return 'font'}
if (resourceType === 'Image' || mime.startsWith('image/')) {return 'image'}
return 'other'
}
/**
* @param {import('@playwright/test').Browser} browser
* @param {string} url
* @param {'mobile'|'desktop'} profileName
* @param {{ blockThirdParty?: boolean, interact?: boolean, settleMs?: number }} [options]
* @returns {Promise<PageMeasurement>}
*/
export async function measurePage(browser, url, profileName, options = {}) {
const profile = PROFILES[profileName]
const context = await browser.newContext({ ...profile.viewport, viewport: { height: profile.viewport.height, width: profile.viewport.width } })
const page = await context.newPage()
const cdp = await context.newCDPSession(page)
await cdp.send('Network.enable')
await cdp.send('Network.setCacheDisabled', { cacheDisabled: true })
await cdp.send('Network.emulateNetworkConditions', { offline: false, ...profile.network })
await cdp.send('Emulation.setCPUThrottlingRate', { rate: profile.cpu })
await cdp.send('Performance.enable')
await page.addInitScript(OBSERVERS)
const origin = new URL(url).origin
if (options.blockThirdParty) {await context.route((u) => u.origin !== origin, (route) => route.abort())}
const requests = new Map()
let prefetches = 0
cdp.on('Network.requestWillBeSent', (e) => {
if (e.request.url.startsWith('data:')) {return}
if (/[?&]_rsc=/.test(e.request.url)) {prefetches++; return}
requests.set(e.requestId, { bytes: 0, type: typeOf(e.type), url: e.request.url })
})
cdp.on('Network.responseReceived', (e) => { const r = requests.get(e.requestId); if (r) {r.type = typeOf(e.type, e.response.mimeType); r.status = e.response.status} })
cdp.on('Network.loadingFinished', (e) => { const r = requests.get(e.requestId); if (r) {r.bytes = e.encodedDataLength} })
const response = await page.goto(url, { timeout: 60_000, waitUntil: 'load' })
await page.waitForLoadState('networkidle', { timeout: 15_000 }).catch(() => {})
await page.waitForTimeout(options.settleMs ?? 1000)
let interaction = null
if (options.interact !== false) {
// INP stand-in: one click on the first visible button (menu toggle, cookie settings, theme): a real handler runs
const button = page.locator('button:visible').first()
if (await button.count()) {
interaction = (await button.getAttribute('aria-label')) ?? (await button.innerText()).slice(0, 40)
await button.click({ timeout: 5000 }).catch(() => { interaction = null })
await page.waitForTimeout(500)
}
}
const nav = await page.evaluate(() => {
const n = performance.getEntriesByType('navigation')[0]
const fcp = performance.getEntriesByName('first-contentful-paint')[0]
const blocking = performance.getEntriesByType('resource').filter((r) => r.renderBlockingStatus === 'blocking').map((r) => r.name)
return { blocking, domContentLoaded: n.domContentLoadedEventEnd, fcp: fcp ? fcp.startTime : null, load: n.loadEventEnd, ttfb: n.responseStart }
})
const vitals = await page.evaluate(() => window.__perf)
const { metrics } = await cdp.send('Performance.getMetrics')
const metric = (name) => metrics.find((m) => m.name === name)?.value ?? 0
await context.close()
const list = [...requests.values()]
const bytes = { css: 0, font: 0, html: 0, image: 0, js: 0, other: 0 }
for (const r of list) {bytes[r.type] += r.bytes}
const fcp = nav.fcp ?? 0
const tbt = vitals.longTasks.filter(([start]) => start >= fcp).reduce((sum, [, d]) => sum + Math.max(0, d - 50), 0)
const round = (n) => (n == null ? null : Math.round(n))
return {
bytes: Object.fromEntries(Object.entries(bytes).map(([k, b]) => [k, Math.round(b)])),
cls: Math.round(vitals.cls * 1000) / 1000,
fcp: round(nav.fcp),
inp: vitals.events.length ? round(Math.max(...vitals.events.map((e) => e.d))) : interaction ? 0 : null,
interaction,
lcp: round(vitals.lcp?.at),
lcpElement: vitals.lcp ? { fetchpriority: vitals.lcp.fetchpriority, loading: vitals.lcp.loading, src: vitals.lcp.src ? vitals.lcp.src.replace(origin, '') : null, tag: vitals.lcp.tag } : null,
load: round(nav.load),
prefetches,
profile: profileName,
renderBlocking: nav.blocking.map((u) => u.replace(origin, '')),
requests: list.length,
scriptMs: round(metric('ScriptDuration') * 1000),
status: response?.status() ?? null,
tbt: round(tbt),
thirdParty: [...new Set(list.filter((r) => !r.url.startsWith(origin)).map((r) => new URL(r.url).origin))],
ttfb: round(nav.ttfb),
url: url.replace(origin, ''),
}
}
export const median = (values) => {
const sorted = values.filter((v) => typeof v === 'number').sort((a, b) => a - b)
if (!sorted.length) {return null}
const mid = Math.floor(sorted.length / 2)
return sorted.length % 2 ? sorted[mid] : Math.round(((sorted[mid - 1] + sorted[mid]) / 2) * 1000) / 1000
}
/**
* The median of `runs` measurements for every number; the rest from the last run.
* @param {import('@playwright/test').Browser} browser
* @param {string} url
* @param {'mobile'|'desktop'} profileName
* @param {number} [runs]
* @param {{ blockThirdParty?: boolean, interact?: boolean, settleMs?: number }} [options]
* @returns {Promise<PageMeasurement>}
*/
export async function measureMedian(browser, url, profileName, runs = 3, options = {}) {
const all = []
for (let i = 0; i < runs; i++) {all.push(await measurePage(browser, url, profileName, options))}
const last = all.at(-1)
const out = { ...last, runs }
for (const key of ['cls', 'fcp', 'inp', 'lcp', 'load', 'requests', 'scriptMs', 'tbt', 'ttfb']) {out[key] = median(all.map((r) => r[key]))}
out.bytes = Object.fromEntries(Object.keys(last.bytes).map((k) => [k, median(all.map((r) => r.bytes[k]))]))
return out
}
export const launch = () => chromium.launch()
+142
View File
@@ -0,0 +1,142 @@
import type { Browser } from '@playwright/test'
import { overBudget, perfBudgets, SERVER_BUDGET } from '@intecion/ipal-kit/doctor'
import { chromium, expect, test } from '@playwright/test'
import { readFileSync } from 'node:fs'
import { createRequire } from 'node:module'
import path from 'node:path'
// a plain ES module (JSDoc types), shared with scripts/perf-measure.mjs
import { measureMedian } from './perf-lab.mjs'
/**
* Performance budgets — a BINDING gate (docs/performance.md): every page type, a phone on Slow 4G with a 4× slower CPU
* and a desktop, first visit. The numbers are this site's own, measured on 2026-12-01 (docs/dev/perf/*-after.json)
* with headroom for lab noise: a change that makes a page heavier or slower fails here, in `pnpm e2e:built`, with both
* bundlers. Loosen a number only with a reason in the comment next to it.
* PERF_RUNS (default 1) runs per page; the gate takes the median. Third-party requests are recorded (none may come
* before consent) and aborted, so an external host's speed cannot fail or hang the gate.
*/
const runs = Number(process.env.PERF_RUNS ?? 1)
const budgets = perfBudgets({
// measured 1.18.0 (docs/dev/perf/*-1180-after.json): JS 175–180 kB on a page without a form, 184–188 kB with one
// (the form's code loads there only), CSS 11–12 kB, fonts 209.5 kB (Inter + Fraunces, latin + latin-ext; the
// heading font not preloaded), LCP 0.74–0.82 s on the phone, 0.28–0.30 s on the desktop
desktop: { cssBytes: 16_000, fontBytes: 215_000, jsBytes: 195_000, lcp: 800, renderBlocking: 1, requests: 36, tbt: 50 },
mobile: { cssBytes: 16_000, fontBytes: 215_000, jsBytes: 195_000, lcp: 1500, renderBlocking: 1, requests: 30, tbt: 100 },
})
/** One of each template (AGENTS.md → Site map), with what differs for that page. */
type Budget = Partial<typeof budgets.mobile>
const PAGES: Array<{ budget?: { desktop?: Budget; mobile?: Budget }; name: string; path: string; why?: string }> = [
{ name: 'home', path: '/pl' },
{ name: 'page', path: '/pl/o-nas' },
{ name: 'archive', path: '/pl/blog' },
{ name: 'post', path: '/pl/blog/zanim-kupisz-dzialke' },
{ name: 'case study', path: '/pl/realizacje/dom-pod-lasem' },
{ name: 'form', path: '/pl/wycena' },
// every block × variant on one page, the contact form's Turnstile included (a necessary service, before consent)
{ budget: { desktop: { jsBytes: 230_000, thirdParty: ['https://challenges.cloudflare.com'] }, mobile: { jsBytes: 230_000, thirdParty: ['https://challenges.cloudflare.com'] } }, name: 'showcase', path: '/pl/bloki' },
// the lazy 404: its content arrives after hydration; the placeholder in not-found.tsx keeps its height (CLS 0)
{ budget: { mobile: { lcp: 2200 } }, name: '404', path: '/pl/nie-ma-takiej-strony', why: 'the 404 content comes from a server action after hydration' },
]
let browser: Browser
test.beforeAll(async () => {
browser = await chromium.launch()
})
test.afterAll(async () => {
await browser?.close()
})
test.describe('performance budgets', () => {
test.describe.configure({ timeout: 180_000 })
for (const page of PAGES) {
for (const profile of ['mobile', 'desktop'] as const) {
test(`${page.name} (${profile}) stays within its budget`, async ({ baseURL }) => {
const budget = { ...budgets[profile], ...page.budget?.[profile] }
const measured = await measureMedian(browser, `${baseURL}${page.path}`, profile, runs, { blockThirdParty: true })
test.info().annotations.push({ description: JSON.stringify({ bytes: measured.bytes, cls: measured.cls, inp: measured.inp, lcp: measured.lcp, requests: measured.requests, tbt: measured.tbt }), type: 'measured' })
expect(overBudget(measured, budget), `${page.path} ${profile}${page.why ? ` (${page.why})` : ''}`).toEqual([])
// the LCP image is never lazy (web.dev/articles/lcp-lazy-loading)
if (measured.lcpElement?.tag === 'img') {expect(measured.lcpElement.loading, `${page.path}: the LCP image is lazy`).not.toBe('lazy')}
})
}
}
})
/**
* Database queries for ONE render of a page outside the ISR cache (Next's own on-demand revalidation header), counted
* by MongoDB's profiler. Measured 1.18.0: 19–27 per page (1.17.2: 30–43); each budget is that plus ~15 %. Skipped when the profiler cannot be
* switched on (not MongoDB, or a user without the right).
*/
test.describe('queries per render', () => {
const QUERY_BUDGET: Record<string, number> = { '/pl': 28, '/pl/bloki': 31, '/pl/blog/zanim-kupisz-dzialke': 30, '/pl/o-nas': 25, '/pl/wycena': 22 }
test('every page type stays within its query budget', async ({ baseURL }) => {
test.setTimeout(120_000)
const uri = process.env.DATABASE_URI
test.skip(!uri?.startsWith('mongodb'), 'not MongoDB')
const site = process.cwd() // Playwright runs in reference/
const requireFromAdapter = createRequire(createRequire(path.join(site, 'package.json')).resolve('@payloadcms/db-mongodb'))
const mongoose = requireFromAdapter('mongoose') as typeof import('mongoose')
const conn = await mongoose.createConnection(uri!).asPromise()
const db = conn.db!
try {
try {
await db.command({ profile: 0 })
} catch {
test.skip(true, 'the database user may not use the profiler')
}
const previewModeId = JSON.parse(readFileSync(path.join(site, '.next', 'prerender-manifest.json'), 'utf8')).preview?.previewModeId as string
const counts: Record<string, number> = {}
for (const [p, limit] of Object.entries(QUERY_BUDGET)) {
await fetch(`${baseURL}${p}`, { headers: { 'x-prerender-revalidate': previewModeId } }) // warm: the first render compiles
await db.command({ profile: 0 })
await db.collection('system.profile').drop().catch(() => {})
await db.command({ profile: 2 })
const res = await fetch(`${baseURL}${p}`, { headers: { 'x-prerender-revalidate': previewModeId } })
expect(res.status).toBe(200)
await db.command({ profile: 0 })
counts[p] = await db.collection('system.profile').countDocuments({ ns: { $not: /system\.profile$/ }, op: 'query' })
expect(counts[p], `${p}: no query counted — the profiler did not record this database`).toBeGreaterThan(0)
expect(counts[p], `${p}: ${counts[p]} queries (budget ${limit}, plugin default ${SERVER_BUDGET.queriesPerRender})`).toBeLessThanOrEqual(limit)
}
test.info().annotations.push({ description: JSON.stringify(counts), type: 'queries' })
} finally {
await db.command({ profile: 0 }).catch(() => {})
await conn.close()
}
})
})
/**
* MongoDB TTL index of the consent log (1.18.0, shared/ttl.ts): the database deletes records older than the retention
* itself, also on a quiet site. The index exists with the retention's lifetime, and a new record carries the date it
* counts from. Skipped when not MongoDB.
*/
test('consent log: the TTL index is there and a new record carries its date', async ({ baseURL }) => {
const uri = process.env.DATABASE_URI
test.skip(!uri?.startsWith('mongodb'), 'not MongoDB')
const site = process.cwd()
const requireFromAdapter = createRequire(createRequire(path.join(site, 'package.json')).resolve('@payloadcms/db-mongodb'))
const mongoose = requireFromAdapter('mongoose') as typeof import('mongoose')
const conn = await mongoose.createConnection(uri!).asPromise()
try {
const records = conn.db!.collection('consent-records')
const ttl = (await records.indexes()).find((i) => i.name === 'iapl_ttl')
expect(ttl, 'the TTL index').toMatchObject({ expireAfterSeconds: 1095 * 86_400, key: { iaplTtlFrom: 1 } })
const id = [...crypto.getRandomValues(new Uint8Array(12))].map((b) => b.toString(16).padStart(2, '0')).join('')
const res = await fetch(`${baseURL}/api/ipal/consent`, {
body: JSON.stringify({ id, state: { analytics: false, functional: false, marketing: false, necessary: true }, version: 1 }),
headers: { 'content-type': 'application/json', origin: baseURL! },
method: 'POST',
})
expect(res.status).toBe(201)
const record = await records.findOne({ consentId: id })
expect(record?.iaplTtlFrom, 'the date the TTL counts from').toBeInstanceOf(Date)
await records.deleteOne({ consentId: id })
} finally {
await conn.close()
}
})
+87 -83
View File
@@ -1,29 +1,29 @@
{
"$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: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"DELETE /api/caseStudies/:id": "deleteByID: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"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: any signed-in account (owner Q1); update: Payload default; delete: admin",
"DELETE /api/form-submissions/:id": "deleteByID: create: any signed-in account (owner Q1); update: Payload default; 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: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"DELETE /api/media/:id": "deleteByID: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"DELETE /api/pages": "delete: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"DELETE /api/pages/:id": "deleteByID: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"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: Payload default: any signed-in account (owner Q3)",
"DELETE /api/payload-locked-documents/:id": "deleteByID: Payload default: any signed-in account (owner Q3)",
"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)",
"DELETE /api/payload-locked-documents/:id": "deleteByID: staff accounts with the second factor (iapl lockedDocuments, 1.18.0; set at start, Payload's default was any signed-in account)",
"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: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"DELETE /api/posts/:id": "deleteByID: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"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",
@@ -77,6 +77,7 @@
"GET /api/globals/site-settings/versions": "versions: readVersions = read (anyone (brand, homepage, construction mode)); no version history kept here",
"GET /api/globals/site-settings/versions/:id": "versionByID: readVersions = read (anyone (brand, homepage, construction mode)); no version history kept here",
"GET /api/iapl/mail-relay/status": "mail service status in the panel: admin",
"GET /api/iapl/two-factor/confirm": "public by design: the e-mailed 2FA confirmation link's page (twoFactor.confirmByEmail); shows one button, changes nothing; 400 without a valid waiting set-up",
"GET /api/ipal/admin-icon": "public by design: the panel's favicon (white-label)",
"GET /api/ipal/admin-language": "public by design: the sign-in panel's language links (whiteLabel.signIn); writes Payload's payload-lng cookie for a supported language and 303s to a path inside the admin route; 400 otherwise",
"GET /api/ipal/admin-og": "public by design: the panel's link-preview image",
@@ -101,11 +102,11 @@
"GET /api/payload-kv/count": "count: nobody (Payload: every rule false; the plugin keeps 2FA counts and the mail-service token here)",
"GET /api/payload-kv/versions": "versions: readVersions = read (nobody (Payload: every rule false; the plugin keeps 2FA counts and the mail-service token here)); no version history kept here",
"GET /api/payload-kv/versions/:id": "versionByID: readVersions = read (nobody (Payload: every rule false; the plugin keeps 2FA counts and the mail-service token here)); no version history kept here",
"GET /api/payload-locked-documents": "find: Payload default: any signed-in account (owner Q3)",
"GET /api/payload-locked-documents/:id": "findByID: Payload default: any signed-in account (owner Q3)",
"GET /api/payload-locked-documents/count": "count: Payload default: any signed-in account (owner Q3)",
"GET /api/payload-locked-documents/versions": "versions: readVersions = read (Payload default: any signed-in account (owner Q3)); no version history kept here",
"GET /api/payload-locked-documents/versions/:id": "versionByID: readVersions = read (Payload default: any signed-in account (owner Q3)); no version history kept here",
"GET /api/payload-locked-documents": "find: staff accounts with the second factor (iapl lockedDocuments, 1.18.0; set at start, Payload's default was any signed-in account)",
"GET /api/payload-locked-documents/:id": "findByID: staff accounts with the second factor (iapl lockedDocuments, 1.18.0; set at start, Payload's default was any signed-in account)",
"GET /api/payload-locked-documents/count": "count: staff accounts with the second factor (iapl lockedDocuments, 1.18.0; set at start, Payload's default was any signed-in account)",
"GET /api/payload-locked-documents/versions": "versions: readVersions = read (staff accounts with the second factor (iapl lockedDocuments, 1.18.0; set at start, Payload's default was any signed-in account)); no version history kept here",
"GET /api/payload-locked-documents/versions/:id": "versionByID: readVersions = read (staff accounts with the second factor (iapl lockedDocuments, 1.18.0; set at start, Payload's default was any signed-in account)); no version history kept here",
"GET /api/payload-preferences": "find: the signed-in account's own preferences only (Payload)",
"GET /api/payload-preferences/:id": "findByID: the signed-in account's own preferences only (Payload)",
"GET /api/payload-preferences/:key": "findByID: the signed-in account's own preferences only (Payload)",
@@ -124,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: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"PATCH /api/caseStudies/:id": "updateByID: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"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: any signed-in account (owner Q1); update: Payload default; delete: admin",
"PATCH /api/form-submissions/:id": "updateByID: create: any signed-in account (owner Q1); update: Payload default; 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: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"PATCH /api/media/:id": "updateByID: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"PATCH /api/pages": "update: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"PATCH /api/pages/:id": "updateByID: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"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: Payload default: any signed-in account (owner Q3)",
"PATCH /api/payload-locked-documents/:id": "updateByID: Payload default: any signed-in account (owner Q3)",
"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: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"PATCH /api/posts/:id": "updateByID: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"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: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"POST /api/caseStudies/:id/duplicate": "duplicate: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"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: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"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",
@@ -162,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: create: any signed-in account (owner Q1); update: Payload default; delete: admin",
"POST /api/form-submissions/:id/duplicate": "duplicate: create: any signed-in account (owner Q1); update: Payload default; 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: any signed-in account (owner Q1); update: Payload default; 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: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"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: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"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: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"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: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"POST /api/globals/header": "update: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"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: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"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+",
@@ -196,7 +197,10 @@
"POST /api/globals/site-settings/versions/:id": "restore a version: editor+",
"POST /api/iapl/mail-relay/confirm": "public by design: the mail service's call-back; 404 unless it carries a nonce this site made in the last 5 min (single use)",
"POST /api/iapl/mail-relay/connect": "mail service, connect with a pasted token: admin",
"POST /api/iapl/mail-relay/connect-link": "mail service, \"Połącz z IWSN\": admin; asks the service for the confirmation link on the click, never stores or logs it; absent with mail.relay.connectButton: false",
"POST /api/iapl/mail-relay/disconnect": "mail service, disconnect: admin",
"POST /api/iapl/two-factor/confirm": "public by design: the link's button; own origin, the single-use 30-min token AND the enrolling browser's cookie; turns the factor on, ends the account's sessions, signs nobody in",
"POST /api/iapl/two-factor/confirm-pending": "2FA: an admin signed in with the second factor confirms another account's waiting set-up (mail not working); own origin",
"POST /api/ipal/consent": "public by design: a visitor's own banner choice (random id, no personal data), body capped at 4 KiB",
"POST /api/ipal/cookie-approval": "approve cookies: editor+ with the second factor",
"POST /api/ipal/cookie-crawl": "start a crawl: editor+, or Bearer IAPL_COOKIE_SCAN_TOKEN (the schedule); only of the configured site URL",
@@ -205,22 +209,22 @@
"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: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"POST /api/media/:id/duplicate": "duplicate: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"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: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"POST /api/pages": "create: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"POST /api/pages/:id/duplicate": "duplicate: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"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: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"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",
"POST /api/payload-kv/versions/:id": "restore a version: nobody (every rule false)",
"POST /api/payload-locked-documents": "create: Payload default: any signed-in account (owner Q3)",
"POST /api/payload-locked-documents/:id/duplicate": "duplicate: Payload default: any signed-in account (owner Q3)",
"POST /api/payload-locked-documents": "create: staff accounts with the second factor (iapl lockedDocuments, 1.18.0; set at start, Payload's default was any signed-in account)",
"POST /api/payload-locked-documents/:id/duplicate": "duplicate: staff accounts with the second factor (iapl lockedDocuments, 1.18.0; set at start, Payload's default was any signed-in account)",
"POST /api/payload-locked-documents/access/:id?": "the signed-in account's own permissions on payload-locked-documents",
"POST /api/payload-locked-documents/versions/:id": "restore a version: Payload default: any signed-in account (owner Q3)",
"POST /api/payload-locked-documents/versions/:id": "restore a version: staff accounts with the second factor (iapl lockedDocuments, 1.18.0; set at start, Payload's default was any signed-in account)",
"POST /api/payload-preferences": "create: own preferences only (Payload)",
"POST /api/payload-preferences/:id/duplicate": "duplicate: own preferences only (Payload)",
"POST /api/payload-preferences/:key": "updateByID: own preferences only (Payload)",
@@ -230,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: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"POST /api/posts/:id/duplicate": "duplicate: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"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: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"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",
@@ -248,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: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"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: create: any signed-in account (owner Q1); update: Payload default; delete: admin",
"graphql mutation createMedia": "GraphQL create: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"graphql mutation createPage": "GraphQL create: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"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: Payload default: any signed-in account (owner Q3)",
"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: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"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: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"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: any signed-in account (owner Q1); update: Payload default; delete: admin",
"graphql mutation deleteMedia": "GraphQL delete: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"graphql mutation deletePage": "GraphQL delete: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"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: Payload default: any signed-in account (owner Q3)",
"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: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"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: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"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: any signed-in account (owner Q1); update: Payload default; delete: admin",
"graphql mutation duplicateMedia": "GraphQL duplicate: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"graphql mutation duplicatePage": "GraphQL duplicate: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"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: Payload default: any signed-in account (owner Q3)",
"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: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"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: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"graphql mutation updateCompany": "GraphQL update: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"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: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"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: any signed-in account (owner Q1); update: Payload default; delete: admin",
"graphql mutation updateHeader": "GraphQL update: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"graphql mutation updateMedia": "GraphQL update: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"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: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"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: Payload default: any signed-in account (owner Q3)",
"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: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
"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",
@@ -332,8 +336,8 @@
"graphql query Pages": "GraphQL find: anyone (published content, no drafts)",
"graphql query PayloadKv": "GraphQL find: nobody (Payload: every rule false; the plugin keeps 2FA counts and the mail-service token here)",
"graphql query PayloadKvs": "GraphQL find: nobody (Payload: every rule false; the plugin keeps 2FA counts and the mail-service token here)",
"graphql query PayloadLockedDocument": "GraphQL find: Payload default: any signed-in account (owner Q3)",
"graphql query PayloadLockedDocuments": "GraphQL find: Payload default: any signed-in account (owner Q3)",
"graphql query PayloadLockedDocument": "GraphQL find: staff accounts with the second factor (iapl lockedDocuments, 1.18.0; set at start, Payload's default was any signed-in account)",
"graphql query PayloadLockedDocuments": "GraphQL find: staff accounts with the second factor (iapl lockedDocuments, 1.18.0; set at start, Payload's default was any signed-in account)",
"graphql query PayloadPreference": "GraphQL find: the signed-in account's own preferences only (Payload)",
"graphql query PayloadPreferences": "GraphQL find: the signed-in account's own preferences only (Payload)",
"graphql query Post": "GraphQL find: anyone (published content, no drafts)",
@@ -350,7 +354,7 @@
"graphql query countForms": "GraphQL count: anyone (the form renders from it; the Emails tab is staff-only by field access)",
"graphql query countPages": "GraphQL count: anyone (published content, no drafts)",
"graphql query countPayloadKvs": "GraphQL count: nobody (Payload: every rule false; the plugin keeps 2FA counts and the mail-service token here)",
"graphql query countPayloadLockedDocuments": "GraphQL count: Payload default: any signed-in account (owner Q3)",
"graphql query countPayloadLockedDocuments": "GraphQL count: staff accounts with the second factor (iapl lockedDocuments, 1.18.0; set at start, Payload's default was any signed-in account)",
"graphql query countPayloadPreferences": "GraphQL count: the signed-in account's own preferences only (Payload)",
"graphql query countPosts": "GraphQL count: anyone (published content, no drafts)",
"graphql query countUsers": "GraphQL count: an admin, or the account itself (adminOrSelfIn users)",
+62
View File
@@ -0,0 +1,62 @@
import { type APIRequestContext, expect, test } from '@playwright/test'
import { randomUUID } from 'node:crypto'
import { totp } from './totp'
/**
* 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.
* Needs the E2E_* test admin (e2e/create-test-admin.ts). The locked account is a fresh one made here, so the test
* admins are never locked.
*/
const { E2E_ADMIN_EMAIL: adminEmail, E2E_ADMIN_PASSWORD: password, E2E_TOTP_SECRET: secret } = process.env
let admin: APIRequestContext
test.beforeAll(async ({ baseURL, playwright }) => {
test.skip(!adminEmail || !password || !secret, 'E2E_ADMIN_* values are not set')
admin = await playwright.request.newContext({ baseURL, extraHTTPHeaders: { origin: baseURL! } })
expect((await admin.post('/api/users/login', { data: { email: adminEmail, password } })).status()).toBe(200)
expect((await (await admin.post('/api/verify-totp', { data: { token: totp(secret!) } })).json()).ok).toBe(true)
})
test.afterAll(async () => {
await admin?.dispose()
})
test('a locked staff account gets the wrong-password answer, REST and GraphQL', async ({ baseURL, playwright }) => {
const email = `locked-${randomUUID().slice(0, 8)}@example.com`
const own = `L-${randomUUID()}`
expect((await admin.post('/api/users', { data: { email, password: own, roles: ['editor'] } })).status()).toBe(201)
const anon = await playwright.request.newContext({ baseURL })
// the site reads the client address from IAPL_IP_HEADER (reference/.env: x-forwarded-for, one proxy)
const login = async (address: string, pass: string, ip = '203.0.113.150') => {
const res = await anon.post('/api/users/login', { data: { email: address, password: pass }, headers: { 'x-forwarded-for': ip } })
return { body: await res.text(), status: res.status() }
}
// 1.18.0 (accounts.signInLimit): one IP fails at most 5 times per address and Payload locks a staff account at 50
// failures — a spray from 50 IPs, one failure each, locks it
for (let i = 0; i < 50; i++) {await login(email, 'a-wrong-password-1', `198.51.100.${i + 1}`)}
const invented = await login(`nobody-${randomUUID().slice(0, 8)}@example.com`, 'a-wrong-password-1')
expect(invented.status).toBe(401)
expect(await login(email, own)).toEqual(invented)
const gql = async (address: string, pass: string) => {
const res = await anon.post('/api/graphql', { data: { query: `mutation { loginUser(email: ${JSON.stringify(address)}, password: ${JSON.stringify(pass)}) { token } }` } })
const error = ((await res.json()) as { errors?: { extensions?: { name?: string }; message: string }[] }).errors?.[0]
return { name: error?.extensions?.name, message: error?.message }
}
expect(await gql(email, own)).toEqual(await gql(`nobody-${randomUUID().slice(0, 8)}@example.com`, 'x-wrong-password-1'))
await anon.dispose()
})
test('panel actions: another origin gets 403 with the admin cookie, the site itself goes through', async ({ baseURL }) => {
const foreign = await admin.fetch('/api/ipal/cookie-approval', {
data: '{"ids":[]}',
headers: { 'content-type': 'text/plain', origin: 'https://blog.example.test', 'sec-fetch-site': 'same-site' },
method: 'POST',
})
expect(foreign.status()).toBe(403)
const own = await admin.fetch('/api/ipal/cookie-approval', { data: '{"ids":[]}', headers: { 'content-type': 'text/plain', origin: baseURL! }, method: 'POST' })
expect(own.status()).toBe(200)
})
+128
View File
@@ -493,6 +493,134 @@ 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.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']
const buttonState = () => {
const b = document.querySelector<HTMLElement>('[data-ipal="cookie-button"]')
const footer = [...document.querySelectorAll<HTMLElement>('footer, [role="contentinfo"]')].at(-1)!
if (!b) {return { button: false, room: footer.hasAttribute('data-ipal-cookie-space') }}
const r = b.getBoundingClientRect()
const hits = (q: DOMRect) => q.width > 0 && q.height > 0 && q.right > r.left && q.left < r.right && q.bottom > r.top && q.top < r.bottom
// every piece of footer text and every control of the page that lies under the button
const under: string[] = []
const walker = document.createTreeWalker(footer, NodeFilter.SHOW_TEXT)
const range = document.createRange()
for (let node = walker.nextNode(); node; node = walker.nextNode()) {
if (!/\S/.test(node.nodeValue ?? '')) {continue}
range.selectNodeContents(node)
if ([...range.getClientRects()].some(hits)) {under.push(`text: ${node.nodeValue!.trim().slice(0, 24)}`)}
}
for (const el of document.querySelectorAll('a[href], button, input, select, textarea, summary')) {
if (el !== b && hits(el.getBoundingClientRect())) {under.push(`control: ${(el.textContent ?? '').trim().slice(0, 24)}`)}
}
return {
button: true,
gap: Math.round(window.innerHeight - r.bottom),
inFooter: !!b.closest('footer'),
left: Math.round(r.left),
position: getComputedStyle(b).position,
room: footer.hasAttribute('data-ipal-cookie-space'),
transform: getComputedStyle(b).transform,
under,
}
}
const CORNER = { button: true, gap: 16, inFooter: false, left: 16, position: 'fixed', transform: 'none' }
for (const device of [
{ name: 'desktop', viewport: { height: 800, width: 1280 } },
{ name: 'phone', viewport: { height: 844, width: 390 } },
{ name: 'small phone', viewport: { height: 640, width: 360 } },
]) {
for (const colorScheme of ['light', 'dark'] as const) {
test(`cookie button, ${device.name}, ${colorScheme}: the corner at every scroll position, nothing under it at the end, no layout shift`, async ({ browser }) => {
const context = await browser.newContext({ colorScheme, hasTouch: device.name !== 'desktop', viewport: device.viewport })
const page = await context.newPage()
await page.addInitScript(() => {
const w = window as unknown as { __cls: number }
w.__cls = 0
new PerformanceObserver((list) => {
for (const entry of list.getEntries() as unknown as { hadRecentInput: boolean; value: number }[]) {
if (!entry.hadRecentInput) {w.__cls += entry.value}
}
}).observe({ buffered: true, type: 'layout-shift' })
})
const shifts = () => page.evaluate(() => (window as unknown as { __cls: number }).__cls)
const footerPadding = () => page.evaluate(() => getComputedStyle([...document.querySelectorAll('footer')].at(-1)!).paddingBottom)
// before a decision: no button, the footer as the project made it
await page.goto('/pl')
await expect(page.locator('[data-ipal="banner"]')).toBeVisible()
expect(await page.evaluate(buttonState)).toEqual({ button: false, room: false })
const ownPadding = await footerPadding()
await page.locator('[data-ipal="reject"]').click()
const button = page.locator('[data-ipal="cookie-button"]')
for (const path of BUTTON_PAGES) {
// a returning visitor's page load: the room is there from the first paint, so nothing shifts when the button appears
await page.goto(path)
await expect(button).toBeVisible()
await page.waitForTimeout(400)
const height = await page.evaluate(() => document.documentElement.scrollHeight)
const end = Math.max(0, height - device.viewport.height)
for (const y of [0, end / 2, end - 40, end]) {
await page.evaluate((to) => window.scrollTo(0, to), y)
await page.waitForTimeout(250)
expect(await page.evaluate(buttonState), `${path} at ${Math.round(y)} of ${end}`).toMatchObject(CORNER)
}
// the very end of the page (measured now: a form or its Turnstile widget may have grown the page since)
await page.evaluate(() => window.scrollTo(0, document.documentElement.scrollHeight))
await page.waitForTimeout(250)
expect(await page.evaluate(() => Math.round(window.innerHeight + window.scrollY - document.documentElement.scrollHeight)), `${path}: at the end`).toBe(0)
expect(await page.evaluate(buttonState), `${path} at the very end`).toMatchObject(CORNER)
// no footer text and no control under the button
expect((await page.evaluate(buttonState)).under, `${path}: under the button at the end`).toEqual([])
// and every footer link can be clicked (Playwright refuses a click another element would receive)
const links = page.locator('footer a[href]')
const count = await links.count()
expect(count).toBeGreaterThan(3)
for (let i = 0; i < count; i++) {await links.nth(i).click({ timeout: 3000, trial: true })}
expect(await shifts(), `${path}: layout shift from load to the end of the page`).toBeLessThan(0.001)
}
// keyboard: reachable and it reopens the banner; the room goes with the button
await button.focus()
await expect(button).toBeFocused()
await page.keyboard.press('Enter')
await expect(page.locator('[data-ipal="banner"]')).toBeVisible()
expect(await page.evaluate(buttonState)).toEqual({ button: false, room: false })
await page.goto('/pl') // decided again? no: reopening does not undo the stored decision, the button is back
await expect(button).toBeVisible()
await page.locator('[data-ipal="cookie-button"]').click()
expect(await footerPadding(), 'banner open: the footer as before a decision').toBe(ownPadding)
await context.close()
})
}
}
test('cookie button: for a returning visitor the room is there before the page hydrates (no application script)', async ({ browser }) => {
const context = await browser.newContext({ hasTouch: true, viewport: { height: 844, width: 390 } })
const page = await context.newPage()
const padding = () => page.evaluate(() => parseFloat(getComputedStyle([...document.querySelectorAll('footer')].at(-1)!).paddingBottom))
await page.goto('/pl')
const own = await padding()
await page.locator('[data-ipal="reject"]').click()
await expect(page.locator('[data-ipal="cookie-button"]')).toBeVisible()
const live = await padding()
expect(live).toBeGreaterThan(own)
// the same page with every application script refused: only the inline script can have made the room
await page.route(isAppScript, (route) => route.abort())
await page.goto('/pl')
await expect(page.locator('[data-ipal="cookie-button"]')).toHaveCount(0)
// the same room, to the pixel or one off: here the web font may not have arrived yet, and the row's text box follows the font
expect(Math.abs((await padding()) - live)).toBeLessThanOrEqual(2)
expect(await padding()).toBeGreaterThan(own + 30)
// the server's markup is untouched (React hydrates it without a mismatch): the room is in a style sheet
expect(await page.evaluate(() => [...document.querySelectorAll('footer')].at(-1)!.getAttribute('style'))).toBeNull()
await context.close()
})
test('admin: sign in through 2FA, agency credit, panel link preview', async ({ page, request }) => {
const head = await (await request.get('/admin/login')).text()
expect(head).toMatch(/noindex/)
+7 -9
View File
@@ -74,17 +74,15 @@ test('2FA screens: a prepared back link ends on the admin root', async ({ baseUR
await third.goto(`/admin/setup-totp?back=${encodeURIComponent(SCRIPT)}`)
const newSecret = await third.locator('input[type="hidden"]').evaluateAll((inputs) => inputs.map((i) => (i as HTMLInputElement).value).find((v) => /^[A-Z2-7]{16,}$/.test(v)))
expect(newSecret).toBeTruthy()
// twoFactor.confirmByEmail (1.18.0): a FIRST set-up waits for its e-mail link, so the setup screen does not
// navigate at all — the script in `back` cannot run, the screen stays. (`back` after setup matters only with
// confirmByEmail: false; test/safeBack.test.ts covers the check itself.)
await enterCode(third, totp(newSecret!))
await expectAdminRoot(third, baseURL!)
await expect(third.locator('[data-sonner-toast]').first()).toBeVisible({ timeout: 15_000 })
await expect(third).toHaveURL(/\/admin\/setup-totp/)
expect(await third.title()).not.toContain('XSS-')
await third.context().close()
// setup screen, an ordinary link back into the panel is still followed
const fourth = await passwordOnly(browser, baseURL!, fresh[1])
await fourth.goto(`/admin/setup-totp?back=${encodeURIComponent('/admin/collections/pages?limit=5')}`)
const fourthSecret = await fourth.locator('input[type="hidden"]').evaluateAll((inputs) => inputs.map((i) => (i as HTMLInputElement).value).find((v) => /^[A-Z2-7]{16,}$/.test(v)))
await enterCode(fourth, totp(fourthSecret!))
await expect(fourth).toHaveURL(/\/admin\/collections\/pages\?limit=5$/, { timeout: 20_000 })
await fourth.context().close()
void fresh[1]
} finally {
for (const id of ids) {await first.request.delete(`/api/users/${id}`, { headers: { origin: baseURL! } })}
await first.context().close()
+123
View File
@@ -0,0 +1,123 @@
import { type APIRequestContext, expect, type Page, test } from '@playwright/test'
import { waitForEnrolmentLink } from './enrolment'
import { startSmtpSink } from './smtp-sink'
import { secondTestAdmin, totp } from './totp'
/**
* twoFactor.confirmByEmail on the BUILT site (pnpm e2e:built, webpack and Turbopack; security audit 2026-12, F0).
* Before 1.18.0 the password of an account inside its setup window was enough to enrol a factor of one's own — the
* owner was then locked out. Now the first set-up waits for a link sent to the account's e-mail (read here from the
* mail sink), opened in the browser that scanned the code.
*/
test.describe.configure({ mode: 'serial' })
const stamp = Date.now()
const VICTIM = { email: `e2e-enrol-${stamp}@example.com`, password: `enrol-${stamp}-Hk29dLq` }
const ATTACKER_SECRET = 'JBSWY3DPEHPK3PXPJBSWY3DPEHPK3PXP'
let sink: Awaited<ReturnType<typeof startSmtpSink>>
let victimId: string | undefined
type Ctx = { request: { newContext: (o: object) => Promise<APIRequestContext> } }
const ctx = (playwright: Ctx, baseURL: string) => playwright.request.newContext({ baseURL, extraHTTPHeaders: { origin: baseURL } })
async function adminApi(playwright: Ctx, baseURL: string) {
const api = await ctx(playwright, baseURL)
expect((await api.post('/api/users/login', { data: { email: secondTestAdmin(process.env.E2E_ADMIN_EMAIL!), password: process.env.E2E_ADMIN_PASSWORD } })).status()).toBe(200)
expect((await (await api.post('/api/verify-totp', { data: { token: totp(process.env.E2E_TOTP_SECRET!) } })).json()).ok).toBe(true)
return api
}
async function typeCode(page: Page, secret: string) {
await page.getByRole('textbox').first().click()
await page.keyboard.type(totp(secret))
}
test.beforeAll(async () => {
sink = await startSmtpSink(Number(process.env.E2E_SMTP_PORT ?? 2526))
})
test.afterAll(async ({ baseURL, playwright }) => {
await sink?.close()
if (victimId && process.env.E2E_ADMIN_EMAIL) {
const api = await adminApi(playwright, baseURL!)
await api.delete(`/api/users/${victimId}`)
await api.dispose()
}
})
test('2FA enrolment: the password alone no longer takes an account inside its setup window', async ({ baseURL, playwright }) => {
test.skip(!process.env.E2E_ADMIN_EMAIL || !process.env.E2E_ADMIN_PASSWORD || !process.env.E2E_TOTP_SECRET, 'E2E_* test admin not configured')
const admin = await adminApi(playwright, baseURL!)
const created = await admin.post('/api/users', { data: { ...VICTIM, roles: ['editor'] } })
expect(created.status()).toBe(201)
victimId = String((await created.json()).doc.id)
await admin.dispose()
const attacker = await ctx(playwright, baseURL!)
expect((await attacker.post('/api/users/login', { data: VICTIM })).status()).toBe(200)
const setup = await attacker.post('/api/setup-totp', { data: { secret: ATTACKER_SECRET, token: totp(ATTACKER_SECRET) } })
expect(setup.status()).toBe(202)
expect(await setup.json()).toMatchObject({ ok: false, pending: true })
// not signed in with a factor, nothing opens
expect(((await (await attacker.get('/api/users/me')).json()) as { user?: { _strategy?: string } }).user?._strategy).not.toBe('totp')
expect((await attacker.post('/api/globals/site-settings', { data: {} })).status()).toBe(403)
// the link went to the OWNER's mailbox; opened in the owner's own browser it is refused
const link = await waitForEnrolmentLink(sink.messages, VICTIM.email)
expect(link.origin).toBe(new URL(baseURL!).origin)
const owner = await ctx(playwright, baseURL!)
const page = await owner.get(link.pathname + link.search)
expect(page.status()).toBe(200)
expect(await page.text()).toContain('<form method="post"')
const refused = await owner.post('/api/iapl/two-factor/confirm', { form: { t: link.searchParams.get('t')!, u: link.searchParams.get('u')! } })
expect(refused.status()).toBe(403)
// the owner can still set up their own factor
expect((await owner.post('/api/users/login', { data: VICTIM })).status()).toBe(200)
const ownSetup = await owner.post('/api/setup-totp', { data: { secret: 'KRSXG5CTMVRXEZLUKRSXG5CTMVRXEZLU', token: totp('KRSXG5CTMVRXEZLUKRSXG5CTMVRXEZLU') } })
expect(ownSetup.status()).toBe(202)
await attacker.dispose()
await owner.dispose()
})
test('2FA enrolment in the panel: code, the notice on the setup screen, the e-mail link, sign in again, in', async ({ baseURL, browser, playwright }) => {
test.skip(!process.env.E2E_ADMIN_EMAIL, 'E2E_* test admin not configured')
const person = { email: `e2e-enrol-ui-${stamp}@example.com`, password: `enrolui-${stamp}-Pz71mWx` }
const admin = await adminApi(playwright, baseURL!)
const created = await admin.post('/api/users', { data: { ...person, roles: ['editor'] } })
expect(created.status()).toBe(201)
const id = String((await created.json()).doc.id)
const context = await browser.newContext({ baseURL })
const page = await context.newPage()
try {
await page.goto('/admin/login')
await page.fill('#field-email', person.email)
await page.fill('#field-password', person.password)
await page.click('.form-submit button')
await page.waitForURL(/setup-totp/)
const secret = await page.locator('input[name="secret"]').inputValue()
await typeCode(page, secret)
// the package's form shows the answer; the screen stays, and after a reload names where the link went
await expect(page.locator('[data-sonner-toast]').first()).toContainText(/e…@example\.com/, { timeout: 15_000 })
await page.reload()
await expect(page.locator('[data-iapl="two-factor-pending"]')).toContainText(/e…@example\.com/)
// the link, in this browser: a page with one button, then done
const link = await waitForEnrolmentLink(sink.messages, person.email)
await page.goto(link.toString())
await page.getByRole('button').click()
await expect(page.locator('body')).toContainText(/Two-step verification is on|Weryfikacja dwuetapowa jest włączona/)
// signed out: password, then the code
await page.goto('/admin/login')
await page.fill('#field-email', person.email)
await page.fill('#field-password', person.password)
await page.click('.form-submit button')
await page.waitForURL(/verify-totp/, { waitUntil: 'commit' })
await typeCode(page, secret)
await expect(page).toHaveTitle(/Dashboard|Pulpit/, { timeout: 20_000 })
// notices: the confirmation mail, then "turned on"
expect(sink.messages.filter((m) => m.to.some((to) => to.includes(person.email))).length).toBeGreaterThanOrEqual(2)
} finally {
await context.close()
await admin.delete(`/api/users/${id}`)
await admin.dispose()
}
})
+23 -7
View File
@@ -1,10 +1,12 @@
import { type APIRequestContext, expect, type Page, test } from '@playwright/test'
import { waitForEnrolmentLink } from './enrolment'
import { startSmtpSink } from './smtp-sink'
import { secondTestAdmin, totp } from './totp'
/**
* "2FA setup required" in a real browser: an account that has not set two-step verification up sees only the setup
* screen and gets nothing from the API; after the code it is in. Covers the first admin of a fresh site (only when
* screen and gets nothing from the API; after the code and the e-mailed link (twoFactor.confirmByEmail) it is in. Covers the first admin of a fresh site (only when
* the database has no users yet — run this file before e2e/create-test-admin.ts for that), a new editor, and the
* administrator's reset on the account page.
* E2E_BASE_URL=http://localhost:3217 pnpm exec playwright test e2e/two-factor-setup.spec.ts
@@ -43,7 +45,7 @@ async function adminApi(playwright: { request: { newContext: (o: object) => Prom
return api
}
test('first admin of a fresh site: created, sent to 2FA setup, in after the code', async ({ baseURL, page }) => {
test('first admin of a fresh site: created, sent to 2FA setup; with no mail yet the set-up waits for the link in the server log', async ({ baseURL, page }) => {
// With users in the database this address leads to the login screen instead.
await page.goto('/admin/create-first-user')
const firstUserForm = await page.locator('#field-confirm-password').waitFor({ timeout: 10_000 }).then(() => true, () => false)
@@ -65,9 +67,10 @@ test('first admin of a fresh site: created, sent to 2FA setup, in after the code
}
const secret = await page.locator('input[name="secret"]').inputValue()
await typeCode(page, secret)
await expect(page).toHaveTitle(/Dashboard|Pulpit/, { timeout: 20_000 })
expect((await page.request.get('/api/globals/site-integrations', { headers: { origin: baseURL! } })).status()).toBe(200)
admin = { ...OWNER, secret }
// twoFactor.confirmByEmail: a fresh site has no mail yet, so the set-up waits and its link is in the server log
// (the person who set the site up opens it there); nothing opens before that
await expect(page.locator('[data-sonner-toast]').first()).toContainText(/administrator|log/i, { timeout: 15_000 })
expect((await page.request.get('/api/globals/site-integrations', { headers: { origin: baseURL! } })).status()).toBe(403)
})
test('a new editor: setup screen with the deadline, nothing else, in after the code', async ({ baseURL, page, playwright }) => {
@@ -95,9 +98,22 @@ test('a new editor: setup screen with the deadline, nothing else, in after the c
await page.waitForURL(/setup-totp/)
const secret = await page.locator('input[name="secret"]').inputValue()
// twoFactor.confirmByEmail: the code starts the set-up, the e-mailed link (opened in this browser) finishes it
const sink = await startSmtpSink(Number(process.env.E2E_SMTP_PORT ?? 2526))
try {
await typeCode(page, secret)
const link = await waitForEnrolmentLink(sink.messages, EDITOR.email)
await page.goto(link.toString())
await page.getByRole('button').click()
await expect(page.locator('body')).toContainText(/Two-step verification is on|Weryfikacja dwuetapowa jest włączona/)
} finally {
await sink.close()
}
// signed out by the confirmation: password and code, then the data opens
await signIn(page, EDITOR)
await page.waitForURL(/verify-totp/, { waitUntil: 'commit' })
await typeCode(page, secret)
// back where it wanted to go, and the data opens
await page.waitForURL(/\/admin\/collections\/pages/, { timeout: 20_000 })
await expect(page).toHaveTitle(/Dashboard|Pulpit/, { timeout: 20_000 })
expect((await page.request.get('/api/pages', { headers: { origin: baseURL! } })).status()).toBe(200)
})
+46
View File
@@ -0,0 +1,46 @@
import { expect, test } from '@playwright/test'
import { editorTestAccount, totp } from './totp'
/**
* `iapl({ unusedMedia: true })` (1.18.0; docs/media.md): above the Media list, how many files nothing uses, with a
* link to Payload's own list filtered to them. An image uploaded here and used nowhere must be listed; it is deleted
* by this test afterwards, never by the panel. Signs in as the test editor (the admins' 2FA attempts stay for the
* other specs).
*/
test('Media: the unused-files notice lists a file nothing uses and links to the filtered list', async ({ baseURL, page }) => {
const { E2E_ADMIN_EMAIL: email, E2E_ADMIN_PASSWORD: password, E2E_TOTP_SECRET: secret } = process.env
test.skip(!email || !password || !secret, 'E2E_* test admin not configured')
await page.goto('/admin/login')
await page.fill('#field-email', editorTestAccount(email!))
await page.fill('#field-password', password!)
await page.click('.form-submit button')
await page.waitForURL(/verify-totp|\/admin(\?|$)/, { waitUntil: 'commit' })
if (page.url().includes('verify-totp')) {
await page.getByRole('textbox').first().click()
await page.keyboard.type(totp(secret!))
}
await expect(page).toHaveTitle(/Dashboard|Pulpit/, { timeout: 20_000 })
// a 1×1 PNG nobody points at
const png = Buffer.from('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=', 'base64')
// the session cookie counts only with the site's own Origin (Payload's CSRF rule)
const origin = { origin: new URL(baseURL!).origin }
const created = await page.request.post('/api/media', {
headers: origin,
multipart: { _payload: JSON.stringify({ alt: 'unused-media e2e' }), file: { buffer: png, mimeType: 'image/png', name: 'unused-media-e2e.png' } },
})
expect(created.status(), await created.text()).toBe(201)
const id = ((await created.json()) as { doc: { id: string } }).doc.id
try {
await page.goto('/admin/collections/media')
const notice = page.locator('[data-iapl="unused-media"]')
await expect(notice).toBeVisible()
const href = await notice.locator('a').getAttribute('href')
expect(href).toContain(`=${id}`)
await notice.locator('a').click()
await expect(page.getByText('unused-media-e2e', { exact: false }).first()).toBeVisible()
} finally {
await page.request.delete(`/api/media/${id}`, { headers: origin })
}
})
+3 -1
View File
@@ -65,8 +65,10 @@
"@payloadcms/richtext-lexical": "3.94.1",
"@payloadcms/storage-s3": "3.94.1",
"@payloadcms/ui": "3.94.1",
"cross-spawn@>=7 <7.1.0": "^7.1.2",
"dompurify@<3.4.17": "^3.4.17",
"happy-dom@<21.0.4": "^21.0.4"
"happy-dom@<21.0.4": "^21.0.4",
"ws@>=8 <8.23.0": "^8.23.0"
}
},
"dependenciesMeta": {
+11 -9
View File
@@ -13,8 +13,10 @@ overrides:
'@payloadcms/richtext-lexical': 3.94.1
'@payloadcms/storage-s3': 3.94.1
'@payloadcms/ui': 3.94.1
cross-spawn@>=7 <7.1.0: ^7.1.2
dompurify@<3.4.17: ^3.4.17
happy-dom@<21.0.4: ^21.0.4
ws@>=8 <8.23.0: ^8.23.0
importers:
@@ -1428,8 +1430,8 @@ packages:
engines: {node: '>=20'}
hasBin: true
cross-spawn@7.0.6:
resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==}
cross-spawn@7.1.2:
resolution: {integrity: sha512-8BPK2r+sKWC8sDinRwLwrFMq2lXTBBwzYYEB9LiCznfMurOi4FOvQflq3XOLGG+HPdMSVpe+k/s96+AtDEOgPg==}
engines: {node: '>= 8'}
[email protected]:
@@ -2663,8 +2665,8 @@ packages:
[email protected]:
resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==}
[email protected]2.0:
resolution: {integrity: sha512-Ydggc987+RO0AnWtZ/7Wq9FtNvcrL1b/RO0ud9mWjUPgDrsAAwQSF51sm2hm1XofbU/4jkpGEsLFsZZxU+1DOg==}
[email protected]3.1:
resolution: {integrity: sha512-1rzWDSN0NOi3tpwgHsQExjWRoKUGtjCkJ2gZRaaRtzhYLboMytOI9pj9PU7yCgY37auqdd4OyLofZDbkeuZmPA==}
engines: {node: '>=10.0.0'}
peerDependencies:
bufferutil: ^4.0.1
@@ -4151,9 +4153,9 @@ snapshots:
[email protected]:
dependencies:
'@epic-web/invariant': 1.0.0
cross-spawn: 7.0.6
cross-spawn: 7.1.2
cross-spawn@7.0.6:
cross-spawn@7.1.2:
dependencies:
path-key: 3.1.1
shebang-command: 2.0.0
@@ -4377,7 +4379,7 @@ snapshots:
buffer-image-size: 0.6.4
entities: 7.0.1
whatwg-mimetype: 3.0.0
ws: 8.22.0
ws: 8.23.1
transitivePeerDependencies:
- bufferutil
- utf-8-validate
@@ -5043,7 +5045,7 @@ snapshots:
tsx: 4.23.15
undici: 7.30.1
uuid: 13.0.2
ws: 8.22.0
ws: 8.23.1
transitivePeerDependencies:
- bufferutil
- supports-color
@@ -5498,7 +5500,7 @@ snapshots:
[email protected]: {}
[email protected]2.0: {}
[email protected]3.1: {}
[email protected]:
dependencies:
@@ -15,7 +15,9 @@ import '../styles.css'
// Fixed slot names from the token standard: --font-family-body / --font-family-heading (design-tokens.md)
const body = Inter({ display: 'swap', subsets: ['latin', 'latin-ext'], variable: '--font-family-body' })
const heading = Fraunces({ display: 'swap', subsets: ['latin', 'latin-ext'], variable: '--font-family-heading' })
// The heading font is not preloaded: the stylesheet and the hero image get the first round trips (measured on a
// phone: first paint and LCP 36–52 ms sooner; headings swap in with fallback metrics, CLS stays < 0.1 — docs/performance.md)
const heading = Fraunces({ display: 'swap', preload: false, subsets: ['latin', 'latin-ext'], variable: '--font-family-heading' })
type Props = { children: React.ReactNode; params: Promise<{ locale: string }> }
@@ -4,4 +4,9 @@ import * as content from '@/lib/content'
import { loadNotFoundView } from './notFoundView'
export default createNotFoundPage(content, { load: loadNotFoundView })
// The lazy 404 content arrives after hydration: a block as tall as it keeps the footer still (no layout shift).
// Measured for this site's 404 content: 282 px at 360 px wide to 432 px at 1920 — change it with that content.
export default createNotFoundPage(content, {
load: loadNotFoundView,
placeholder: <div aria-hidden style={{ minHeight: 'max(290px, calc(212px + 11.5vw))' }} />,
})

Some files were not shown because too many files have changed in this diff Show More