Compare commits
@@ -5,7 +5,7 @@ Start with `.claude/skills/payload/SKILL.md` for a quick reference, then see `.c
|
||||
|
||||
## Main rule: the plugin helps projects, never limits them
|
||||
|
||||
ipal-kit is a plugin. Every change must leave the consuming project free to adapt it.
|
||||
IAPL (Intecion Advanced Payload Library, package `@intecion/ipal-kit`, formerly ipal-kit) is a plugin. Every change must leave the consuming project free to adapt it.
|
||||
|
||||
- Every module and feature can be turned off on its own. Turning one off never takes away anything the project still needs.
|
||||
- Every default can be overridden: access rules, fields, hooks, labels, routes, collections and globals. The project's own config is merged with the plugin's and wins.
|
||||
@@ -15,7 +15,7 @@ ipal-kit is a plugin. Every change must leave the consuming project free to adap
|
||||
|
||||
## Rule: an agent that adds the plugin gets the complete guide
|
||||
|
||||
When an agent adds ipal-kit to a project, `docs/agent/AGENT.md` and the `ipal-*` skills (installed by `ipal-skills`) must tell it how to set up and use every function the plugin supports.
|
||||
When an agent adds IAPL to a project, `docs/agent/AGENT.md` and the `iapl-*` skills (installed by `iapl-skills`) must tell it how to set up and use every function the plugin supports.
|
||||
|
||||
- Every export, option, env var, route, middleware, layout component, admin import-map entry and hook a project must wire is documented, with steps and a way to verify it.
|
||||
- A change that adds or alters a feature updates the agent guide and the matching skill in the same change.
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
// text between the markers is ever rewritten; the project's own content stays as it is.
|
||||
|
||||
import { createHash } from 'node:crypto'
|
||||
import { cpSync, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from 'node:fs'
|
||||
import { dirname, join, relative, resolve } from 'node:path'
|
||||
import { cpSync, existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, writeFileSync } from 'node:fs'
|
||||
import { basename, dirname, join, relative, resolve, sep } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
|
||||
const args = process.argv.slice(2)
|
||||
@@ -39,8 +39,22 @@ if (!destValue || destValue.startsWith('-')) {
|
||||
process.exit(1)
|
||||
}
|
||||
const dest = resolve(process.cwd(), destValue)
|
||||
if (dest === resolve(process.cwd())) {
|
||||
console.error('iapl-skills: --dest must be a subdirectory, not the project root')
|
||||
// Compared AFTER resolving links: `--dest root-link` (a link to `.`), `..` or `/` would otherwise pass and lose
|
||||
// the iapl-* folders of the project root, its parent or the filesystem root. A folder that does not exist yet is
|
||||
// resolved through its nearest existing parent.
|
||||
const real = (path) => {
|
||||
const rest = []
|
||||
let at = path
|
||||
while (!existsSync(at) && dirname(at) !== at) {
|
||||
rest.unshift(basename(at))
|
||||
at = dirname(at)
|
||||
}
|
||||
return join(realpathSync(at), ...rest)
|
||||
}
|
||||
const realDest = real(dest)
|
||||
const realRoot = real(resolve(process.cwd()))
|
||||
if (realDest === realRoot || realRoot.startsWith(realDest.endsWith(sep) ? realDest : `${realDest}${sep}`)) {
|
||||
console.error(`iapl-skills: --dest must be a folder inside the project or elsewhere, not the project root or a folder that holds it (${destValue} is ${realDest})`)
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,179 @@ 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.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
|
||||
> sending method (point 5). In this order:
|
||||
>
|
||||
> **1. A write-only secret could be read back (fixed).** On 1.17.0 an **admin** could recover the SMTP password or
|
||||
> the Turnstile secret key character by character through a query that names the field
|
||||
> (`/api/globals/site-integrations/versions?where[version.smtpPassword][like]=…`, REST or GraphQL), **only on a site
|
||||
> whose project had turned versions on** for Site integrations (off by default), or for its own collection with a
|
||||
> `writeOnlySecret` field. An editor or a plain account could not (their query on the field was refused); visitors
|
||||
> never. Now no query can name a write-only field (`where` / `sort` answer `400 QueryError`); reads still show
|
||||
> `********`. Nothing to do. If such a site is yours and an admin account may have been misused, change the SMTP
|
||||
> password and the Turnstile key.
|
||||
>
|
||||
> **2. What can stop a site at start.** A config value the plugin does not understand now stops the start with the
|
||||
> option's name, instead of being read as off or open — for example `accounts: 0`, `stats: 'false'`,
|
||||
> `consentLog: { retentionDays: null }`, `dashboardAlerts.integrations: 'Admin'`, `buildCsp({ dev: 'false' })`,
|
||||
> `buildSecurityHeaders({ hsts: null })`, seed `guard: 0`, a `developmentHosts` list that is not one. Role names
|
||||
> outside `user`, `editor`, `admin` in `requireRole` / `requireRoleField` throw. Real values start as before.
|
||||
> **Check before deploying:** `pnpm build` (the error names the option; security.md → "Switches are read strictly").
|
||||
>
|
||||
> **3. What people see change.**
|
||||
> - **Sites with `whiteLabel`: the panel's sign-in page has a new look** — a dark panel with the client's logo
|
||||
> (Site settings → Logo) or the site's name beside the form, on login and the 2FA screens. **Editors can no longer
|
||||
> change the site's name, logo and icon** in Site settings (admins can; `whiteLabel: { brandAccess: 'editor' }`
|
||||
> gives it back). **Every logo that showed on the login screen before shows on the new screens**, an SVG too (as a
|
||||
> picture). No plate under the logo: a logo with dark letters needs `signIn: { logoPlate: true }`. The old screens: `whiteLabel: { signIn: false }`.
|
||||
> Forgot / reset password, first user and logout get the look with **one config line**,
|
||||
> `whiteLabel: { signIn: { allScreens: true } }`, and `pnpm payload generate:importmap`.
|
||||
> - **2FA:** correct codes are never refused any more (only wrong ones count towards the limit); several attempts at
|
||||
> once may be told "try again in a moment". The admin's 2FA reset works only from the site's own pages.
|
||||
> - **Visitors:** `/md/<a language the site does not have>` is a 404; a never-published page assigned as the 404
|
||||
> page is not shown; a search longer than 10 words or 200 characters is searched by its first words.
|
||||
> - **A site without `serverURL` and without `NEXT_PUBLIC_SERVER_URL`** loses the logo in its panel link preview.
|
||||
>
|
||||
> **4. One line in each project:** the proxy matcher (`src/proxy.ts`) —
|
||||
> `'/((?!(?:api|admin|_next)(?:/|$)|.*\\..*).*)'`; `iapl-doctor` warns `proxy-matcher` until it is changed. Without it
|
||||
> pages whose names only start with `api` / `admin` / `_next` skip the proxy, as before.
|
||||
>
|
||||
> **5. E-mail — nothing to do, one thing to know.** "Sending method" in Site integrations → E-mail sending is a
|
||||
> choice again: IWSN (built-in), Own SMTP server, Microsoft Graph (deprecated). **Upgrading writes nothing and
|
||||
> loses no mail:** the field shows the method the site sends through today as selected (no SMTP server → IWSN; an
|
||||
> SMTP server → Own SMTP server; `GRAPH_*` → Microsoft Graph), and the site keeps sending that way. **Nothing changes
|
||||
> until somebody picks another option:** saving the page with the method shown stores no choice. A different option
|
||||
> picked and saved is stored, and from then on the site sends that way only. If the chosen method cannot
|
||||
> be used — "Own SMTP server" without server, user name and password, "Microsoft Graph" on a server without
|
||||
> `GRAPH_*` — e-mails **fail and the panel says so; they are not sent another way** (in 1.17.0 they would have gone
|
||||
> through SMTP or IWSN). The panel warns while the option is being picked, before the save.
|
||||
> **Postgres / SQLite projects: create and apply one migration** (`pnpm payload migrate:create`; the new field
|
||||
> `emailMethod` is a column) in the same deploy. Without it the site still sends its mail the old way and one loud
|
||||
> log line says so, but the Site integrations page of the panel does not open. MongoDB: nothing.
|
||||
> A seed or script that set `emailTransport` keeps working (it leaves the site on the old order); to choose, it
|
||||
> writes `emailMethod`.
|
||||
|
||||
### Security
|
||||
- **Write-only secrets cannot be named in a query** (point 1 above). `secretReadAccess`, the field read rule behind
|
||||
it, is exported; `writeOnlySecret` sets it.
|
||||
- **The proxy matcher skipped pages that only start with `api`, `admin` or `_next`.** The documented literal
|
||||
`'/((?!api|admin|_next|.*\\..*).*)'` did not end those names at "/", so `/administracja`, `/admin-guide` or `/apis`
|
||||
skipped the proxy: no locale redirect, and on a single-locale site with `createProxy({ csp })` no CSP. The
|
||||
literal is now `'/((?!(?:api|admin|_next)(?:/|$)|.*\\..*).*)'` (`DEFAULT_PROXY_MATCHER`, the reference site, the
|
||||
starter, the docs). **Requires a project change:** Next reads the matcher from each site's `proxy.ts`, so paste
|
||||
the new literal there; `iapl-doctor` reports the old one (`proxy-matcher`, warning).
|
||||
- **Form files: a program inside a DOCX / XLSX named `setup.exe.` or `setup.exe ` passed** (Windows drops the
|
||||
trailing dot or space when the file is extracted). Trailing dots and spaces are ignored now.
|
||||
- **`iapl-skills --dest` compared the paths before resolving links**: `--dest <a link to .>`, `..` or `/` passed
|
||||
the "not the project root" rule and lost the `iapl-*` folders there. The paths are resolved first; a folder that
|
||||
is the project root or holds it is refused. A folder elsewhere (shared skills) still works.
|
||||
- **The starter bundle followed symbolic links**: a link committed under `reference/` would have shipped its
|
||||
target's content in the published bundle (none existed). Links are refused; `iapl create` also refuses a bundle
|
||||
path that leaves the new folder.
|
||||
- **2FA verify limit counts wrong codes only.** Before, every attempt counted, so the sixth correct login of one
|
||||
account within 10 minutes (an office sharing a login, several devices) was refused for 10 minutes. Five wrong
|
||||
codes still lock the account for the window. Several attempts of one account at the same moment: one may be told
|
||||
"being checked right now, try again in a moment" (`429`, `Retry-After: 2`). A project that wires
|
||||
`buildVerifyLimit` into its own endpoint calls `limit.settle(req, correct)` after its check.
|
||||
- **`POST /api/ipal/two-factor/reset` refuses a request a browser marks as coming from another origin** (`403`), like
|
||||
verify and setup since 1.16.7: a page on a sibling subdomain could reset any account's 2FA with an admin's cookie
|
||||
when `serverURL` was not set. `twoFactor.sameOrigin: false` turns it off.
|
||||
- **Request bodies from strangers are read only up to their cap**, also without a `content-length`: the mail-service
|
||||
confirm call, CSP reports, page views (stats) and MCP (`maxBytes`, 64 KiB).
|
||||
- **Rich-text links:** one check for every stored URL (`autolink`, links marked internal, the Markdown output).
|
||||
- **Strict switches** (point 2 above): `hasMinimumRole` / `userMeetsRole` answer `false` for an unknown role name;
|
||||
before, every staff account met it.
|
||||
- **Site integrations versions** (when a project turns them on): only admins list them (`readVersions`).
|
||||
- **Unknown locales:** `resolveRoute` returns nothing for a code the site does not have (`isSiteLocale`); `/md/xx`,
|
||||
MCP `get_page` and the search route no longer fall back to the default language's page.
|
||||
- **The 404 page:** a never-published page assigned in System pages is not rendered.
|
||||
- **The public preview-image endpoint could be made to fetch from a host named in the request.**
|
||||
`GET /api/ipal/admin-og` resolved a site-relative logo address against the request's own host and fetched it with
|
||||
redirects followed, no timeout and no size limit; `GET /api/ipal/admin-icon` resolved the same way. Both now
|
||||
resolve against the site's configured origin only (`serverURL`, else `NEXT_PUBLIC_SERVER_URL`), ask one address,
|
||||
never follow a redirect, give up after 5 s and stop reading at 512 KB. `fetchPublicImage` (exported) behaves so
|
||||
for every caller and takes `{ timeoutMs }`; new export `PUBLIC_IMAGE_TIMEOUT_MS`. **For a project:** nothing to do
|
||||
when `serverURL` is set (the starter sets it). A site without `serverURL` and without `NEXT_PUBLIC_SERVER_URL`
|
||||
loses the logo in its panel link preview (the site name is drawn) and the icon endpoint redirects to the media
|
||||
file — set `serverURL`. A logo or icon whose address answers with a redirect is no longer fetched by the server.
|
||||
|
||||
### Added
|
||||
- **Sign-in look (`whiteLabel.signIn`, on with `whiteLabel`).** A dark panel with the label "Administration panel",
|
||||
the client's logo (Site settings → Logo) or the site's name, and the panel's languages as links;
|
||||
the form beside it, in both admin themes; a band above the form on a phone. Logo and name come from Site settings:
|
||||
no env var, **no new field, no schema change** (MongoDB, Postgres, SQLite alike). With nothing set the panel shows
|
||||
the label and the site's host — no Payload or Intecion mark. The logo on a white plate is an option; the default is no plate.
|
||||
- **`signIn: { allScreens: true }`** — the same look on forgot / reset password, create first user, logout and
|
||||
"unauthorized". Adds the provider `SignInLook` (one import-map entry: `pnpm payload generate:importmap`). The
|
||||
project starter writes it for new sites. A production start that does not find the entry in `importMap.js`
|
||||
leaves the provider out and logs what to run; the panel keeps working.
|
||||
- **The logo:** whatever Site settings → Logo holds, an SVG too, as an `<img>`; fits 240 × 72 (it was up to
|
||||
420 × 120), served from a generated size at least twice as wide when the media collection has one; alternative
|
||||
text = the site's name. Its file is asked once before it is printed (no redirect followed, 4 s, 512 KB): a file
|
||||
that is gone, or is no picture, gives the site's name instead of a broken picture; in any doubt the upload is
|
||||
believed.
|
||||
- **Options:** `signIn.accent` (hex colour of the button, links and focus ring), `signIn.logoPlate` (a white plate),
|
||||
`signIn.svgLogo: false` (refuse an SVG logo), `signIn.checkLogo: false`, `signIn.languages: false`,
|
||||
`whiteLabel.brandAccess` (`'admin'` with the look, `'editor'` as before; field-level access, no schema change).
|
||||
CSS variables `--iapl-signin-*` for a project's `custom.scss`.
|
||||
- **Language links before sign-in:** `GET /api/ipal/admin-language?lng=<code>` writes Payload's language cookie for
|
||||
a supported language and returns to the admin page it was opened from (public; 400 for an unknown language;
|
||||
never redirects off the admin route). Registered only with the sign-in look and `languages !== false`.
|
||||
- **The 2FA code boxes have names** for screen readers ("Digit 2 of 6") and ask a phone for the numeric keyboard
|
||||
(with the sign-in look).
|
||||
- Exports: `SignInPanel`, `SignInLook` (`/admin`); `resolveSignInLook`, `loadSignInBrand`, `signInLogo`,
|
||||
`signInName`, `checkLogoFile`, `fitLogo`, `isSvgUpload`, `languageLinks`, `LANGUAGE_NAMES`, `signInCss`, `isHexColour`,
|
||||
`signInProviderActive`, `buildAdminLanguageEndpoint`, `adminPathFromReferer`, `SIGN_IN_LOOK`, `SIGN_IN_STYLE_ID`,
|
||||
`SIGN_IN_LOGO_BOX`, `SIGN_IN_NAME_MAX`, `ADMIN_LANGUAGE_PATH` and their types.
|
||||
- **`routes:check`** — every public route (REST, GraphQL, Next route files) against a committed snapshot with one
|
||||
reason per entry; fails on a route nobody has judged. `listPublicRoutes`, `listNextRouteFiles`,
|
||||
`compareRouteSnapshot`, `updateRouteSnapshot` (`@intecion/ipal-kit`), `runRouteCheck` (`@intecion/ipal-kit/doctor`);
|
||||
a template in the `iapl-audit` skill (security.md "Routes nobody has judged").
|
||||
- **Closed doors from outside** — a Playwright template that asks every door that must stay closed as an anonymous
|
||||
visitor, a customer and an editor on a production build (security.md "Closed doors from outside"); in this
|
||||
repository part of `pnpm e2e:built`, in both bundlers.
|
||||
- `iapl-doctor` rule **`proxy-matcher`** (above).
|
||||
- `readPublished(minimum)` — read rule for a collection with drafts: visitors get published documents only (by id,
|
||||
list, `?draft=true`, GraphQL). `isSiteLocale`, `limitQuery`, `SEARCH_QUERY_LIMIT`,
|
||||
`searchContent` / `createSearchRoute({ queryLimit })`, `createMcpRoute({ maxBytes })`, `assertPluginSwitches`.
|
||||
- Docs: decide `twoFactor.requireSetup.exempt` from a field only admins can write (an admin-only checkbox), not from
|
||||
the e-mail — every account may change its own e-mail (security.md).
|
||||
|
||||
### Changed
|
||||
- **E-mail: "Sending method" is an explicit choice again** — "IWSN (built-in)", "Own SMTP server", "Microsoft
|
||||
Graph (deprecated)" — and what is chosen is what is used (point 5 above). Only the chosen method's fields are
|
||||
shown; the state block and the test e-mail name it ("through IWSN" / "through your SMTP server" / "through
|
||||
Microsoft Graph"). A chosen method that cannot be used fails loudly — status `smtp-incomplete` /
|
||||
`graph-not-set-up`, doctor `mail-method` — and the mail is not sent another way; in 1.17.0 "Automatic" picked
|
||||
the transport from which fields were filled in. Stored in a new field of Site integrations, `emailMethod`
|
||||
(`relay` / `smtp` / `graph`, empty until somebody chooses); `emailTransport` stays, hidden.
|
||||
New exports: `getMailMethod`, `setMailMethod`, `resolveMailMethod`, `readMailSettings`, `isMailMethod`,
|
||||
`MAIL_METHODS`, `STORED_MAIL_METHOD_CONTEXT`, `mailMethodColumnMissing`, types `MailMethod`, `ResolvedMailMethod`,
|
||||
`MailMethodProblem`. `pnpm payload generate:types`
|
||||
gives a diff (the new field): run it and commit.
|
||||
- `AdminLogo` prints the sign-in panel when the plugin gives it `signIn` (the default with `whiteLabel`); wired by
|
||||
hand without that prop it is the plain logo as before. The logo on the login screen is now shown inside
|
||||
240 × 72 px (it was up to 420 × 120).
|
||||
- The credit line under the login form: full-strength muted colour and a hairline above it (it was 60 % opacity).
|
||||
- The reference site and the starter use `whiteLabel: { signIn: { allScreens: true } }`.
|
||||
- The plugin's own `package.json` declares `@swc/core` in `pnpm.ignoredBuiltDependencies`: its install script only
|
||||
checks the native binary, which the build already has. pnpm no longer asks about it (repository only; no effect on
|
||||
projects).
|
||||
- `truncate` (summaries, meta descriptions) never returns more than its limit.
|
||||
|
||||
### Requires project changes
|
||||
- **Postgres / SQLite projects: one migration**, in the same deploy — the new field `emailMethod` of Site
|
||||
integrations is a column (`pnpm payload migrate:create`, commit, apply at container start). MongoDB projects:
|
||||
nothing. Until it runs: mail keeps going the old way, the Site integrations page does not open,
|
||||
`iapl-doctor --deep` reports `mail-method` (point 5 above).
|
||||
- **The proxy matcher**, one line (point 4 above).
|
||||
- **A config value the plugin does not understand** stops the start (point 2): `pnpm build` before deploying.
|
||||
- **Recommended with `whiteLabel`:** `signIn: { allScreens: true }` + `pnpm payload generate:importmap`; look at a
|
||||
project's own login CSS after the update.
|
||||
- `serverURL` (or `NEXT_PUBLIC_SERVER_URL`) set, as the starter does, for the panel's link-preview logo.
|
||||
|
||||
## 1.17.0 — the plugin is called IAPL; mail works with no setup
|
||||
|
||||
> **Read before upgrading.** In this order: the security follow-ups prepared as 1.16.8 (never released on their
|
||||
|
||||
@@ -169,7 +169,7 @@ They fail closed: where the staff collections are not known, nobody is staff, an
|
||||
### Collection-level (return boolean | Where)
|
||||
|
||||
```ts
|
||||
import { adminOnly, adminOrEditor, adminOrSelf, adminOrSelfIn, requireRole, authenticated } from '@intecion/ipal-kit'
|
||||
import { adminOnly, adminOrEditor, adminOrSelf, adminOrSelfIn, readPublished, requireRole, authenticated } from '@intecion/ipal-kit'
|
||||
|
||||
export const Articles = {
|
||||
slug: 'articles',
|
||||
@@ -191,8 +191,19 @@ access: { read: adminOrSelf } // fine with a single auth collection
|
||||
|
||||
// any minimum threshold
|
||||
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') }
|
||||
```
|
||||
|
||||
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
|
||||
the rule to that version), never the draft.
|
||||
|
||||
### Field-level (return boolean)
|
||||
|
||||
```ts
|
||||
|
||||
@@ -528,7 +528,7 @@ No abbreviations (`HeroSection`, not `HeroSec`). Do not create `lib/pages.ts`,
|
||||
|
||||
1. **`proxy.ts`, never `middleware.ts`.** middleware.ts exists → delete it. Proxy:
|
||||
`export const proxy = createProxy(i18nConfig, { NextResponse, markdown: true })`, the matcher
|
||||
as an **inline literal** (`['/((?!api|admin|_next|.*\\..*).*)']`), not an import.
|
||||
as an **inline literal** (`['/((?!(?:api|admin|_next)(?:/|$)|.*\\..*).*)']`), not an import.
|
||||
2. **No explicit `<head>` in the layout.** It pushes metadata into `<body>`.
|
||||
`<MediaPreconnect/>` in `<body>` (React 19 hoists it).
|
||||
3. **ISR:** `export const revalidate = 3600` in `page.tsx`. Refresh after save:
|
||||
@@ -1103,7 +1103,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`); 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 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 |
|
||||
| Data from globals | `getGlobal`, `getSiteSettings`, `getSiteIntegrations` | payload-helpers.md |
|
||||
|
||||
**Links and navigation**
|
||||
@@ -1141,7 +1141,7 @@ project → **plugin gap**, not a copy.
|
||||
| Product / category JSON-LD (an entry that is not an article) | `pageJsonLd.entries` + `buildProductJsonLd` | seo.md |
|
||||
| llms.txt / llms-full / Markdown / MCP | `llmsRoute`, `llmsFullRoute`, `markdownRoute`, `mcpGET`/`mcpPOST`; `markdownAlternate: true`; `createProxy({ markdown: true })` | seo.md, content.md, mcp.md |
|
||||
| IndexNow | `iapl({ indexNow: true })` + `indexNowKeyRoute` | seo.md |
|
||||
| Search | `createSearchRoute({ …, isPathVisible })` | content.md |
|
||||
| Search | `createSearchRoute({ …, isPathVisible })`; `queryLimit` (default `SEARCH_QUERY_LIMIT` = `{ length: 200, words: 10 }`, `limitQuery(query, limit)` shows the cut — a longer query is cut before the database; `false` = whole query); an unknown `?locale` is the default locale | content.md |
|
||||
|
||||
**Media, look, speed**
|
||||
| Need | Use | Doc |
|
||||
@@ -1171,6 +1171,7 @@ project → **plugin gap**, not a copy.
|
||||
| Mail | `email: mailAdapter()` + `serverURL` — mail works with no other setup, through the Intecion mail service; SMTP in the panel only when the client asks; your own mail: `payload.sendEmail` (`withMailKind` when it is account mail); never a second transport in the project. §7.2 | email.md |
|
||||
| Env validation, health | `assertEnv(iaplEnvRules({…}))` (`/env`), `healthRoute` | env.md |
|
||||
| 2FA, white-label, headers | `twoFactor: { issuer, plugin: payloadTotp }`, `whiteLabel`, `buildSecurityHeaders` | security.md, white-label.md |
|
||||
| Sign-in screens (login, forgot / reset password, first user, logout, the 2FA screens): a dark panel with the client's logo or the site's name beside the form, language links, both themes, phone | on with `whiteLabel` (`signIn`); a NEW site: `whiteLabel: { signIn: { allScreens: true } }` + `pnpm payload generate:importmap` (adds the provider `SignInLook`; without it only login and the 2FA screens get the look, through `AdminLogo` / `SafeTotpView`). Logo and name come from Site settings (no env var, no new field, no migration). The logo is whatever Site settings → Logo holds, an SVG too, as `<img>` — the same as on the login screen before (`svgLogo: false` refuses SVG); a file that is gone gives the name instead of a broken picture (`checkLogo`); no plate (`logoPlate: true` for a logo with dark letters). Options: `accent` (hex), `languages: false`; `signIn: false` = Payload's screens. Name / logo / icon are admin-only with the look (`brandAccess: 'editor'` = as before). Never build a login page, a custom `graphics.Logo` or login CSS by hand. Check: `curl -s $URL/admin/login \| grep -c iapl-signin__label` ≥ 1; `curl -si "$URL/api/ipal/admin-language?lng=xx"` → 400 | white-label.md → "The sign-in screens" |
|
||||
| Panel link preview + noindex (site name, description, preview image, technology support credit) | on by default (`adminMeta`, `agency`) — do not hand-write `admin.meta` for it; override single keys in `admin.meta` or `adminMeta: { … }` | white-label.md |
|
||||
| Rate limit (forms, MCP, search) | built in; IP from `IAPL_IP_HEADER`; several instances → `setRateLimitStore` | forms.md |
|
||||
|
||||
@@ -1211,6 +1212,11 @@ add missing hosts with flags / `extra`; (3) change `mode` to `'enforce'` in both
|
||||
| Text written in one language fills the empty languages (cookie list, cookie review), never over a language's own text | `fillEmptyLocales: false` | `fillEmptyLocales: { 'cookie-settings': [...], 'cookie-review': [...] }`; `buildFillEmptyLocalesGlobalHook` / `…CollectionHook` for your own globals and collections |
|
||||
| Cookie approval: one summary + **Approve and add** (editor+), unknown cookies approved as `marketing` + "Needs description", dashboard reminder while cookies wait; nothing reaches the cookie banner before approval | `cookieScanner.approval: false` (per-entry review) | `approval.unknownCategory`, `approval.dashboard: false`; building blocks `approveCookies`, `loadCookieApproval`, `countPendingCookies`, `flagGoneEntries`, `sameCookie` |
|
||||
| Cookie review: scan + review editor+, delete admin; Open Cookie Database "Functional" → `functional` | omit `cookieScanner` | `cookieScanner.access`, `collectionOverrides`, `databaseCategories`, `integrations`, `declarations`, `labels`, `syncAccepted: false`; building blocks `runCookieScan`, `collectCookieFindings`, `applyCookieFindings` |
|
||||
| Plugin switches read strictly (1.17.1): a nonsense value (`accounts: 0`, `stats: 'false'`, `consentLog: { retentionDays: null }`, `dashboardAlerts.integrations: 'Admin'`, a 0 window in `mail.relay`, `storageNames: 'IAPL'`, …) stops the start with the option's name; `buildSecurityHeaders` / `buildCsp` likewise (`extra` values are arrays) | — (pass a real value: `true` / `false`, an object, a number in range) | security.md "Switches are read strictly"; verify: `pnpm build` starts, or the error names the option |
|
||||
| Request bodies from strangers are read only up to a cap, declared length or not (1.17.1): consent log 4 KiB, page views 4 KiB, mail-service confirm 2 KiB, CSP reports `maxBytes` 16 KiB, MCP `maxBytes` 64 KiB → `413` | — | `createMcpRoute({ maxBytes })`, `createCspReportRoute({ maxBytes })`, `readCappedBody(request, max)` |
|
||||
| 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 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` |
|
||||
@@ -1218,11 +1224,11 @@ add missing hosts with flags / `extra`; (3) change `mode` to `'enforce'` in both
|
||||
| Injected `users`: admin manages everyone, others only themselves | — | `access.authAccess` (your keys win); your own `users` collection wins whole |
|
||||
| First registered account = admin | `access.firstUserAdmin: false` | `buildRolesField(defaultRole, { firstUserAdmin })` |
|
||||
| 2FA on the panel's login collection, mismatch = startup error; redirect to the 2FA screens by `TotpRedirectProvider` | `twoFactor: false` (discouraged) | `twoFactor.collectionSlug`, `allowCollectionMismatch: true`, `twoFactor.provider` (own component, or `false` for the package's) |
|
||||
| 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`), `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** |
|
||||
| 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 verify attempts per account in 10 minutes (`POST /api/verify-totp` → `429`); the count is kept in memory and in the database (`payload.kv`), so a restart or a second instance does not reset it | `twoFactor.verifyLimit: false` | `verifyLimit: { max, windowMinutes, store: 'memory' }` |
|
||||
| 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. **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. **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]` |
|
||||
| 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)` |
|
||||
| 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` |
|
||||
@@ -1251,7 +1257,7 @@ add missing hosts with flags / `extra`; (3) change `mode` to `'enforce'` in both
|
||||
| Sitemap split / CDN cache / memo | `sitemapOptions: { maxUrls: Infinity, cacheControl: false, memoSeconds: 0 }` | `sitemapEntries`, `createSitemapRouteHandler`, `buildSitemapIndexXml`, `buildSitemapEntries` |
|
||||
| Sitemap error = 503 + `Retry-After` | — (correct HTTP behaviour) | your own route with `buildSitemapXml` |
|
||||
| IndexNow silent with `IAPL_NOINDEX` | `indexNow` off by default | `submitToIndexNow` by hand |
|
||||
| A site with no SMTP server in the panel sends through the Intecion mail service: it enrols by itself on its first send (an outbound call with its host and the plugin version) and gets its own token through the public route `POST /api/iapl/mail-relay/confirm` | `mail: { relay: false }` (no call, no routes, no state block) | `mail.relay: { url, host, enrol, token, senderName, kind, accountMail, confirmRateLimit, timeoutMs, retryBackoffMs, fetchImpl }`; `mailAdapter({ relay })`; §7.2 |
|
||||
| A site sends through the Intecion mail service unless an admin chose another "Sending method" (SMTP, Graph): it enrols by itself on its first send (an outbound call with its host and the plugin version) and gets its own token through the public route `POST /api/iapl/mail-relay/confirm` | `mail: { relay: false }` (no call, no routes, no state block) | `mail.relay: { url, host, enrol, token, senderName, kind, accountMail, confirmRateLimit, timeoutMs, retryBackoffMs, fetchImpl }`; `mailAdapter({ relay })`; §7.2 |
|
||||
| The mail service's token is kept in `payload.kv` (never in a field, never readable over REST or GraphQL), bound to the site's server addresses, rotated every 90 days | "Disconnect" in the panel; `disconnectRelay` | `enrolRelay`, `rotateRelayToken`, `setRelayToken`, `getRelayStatus` |
|
||||
| Account e-mails through the mail service: at most 5 to one address and 10 asked for by one visitor an hour | `mail: { relay: { accountMail: false } }` | `accountMail: { perAddress, perVisitor, windowMinutes }` |
|
||||
| Every message says what it is (form notification, form confirmation, account, test, system) | — (other transports ignore the mark) | `withMailKind`, `runWithMailKind`, `expectMailTo`, `mail.relay.kind`, `buildFormMailKindHook` |
|
||||
@@ -1283,9 +1289,25 @@ No env variable, no key, no field to fill in, no import-map change (the tab's st
|
||||
banner that is already in every import map). **Do not** add `nodemailer`, `resend`, an `api/send` route or a
|
||||
`GRAPH_*` variable to a project.
|
||||
|
||||
**How a send is routed** (`resolveMailTransport`, type `MailTransport`): Microsoft Graph when the panel says so and
|
||||
`GRAPH_*` is set (deprecated) → SMTP when server, user name and password are filled in → Graph when `GRAPH_*` is set →
|
||||
the mail service → nothing (`mail: { relay: false }` and no SMTP). A site with SMTP filled in never contacts the service.
|
||||
**How a send is routed** — by the admin's choice, Site integrations → E-mail sending → **"Sending method"**: "IWSN
|
||||
(built-in)" (the mail service), "Own SMTP server", "Microsoft Graph (deprecated)". What is chosen is what is used;
|
||||
a choice that cannot be used (SMTP incomplete, Graph without `GRAPH_*`) **fails loudly and nothing is sent another
|
||||
way** (state block, status `smtp-incomplete` / `graph-not-set-up`, doctor `mail-method`). The choice is the stored field
|
||||
`emailMethod` (`relay` / `smtp` / `graph`; empty until somebody chooses) — **MongoDB: nothing to run; Postgres / SQLite:
|
||||
one migration** (`pnpm payload migrate:create`, applied at container start); before it runs the site keeps sending the
|
||||
old way, the Site integrations page does not open, and `iapl-doctor --deep` reports `mail-method` (error). Until somebody chooses (an upgraded site, a new site) the order of 1.17.0 applies and the field shows
|
||||
its result as selected (`resolveMailTransport`, type `MailTransport`): Graph when `emailTransport` is `graph` and
|
||||
`GRAPH_*` is set → SMTP when server, user name and password are filled in → Graph when `GRAPH_*` is set → the mail
|
||||
service → nothing. Saving with the method shown stores no choice: only picking another option does (the owner's
|
||||
rule: nothing changes until somebody picks another option); `setMailMethod` fixes it from code. The state block warns
|
||||
while an unusable option is picked, before the save. From code: `getMailMethod`,
|
||||
`setMailMethod(payload, 'relay' | 'smtp' | 'graph' | null)`, `resolveMailMethod` (`ResolvedMailMethod`,
|
||||
`MailMethodProblem`), `MailMethod`, `MAIL_METHODS`, `isMailMethod`, `readMailSettings` / `STORED_MAIL_METHOD_CONTEXT`
|
||||
(a read with the value as stored — an ordinary read shows the method in effect), `mailMethodColumnMissing`; or
|
||||
`updateGlobal` with `emailMethod`. Seeds that
|
||||
set up mail write `emailMethod`, not `emailTransport`. **Verify:** the state block names the method; **Send test
|
||||
e-mail** answers "through IWSN" / "through your SMTP server" / "through Microsoft Graph"; `iapl-doctor --deep`
|
||||
reports `mail-method` info (nothing picked yet) or nothing (picked and usable). `mail: { relay: false }` removes the option "IWSN".
|
||||
|
||||
**What the site needs for the mail service** — check each one:
|
||||
|
||||
@@ -1318,8 +1340,8 @@ the mail service → nothing (`mail: { relay: false }` and no SMTP). A site with
|
||||
--deep --url <site>` reports no `mail-*` finding. On `localhost` the plugin refuses to enrol (nothing leaves the machine): test
|
||||
mail locally with SMTP (Mailpit) or `createFakeRelay()`.
|
||||
|
||||
**The client wants its own mail server:** fill in "Own SMTP server", user name, password and "Sender address" in the
|
||||
panel, send a test. Nothing in code. **A site on `GRAPH_*`:** keeps working, warns once per start; move it when the
|
||||
**The client wants its own mail server:** "Sending method" → "Own SMTP server", fill in server, user name, password
|
||||
and "Sender address", save, send a test. Nothing in code. **A site on `GRAPH_*`:** keeps working, warns once per start; move it when the
|
||||
owner says so (email.md "Moving off Microsoft Graph").
|
||||
|
||||
**Your own mail** goes through `payload.sendEmail`. Say what it is when it is not a generic system message:
|
||||
@@ -1411,6 +1433,8 @@ its own tests). Order from the cheapest:
|
||||
| Build | `pnpm build` — page routes `●` (SSG), not `ƒ` | before every "done" |
|
||||
| Smoke (Playwright) | `iapl-audit/resources/smoke.spec.template.ts` → `tests/smoke.spec.ts`: all URLs from the sitemap 200 + title + one h1, 404, GEO routes, banner, form end-to-end | before handover and after every IAPL update |
|
||||
| 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 |
|
||||
| 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 |
|
||||
|
||||
|
||||
@@ -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.0 ("Example Studio", made up) that uses
|
||||
The reference site is one complete client site on IAPL 1.17.1 ("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:
|
||||
@@ -265,7 +265,7 @@ import { i18nConfig } from '@/i18n.config'
|
||||
export const proxy = createProxy(i18nConfig, { markdown: true, NextResponse })
|
||||
|
||||
// Inline LITERAL — Next reads the matcher statically (importing DEFAULT_PROXY_MATCHER breaks /admin)
|
||||
export const config = { matcher: ['/((?!api|admin|_next|.*\\..*).*)'] }
|
||||
export const config = { matcher: ['/((?!(?:api|admin|_next)(?:/|$)|.*\\..*).*)'] }
|
||||
```
|
||||
|
||||
## Collections and globals
|
||||
@@ -1164,6 +1164,8 @@ Rules: AGENT.md §8a.
|
||||
|
||||
| File | What it shows |
|
||||
|---|---|
|
||||
| `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/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) |
|
||||
@@ -1171,9 +1173,12 @@ Rules: AGENT.md §8a.
|
||||
| `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/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-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 address of the second test admin (below) |
|
||||
| `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-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 |
|
||||
|
||||
@@ -1239,7 +1244,7 @@ const payload = await getPayload({ config })
|
||||
await payload.updateGlobal({
|
||||
slug: 'site-integrations',
|
||||
context: { ipalIntegrationStatus: true },
|
||||
data: { emailStatus: { checkedAt: null, code: null, message: null, since: null, state: null }, emailTransport: 'smtp', smtpFromAddress: 'site@example-studio.test', smtpFromName: 'Example Studio', smtpHost: null, smtpPassword: null, smtpUser: null } as never,
|
||||
data: { emailStatus: { checkedAt: null, code: null, message: null, since: null, state: null }, emailMethod: 'relay', emailTransport: 'smtp', smtpFromAddress: 'site@example-studio.test', smtpFromName: 'Example Studio', smtpHost: null, smtpPassword: null, smtpUser: null } as never,
|
||||
overrideAccess: true,
|
||||
})
|
||||
for (const key of await payload.kv.keys()) {
|
||||
@@ -1249,6 +1254,23 @@ console.log('[e2e] no SMTP server and no mail-service token: the next e-mail enr
|
||||
process.exit(0)
|
||||
```
|
||||
|
||||
### `e2e/routes.ts`
|
||||
|
||||
```ts
|
||||
/**
|
||||
* routes:check — every public route of this site (REST, GraphQL, Next route files) against the judged list in
|
||||
* e2e/routes.snapshot.json (docs/security.md "Routes nobody has judged"). Reads the config only, never the database.
|
||||
* pnpm payload run e2e/routes.ts → fails on a route nobody has judged
|
||||
* pnpm payload run e2e/routes.ts update → adds new routes with an empty reason (judge them), drops gone ones
|
||||
* (`payload run` drops `--flags`, so the word is `update`.) From the plugin repository: pnpm routes:check [--update],
|
||||
* also the first step of pnpm e2e:built.
|
||||
*/
|
||||
import config from '@payload-config'
|
||||
import { runRouteCheck } from '@intecion/ipal-kit/doctor'
|
||||
|
||||
process.exit(await runRouteCheck({ config: await config, update: process.argv.slice(2).includes('update') }))
|
||||
```
|
||||
|
||||
### `e2e/totp.ts`
|
||||
|
||||
```ts
|
||||
@@ -1270,4 +1292,7 @@ export function totp(secret: string, now = Date.now()): string {
|
||||
|
||||
/** The second smoke-test admin (create-test-admin.ts makes both): `e2e-admin@…` → `e2e-admin-2@…`. */
|
||||
export const secondTestAdmin = (email: string): string => email.replace('@', '-2@')
|
||||
|
||||
/** The smoke-test editor (create-test-admin.ts makes it): `e2e-admin@…` → `e2e-admin-editor@…`, role `editor`, the same password and secret. */
|
||||
export const editorTestAccount = (email: string): string => email.replace('@', '-editor@')
|
||||
```
|
||||
|
||||
@@ -51,6 +51,13 @@ names, env, admin, AGENTS.md, skills, seeds and — with `--url` / `--deep` —
|
||||
|
||||
## What the script does not check (do it by hand)
|
||||
|
||||
- **Closed doors and judged routes** (security.md "Closed doors from outside", "Routes nobody has judged"):
|
||||
`resources/closed-doors.spec.template.ts` → `tests/closed-doors.spec.ts` (add the project's own doors; run on a
|
||||
production build as anonymous, customer and editor) and `resources/routes.template.ts` → `tests/routes.ts`
|
||||
(`pnpm payload run tests/routes.ts update` once, write a reason per route, commit the snapshot; then
|
||||
`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.
|
||||
|
||||
- **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
|
||||
@@ -69,4 +76,13 @@ names, env, admin, AGENTS.md, skills, seeds and — with `--url` / `--deep` —
|
||||
rolled out). Report-only for more than a few weeks with clean reports → WARNING (switch to `mode: 'enforce'`).
|
||||
Then open `/pl` and `/admin` in the browser: CSP lines in the console = missing sources (flags / `extra`).
|
||||
|
||||
- **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`
|
||||
(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"`
|
||||
answers an error with no `totalDocs`, else ERROR (the field lost `secretReadAccess`, e.g. an override replaced its
|
||||
`access`).
|
||||
|
||||
Do not say "done" until the full audit (without `--quick`) has no errors.
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
/**
|
||||
* Closed doors from outside — every door of the site that must stay CLOSED, asked on a PRODUCTION build (`pnpm build
|
||||
* && pnpm start`: Payload's GraphQL playground and introspection, among others, behave differently outside
|
||||
* production) as an anonymous visitor, a customer and an editor (IAPL docs/security.md "Closed doors from outside").
|
||||
* Copy to tests/closed-doors.spec.ts and run:
|
||||
*
|
||||
* BASE_URL=http://localhost:3000 pnpm exec playwright test tests/closed-doors.spec.ts
|
||||
*
|
||||
* Callers (each is skipped when its variables are missing):
|
||||
* anonymous always;
|
||||
* customer a site with a visitor login collection: E2E_CUSTOMER_COLLECTION (its slug), E2E_CUSTOMER_EMAIL,
|
||||
* E2E_CUSTOMER_PASSWORD — an existing test account of that collection;
|
||||
* editor E2E_EDITOR_EMAIL, E2E_EDITOR_PASSWORD, E2E_EDITOR_TOTP_SECRET — a staff test account with the role
|
||||
* `editor` and a known 2FA secret, on a LOCAL or staging database only (never production accounts).
|
||||
* Add the project's own doors to DOORS (a custom endpoint, a collection only staff may read, a global with secrets).
|
||||
* A write door is asked with a body that changes nothing when the door is open (an id that does not exist, `{}`).
|
||||
*/
|
||||
import { type APIRequestContext, expect, test } from '@playwright/test'
|
||||
import { createHmac } from 'node:crypto'
|
||||
|
||||
type Caller = 'anonymous' | 'customer' | 'editor'
|
||||
type Answer = { body: unknown; status: number }
|
||||
type Door = { body?: unknown; closed?: (a: Answer) => boolean; closedFor: Caller[]; graphql?: string; method?: 'DELETE' | 'GET' | 'PATCH' | 'POST'; name: string; path?: string }
|
||||
|
||||
const BASE = (process.env.BASE_URL ?? 'http://localhost:3000').replace(/\/$/, '')
|
||||
const ALL: Caller[] = ['anonymous', 'customer', 'editor']
|
||||
const OUTSIDERS: Caller[] = ['anonymous', 'customer']
|
||||
const NO_ID = '000000000000000000000000' // MongoDB; use 999999999 on Postgres / SQLite
|
||||
const refused = ({ status }: Answer) => [401, 403, 404].includes(status)
|
||||
const status = (code: number) => (a: Answer) => a.status === code
|
||||
const noData = (field: string) => ({ body, status: s }: Answer) => {
|
||||
const b = body as { data?: Record<string, unknown> | null; errors?: unknown[] } | null
|
||||
return s >= 400 || Boolean(b?.errors?.length) || b?.data?.[field] == null
|
||||
}
|
||||
|
||||
const DOORS: Door[] = [
|
||||
// the plugin's own — keep them
|
||||
{ closedFor: ALL, name: 'Site integrations cannot be read', path: '/api/globals/site-integrations' },
|
||||
{ body: {}, closedFor: ALL, method: 'POST', name: 'Site integrations cannot be saved', path: '/api/globals/site-integrations' },
|
||||
{ closedFor: ALL, graphql: '{ SiteIntegration { smtpHost } }', closed: noData('SiteIntegration'), name: 'Site integrations over GraphQL' },
|
||||
{ closedFor: ALL, name: 'the key-value store (2FA counts, the mail-service token)', path: '/api/payload-kv' },
|
||||
{ closedFor: ALL, name: 'the consent log', path: '/api/consent-records' },
|
||||
{ closedFor: ALL, name: 'the deep doctor status without its token', path: '/api/ipal/doctor', closed: status(404) },
|
||||
{ closedFor: ALL, method: 'POST', name: 'a test e-mail', path: '/api/ipal/test-email', body: { to: '[email protected]' } },
|
||||
{ closedFor: ALL, name: 'the mail-service status', path: '/api/iapl/mail-relay/status' },
|
||||
{ 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' },
|
||||
{ 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) },
|
||||
// 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) },
|
||||
]
|
||||
|
||||
/** RFC 6238 TOTP (SHA-1, 6 digits, 30 s) for a base32 secret. */
|
||||
function totp(secret: string): string {
|
||||
const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'
|
||||
let bits = ''
|
||||
for (const ch of secret.replace(/=+$/, '').toUpperCase()) {bits += alphabet.indexOf(ch).toString(2).padStart(5, '0')}
|
||||
const key = Buffer.from((bits.match(/.{8}/g) ?? []).map((b) => parseInt(b, 2)))
|
||||
const counter = Buffer.alloc(8)
|
||||
counter.writeBigUInt64BE(BigInt(Math.floor(Date.now() / 30_000)))
|
||||
const h = createHmac('sha1', key).update(counter).digest()
|
||||
return (((h.readUInt32BE(h[h.length - 1]! & 0xf) & 0x7fffffff) % 1_000_000).toString().padStart(6, '0'))
|
||||
}
|
||||
|
||||
async function signIn(caller: Caller, playwright: { request: { newContext: (o: object) => Promise<APIRequestContext> } }): Promise<APIRequestContext | null> {
|
||||
const api = await playwright.request.newContext({ baseURL: BASE, extraHTTPHeaders: { origin: BASE } })
|
||||
const env = process.env
|
||||
if (caller === 'customer') {
|
||||
if (!env.E2E_CUSTOMER_COLLECTION || !env.E2E_CUSTOMER_EMAIL || !env.E2E_CUSTOMER_PASSWORD) {return null}
|
||||
expect((await api.post(`/api/${env.E2E_CUSTOMER_COLLECTION}/login`, { data: { email: env.E2E_CUSTOMER_EMAIL, password: env.E2E_CUSTOMER_PASSWORD } })).status()).toBe(200)
|
||||
}
|
||||
if (caller === 'editor') {
|
||||
if (!env.E2E_EDITOR_EMAIL || !env.E2E_EDITOR_PASSWORD || !env.E2E_EDITOR_TOTP_SECRET) {return null}
|
||||
expect((await api.post('/api/users/login', { data: { email: env.E2E_EDITOR_EMAIL, password: env.E2E_EDITOR_PASSWORD } })).status()).toBe(200)
|
||||
expect((await (await api.post('/api/verify-totp', { data: { token: totp(env.E2E_EDITOR_TOTP_SECRET) } })).json()).ok).toBe(true)
|
||||
}
|
||||
return api
|
||||
}
|
||||
|
||||
for (const caller of ALL) {
|
||||
test.describe(`closed doors as ${caller}`, () => {
|
||||
let api: APIRequestContext | null = null
|
||||
test.beforeAll(async ({ playwright }) => {
|
||||
api = await signIn(caller, playwright)
|
||||
})
|
||||
for (const door of DOORS.filter((d) => d.closedFor.includes(caller))) {
|
||||
test(door.name, async () => {
|
||||
test.skip(!api, `no ${caller} test account configured`)
|
||||
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' })
|
||||
const text = await res.text()
|
||||
let body: unknown = text
|
||||
try { body = JSON.parse(text) } catch { /* not JSON */ }
|
||||
expect((door.closed ?? refused)({ body, status: res.status() }), `${door.graphql ?? door.path} → ${res.status()} ${text.slice(0, 200)}`).toBe(true)
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Routes nobody has judged — every public route of this site (REST, GraphQL, Next route files) against the judged
|
||||
* list in tests/routes.snapshot.json (IAPL docs/security.md "Routes nobody has judged"). Reads the config, never the
|
||||
* database: the same on MongoDB, Postgres and SQLite. Copy to tests/routes.ts, then:
|
||||
*
|
||||
* pnpm payload run tests/routes.ts update → writes tests/routes.snapshot.json, every route with an EMPTY reason
|
||||
* (write one line per route: who may use it and why it is open, or that it is closed and to whom)
|
||||
* pnpm payload run tests/routes.ts → fails on a route nobody has judged or an entry without a reason
|
||||
*
|
||||
* Run it in CI and after every Payload / IAPL / plugin upgrade; an upgrade that adds a route fails here until somebody
|
||||
* judges it (`update` adds it with an empty reason; review the diff). `payload run` drops `--flags`: the word is `update`.
|
||||
*/
|
||||
import config from '@payload-config'
|
||||
import { runRouteCheck } from '@intecion/ipal-kit/doctor'
|
||||
|
||||
process.exit(
|
||||
await runRouteCheck({
|
||||
config: await config,
|
||||
snapshot: 'tests/routes.snapshot.json',
|
||||
// appDir: 'src/app', // where the Next routes live
|
||||
// graphql: false, // a site that deleted app/(payload)/api/graphql
|
||||
update: process.argv.slice(2).includes('update'),
|
||||
}),
|
||||
)
|
||||
@@ -46,6 +46,9 @@ 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() }`
|
||||
— 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.
|
||||
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
|
||||
|
||||
@@ -34,7 +34,7 @@ through this procedure. Ask only when you are missing something you cannot get y
|
||||
### Build / TypeScript
|
||||
| Symptom | Cause | Fix |
|
||||
|---|---|---|
|
||||
| the 2FA code screen answers "Too many codes were tried…" (`429` from `/api/verify-totp`) | more than 5 verify attempts for that account in 10 minutes (`twoFactor.verifyLimit`); 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 |
|
||||
| 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 |
|
||||
@@ -100,6 +100,9 @@ through this procedure. Ask only when you are missing something you cannot get y
|
||||
| pixel before consent (consent-check) | script wired by hand (`<Script>`) | only through the panel → `<Analytics>` (GA/GTM/pixels) or `<ConsentScript>` (analytics.md, consent.md) |
|
||||
| banner without styles | Tailwind does not scan the plugin | `@source` on `node_modules/@intecion/ipal-kit/dist/**/*.js` (path relative to the CSS file, PROGRAMISTA §2.5) |
|
||||
| emails are not sent | no `email: mailAdapter()` / empty Emails tab of the form / the transport fails | Site integrations → E-mail sending: read the block "How e-mails are sent" and the banner's code, then **Send test e-mail**; rows below; email.md |
|
||||
| e-mails are not sent; state block: "Your SMTP server is chosen, but its settings are incomplete" / "Microsoft Graph is chosen, but it is not set up on this server" (status `smtp-incomplete` / `graph-not-set-up`, doctor `mail-method` error) | the chosen "Sending method" cannot be used, and since 1.17.1 nothing is sent another way | fill in server, user name and password / set the `GRAPH_*` variables — or choose another method (IWSN needs nothing) and save |
|
||||
| Site integrations does not open after the upgrade to 1.17.1 (Postgres / SQLite); log: "the column for \"emailMethod\" … is missing"; doctor `mail-method` error | the migration that adds the column has not run (mail still leaves the old way) | `pnpm payload migrate:create`, commit, apply at container start |
|
||||
| the site switched how it sends after a field or a variable changed | nobody has chosen the "Sending method" yet (doctor `mail-method` info): the site still picks by the order of 1.17.0 | nothing, if that is wanted (the owner's rule: no change until another option is picked); to fix it: pick the method (another option, then this one) or `setMailMethod(payload, '<method>')` |
|
||||
| state block: "Not connected yet" on the production domain | no e-mail was sent yet | **Send test e-mail** (the site enrols on its first send) or "Connect again" |
|
||||
| `relay-refused` / "The mail service could not reach this site at …" (cause `callback-failed`) | `unreachable` / `timeout`: firewall, private network, wrong public host in `serverURL`; `redirect`: `trailingSlash: true`, apex → `www`, a language redirect; `status`: route blocked, missing (`mail: { relay: false }`?) or another `routes.api`; `confirmation`: a proxy rewrites the answer | `curl -i -X POST https://<host>/api/iapl/mail-relay/confirm -d '{}' -H 'content-type: application/json'` must answer **404 with an empty body, no redirect**; fix `serverURL` / `mail.relay.host`, or ask Intecion to set the site's confirm address (path ending in `/confirm/` with trailing slashes); then "Connect again" (the site does not retry by itself for 15 min). email.md "When the site cannot be confirmed" |
|
||||
| `relay-refused`, cause `host-not-allowed` / "This site has no public address yet" | the site runs on `localhost`, a private name, or `serverURL` is empty | expected in development (use SMTP / Mailpit there); in production set `serverURL` |
|
||||
|
||||
@@ -39,6 +39,7 @@ description: Complete map of everything @intecion/ipal-kit provides — every ia
|
||||
| `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) |
|
||||
| `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) |
|
||||
| `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) |
|
||||
@@ -51,8 +52,8 @@ description: Complete map of everything @intecion/ipal-kit provides — every ia
|
||||
| `twoFactor.importMapCheck` | on | production only: at start searches the `importMap.js` on disk (where Payload looks for it) for `@intecion/ipal-kit/admin#SafeTotpView`; when not found, logs `[iapl] The admin import map may be out of date …` and IAPL's `TotpRedirectProvider` puts the notice "Two-step verification may not be available" above the 2FA screens (never instead of them). A hint only — the map in the build can differ from the file on disk (Dockerfile runner stage, re-exporting map); a file that is not found is not reported | `false` = no file read, log line or notice |
|
||||
| `twoFactor.texts` | IAPL's en/pl texts (`TOTP_TEXTS`) over the package's; 2FA screens titled "Two-step verification" / "Weryfikacja dwuetapowa" (site's language) | `false` = the package's texts; one text: `i18n.translations.<lang>.totpPlugin.<key>` (security.md) |
|
||||
| `twoFactor.guard` | on | IAPL's own second-factor check on every collection and global (also the plugin's own and those of plugins listed after iapl) and in `userMeetsRole`; startup fails with `[iapl] twoFactor: the injected 2FA plugin did not add …` when the 2FA package lacks the `totp` strategy / `hasTotp` / `totpSecret` | per entity: `custom.ipal.secondFactor: false` / `{ read: false }` or the package's `custom.totp.disableAccessWrapper.<op>`; `false` = the package's wrapper only (the plugin's own data then opens to a password without the code; not recommended). The package's endpoints stay limited to accounts of the 2FA collection either way |
|
||||
| `twoFactor.verifyLimit` | `{ max: 5, windowMinutes: 10, store: 'database' }` | attempts per account on `POST /api/verify-totp` (the 2FA package counts none): the sixth in the window, right or wrong, gets `429` + `Retry-After`. Counted in memory and in the database (`payload.kv`, the `payload-kv` collection Payload adds), so a restart or a second instance does not reset it; a failing store never opens the gate | `{ max, windowMinutes }`; `{ store: 'memory' }` = this instance only; `false` = no limit |
|
||||
| `twoFactor.sameOrigin` | on | `POST /api/verify-totp` and `/api/setup-totp` refuse (`403`, not counted) a request a browser marks as coming from another origin (`Origin`, else `Sec-Fetch-Site`). Own origins: the request's host (`Host`, `X-Forwarded-Host`, a default port written out is ignored), `serverURL`, Payload's `csrf` / `cors`. Requests without those headers pass. A refusal is logged once per origin with how to allow it — behind a proxy that hides the address set `serverURL` | `{ origins: ['https://app.example.com'] }` adds origins; `false` = off |
|
||||
| `twoFactor.verifyLimit` | `{ max: 5, windowMinutes: 10, store: 'database' }` | wrong codes per account on `POST /api/verify-totp` (the 2FA package counts none): after five wrong ones in the window the next attempt, right or wrong, gets `429` + `Retry-After`; a right code gives its place back (1.17.1); an attempt held out only by others still being checked gets `429` + `Retry-After: 2`. Counted in memory and in the database (`payload.kv`, the `payload-kv` collection Payload adds), so a restart or a second instance does not reset it; a failing store never opens the gate | `{ max, windowMinutes }`; `{ store: 'memory' }` = this instance only; `false` = no limit |
|
||||
| `twoFactor.sameOrigin` | on | `POST /api/verify-totp`, `/api/setup-totp` and (1.17.1) the admin's `/api/ipal/two-factor/reset` refuse (`403`, not counted) a request a browser marks as coming from another origin (`Origin`, else `Sec-Fetch-Site`). Own origins: the request's host (`Host`, `X-Forwarded-Host`, a default port written out is ignored), `serverURL`, Payload's `csrf` / `cors`. Requests without those headers pass. A refusal is logged once per origin with how to allow it — behind a proxy that hides the address set `serverURL` | `{ origins: ['https://app.example.com'] }` adds origins; `false` = off |
|
||||
| `twoFactor.requireSetup` | on, `{ windowHours: 72 }` | an account without TOTP reaches nothing but the setup screen and `/api/setup-totp` (REST, GraphQL and the panel's data answer 403); it has `windowHours` from its creation or from an admin's reset, then it is blocked until an admin reopens setup. Adds the field `totpSetupStatus` (panel) to the 2FA collection, a dashboard notice and `POST /api/ipal/two-factor/reset`; the date field `totpSetupFrom` is there whenever 2FA is on (also with `requireSetup: false` / `guard: false`). Existing accounts get their window at the first start after the upgrade, written once. **Postgres/SQLite: the migration must be applied when the new container starts — `prodMigrations` or `pnpm payload migrate && pnpm start`, not a pre-deployment command (deployment.md §4.3) — or every login answers 500**; `generate:importmap`. `exempt` must return exactly `true` at once (an `async` one, or a `windowHours` that is not a number / `false`, stops the start) | `false` = the package's rule (API open until setup); `{ windowHours: 24 }`, `{ windowHours: false }` (no limit), `{ exempt: ({ user }) => … }` (a service account) |
|
||||
| `twoFactor.requireSetup.dashboardNotice` / `.statusField` / `.setupNotice` | on | the administrators' notice on the dashboard; the status and reset control on the account page; the notice on the setup screen | `false` each (the lock and the reset endpoint stay) |
|
||||
| `twoFactor.resetAccess` (the endpoint exists with `twoFactor.guard` on; `guard: false` = no endpoint, 404) | a staff admin whose session entered its own TOTP code (not an API key, not an `exempt` account) | who may reset another account's TOTP / reopen its setup (the button on the account page, `POST /api/ipal/two-factor/reset`). The reset clears the secret and the account's sessions. A session that still owes its code is always refused | `({ req }) => boolean` — replaces the rule, so keep `req.user?._strategy === 'totp' &&` in it unless API-key / exempt admins should reset; only `true` allows; `req.user._strategy` tells `'totp'`, `'api-key'`, `'local-jwt'` apart |
|
||||
@@ -64,6 +65,14 @@ description: Complete map of everything @intecion/ipal-kit provides — every ia
|
||||
| `whiteLabel.logoField` / `iconField` / `nameField` | `'logo'` / `'favicon'` / `'siteName'` | fields in Site settings | any upload/text field |
|
||||
| `whiteLabel.titleSuffix` | none | `admin.meta.titleSuffix` (tab title) | — |
|
||||
| `whiteLabel.credit` | on | `IntecionCredit` in `afterLogin` and `afterNavLinks`: "Technology support: Intecion.com" (en/pl, from `agency`) | `false`; `{ text, url }` overrides |
|
||||
| `whiteLabel.signIn` | on (with `whiteLabel`) | the sign-in look: a dark panel with the client's logo (Site settings → Logo, any picture it holds — an SVG too — as `<img>`, exactly what the login screen showed before; fits 240 × 72, no plate) or the site's name beside the form, "Administration panel", language links; both themes, a band above the form on a phone. Login, the 2FA screens and e-mail verification get it through `AdminLogo` / `SafeTotpView` (already in the import map: an upgrade needs no edit). No env var, no new field, no migration | `false` = Payload's own screens |
|
||||
| `whiteLabel.signIn.allScreens` | `false` (the starter writes `true`) | the look on forgot / reset password, create first user, logout and "unauthorized" too: adds the provider `SignInLook` — ONE new import-map entry, run `pnpm payload generate:importmap`. Production start: when `importMap.js` on disk lacks it, the provider is left out and the log says `[iapl] The sign-in look covers only the login and 2FA screens …` | `true` |
|
||||
| `whiteLabel.signIn.accent` | `#0070c0` | hex colour of the button, links and focus ring (anything that is not a hex colour is ignored); or CSS variables `--iapl-signin-*` on `:root` in the admin's `custom.scss` | `'#0b6e4f'` |
|
||||
| `whiteLabel.signIn.logoPlate` | `false` (the logo straight on the dark panel: upload one that works on dark) | `true` = a white plate behind the logo (dark letters) | — |
|
||||
| `whiteLabel.signIn.checkLogo` | on | only against a broken picture: the logo's address is asked once as an anonymous visitor would (no redirect followed, 4 s, ≤ 512 KB read, 10-minute memory); a file that is gone (404 / 410) or is no picture (HTML, PDF) → the site's name; anything else (nothing answers, a redirect, another status, over 512 KB) → the upload is believed | `false` = no fetch |
|
||||
| `whiteLabel.signIn.languages` | shown with 2+ admin languages | links on the panel; `GET /api/ipal/admin-language?lng=<code>` writes Payload's `payload-lng` cookie and redirects (303) back to the admin path of the `Referer`; unknown language → 400 | `false` = no links, no endpoint |
|
||||
| `whiteLabel.signIn.svgLogo` | `true`: an SVG logo is shown as a picture (`<img>` runs no script), as on the login screen before | `false` = an SVG logo is not shown on the sign-in screens (the site's name is) | — |
|
||||
| `whiteLabel.brandAccess` | `'admin'` with the sign-in look (else `'editor'`) | field-level `access.update` on the name, logo and icon fields of Site settings: only admins change what the sign-in screens show; editors keep the rest. No schema change | `'editor'` = whoever edits Site settings |
|
||||
| `agency` | `{ name: 'Intecion.com', url: 'https://intecion.com' }` | the credit line, the panel's link description and preview image | `{ name, url }` = another agency; `false` = none anywhere |
|
||||
| `adminMeta` | on (with or without `whiteLabel`) | panel `<head>`: `robots` noindex/nofollow, `titleSuffix` "— <site> \| Panel", `og:site_name` + description from Site settings (refreshed on save), `og:image` `GET /api/ipal/admin-og` (1200×630 from the logo or name), icon `GET /api/ipal/admin-icon` (favicon or initials); no import map step | `false` = Payload defaults; `{ robots, titleSuffix, description, image, icons, language }` (each `false` or your value; `{site}`, `{agency}` placeholders); your own `admin.meta` keys always win. Check: `curl -s $URL/admin/login \| grep -E 'og:\|robots'` (white-label.md) |
|
||||
| `pages` | none | Site settings → **System pages** (page roles) and **Maintenance** tabs | omit → neither tab |
|
||||
@@ -153,6 +162,7 @@ description: Complete map of everything @intecion/ipal-kit provides — every ia
|
||||
|---|---|---|
|
||||
| `AdminLogo`, `AdminIcon` | `graphics.Logo/Icon` | `whiteLabel` |
|
||||
| `IntecionCredit` | `afterLogin`, `afterNavLinks` | `whiteLabel` and `credit !== false` |
|
||||
| `SignInLook` | `providers` (last) | `whiteLabel.signIn.allScreens` — the only entry the sign-in look adds; without it nothing new is needed |
|
||||
| `StatsNavLink`, `StatsView` (`views.ipalStats`, `/stats`), `StatsWidget` (`beforeDashboard`) | nav, view, dashboard | `stats` (`dashboard: false` without the widget) |
|
||||
| `CookieScanButton` | `beforeListTable` of `cookie-review` (with **Check site** when `crawl` is on) | `cookieScanner` |
|
||||
| `CookieReviewTab`, `CookieSiteCheckTab` | `ui` fields in the `cookie-settings` tabs | `cookieScanner` with `adminLayout !== 'separate'` (Site check: `crawl`) |
|
||||
|
||||
@@ -38,6 +38,8 @@ Admin panel components from `@intecion/ipal-kit/admin` — the project does NOT
|
||||
| `TwoFactorResetButton` | `@intecion/ipal-kit/admin` | Client button inside `TwoFactorStatusField`: `POST /api/ipal/two-factor/reset` `{ userId }`, then reloads the view. Props `{ kind: 'reset' \| 'reopen', userId }`. |
|
||||
| `TwoFactorAlert` | `@intecion/ipal-kit/admin` | Server component on the dashboard (`beforeDashboard`), administrators only: accounts without two-step verification and how many are blocked. Wired by the plugin with `twoFactor.requireSetup`; renders nothing when every account has it. |
|
||||
| `IntecionCredit` | `@intecion/ipal-kit/admin` | The line "Technology support: Intecion.com" (admin language; `agency` prop = the name) below the nav and below the login form (`variant: 'nav' \| 'login'`). Injected by the plugin with `whiteLabel`; turn off: `whiteLabel: { credit: false }` or `agency: false`. |
|
||||
| `SignInPanel` | `@intecion/ipal-kit/admin` | Server component: the dark sign-in panel with its stylesheet (`<style>` deduplicated by React) — label, the logo or the site's name from Site settings as a link to the site, language links. Props `look` (`SignInLookProps`) plus what Payload injects (`payload`, `i18n`, `locale`, `user`); `SignInPanelProps`. Hidden by its own CSS on any page that is not Payload's minimal template. `AdminLogo` (prop `signIn`) and `SafeTotpView` (prop `iaplSignIn`) render it when the provider does not. |
|
||||
| `SignInLook` | `@intecion/ipal-kit/admin` | Admin provider (`admin.components.providers`, `serverProps: { look }`; `SignInLookProviderProps`): prints `SignInPanel` on every admin page so that every minimal screen has it. Registered by `whiteLabel: { signIn: { allScreens: true } }`. |
|
||||
| `buildAdminMeta({ agency, apiRoute?, defaultLocale?, meta?, options? })` | `@intecion/ipal-kit` | The `adminMeta` step: static panel meta (robots, preview image, icon) without overwriting keys in `meta`; returns `{ meta, resolved }` |
|
||||
| `adminMetaForSite(site, resolved)`, `syncAdminMeta(payload, resolved, { nameField?, settingsSlug? })` | `@intecion/ipal-kit` | Site-name parts (suffix, description, siteName); `syncAdminMeta` writes them into the live config (onInit + Site settings afterChange, never throws) |
|
||||
| `buildAdminImageEndpoints(resolved, { settingsSlug?, nameField?, logoField?, iconField? })` | `@intecion/ipal-kit` | `GET /api/ipal/admin-og` (1200×630 PNG via `next/og`) and `GET /api/ipal/admin-icon` (the favicon itself, or initials) — already added by `adminMeta` |
|
||||
@@ -75,7 +77,7 @@ Admin panel components from `@intecion/ipal-kit/admin` — the project does NOT
|
||||
| `writeOnlySecret(field, options?)`, `writeOnlySecrets(fields, names, optionsByName?)`, `maskSecretAfterRead`, `keepSecretBeforeValidate`, `buildKeepSecret(options?)`, `SECRET_MASK`, `SECRET_CLEAR`, `isSecretMask(value)`, `INTEGRATION_SECRET_FIELDS`, `SMTP_PASSWORD_BOUND_TO` | `@intecion/ipal-kit` | Write-only secret fields (`secrets.writeOnly`): the wrapper for one field and for named fields anywhere in a tree (tabs, rows, groups); the two field hooks (reads through access control get `'********'`, the Local API with access control off gets the value; a save with nothing / empty / the mask keeps the stored value, `'[[clear]]'` removes it); the hook builder with options — `{ boundTo: ['siblingField'], appliesWhen?: (siblingData) => boolean }`: a save through access control that changes a bound sibling field without sending the secret throws a `ValidationError` on the secret (`secrets.reenterOnChange`); the two constants; the plugin's own secret field names (`smtpPassword`, `turnstileSecretKey`); the fields the SMTP password is bound to (`smtpHost`, `smtpPort`, `smtpUser` — not the transport: the mail adapter may fall back to SMTP). |
|
||||
| `maskSecretsOnRestore`, `maskWriteOnlySecrets(data, fields)` | `@intecion/ipal-kit` | Versions and write-only secrets: the `afterRead` hook for a global or a collection (a restore answers with the version document, fields under `version`, where field hooks do not run — it masks them there for reads through access control); the walker it uses (masks every write-only field in `data`, following tabs, rows, groups, arrays and blocks). On Site integrations by default; add the hook to your own entity that has both. |
|
||||
| `requestFromOwnOrigin(req, extraOrigins?)`, `ownOrigins(req, extraOrigins?)`, `reportRefusedOrigin(req, extraOrigins?)` | `@intecion/ipal-kit` | `twoFactor.sameOrigin`: `false` when a browser marks the request as coming from another origin (`Origin` not among the request's host, `serverURL`, `csrf`, `cors`, the extras; a default port written out on the host is ignored; else `Sec-Fetch-Site` not `same-origin` / `none`); `true` without those headers. `ownOrigins` → `{ hosts, origins }`. `reportRefusedOrigin` writes one log line per refused origin and process (at most 50) with the ways to allow it, and returns whether it wrote. For your own state-changing endpoint. |
|
||||
| `buildVerifyLimit(collection, { max?, windowMinutes?, store?, keyPrefix? })`, `verifyLimitKey(collection, id, keyPrefix?)`, `clearVerifyLimits()` | `@intecion/ipal-kit` | `twoFactor.verifyLimit`: `async (req) => Response \| null` — counts an attempt of `req.user` in memory and, unless `store: 'memory'`, in `payload.kv`; a `429` with `Retry-After` past `max`. The kv key of an account's count; emptying the in-memory counts (tests). |
|
||||
| `buildVerifyLimit(collection, { max?, windowMinutes?, store?, keyPrefix? })`, `verifyLimitKey(collection, id, keyPrefix?)`, `clearVerifyLimits()` | `@intecion/ipal-kit` | `twoFactor.verifyLimit`: `async (req) => Response \| null` — takes a place for an attempt of `req.user` in memory and, unless `store: 'memory'`, in `payload.kv`; a `429` with `Retry-After` past `max` (`Retry-After: 2` when only attempts still being checked hold it). `limit.settle(req, correct)` after the check: a right code gives its place back (unsettled = wrong). The kv key of an account's count; emptying the in-memory counts (tests). |
|
||||
| `turnstileSecretFromEnv(integrations)`, `TURNSTILE_SECRET_ENV` | `@intecion/ipal-kit` | `true` when the Turnstile secret in use comes from the environment because the panel field is empty (**deprecated** path; the doctor's `turnstile-env-key`); the variable's name, `'TURNSTILE_SECRET_KEY'`. |
|
||||
| `userMeetsRole(req, minimum)` | `@intecion/ipal-kit` | Predicate → `boolean` with `req` (`{ payload, user }`), in this order: the account belongs to a **staff collection** (`admin.user`, `access.authCollection`, `access.staffCollections`); with 2FA on it has passed the second factor (`secondFactorPassed`); it has a role ≥ `minimum`, **or** its collection has no `roles` field (the project omitted `access`). An account of any other auth collection never passes, whatever fields it has. The plugin's staff features (Site integrations, settings globals, form submissions, consent records, stats, cookie scanner, the e-mail test) use it; use it in your own endpoints. |
|
||||
| `staffCollectionSlugs(source?)` | `@intecion/ipal-kit` | `string[]`: the staff collections — `admin.user`, `access.authCollection` and `access.staffCollections` — from `req.payload`, a config or `{ staffCollections }`; without an argument what the configs built in this process agree on (`[]` when there is none). Roles and staff checks count only for accounts of these. |
|
||||
@@ -619,10 +621,15 @@ 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). |
|
||||
| `buildTwoFactorResetEndpoint(collection, { access? })`, `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. 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. |
|
||||
| `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`. |
|
||||
| `fetchPublicImage(url, base)`, `publicImageDataUri(url, base)`, `rasterImageType(bytes)`, `siteOrigin(serverURL)`, `PUBLIC_IMAGE_MAX_BYTES` | `@intecion/ipal-kit` | An image fetched the way an anonymous visitor gets it (no cookies; http(s) only; `image/*`; at most 512 KB, reading stops at the limit) as `{ bytes, type }` or a `data:` address, else `null`. Used for the logo and icon on the 2FA screens. `rasterImageType(bytes)` → the media type of a bitmap by its first bytes (PNG, JPEG, GIF, WebP, ICO, AVIF) or `null` — never trust a claimed type before answering a file's bytes from the site's origin; an SVG gives `null`. |
|
||||
| `fetchPublicImage(url, base, { timeoutMs? }?)`, `publicImageDataUri(url, base)`, `rasterImageType(bytes)`, `siteOrigin(serverURL)`, `PUBLIC_IMAGE_MAX_BYTES`, `PUBLIC_IMAGE_TIMEOUT_MS` | `@intecion/ipal-kit` | An image fetched the way an anonymous visitor gets it, as `{ bytes, type }` or a `data:` address, else `null`: no cookies; http(s) only; `image/*`; ONE address — a redirect is never followed (a 3xx is "no image"); the whole exchange within `PUBLIC_IMAGE_TIMEOUT_MS` (5000); at most `PUBLIC_IMAGE_MAX_BYTES` (512 KB), reading stops at the limit whatever `content-length` says. `base` is the site's configured origin (`siteOrigin(config.serverURL)` = `serverURL`, else `NEXT_PUBLIC_SERVER_URL`) — never build it from a request's `Host` / `X-Forwarded-Host`. Used for the logo and icon on the 2FA screens and by `/api/ipal/admin-og` and `/api/ipal/admin-icon`. `rasterImageType`: the bitmap type by the first bytes (PNG, JPEG, GIF, WebP, ICO, AVIF), `null` for anything else, SVG included. |
|
||||
| `resolveSignInLook(whiteLabel)` | `@intecion/ipal-kit` | `whiteLabel` option → `null` (white-label or `signIn` off) or `{ allScreens, props }` (`ResolvedSignInLook`; `props` = `SignInLookProps`, the plain values the components get: `accent`, `checkLogo`, `imageField`, `inlineImages`, `languages`, `logoPlate`, `nameField`, `settingsSlug`, `svgLogo`). Option type: `SignInLookOptions`. |
|
||||
| `loadSignInBrand({ payload, look, locale?, user? })`, `signInName(value, locale?)`, `signInLogo(media, { svgLogo? })`, `checkLogoFile(url, base, allowSvg?)`, `fitLogo(width, height, box?)`, `isSvgUpload(media)` | `@intecion/ipal-kit` | What the sign-in panel shows: `{ name, logo }` (`SignInBrand`, `SignInLogo = { src, width?, height? }`) read from Site settings, never throwing; the name as one line of plain text (control characters out, cut at `SIGN_IN_NAME_MAX` = 80); the logo of an upload document — any picture (an SVG too unless `svgLogo: false`; `null` only for an upload whose type says it is no picture, or an address that is not `http(s)` or site-relative), fitted into `SIGN_IN_LOGO_BOX` (240 × 72) without enlarging, served from the smallest generated size ≥ 2× the shown width with the same proportions; the look at the file itself (`LogoCheck`: `{ bytes, type }`; `'bad'` = certainly no picture there: 404 / 410, a 2xx answer of another type, an SVG while refused; `'unknown'` = nothing answered, a redirect (never followed), another status, no type, over 512 KB — the upload is believed). A session that owes its 2FA code gets the checked picture inlined or no logo. |
|
||||
| `signInCss({ accent? })`, `isHexColour(value)`, `SIGN_IN_STYLE_ID` | `@intecion/ipal-kit` | The stylesheet of the sign-in look as a string (no `url()`, no font, no other host; every rule needs `.iapl-signin` on the page), the hex check `accent` must pass, and the `href` of its `<style>` (`'iapl-sign-in'`). |
|
||||
| `languageLinks(config, current)`, `LANGUAGE_NAMES`, `buildAdminLanguageEndpoint()`, `adminPathFromReferer(referer, adminRoute)`, `ADMIN_LANGUAGE_PATH` | `@intecion/ipal-kit` | The panel's languages as links (`LanguageLink[]`: `{ code, name, current, href }`; empty with one language; names in their own language, else the code); the public endpoint `GET /api/ipal/admin-language?lng=` (`'/ipal/admin-language'`) that writes `<cookiePrefix>-lng` for a supported language (else 400) and answers 303 to a path inside the admin route taken from the `Referer` (anything else → the admin root, never another host). |
|
||||
| `signInProviderActive(payload)`, `SIGN_IN_LOOK` | `@intecion/ipal-kit` | Whether the provider `'@intecion/ipal-kit/admin#SignInLook'` is in the config AND in the running import map — `AdminLogo` and `SafeTotpView` print the panel themselves only when it is not. |
|
||||
| `UPLOAD_SECURITY_HEADERS` | `@intecion/ipal-kit` | The two headers of `buildUploadSecurityHeaders` (`Content-Security-Policy: default-src 'none'; … sandbox`, `X-Content-Type-Options: nosniff`) for a route of your own that returns an uploaded file's bytes from the site's origin. In a Next project a site-wide `headers()` rule with the same key overrides a header the route sets itself: add a `headers()` rule for the path after the site-wide one (as `buildUploadSecurityHeaders({ collections, adminIcon })` does for the upload routes and `/api/ipal/admin-icon`), and never answer with an SVG. |
|
||||
| `twoFactorSetupState(req)`, `twoFactorSetupDeadline(req)` | `@intecion/ipal-kit` | Where an account stands with TOTP setup, from `{ payload, user }`: `'set-up'`, `'open'` (may set it up now), `'closed'` (the setup window has passed: blocked until an admin reopens it), `'exempt'` (`requireSetup.exempt`, or `requireSetup: false`), `'not-applicable'` (no user, another collection, 2FA off); and the moment setup closes (`Date`, or `null` without a window). Types: `TwoFactorSetupState`, `RequireSetupOptions`. |
|
||||
| `requireSecondFactor(access?)` | `@intecion/ipal-kit` | Wraps an `Access` function: refused while the second factor is owed, otherwise the function itself (Payload's default "logged in" when none). iapl applies it to every collection and global in the config, and to those added by plugins listed after it (in `onInit` and at the start of the first request, so also after a dev hot reload); use it for access functions that are not part of the config. Per-entity opt-out: `custom.ipal.secondFactor: false \| { read: false }` or the package's `custom.totp.disableAccessWrapper`. Wrapping twice is harmless. |
|
||||
@@ -865,6 +872,10 @@ Bin: `iapl-doctor` (`pnpm exec iapl-doctor [dir] [--json] [--md] [--strict] [--f
|
||||
| `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`. |
|
||||
| `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`. |
|
||||
| `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`. |
|
||||
| `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`,
|
||||
`DoctorSource`, `DoctorStatus`, `DoctorContext`, `RunDoctorOptions`, `DoctorEndpointOptions`, `FrontendLayout`.
|
||||
|
||||
@@ -188,7 +188,7 @@ export default buildConfig({
|
||||
seo: { collections: ['pages'] },
|
||||
forms: { redirectRelationships: ['pages'] },
|
||||
twoFactor: { issuer: '<Client name>', plugin: payloadTotp },
|
||||
whiteLabel: true,
|
||||
whiteLabel: { signIn: { allScreens: true } }, // client's logo / name on every sign-in screen (white-label.md)
|
||||
indexNow: true,
|
||||
// consentLog is on by default (1.17.0): consent-records + POST /api/ipal/consent; `consentLog: false` turns it off.
|
||||
// Postgres / SQLite: pnpm payload migrate:create consent-log, applied in the same deploy.
|
||||
@@ -207,7 +207,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` and `#SafeTotpView`); `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);
|
||||
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`.
|
||||
@@ -228,7 +228,7 @@ the panel shows Site settings, Site integrations, Cookies, Form messages, the Fo
|
||||
`[iapl] twoFactor…` unless `allowCollectionMismatch: true`. The second factor covers every collection and global
|
||||
(the plugin's own, and those of plugins listed after `iapl`) and the plugin's endpoints; guard your own
|
||||
endpoints with `secondFactorPassed(req)` or `userMeetsRole(req, role)` (security.md "What the second factor covers").
|
||||
Verify attempts: 5 per account in 10 minutes (`twoFactor.verifyLimit`).
|
||||
Verify attempts: 5 wrong codes per account in 10 minutes (`twoFactor.verifyLimit`); right codes do not count.
|
||||
The `back` link of the setup and verify screens is checked on the server (`twoFactor.safeBack`, on by default:
|
||||
only a path inside the admin route is kept; `false` turns it off, a function replaces the rule). It needs the
|
||||
import map entry `@intecion/ipal-kit/admin#SafeTotpView` — run `pnpm payload generate:importmap` and commit
|
||||
@@ -246,7 +246,9 @@ the panel shows Site settings, Site integrations, Cookies, Form messages, the Fo
|
||||
(column `totp_setup_from`, there whenever 2FA is
|
||||
on) — without it every login answers 500; `pnpm payload generate:importmap` (`TwoFactorStatusField`,
|
||||
`TwoFactorAlert`). A service account that logs in with a password: `requireSetup: { exempt }` (a plain function
|
||||
returning exactly `true`; never `async`); an API key needs nothing. Parts to switch off: `requireSetup:
|
||||
returning exactly `true`; never `async`), deciding from a field only an admin can write (`serviceAccount`
|
||||
checkbox with `adminOnlyField`; security.md "Decide `exempt` from a field only an administrator can write"),
|
||||
never from the e-mail — every account may change its own e-mail; an API key needs nothing. Parts to switch off: `requireSetup:
|
||||
{ dashboardNotice: false, statusField: false, setupNotice: false }`. An admin's reset ends the account's
|
||||
sessions and needs the admin's own TOTP code (`twoFactor.resetAccess` changes who). Have two administrators
|
||||
with 2FA: when all are blocked, only a script or a redeploy helps (security.md "Every administrator is
|
||||
@@ -294,6 +296,14 @@ the panel shows Site settings, Site integrations, Cookies, Form messages, the Fo
|
||||
win; a function `(global) => global` takes over). Without `revalidatePath` global saves wait for the ISR window.
|
||||
- `whiteLabel: { credit: false, titleSuffix, settingsSlug, logoField, … }`; with `whiteLabel` the plugin overrides
|
||||
`graphics.Logo/Icon` — your own graphics only without it.
|
||||
- Sign-in screens (`whiteLabel.signIn`, on): a dark panel with the client's logo or the site's name beside the
|
||||
form; the logo and name are Site settings fields (no env var, no migration). `allScreens: true` (in the config
|
||||
above) adds the provider `SignInLook` to the import map and covers forgot / reset password, first user and
|
||||
logout. The logo: any picture Site settings holds, an SVG too (`svgLogo: false` refuses SVG), drawn for a
|
||||
DARK ground (no plate; `logoPlate: true` for a logo with dark letters). `accent: '#hex'`,
|
||||
`languages: false`, `checkLogo: false`; `signIn: false` = Payload's screens. Name, logo and icon in Site
|
||||
settings are admin-only with the look (`brandAccess: 'editor'` gives them back to editors).
|
||||
Check: `/admin/login` and `/admin/forgot` show the panel, also at a phone width; do not write login CSS by hand.
|
||||
- Panel link preview (`adminMeta`, on): noindex/nofollow, "— <site> | Panel" suffix, site name, description and
|
||||
preview image (`/api/ipal/admin-og`) from Site settings; `agency` names who supports the technology (default
|
||||
Intecion.com). Turn off: `adminMeta: false`, `agency: false`; your own `admin.meta` keys win. Check:
|
||||
@@ -399,7 +409,7 @@ import { createProxy } from '@intecion/ipal-kit'
|
||||
import { i18nConfig } from '@/i18n.config'
|
||||
export const proxy = createProxy(i18nConfig, { NextResponse, markdown: true })
|
||||
// Inline LITERAL (importing DEFAULT_PROXY_MATCHER = 500 on /admin); with adminRoute '/its' write `its` instead of `admin`
|
||||
export const config = { matcher: ['/((?!api|admin|_next|.*\\..*).*)'] }
|
||||
export const config = { matcher: ['/((?!(?:api|admin|_next)(?:/|$)|.*\\..*).*)'] }
|
||||
```
|
||||
`src/lib/content.ts` = PROGRAMISTA §2.7 1:1: `createContentHelpers({ config, content: contentConfig, i18n: i18nConfig,
|
||||
baseUrl: process.env.NEXT_PUBLIC_SERVER_URL, markdownAlternate: true, summaryField: 'aiSummary', mcp: { serverName:
|
||||
@@ -650,8 +660,8 @@ scaling (5). `●` routes for pages need the database at build time (PROGRAMISTA
|
||||
in every language.
|
||||
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). SMTP fields **only** when the client asked
|
||||
for its own server. 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
|
||||
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
|
||||
`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.
|
||||
|
||||
@@ -25,6 +25,27 @@ 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.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`):
|
||||
no locale redirect, no proxy CSP there. Verify on a build: `curl -sI localhost:3000/administracja` → 307 to
|
||||
`/pl/administracja`; `/admin` and `/api/health` unchanged. (2) If the project has `tests/routes.ts`: run
|
||||
`pnpm payload run tests/routes.ts update`, judge the new entries, commit (after EVERY Payload / IAPL upgrade). New
|
||||
projects: add the closed-doors spec and the route check (iapl-audit "What the script does not check").
|
||||
|
||||
**→ 1.17.1, security (CHANGELOG 1.17.1; PROGRAMISTA §6, items 79–81; security.md) — check before deploying:**
|
||||
1. `pnpm build`: a config value the plugin does not understand now stops the start with the option's name
|
||||
(`accounts: 0`, `stats: 'false'`, `retentionDays: null`, an unknown role name in `requireRole`, …). Fix the value;
|
||||
real values start as before (security.md → "Switches are read strictly").
|
||||
2. Nothing to do for the write-only secrets: no query can name them any more. A site that had versions on for Site
|
||||
integrations, with an admin account that may have been misused: change the SMTP password and the Turnstile key.
|
||||
3. `twoFactor.requireSetup.exempt` decided from the e-mail: move to an admin-only checkbox (security.md); every
|
||||
account may change its own e-mail.
|
||||
4. A collection of the project with drafts and `read: () => true`: use `readPublished()` so `?draft=true` answers
|
||||
visitors nothing unpublished.
|
||||
5. Your own endpoint with `buildVerifyLimit`: call `limit.settle(req, correct)` after the check.
|
||||
**Check:** `pnpm exec iapl-doctor` has no `proxy-matcher`; `curl -s "<site>/md/xx"` → 404; the panel's 2FA works.
|
||||
|
||||
**1.8.x → 1.9.0 (PROGRAMISTA §6, items 17–21):** `twoFactor.plugin` required;
|
||||
`getTurnstileConfig` instead of `turnstileSiteKey` (with both keys set the token is
|
||||
required — check that every form has the widget); `clientIp(await headers())` in
|
||||
@@ -405,7 +426,10 @@ site without steps 1–3 and a deploy day agreed with the owner. Steps 2, 3 and
|
||||
`[iapl] 2FA: the column for "totpSetupFrom" is missing … NOBODY CAN LOG IN`. `pnpm exec iapl-doctor` reports
|
||||
it before the deploy. MongoDB: nothing.
|
||||
4. An integration that logs in with a password and has no TOTP: give it an API key, or
|
||||
`twoFactor.requireSetup: { exempt: ({ user }) => user.email === '…' }`. `grep -rn "overrideAccess: false" src`:
|
||||
`twoFactor.requireSetup: { exempt: ({ user }) => user.serviceAccount === true }` with a checkbox only admins can
|
||||
write (`access: { create: adminOnlyField, update: adminOnlyField }`) — not by e-mail: every account may change its
|
||||
own e-mail (security.md "Decide `exempt` from a field only an administrator can write"). A project already on an
|
||||
e-mail list (1.17.1): move to the field, or make `email` admin-only. `grep -rn "overrideAccess: false" src`:
|
||||
a `user` fetched by id is refused for every account now — take it from `payload.auth({ headers })`.
|
||||
5. `rm -rf .next`, build, redeploy on Coolify. Read the first lines of the log: `[iapl] 2FA: N existing account(s)
|
||||
without two-step verification…` — pass that number to the owner. The line appears on that first start only.
|
||||
@@ -648,6 +672,43 @@ PROGRAMISTA §6, items 73–75; email.md; AGENT.md §7.2) — nothing to run; re
|
||||
**Send test e-mail** names the transport you expect; a form submission arrives. **The service is live at
|
||||
`https://webservices.intecion.net/mail`; 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`.**
|
||||
|
||||
**→ 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),
|
||||
commit it, apply it when the new container starts — in the same deploy. Without it mail still leaves the old way, but
|
||||
the Site integrations page does not open and the log and `iapl-doctor --deep` (`mail-method`, error) say so. No
|
||||
import-map change; `pnpm payload generate:types` gives a diff (the field `emailMethod`): run it and commit.
|
||||
2. After the deploy open Site integrations → E-mail sending. "Sending method" shows the method the site sends through
|
||||
today as selected: **IWSN (built-in)** (no SMTP server), **Own SMTP server**, or **Microsoft Graph (deprecated)**
|
||||
(`GRAPH_*` on the server). Nothing to save: the site keeps sending exactly as before **until somebody picks another
|
||||
option** (saving with the shown method stores nothing); `iapl-doctor --deep` notes it (`mail-method`, info). Send a
|
||||
test e-mail: the answer names the method.
|
||||
3. From the save on what is chosen is what is used: "Own SMTP server" with an incomplete server, or "Microsoft Graph"
|
||||
without `GRAPH_*`, sends **nothing** and says so (state block, `mail-method` error) — no fallback to another method.
|
||||
Tell the owner before changing the method on a live site.
|
||||
4. Seeds and scripts that set up mail: write `emailMethod: 'relay' | 'smtp' | 'graph'` (or `setMailMethod(payload, …)`).
|
||||
`emailTransport` written alone still works and means the old order.
|
||||
|
||||
**→ 1.17.1, the sign-in look (CHANGELOG 1.17.1; PROGRAMISTA §6, item 80; white-label.md → "The sign-in screens") — nothing is required:**
|
||||
1. **Sites with `whiteLabel`:** after the update the login screen and the 2FA screens (code, setup) have the new
|
||||
look — a dark panel with the client's logo or the site's name beside the form. No edit, no
|
||||
`generate:importmap`, no migration: the look comes through `AdminLogo` and `SafeTotpView`, which the site's
|
||||
import map already has. **Check:** open `/admin/login` on a desktop and at a phone width, in both themes; sign
|
||||
in through 2FA.
|
||||
**Look at the logo:** it stands straight on a dark panel. A logo with dark letters: `signIn: { logoPlate: true }`
|
||||
(a white plate) or ask the client for a logo for dark grounds. Every logo that showed on the login screen
|
||||
before shows now (an SVG too); only a logo whose file is gone shows the site's name instead of a broken picture.
|
||||
**Editors lose three fields:** the name, logo and icon of Site settings are admin-only now (they are what the
|
||||
public sign-in page shows). A site whose editors must change them: `whiteLabel: { brandAccess: 'editor' }`.
|
||||
2. **Tell the owner the sign-in page looks different** and ask whether to keep it. No: `whiteLabel: { signIn: false }`
|
||||
— Payload's screens with the plain logo, as before (record it in AGENTS.md → Project decisions).
|
||||
3. **Recommended, one edit:** `whiteLabel: { signIn: { allScreens: true } }`, `pnpm payload generate:importmap`,
|
||||
commit `importMap.js` — forgot / reset password, create first user and logout get the same look. Forgetting
|
||||
the import map does not break the panel: at a production start the provider is left out and the log says so.
|
||||
4. **Project CSS for the login screen** (`custom.scss` rules on `.login`, `.template-minimal`, a hand-made
|
||||
`graphics.Logo`): look at the screens after the update; the look's own rules win over Payload's layer but not
|
||||
over the project's later ones. Restyle with the `--iapl-signin-*` variables instead.
|
||||
5. Sites **without** `whiteLabel`: nothing changes.
|
||||
|
||||
## 2. Inventory (no code changes)
|
||||
**What changed for projects** between your old and new plugin version is exactly the reference site's diff —
|
||||
`git diff v<old> v<new> -- reference/` in the IAPL repo (or the two `docs/agent/reference-site/INDEX.md` files):
|
||||
|
||||
@@ -89,6 +89,11 @@ Without `draft: true`, documents with a `_status` other than `published` (page,
|
||||
entry) give `null`. The page assigned as 404 in System pages also gives `null`
|
||||
(a real 404 instead of a soft 404).
|
||||
|
||||
**A locale the site does not have gives `null` (1.17.1).** `xx`, `all` or `*` — from a URL that went past the
|
||||
proxy (a dotted path, the Markdown route `/md/xx`) or a caller — used to resolve the default locale's page under that
|
||||
code; now it is "not found". `isSiteLocale(payload, locale)` is the same check for your own code. A site without
|
||||
localization is not affected.
|
||||
|
||||
Logic: the first segment is matched against the slugs of the archive pages from System
|
||||
Pages. A match → we know which collection it is about. `['artykuly']` → listing of
|
||||
`posts`; `['artykuly','moj-post']` → an entry in `posts`; no match → a regular
|
||||
@@ -391,7 +396,8 @@ Query: `?q=` (required), `?locale=`, `?limit=`. Response:
|
||||
"results": [{ "title": "O nas", "url": "https://x/pl/o-nas", "description": "…", "slug": "o-nas" }] }
|
||||
```
|
||||
|
||||
No `q` → 400. Published only, without `noindex` (`noindex` or `meta.noindex`) and without the page assigned as the
|
||||
No `q` → 400. An unknown `?locale=` is the default locale — in the search, the under-construction check and the
|
||||
answer alike (1.17.1). Published only, without `noindex` (`noindex` or `meta.noindex`) and without the page assigned as the
|
||||
404 page (Site settings → System pages, read through `settingsSlug`, default `site-settings`),
|
||||
10 by default (`defaultLimit`), max 50 results. Under-construction mode:
|
||||
pass `isPathVisible` from `createContentHelpers`, and hidden pages drop out of the results. Error/database
|
||||
@@ -411,12 +417,16 @@ const results = await searchContent({ payload, query, config, locale, limit, bas
|
||||
|
||||
`searchContent` options: `collection` (`'pages'`), `baseUrl`, `homeSlug`, `settingsSlug` (`'site-settings'`, for the 404 page), `locale`
|
||||
(default/invalid → `defaultLocale`), `limit` (10, clamped to 1–50),
|
||||
`queryLimit` (1.17.1; default `{ length: 200, words: 10 }` — `SEARCH_QUERY_LIMIT`): how much of the query reaches
|
||||
the database. Each word is one more `LIKE` on two columns and the text comes from a stranger, so a longer query is
|
||||
cut to its first words (`limitQuery(query, queryLimit)` shows the result); `false` = the whole query, as before.
|
||||
`summaryField` (e.g. `'aiSummary'` — prefers the richer description from
|
||||
`buildSummaryField` over `meta.description`; see [seo.md](./seo.md)). Never throws
|
||||
(error → `[]`).
|
||||
|
||||
`createSearchRoute` additionally takes `getCachedPayload`, `config` (required),
|
||||
`defaultLimit` (10), `rateLimit`, `clientIp` (see `clientIp()` in security.md), `isPathVisible`.
|
||||
`defaultLimit` (10), `rateLimit`, `clientIp` (see `clientIp()` in security.md), `isPathVisible`, `queryLimit`
|
||||
(passed to `searchContent`; the MCP `search_content` tool uses the default).
|
||||
|
||||
`listContent({ payload, config, locale, limit, … })` — the same results without a query:
|
||||
all published, indexable pages by title (`limit` 50, max 200). A list
|
||||
|
||||
@@ -45,7 +45,8 @@ they will have to log in again.
|
||||
|
||||
### Email — nothing in env
|
||||
|
||||
Mail needs **no variable**. A site with no SMTP server in the panel sends through the Intecion mail service
|
||||
Mail needs **no variable**. A site sends through the Intecion mail service unless an admin chose another
|
||||
"Sending method" in the panel
|
||||
([email.md](./email.md)); SMTP is typed in the panel. What the deploy needs for the mail service:
|
||||
|
||||
- **`NEXT_PUBLIC_SERVER_URL` / `serverURL` = the public address the site answers on without a redirect** (the service
|
||||
|
||||
@@ -245,7 +245,7 @@ import { i18nConfig } from '@/i18n.config'
|
||||
export const proxy = createProxy(i18nConfig, { NextResponse, markdown: true })
|
||||
|
||||
// Inline literal — Next analyzes it statically; importing a variable = proxy on /admin → 500
|
||||
export const config = { matcher: ['/((?!api|admin|_next|.*\\..*).*)'] }
|
||||
export const config = { matcher: ['/((?!(?:api|admin|_next)(?:/|$)|.*\\..*).*)'] }
|
||||
```
|
||||
Sets `x-locale` / `x-pathname`, the language cookie with consent, redirects `/`.
|
||||
The headers are for dynamic routes (API, route handlers) — in SSG/ISR pages,
|
||||
@@ -686,6 +686,10 @@ Do one item at a time, build, check. Order by importance:
|
||||
| 76 | **1.17.0 — public pages: Chrome requests the first page of a visit twice** — `curl -sI <site>/pl` shows `Critical-CH: Sec-CH-Prefers-Color-Scheme` (Payload's `withPayload` adds it for every path; only the admin reads the hint); Lighthouse lists the same URL twice under redirects | `next.config.ts`: `withSecurityConfig(withPayload(nextConfig))` — the plugin's wrapper OUTSIDE (was inside). Another panel address: `{ adminClientHints: { route } }`; keep the old behaviour: `{ adminClientHints: false }`. Without the edit nothing changes | `iapl-upgrade` "→ 1.17.0, the public pages' first request", security.md "Client hints" |
|
||||
| 77 | **1.17.0 — cookie banner at first paint** — the banner appeared seconds after the page (after hydration) and was the LCP element on text pages; or after the update an e2e test finds a hidden `[data-ipal="banner"]` for a returning visitor; or with a nonce CSP the console reports a refused inline script | Nothing to run: the banner is now in the server HTML and an inline script shows or hides it before the first paint; pages stay static; consent, tags and the log are unchanged. Remove a project "mounted" wrapper around the banner. Nonce CSP: `<SiteProviders nonce>`. Tailwind 3 with a `classNames.root` that sets `display`: `[data-ipal="banner"][hidden] { display: none !important }`. Old behaviour: `<CookieBanner firstPaint={false} />`; exact HTML on a dynamic site: `consentCookie` | `iapl-upgrade` "→ 1.17.0, cookie banner at first paint", consent.md "First paint" |
|
||||
| 78 | **1.17.0 — consent compliance** — after the update "Reject" looks like "Accept all"; a browser with Global Privacy Control sees no banner; *Privacy → Consent records* fills with every choice; or on Postgres / SQLite the log says "the consent-records table does not exist" and doctor reports `consent-log-migration` | MongoDB: nothing to run. Postgres / SQLite without the log before: `pnpm payload migrate:create consent-log` + apply in the same deploy, or `iapl({ consentLog: false })`. `generate:types`. Opt-outs: `equalChoice={false}`, `gpc="ask"` / `gpc={false}`, `consentLog: false`, `logEndpoint={false}` | `iapl-upgrade` "→ 1.17.0, consent compliance", consent.md "Compliance defaults" |
|
||||
| 79 | **1.17.1 — security** — the start stops with "`[iapl] … must be …`" naming an option; or `requireRole('…')` throws; or an admin's `where` on `smtpPassword` / `turnstileSecretKey` answers `400 QueryError` | Fix the named value (security.md "Switches are read strictly"); role names are `user`, `editor`, `admin`. The query refusal is the fix (write-only secrets cannot be named in a query). With versions on for Site integrations and a doubt about an admin account: change the SMTP password and the Turnstile key | CHANGELOG 1.17.1 "Read before upgrading" 1–2, `iapl-upgrade` "→ 1.17.1, security" |
|
||||
| 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" |
|
||||
|
||||
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`.
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
# The panel's sign-in screens: design notes and screenshots
|
||||
|
||||
Design record of `whiteLabel.signIn` (the user-facing page is [white-label.md](../../white-label.md) → "The sign-in
|
||||
screens"). The goal: IAPL's sign-in looks like IAWL's (the WordPress sibling), and both have a place for the client's
|
||||
logo.
|
||||
|
||||
## Files here
|
||||
|
||||
Made with `node scripts/login-page-shots.mjs` (headless Chromium, 1280 × 800 and 390 × 844) against the reference
|
||||
site; `after-*` from a production build with `signIn: { allScreens: true }`, `before-*` from main (1.17.0).
|
||||
|
||||
| Files | What |
|
||||
|---|---|
|
||||
| `before-*.png` | IAPL 1.17.0: login (light, dark, phone, Polish, wrong password), forgot password, 2FA code, 2FA setup; `-logo` = with a logo set |
|
||||
| `after-*-name.png` | the new look with no logo set: the site's name |
|
||||
| `after-*-logo.png` | the new look with a logo made for dark grounds (`placeholder-logo-for-dark.png`), no plate — the default |
|
||||
| `after-{login,2fa-code}-*-logo-svg.png` | an SVG logo from Site settings (`placeholder-logo-for-dark.svg`) on a built site: shown on login and, inlined, on the 2FA code screen — as 1.17.0 showed it |
|
||||
| `after-login-*-logo-dark-letters-no-plate.png` | a logo with dark letters (`placeholder-logo.png`) on the default: hard to read; such a site sets `logoPlate: true` |
|
||||
| `after-first-user-*.png` | create first user on an empty database (no site name yet: the host is shown) |
|
||||
| `legacy-unedited-*.png` | the reference site as it was at v1.16.7, **unedited**, built against this plugin: login has the look (through `AdminLogo`), forgot password and create first user are Payload's own until the project sets `allScreens` |
|
||||
| `iawl-*.png` | IAWL's sign-in page, copied from its repository (`docs/reviews/white-label/`, made 2026-11-24; the languages are still a drop-down there). `iawl-current-sign-in.png` is the page as built now (`docs/reviews/rule-13/after-5-sign-in.png`) |
|
||||
| `placeholder-logo*.png` | the placeholder logos (dark text; white text for `logoMadeFor: 'dark'`) |
|
||||
|
||||
Screens: `login-{light,dark,phone,phone-dark,pl}`, `login-error-{light,phone}`, `forgot-{light,dark,phone}`,
|
||||
`2fa-code-{light,dark,phone}`, `2fa-setup-{light,dark,phone}`, `first-user-{light,dark,phone}` (needs a database
|
||||
without users: `--only=first-user`). The files are 8-bit PNGs (re-encoded to keep the folder small).
|
||||
|
||||
## What defines IAWL's sign-in page (read from `plugin/assets/sign-in/sign-in.css`, `SignInLook.php`, `Logo.php`, `LanguageSwitcher.php`)
|
||||
|
||||
- **Layout:** two columns, 5 : 6. Left: a dark panel (`#060606`) inset 10 px from the window's edge, 20 px corners,
|
||||
a faint grid (3.5 × 2.5 rem cells, 4 % white lines) and two blue glows (`rgb(0 158 246)`, 22–24 %). Right: a white
|
||||
page with the form, 28 rem wide, centred in its column. No card around the form.
|
||||
- **On the panel**, at the bottom: a label "ADMINISTRATION PANEL" (mono, 14 px, 600, upper case, 0.05 em tracking,
|
||||
`#b2b2b2`, a 5 px blue square before it), then the logo on a white plate (12 px corners, 16 × 20 px padding; the
|
||||
logo fits 240 × 72) or the site's name as text (weight 500, −0.03 em, clamp 36–60 px). Both link to the site.
|
||||
- **Form:** labels above fields, 48 px fields with a 1 px `#80868f` border and 6 px corners, a full-width 50 px blue
|
||||
button (`#0070c0`, hover `#005a9e`, white text), links `#006bb8` underlined, focus ring 2 px `#017bd0`.
|
||||
- **Under the form:** links (lost password, back to the site), the languages as links, a hairline, and the credit
|
||||
"Technology support: Intecion.com" (13 px, muted, centred).
|
||||
- **Messages:** boxes above the form with a 4 px bar on the leading edge: red for errors, green for success.
|
||||
- **Phone (≤ 52 rem):** the panel is a band above the form, bottom corners rounded, the logo 192 × 56.
|
||||
- **Theme:** none: the panel is always dark, the form always light. **Fonts:** Outfit / Inter / Roboto Mono from
|
||||
local files, part of the credit (off with `credit => false`). **Script:** one optional file, the grid light that
|
||||
follows the mouse.
|
||||
- **States:** WordPress's own (errors, lost password, reset with the strength meter, logged out, interim frame);
|
||||
IAWL changes the look only.
|
||||
|
||||
## How IAPL maps it
|
||||
|
||||
| Element | IAPL | Same as IAWL? |
|
||||
|---|---|---|
|
||||
| Split, panel inset and corners, grid, glows, colours | the same numbers (`css.ts`) | yes |
|
||||
| Label, logo box (240 × 72, 2× source), name as text, link to the site, alternative text | the same | yes |
|
||||
| Logo types and the look at the file before printing | **as IAPL's white label did in 1.17.0** (owner, 2026-11-26): any picture Site settings holds, an SVG too, as `<img>`; `svgLogo: false` refuses SVG. The file is asked once only to avoid a broken picture (gone / no picture → the name) | IAWL: JPEG, PNG, WebP, AVIF, GIF, no SVG (WordPress refuses the upload); file read from disk |
|
||||
| Plate | **no plate by default** (the owner's choice for new surfaces), `logoPlate: true` adds it | IAWL: plate by default, `logoMadeFor => 'dark'` removes it |
|
||||
| Button, link, focus and border colours; field and button heights; 28 rem column | the same | yes |
|
||||
| Phone band at 52 rem | the same | yes |
|
||||
| Languages | links, **on the panel** (top corner; under the brand on a phone), because the form's markup is Payload's and differs per screen | place differs |
|
||||
| Credit line | under the login form, hairline above (login only, as before) | IAWL: every screen |
|
||||
| Dark theme | the form's side follows the admin theme; the panel stays dark | IAWL has no dark form |
|
||||
| Fonts | the admin's own font stack and the system's mono; no font file | differs (no extra request before sign-in) |
|
||||
| Grid light (script) | not built: no script on the sign-in page | differs |
|
||||
| Messages | Payload's own toasts and field errors, unchanged | differs |
|
||||
| Field look | Payload's fields with the shared border colour and height | close |
|
||||
|
||||
## Decisions
|
||||
|
||||
1. **Carried by components every site already has.** A new admin component needs a new import-map entry, and a
|
||||
provider missing from the map blanks the whole panel. So `AdminLogo` prints the panel on the login screen and
|
||||
`SafeTotpView` in front of the 2FA screens; only `allScreens` adds a provider (`SignInLook`), guarded at start.
|
||||
2. **The panel is one self-contained element**, fixed on a desktop and in the flow on a phone, hidden by its own
|
||||
CSS off the minimal template. It therefore works wherever it is printed (inside the login form's wrapper, before
|
||||
a 2FA view, at the top of the body).
|
||||
3. **No new stored data.** Logo and name are Site settings fields that exist since 1.0 — the ones the public site
|
||||
reads — so every part of the site shows the same logo and there is no migration. The plate switch (`logoPlate`)
|
||||
and the accent are code options; putting them in the panel would add columns on SQL.
|
||||
4. **Payload draws its admin screens in the browser** (the server's HTML body is empty until React runs), so "no
|
||||
flash" means: the panel, its stylesheet and the form appear in the same step. The e2e spec checks that the
|
||||
form's template is never in the page without them.
|
||||
|
After Width: | Height: | Size: 72 KiB |
|
After Width: | Height: | Size: 72 KiB |
|
After Width: | Height: | Size: 74 KiB |
|
After Width: | Height: | Size: 72 KiB |
|
After Width: | Height: | Size: 72 KiB |
|
After Width: | Height: | Size: 74 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 83 KiB |
|
After Width: | Height: | Size: 85 KiB |
|
After Width: | Height: | Size: 83 KiB |
|
After Width: | Height: | Size: 85 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 76 KiB |
|
After Width: | Height: | Size: 76 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 72 KiB |
|
After Width: | Height: | Size: 73 KiB |
|
After Width: | Height: | Size: 72 KiB |
|
After Width: | Height: | Size: 75 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 70 KiB |
|
After Width: | Height: | Size: 71 KiB |
|
After Width: | Height: | Size: 71 KiB |
|
After Width: | Height: | Size: 71 KiB |
|
After Width: | Height: | Size: 71 KiB |
|
After Width: | Height: | Size: 71 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 71 KiB |
|
After Width: | Height: | Size: 71 KiB |
|
After Width: | Height: | Size: 71 KiB |
|
After Width: | Height: | Size: 71 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 71 KiB |
|
After Width: | Height: | Size: 72 KiB |
|
After Width: | Height: | Size: 71 KiB |
|
After Width: | Height: | Size: 72 KiB |
|
After Width: | Height: | Size: 8.1 KiB |
|
After Width: | Height: | Size: 9.6 KiB |
|
After Width: | Height: | Size: 7.9 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 8.1 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 6.7 KiB |
|
After Width: | Height: | Size: 7.8 KiB |
|
After Width: | Height: | Size: 5.8 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 8.9 KiB |
|
After Width: | Height: | Size: 8.9 KiB |
|
After Width: | Height: | Size: 6.4 KiB |
|
After Width: | Height: | Size: 7.0 KiB |
|
After Width: | Height: | Size: 4.7 KiB |
|
After Width: | Height: | Size: 7.7 KiB |
|
After Width: | Height: | Size: 5.2 KiB |
|
After Width: | Height: | Size: 9.1 KiB |
|
After Width: | Height: | Size: 6.6 KiB |
@@ -0,0 +1,72 @@
|
||||
# Changelog draft — the sign-in look (for 1.17.1)
|
||||
|
||||
To be placed in `docs/CHANGELOG.md` by the release; the version number is the integration session's call.
|
||||
|
||||
## Read before upgrading
|
||||
|
||||
**The panel's sign-in page looks different on every site with `whiteLabel`.** After the update the login screen and
|
||||
the 2FA screens (code, setup) show a dark panel with the client's logo — or the site's name — beside the form, the
|
||||
look IAPL now shares with IAWL. No edit, no `generate:importmap`, no migration, no new env var.
|
||||
Keep Payload's screens: `whiteLabel: { signIn: false }`. Sites without `whiteLabel`: nothing changes.
|
||||
|
||||
**Every logo that showed on the login screen before shows on the new screens** (an SVG too): the logo is handled
|
||||
as the white label handled it until now. Two things to look at on such a site, each with a one-line way back:
|
||||
- **The logo stands straight on a dark panel** (no plate — the owner's decision). A logo with dark letters:
|
||||
`signIn: { logoPlate: true }`.
|
||||
- **Editors can no longer change the site's name, logo and icon** in Site settings (admins can): these are what the
|
||||
public sign-in page shows. `whiteLabel: { brandAccess: 'editor' }` gives them back.
|
||||
|
||||
## Security
|
||||
|
||||
- **The public preview-image endpoint could be made to fetch from a host named in the request.**
|
||||
`GET /api/ipal/admin-og` resolved a site-relative logo address against the request's own host and fetched it with
|
||||
redirects followed, no timeout and no size limit; `GET /api/ipal/admin-icon` resolved the same way. Both now
|
||||
resolve against the site's configured origin only (`serverURL`, else `NEXT_PUBLIC_SERVER_URL`), ask one address,
|
||||
never follow a redirect, give up after 5 s and stop reading at 512 KB. `fetchPublicImage` (exported) behaves so
|
||||
for every caller and takes `{ timeoutMs }`; new export `PUBLIC_IMAGE_TIMEOUT_MS`. **For a project:** nothing to do
|
||||
when `serverURL` is set (the starter sets it). A site without `serverURL` and without `NEXT_PUBLIC_SERVER_URL`
|
||||
loses the logo in its panel link preview (the site name is drawn) and the icon endpoint redirects to the media
|
||||
file — set `serverURL`. A logo or icon whose address answers with a redirect is no longer fetched by the server.
|
||||
|
||||
## Added
|
||||
|
||||
- **Sign-in look (`whiteLabel.signIn`, on with `whiteLabel`).** A dark panel with the label "Administration panel",
|
||||
the client's logo (Site settings → Logo) or the site's name, and the panel's languages as links;
|
||||
the form beside it, in both admin themes; a band above the form on a phone. Logo and name come from Site settings:
|
||||
no env var, **no new field, no schema change** (MongoDB, Postgres, SQLite alike). With nothing set the panel shows
|
||||
the label and the site's host — no Payload or Intecion mark. The logo on a white plate is an option; the default is no plate.
|
||||
- **`signIn: { allScreens: true }`** — the same look on forgot / reset password, create first user, logout and
|
||||
"unauthorized". Adds the provider `SignInLook` (one import-map entry: `pnpm payload generate:importmap`). The
|
||||
project starter writes it for new sites. A production start that does not find the entry in `importMap.js`
|
||||
leaves the provider out and logs what to run; the panel keeps working.
|
||||
- **The logo:** whatever Site settings → Logo holds, an SVG too, as an `<img>`; fits 240 × 72 (it was up to
|
||||
420 × 120), served from a generated size at least twice as wide when the media collection has one; alternative
|
||||
text = the site's name. Its file is asked once before it is printed (no redirect followed, 4 s, 512 KB): a file
|
||||
that is gone, or is no picture, gives the site's name instead of a broken picture; in any doubt the upload is
|
||||
believed.
|
||||
- **Options:** `signIn.accent` (hex colour of the button, links and focus ring), `signIn.logoPlate` (a white plate),
|
||||
`signIn.svgLogo: false` (refuse an SVG logo), `signIn.checkLogo: false`, `signIn.languages: false`,
|
||||
`whiteLabel.brandAccess` (`'admin'` with the look, `'editor'` as before; field-level access, no schema change).
|
||||
CSS variables `--iapl-signin-*` for a project's `custom.scss`.
|
||||
- **Language links before sign-in:** `GET /api/ipal/admin-language?lng=<code>` writes Payload's language cookie for
|
||||
a supported language and returns to the admin page it was opened from (public; 400 for an unknown language;
|
||||
never redirects off the admin route). Registered only with the sign-in look and `languages !== false`.
|
||||
- **The 2FA code boxes have names** for screen readers ("Digit 2 of 6") and ask a phone for the numeric keyboard
|
||||
(with the sign-in look).
|
||||
- Exports: `SignInPanel`, `SignInLook` (`/admin`); `resolveSignInLook`, `loadSignInBrand`, `signInLogo`,
|
||||
`signInName`, `checkLogoFile`, `fitLogo`, `isSvgUpload`, `languageLinks`, `LANGUAGE_NAMES`, `signInCss`, `isHexColour`,
|
||||
`signInProviderActive`, `buildAdminLanguageEndpoint`, `adminPathFromReferer`, `SIGN_IN_LOOK`, `SIGN_IN_STYLE_ID`,
|
||||
`SIGN_IN_LOGO_BOX`, `SIGN_IN_NAME_MAX`, `ADMIN_LANGUAGE_PATH` and their types.
|
||||
|
||||
## Changed
|
||||
|
||||
- `AdminLogo` prints the sign-in panel when the plugin gives it `signIn` (the default with `whiteLabel`); wired by
|
||||
hand without that prop it is the plain logo as before. The logo on the login screen is now shown inside
|
||||
240 × 72 px (it was up to 420 × 120).
|
||||
- The credit line under the login form: full-strength muted colour and a hairline above it (it was 60 % opacity).
|
||||
- The reference site and the starter use `whiteLabel: { signIn: { allScreens: true } }`.
|
||||
|
||||
## Requires project changes
|
||||
|
||||
None for the panel to work — but read the two points at the top. Recommended: `allScreens` (one config line, regenerate the import map). A project with its own CSS for the
|
||||
login screen looks at the result after the update.
|
||||
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 74 KiB |
|
After Width: | Height: | Size: 74 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 82 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 8.8 KiB |
|
After Width: | Height: | Size: 9.0 KiB |
|
After Width: | Height: | Size: 7.4 KiB |
|
After Width: | Height: | Size: 8.1 KiB |