Merge local main (1.17.2) into security-a-118
Conflicts resolved by keeping both sides: lockedAnswer + sign-in rules in plugin.ts and switches.ts, IPv6 grouping in the mail service's new per-visitor address count, both built-site specs in e2e:built, docs and skills (reference copies synced). The lockedAnswer suite and the sign-in-answers spec now reach Payload's lock the 1.18.0 way: a spray from 50 IPs, one failure each (one IP alone gets 429 after five). Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -78,7 +78,8 @@ names, env, admin, AGENTS.md, skills, seeds and — with `--url` / `--deep` —
|
||||
|
||||
- **Drafts and locales over the API** (a collection with `versions: { drafts: true }`): without a session,
|
||||
`curl -s "$U/api/<slug>?draft=true&limit=100" | grep -c '"_status":"draft"'` → `0`, else ERROR: give it
|
||||
`access: { read: readPublished(), readVersions: readPublished() }` (access.md). `curl -sI "$U/md/xx"` → `404`
|
||||
`access: { read: readPublished(), readVersions: readPublishedVersions() }` (access.md). `curl -s -o /dev/null -w '%{http_code}' "$U/api/<slug>/versions?limit=10"`
|
||||
→ `200` (a `500` = a rule with the document's `_status` path on `readVersions`: ERROR). `curl -sI "$U/md/xx"` → `404`
|
||||
(no stand-in locale); a 404 page assigned in System pages must be published.
|
||||
- **Secrets out of queries** (as an admin, with versions on for Site integrations or a collection using
|
||||
`writeOnlySecret`): `curl -s -H "Authorization: JWT $T" "$U/api/globals/site-integrations/versions?where[version.smtpPassword][exists]=true"`
|
||||
|
||||
@@ -46,12 +46,16 @@ const DOORS: Door[] = [
|
||||
{ closedFor: ALL, method: 'POST', name: 'the crawler\'s call-back without its token', path: '/api/ipal/cookie-crawl/results', body: { jobId: 'x', ok: true } },
|
||||
{ closedFor: OUTSIDERS, method: 'POST', name: 'a crawl without the schedule\'s token', path: '/api/ipal/cookie-crawl' },
|
||||
{ closedFor: OUTSIDERS, name: 'form submissions', path: '/api/form-submissions' },
|
||||
// IAPL 1.17.2: a staff account only; an open door answers 400 (validation) instead of 403
|
||||
{ body: { form: NO_ID, submissionData: [] }, closedFor: OUTSIDERS, method: 'POST', name: 'a submission past submitForm', path: '/api/form-submissions', closed: status(403) },
|
||||
{ body: { email: '[email protected]', password: 'Door-Password-1234', roles: ['admin'] }, closedFor: ALL, method: 'POST', name: 'nobody creates a staff account', path: '/api/users', closed: status(403) },
|
||||
{ body: { email: '[email protected]', password: 'Door-Password-1234' }, closedFor: ALL, method: 'POST', name: 'the first-user route once an account exists', path: '/api/users/first-register', closed: status(403) },
|
||||
{ body: {}, closedFor: OUTSIDERS, method: 'POST', name: 'Site settings cannot be saved', path: '/api/globals/site-settings', closed: status(403) },
|
||||
{ closedFor: ALL, name: 'the GraphQL playground (production)', path: '/api/graphql-playground', closed: status(404) },
|
||||
{ closedFor: ALL, graphql: '{ __schema { queryType { name } } }', closed: ({ body }) => Boolean((body as { errors?: unknown[] })?.errors?.length), name: 'GraphQL introspection (production)' },
|
||||
{ closedFor: ALL, name: 'Payload\'s job queue (a site without jobs)', path: '/api/payload-jobs/run', closed: status(404) },
|
||||
// a site without jobs: 404. A site WITH jobs (IAPL 1.17.2): refused (401) for everybody but an admin and
|
||||
// `Authorization: Bearer <CRON_SECRET>` — drop `closed: status(404)` there
|
||||
{ closedFor: ALL, name: 'Payload\'s job queue', path: '/api/payload-jobs/run', closed: status(404) },
|
||||
// the project's own doors: add them here
|
||||
// { closedFor: OUTSIDERS, body: {}, method: 'PATCH', name: 'pages cannot be changed', path: `/api/pages/${NO_ID}`, closed: status(403) },
|
||||
]
|
||||
|
||||
@@ -46,9 +46,11 @@ Ask only when the brief leaves a business question open (e.g. "do posts have aut
|
||||
**No URL prefix in code** — the editor assigns the archive page in
|
||||
Site settings (`<slug>Archive`). The plugin handles routing, sitemap,
|
||||
generateStaticParams, hreflang.
|
||||
**With drafts** (`versions: { drafts: true }`): `access: { read: readPublished(), readVersions: readPublished() }`
|
||||
**With drafts** (`versions: { drafts: true }`): `access: { read: readPublished(), readVersions: readPublishedVersions() }`
|
||||
(`readPublished` is for `read`, `readPublishedVersions` for `readVersions` — the version list asks for `version._status`)
|
||||
— Payload's open `read: () => true` answers `?draft=true` with the draft over REST and GraphQL. Check:
|
||||
`curl -i <site>/api/<slug>/<draft id>?draft=true` without a session → `404`; the same with an editor's token → the draft.
|
||||
`curl -i <site>/api/<slug>/<draft id>?draft=true` without a session → `404`; the same with an editor's token → the draft;
|
||||
`curl -s -o /dev/null -w '%{http_code}' <site>/api/<slug>/versions?limit=10` without a session → `200`, never `500`.
|
||||
3. Entry list = a block (EntriesList) with `getEntries`; the entry page uses
|
||||
`resolveRoute` (type `entry`); JSON-LD per seo.md (e.g. Article).
|
||||
4. **An auth collection for visitors** (`auth: true`: customers, members) only when the client requires it
|
||||
|
||||
@@ -55,6 +55,14 @@ before analytics or marketing consent — check the project's choice in "Project
|
||||
`nonce` to `<SiteProviders>`. A visitor who decided must never see the banner on reload; one whose
|
||||
decision is from an older Policy version must see it at once. A click on a button before hydration
|
||||
counts (the checks above click as soon as the button is visible).
|
||||
7. Cookie button (1.17.2, consent.md → "Where the cookie button sits"): after a decision, on a long page, a short
|
||||
page and a page with a form, desktop and phone width (also 360 px) — the button is in the bottom corner of the
|
||||
window at the top, in the middle, with the footer in view and at the very end: it must not move at all. At the
|
||||
very end nothing of the footer is under it and the last footer link can be tapped (the footer has grown a little:
|
||||
`[data-ipal-cookie-space]` on it). Before a decision and while the banner is open the footer has its own padding
|
||||
only. Tab reaches the button and Enter reopens the banner. A project scroll handler, a button rendered inside
|
||||
the footer or hand-made bottom padding for it → remove (AGENT.md §7). Too much or too little room:
|
||||
`--ipal-cookie-button-space` on the footer; none: `reserve={false}`.
|
||||
|
||||
The script needs buttons with `data-ipal="accept"` / `"reject"` — the plugin's
|
||||
`CookieBanner` has them in every `settings` mode (`inline`, `modal`, `detailed`). A custom banner in the project violates AGENT.md §7.
|
||||
|
||||
@@ -34,6 +34,11 @@ through this procedure. Ask only when you are missing something you cannot get y
|
||||
### Build / TypeScript
|
||||
| Symptom | Cause | Fix |
|
||||
|---|---|---|
|
||||
| a panel button (mail service Connect / Disconnect, Send test e-mail, cookie scan / approve / check site) answers `403` "Not allowed from this origin."; log `[iapl] a panel action from origin "…" was refused` | the request's origin is not one the site knows (1.17.2, `adminSameOrigin`): a reverse proxy that rewrites `Host` and sends no `X-Forwarded-Host`, and no `serverURL` | set `serverURL: process.env.NEXT_PUBLIC_SERVER_URL` in the Payload config, or make the proxy send `X-Forwarded-Host`, or `adminSameOrigin: { origins: ['https://…'] }`; `iapl-doctor` `csrf-empty` |
|
||||
| a staff account's correct password gets "The email or password provided is incorrect." | the account is locked by Payload after `maxLoginAttempts` wrong passwords (5, for `lockTime`, 10 min); since 1.17.2 a locked staff account gets the wrong-password answer (`accounts.lockedAnswer`) | wait for the lock to end, or an admin unlocks it (the account in the panel, or `POST /api/users/unlock`); `lockUntil` on the account shows it. Payload's own message back: `accounts: { lockedAnswer: 'payload' }` |
|
||||
| a sign-in answers `429` "Too many failed sign-ins to this address from here" | 5 failed sign-ins for that address from that client IP in 15 minutes (`accounts.signInLimit`, 1.18.0); everybody behind one IP shares it (an office NAT); without `IAPL_IP_HEADER` everybody may share the no-IP bucket | wait the minutes it names, or sign in from elsewhere; pin `IAPL_IP_HEADER`; more room: `signInLimit: { perAddress: 10 }` |
|
||||
| staff login / "forgot password" answers `403` and the log says `[iapl] a staff sign-in from origin "…" was refused` | the request came from another origin (`accounts.signInSameOrigin`, 1.18.0): a front end on another domain, or a proxy that rewrites `Host` without `serverURL` | set `serverURL`, or `signInSameOrigin: { origins: ['https://…'] }` |
|
||||
| saving one's own account answers "Enter your current password to change your e-mail address or password." | `accounts.confirmOwnChanges` (1.18.0): own e-mail / username / password changes need the current password | type it in "Current password" on the account page; scripts send `currentPassword`; off: `confirmOwnChanges: false` |
|
||||
| the 2FA code screen answers "Too many codes were tried…" (`429` from `/api/verify-totp`) | more than 5 wrong codes for that account in 10 minutes (`twoFactor.verifyLimit`; right codes do not count since 1.17.1). "…being checked right now. Try again in a moment." (`Retry-After: 2`) = several attempts of one account at the same moment, nothing is locked; repeated lines `[iapl] 2FA: too many verify attempts` in the log without the owner trying = someone has the password | wait for the window, enter the current code once; unexplained attempts: change that account's password. Tests that log in often: `verifyLimit: { max: … }` for that environment |
|
||||
| `isAdmin(req.user)` says `false` for a real administrator on the server, in a process that loads two Payload configs (tests, a multi-site script) | a call without a source counts only collections that are staff in **every** config of the process | pass the source: `isAdmin(req.user, req.payload)` — with it each config gets its own answer |
|
||||
| `isAdmin(user)` / `isEditor(user)` is always `false` in a client component or in `proxy.ts` | the staff collections are not known there (no config in the browser bundle / middleware), and the predicates fail closed | `isAdmin(user, config)` with `useConfig()`, imported from `@intecion/ipal-kit/client`; in middleware `isAdmin(user, { staffCollections: ['users'] })` |
|
||||
|
||||
@@ -38,10 +38,15 @@ description: Complete map of everything @intecion/ipal-kit provides — every ia
|
||||
| `accounts.staffOnlyRead` | on | `read` and `readVersions` on a staff collection without those rules: a fully signed-in account of a staff collection (Payload's default let a visitor account list the staff accounts) | `false` = Payload's default; a `read` rule you wrote wins |
|
||||
| `accounts.firstUserRoute` | `'panel'` | which auth collections `POST /api/<slug>/first-register` answers for while they are empty: only the one the panel logs in with (the first account of a site → admin). Others get `403`, a second staff collection included, in any spelling of the URL (the plugin's own endpoint sits in front of Payload's); a collection whose own `create` allows an anonymous request keeps its route. With `access.firstUserAdmin: false` and a default role below the panel role, the default `panelRole` is not applied (logged) and an explicit one is refused at start | a list of slugs; `'all'` = Payload's behaviour |
|
||||
| `accounts.password` | `{ minLength: 12 }` | when a password is SET on a staff collection (create, first-user screen, change, reset by e-mail; panel, API and Local API): at least `minLength` characters, not the account's e-mail address. Existing passwords are never checked — a shorter one keeps logging in | `{ minLength }`; `false` = Payload's rule (3 characters) |
|
||||
| `accounts.lockedAnswer` | `'wrong'` (1.17.2) | a staff account Payload has locked (too many wrong passwords) gets exactly the wrong-password answer on login (REST, GraphQL, the panel): nobody tells which addresses have an account; the lock itself is unchanged | `'payload'` = Payload's "This user is locked…"; any other value stops the start |
|
||||
| `accounts.signInLimit` | `{ perAddress: 5, windowMinutes: 15, accountLock: { maxLoginAttempts: 50, lockTime: 3_600_000 } }` (1.18.0) | failed staff sign-ins per client IP + typed address (folded): over the limit `429` for that IP and address only; only failures count; Payload's per-account lock raised where the project set none | `{ perAddress, windowMinutes, accountLock }`; `accountLock: false` = Payload's lock; `false` = as before 1.18 |
|
||||
| `accounts.signInSameOrigin` | on (1.18.0) | staff login / forgot / reset password: `403` for a request a browser marks as coming from another origin | `{ origins: [...] }`; `false` |
|
||||
| `accounts.confirmOwnChanges` | on (1.18.0) | own e-mail / username / password change needs `currentPassword` (panel field, REST, GraphQL) | `false` |
|
||||
| `secrets.writeOnly` | on | `smtpPassword` and `turnstileSecretKey` (Site integrations) are never returned: REST, GraphQL and the panel get `'********'` when a value is stored; a save with nothing / empty / the mask keeps it, a new value replaces it, `'[[clear]]'` removes it; the Local API with access control off reads the real value. The panel is the source of these secrets — no env variable. A restore of a version is masked too | `false` = returned to whoever may read the global, as before |
|
||||
| "Sending method" (`emailMethod`; `getMailMethod` / `setMailMethod`) | nobody has chosen: the order of 1.17.0, shown as selected | `relay` (IWSN), `smtp`, `graph` (deprecated): what is chosen is what is used, no fallback; a stored field (Postgres / SQLite: one migration) |
|
||||
| `secrets.reenterOnChange` | on | a save through access control that changes `smtpHost`, `smtpPort` or `smtpUser` while a password is stored must send the password again or remove it (`400` on the field otherwise), whatever `emailTransport` says — so an admin session cannot send the stored password to a server of its own. A change of the transport alone, and the Local API with access control off, are not asked | `false` = the stored password follows the new server |
|
||||
| `dashboardAlerts` | `{ integrations: 'admin', cookies: 'editor' }` | who sees the plugin's dashboard alerts: integration details (error text, link) for `integrations` and above, a neutral "ask an administrator" for editors below it, nothing for others; the cookie crawl / approval alert for `cookies` and above. With a role, a session that owes its second factor sees none | `integrations: 'editor' | 'all'`, `cookies: 'all'` (`'all'` = as before: no role and no second factor is checked) |
|
||||
| `adminSameOrigin` | on (1.17.2) | `POST` mail service connect / disconnect, test e-mail, cookie scan / approval / crawl refuse (`403`) a request a browser marks as coming from another origin; own origins: the request's host, `serverURL`, `csrf`, `cors`, `origins` | `{ origins: [...] }` adds origins; `false` = no check; any other value stops the start |
|
||||
| `adminRoute` | `'/admin'` | `config.routes.admin`; stats link and views, `IntegrationAlerts` | the project moves `app/(payload)/<route>/` itself and adds the route to the proxy matcher (security.md) |
|
||||
| `twoFactor` | **none = error** | `@clocklimited/payload-2fa` with `forceSetup: true` (TOTP enforced, also checked in the API) | `twoFactor: false` (discouraged); omitting the option throws `[iapl] twoFactor.issuer is required` |
|
||||
| `twoFactor.issuer` | — (required) | name in the authenticator app | — |
|
||||
@@ -93,7 +98,7 @@ description: Complete map of everything @intecion/ipal-kit provides — every ia
|
||||
| `forms.adminGroup` | `'Forms'` | sidebar group | `false` = Payload default; `admin.group` in overrides wins |
|
||||
| `forms.fields.*` | on: `checkbox`, `checkboxGroup`, `country`, `date`, `email`, `message`, `number`, `radio`, `select`, `state`, `step`, `text`, `textarea`, `time`; off: `payment` | block types in the builder (all with "Show only when") | `<type>: false`; a block object replaces it; `payment: true` **does nothing** (filtered out) — pass a block object |
|
||||
| `forms.formOverrides` | Form/Forms labels, `emails` readable by logged-in users only | overrides the `forms` collection (`fields: ({ defaultFields }) => …`, `slug`, `admin`, `access`…) | any `CollectionConfig` |
|
||||
| `forms.formSubmissionOverrides` | create: logged-in, read: editor+, delete: admin | overrides `form-submissions` | `access.create` etc. wins |
|
||||
| `forms.formSubmissionOverrides` | create: a staff account with its second factor (since 1.17.2; before: any signed-in account), read: editor+, delete: admin | overrides `form-submissions` | `access.create` etc. wins |
|
||||
| `forms.redirectRelationships` | none | collections a form can redirect to | `['pages']` |
|
||||
| `forms.emailLayout` | `false` | `beforeEmail` with a layout (logo, colour, footer) + Site settings → **Emails** tab; `{{*:table}}` readable | `true` |
|
||||
| `forms.beforeEmail` | none | your own e-mail changes (after the layout) | form-builder function |
|
||||
@@ -102,6 +107,7 @@ description: Complete map of everything @intecion/ipal-kit provides — every ia
|
||||
| `forms.consentFieldName` | `'consent'` | name of the GDPR consent field `submitForm` requires (read from `config.custom.ipal`) | `createSubmitAction({ consentFieldName })` / `submitForm` argument wins |
|
||||
| `consentLog` | **on** (since 1.17.0) | `consent-records` collection + `POST /api/ipal/consent` (rate limit 20/min); Postgres / SQLite: a table, migration in the same deploy | `false` / `{ retentionDays }` (default 1095) |
|
||||
| `consentLog.collectionOverrides` | none | changes `consent-records`: an object merges `access` / `admin` / `hooks` key by key (your keys win), a function `(collection) => collection` takes over (keep the slug) | e.g. `{ access: { read: ({ req }) => req.user?.email === '[email protected]' } }` — narrows who reads records in a project without roles |
|
||||
| `jobsRunAccess` | on (since 1.17.2), only when the project writes no `jobs.access.run` | Payload's job queue over HTTP (`/api/payload-jobs/run`, `/handle-schedules`): an admin with the second factor (an admin API key counts) or `Authorization: Bearer <CRON_SECRET>` (16+ chars); before: any signed-in account of any auth collection. In-process runs (`jobs.autoRun`, `payload jobs:run`) unaffected | `false` = Payload's default; `{ secretVar }` = another variable; your own `jobs.access.run` wins. Check: `curl -H "Authorization: Bearer $CRON_SECRET" $URL/api/payload-jobs/run` → 200, without it 401 (security.md "Payload's job queue") |
|
||||
| `doctor` | on (404 until `IAPL_DOCTOR_TOKEN` is set) | `GET /api/ipal/doctor` — read-only counts for `iapl-doctor --url` (users without TOTP, cookies waiting for approval, versions); Bearer token ≥ 32 characters, rate-limited, never names or values | `false` = no endpoint; `{ tokenVar, access }` (doctor.md) |
|
||||
| `cookieScanner` | off | `cookie-review` collection, "Scan cookies" box above its list (`CookieScanButton`), `GET`/`POST /api/ipal/cookie-scan`, and (unless `approval: false`) the *Approve cookies* view `/admin/cookie-approval` (`CookieApprovalView`) + `GET`/`POST /api/ipal/cookie-approval` + the dashboard reminder; a scan lists the cookies of the integrations switched on + names looked up in the bundled Open Cookie Database; one **Approve and add** puts the ticked cookies into Cookies → Cookie list (so `<CookieTable>` and the detailed window); never deletes, never overwrites edited text, never duplicates, nothing reaches the banner before approval | `true` / object; after switching on: `pnpm generate:importmap` + `migrate:create`. Check: *Privacy → Cookie review* → **Scan cookies** → "Waiting for approval: N" → **Review and approve** → **Approve and add** → the cookies are in Cookies → Cookie list (cookie-scanner.md) |
|
||||
| `cookieScanner.adminLayout` | `'combined'` | one *Cookies* entry: *Review and approve* and (with `crawl`) *Site check* tabs on the `cookie-settings` global (`ui` fields, `CookieReviewTab` / `CookieSiteCheckTab`); `cookie-review` and `cookie-crawl` get `admin.group: false` (out of the nav, pages and API kept) | `'separate'`; no migration, `generate:importmap` |
|
||||
@@ -277,6 +283,7 @@ The plugin's own variables are `IAPL_<NAME>`; a deploy that sets the spelling fr
|
||||
| `IAPL_IP_HEADER` | `ipHeader: true` + production | rate limit trusts any IP header (spoofing) + warning in prod | env: `cf-connecting-ip` (Cloudflare) / `x-forwarded-for` (Traefik/nginx) |
|
||||
| `IAPL_COOKIE_SCAN_URL`, `IAPL_COOKIE_SCAN_TOKEN` | `cookieScanner.crawl` (`iaplEnvRules({ cookieCrawl: true })` requires both in production; token ≥ 16 chars) | **Check site** disabled, the box names the missing variable | env; the token also goes into the scanner service's `IAPL_CRAWLER_SITES` as `host=token` |
|
||||
| `IAPL_DOCTOR_TOKEN` | no; ≥ 32 characters | `GET /api/ipal/doctor` answers 404; with it the endpoint answers a Bearer token, and `iapl-doctor --url` with the same variable reads the deep counts | env (Coolify) and the doctor's shell; also read by the doctor: `CI`, `NO_COLOR`, `PAYLOAD_CONFIG_PATH` (`--deep`), `IAPL_DOCTOR_IMPORT_MAP` (internal) — doctor.md |
|
||||
| `CRON_SECRET` | no; ≥ 16 characters (name: `jobsRunAccess.secretVar`) | Payload's job queue runs over HTTP only for an admin; the start log says so when the queue is on | env (Coolify); the cron sends `Authorization: Bearer <CRON_SECRET>` to `/api/payload-jobs/run` |
|
||||
| `IAPL_NOINDEX` | no; `1`/`true`/`yes` **staging/preview only** | — (when set: robots Disallow, meta noindex, `X-Robots-Tag`, IndexNow sends nothing) | staging env |
|
||||
| `NEXT_PHASE` | set by Next | only tells `next build` from runtime: during the build an unreachable database gives an empty sitemap; at runtime the sitemap throws (route → 503) | do not set by hand |
|
||||
| `NEXT_RUNTIME` | set by Next | `instrumentation.ts` checks for `nodejs`; missing (scripts, seed) → `buildRevalidateHook` does not revalidate | do not set by hand |
|
||||
|
||||
@@ -85,7 +85,12 @@ Admin panel components from `@intecion/ipal-kit/admin` — the project does NOT
|
||||
| `buildRolesField(defaultRole?, { firstUserAdmin? })` | `@intecion/ipal-kit` | The `roles` select field the plugin injects (only admins set roles; `firstUserAdmin` default `true` = the account made on "Create first user" gets `admin`). The plugin wires it itself — use it only for an auth collection the plugin does not manage. |
|
||||
| `injectRoles(config, accessOption)` | `@intecion/ipal-kit` | Adds `roles` to `accessOption.authCollection` in a config. The plugin calls it itself with `access` — do not call. |
|
||||
|
||||
**Types:** `AccountsOptions` (`accounts`: `panelRole`, `adminOnlyCreate`, `adminOnlyWrite`, `staffOnlyRead`, `firstUserRoute`, `password`), `StaffAccountAccessOptions` (`{ create?, write?, read?, pluginRoles? }`), `StaffRuleMark` (`{ slug, self }`), `AccountsMarker` (`{ slug, staff, own? }`, in `custom.ipalAccounts`; `own`: the operations that had a rule of the project's at config time, kept when the collection becomes staff later), `LateAdoption` (`{ slug, applied, kept, known, password, firstUser }`; `known`: in the config when iapl ran and staff only afterwards, `kept`: its operations whose own rule was left as written), `StaffAccountRules` (what the plugin put on a staff collection, in `custom.ipalAccountRules`: `{ applied, ownRoles }`), `WriteOnlySecretOptions` (`{ boundTo?, appliesWhen? }`), `PasswordRuleOptions` (`{ minLength? }`), `FirstUserRouteOption` (`'panel' \| 'all' \| string[]`), `TurnstileOnConfigError` / `TurnstileOnConfigErrorOption` / `TurnstileFormKind` (`@intecion/ipal-kit/server`), `VerifyLimitOptions` (`twoFactor.verifyLimit`: `{ max?, windowMinutes?, store? }`), `RequireSetupOptions` (`twoFactor.requireSetup`), `TwoFactorResetOptions`, `TwoFactorSetupState`, `SafeBackRule` / `SafeBackContext` (`twoFactor.safeBack` as a function: `(back, { adminRoute, origin? }) => string`), `TotpViewComponent` (a view component as registered: a path or `{ path, exportName?, clientProps?, serverProps? }`), `SafeTotpViewProps` (`@intecion/ipal-kit/admin`), `Role` (`'user' \| 'editor' \| 'admin'`), `AccessOption` (the plugin's `access` option: `authCollection`, `defaultRole`, `authAccess`, `firstUserAdmin`, `staffCollections`).
|
||||
| `requireOwnOrigin(endpoint, origins?)`, `guardAdminEndpoints(config, projectEndpoints, option)`, `ADMIN_POST_ENDPOINTS`, type `AdminSameOriginOption` | `@intecion/ipal-kit` | `adminSameOrigin` (1.17.2): wraps an endpoint so a request a browser marks as coming from another origin gets `403` (logged once per origin); applies it to the plugin's panel actions it added; the list of `[method, path]` covered. `reportRefusedOrigin(req, origins?, { what, option, docs }?)` names your option in the log line. |
|
||||
| `lockedLooksWrong`, `withLockedAnswer(config)`, `graphqlLoginName(collection)` | `@intecion/ipal-kit` | `accounts.lockedAnswer` (1.17.2): the config-level `afterError` hook that answers Payload's `LockedAuth` on a staff collection's login (REST, GraphQL) exactly like `AuthenticationError`; adding it to a config (idempotent); the GraphQL login mutation's name of a collection. |
|
||||
| `applySignInRules(collection, accounts?)`, `buildSignInBeforeOperation(slug, rules)`, `releaseSignInPlace`, `settleFailedSignIn`, `buildCurrentPasswordField()`, `resolveSignInRules(accounts?)`, `foldSignInName(value)`, `passwordMatches({ hash, salt }, password)`, `CURRENT_PASSWORD_FIELD`, `SIGN_IN_RULES_MARK` (the mark on the `beforeOperation` hook); types `SignInRulesOptions`, `SignInLimitOptions`, `SignInSameOriginOptions` | `@intecion/ipal-kit` | 1.18.0, `accounts.signInLimit` / `signInSameOrigin` / `confirmOwnChanges`: the three rules on one staff collection (hooks, field, Payload lock defaults); the `beforeOperation` hook; the `afterLogin` hook that gives a sign-in's place back; the config `afterError` hook that ends a failed one; the virtual "Current password" field; the options with defaults; the address folding (NFKC, lower case, trim); Payload's stored-hash check (unknown formats refused). |
|
||||
| `releaseRateLimit({ key, scope, max?, windowMs?, cost? })` | `@intecion/ipal-kit` | Gives back a place `consumeRateLimit` took (memory: never below 0; a store: `hit(id, -cost)`) — for a limiter that counts failures only. |
|
||||
|
||||
**Types:** `AccountsOptions` (`accounts`: `panelRole`, `adminOnlyCreate`, `adminOnlyWrite`, `staffOnlyRead`, `firstUserRoute`, `password`, `lockedAnswer`, `signInLimit`, `signInSameOrigin`, `confirmOwnChanges`), `LockedAnswerOption`, `StaffAccountAccessOptions` (`{ create?, write?, read?, pluginRoles? }`), `StaffRuleMark` (`{ slug, self }`), `AccountsMarker` (`{ slug, staff, own? }`, in `custom.ipalAccounts`; `own`: the operations that had a rule of the project's at config time, kept when the collection becomes staff later), `LateAdoption` (`{ slug, applied, kept, known, password, firstUser }`; `known`: in the config when iapl ran and staff only afterwards, `kept`: its operations whose own rule was left as written), `StaffAccountRules` (what the plugin put on a staff collection, in `custom.ipalAccountRules`: `{ applied, ownRoles }`), `WriteOnlySecretOptions` (`{ boundTo?, appliesWhen? }`), `PasswordRuleOptions` (`{ minLength? }`), `FirstUserRouteOption` (`'panel' \| 'all' \| string[]`), `TurnstileOnConfigError` / `TurnstileOnConfigErrorOption` / `TurnstileFormKind` (`@intecion/ipal-kit/server`), `VerifyLimitOptions` (`twoFactor.verifyLimit`: `{ max?, windowMinutes?, store? }`), `RequireSetupOptions` (`twoFactor.requireSetup`), `TwoFactorResetOptions`, `TwoFactorSetupState`, `SafeBackRule` / `SafeBackContext` (`twoFactor.safeBack` as a function: `(back, { adminRoute, origin? }) => string`), `TotpViewComponent` (a view component as registered: a path or `{ path, exportName?, clientProps?, serverProps? }`), `SafeTotpViewProps` (`@intecion/ipal-kit/admin`), `Role` (`'user' \| 'editor' \| 'admin'`), `AccessOption` (the plugin's `access` option: `authCollection`, `defaultRole`, `authAccess`, `firstUserAdmin`, `staffCollections`).
|
||||
|
||||
## Accessibility — widget (`accessibility`) — details: `node_modules/@intecion/ipal-kit/docs/accessibility.md`
|
||||
|
||||
@@ -165,8 +170,10 @@ Fifteen ready blocks and ten page templates. **Use a library block (or a variant
|
||||
|---|---|---|
|
||||
| `ConsentProvider` | `@intecion/ipal-kit/client` | Consent provider: `{ texts, cookieMap?, logEndpoint?, nonce?, cookieValue?, gpc?, maxAgeDays? }` (`gpc`: Global Privacy Control `'honour'` default / `'ask'` / `false`; `maxAgeDays`: re-ask period, default 180; withdrawal also removes the panel's listed storage keys and tells Meta / TikTok / Clarity) (`nonce`: CSP nonce for the banner's first-paint script; `cookieValue`: optional server-read consent cookie → exact HTML, dynamic pages) — consent state, cookie, Consent Mode, deleting cookies after consent is withdrawn, optional POST of the decision to the log (`'/api/ipal/consent'`). Wrap the layout once; required by the banner, `Analytics`, `ConsentScript`. |
|
||||
| `CookieBanner` | `@intecion/ipal-kit/client` | Consent banner + category settings: `settings: 'inline' \| 'modal' \| 'detailed'`, `controls`, `equalChoice` (recommended `true`), `order`, `settingsActions`, `icon`, `classNames`, `firstPaint` (default `true`: in the server HTML, decided before the first paint by an inline script; pages stay static), `nonce`; colours from `--ipal-*` CSS vars. Do not write your own banner. |
|
||||
| `CookieButton` | `@intecion/ipal-kit/client` | Floating button that reopens the cookie settings (withdrawing consent); hidden while the banner is visible. Props `className`, `side` (`'left' \| 'right'`), `avoid` (selector it lifts above, default `COOKIE_BUTTON_AVOID` = footer; `false`). Tokens `--ipal-cookie-button-offset`, `--ipal-cookie-button-inset`. Type `CookieButtonProps`. |
|
||||
| `COOKIE_BUTTON_AVOID`, `bottomOverlap(tops, viewportHeight)` | `@intecion/ipal-kit/client` | Default footer selector; pixels the footer covers at the bottom of the screen (how far the button moves up) |
|
||||
| `CookieButton` | `@intecion/ipal-kit/client` | Floating button that reopens the cookie settings (withdrawing consent); hidden while the banner is visible. Fixed in the bottom corner of the window on every page and never moves (1.17.2: it no longer climbs above the footer). While it is shown the footer gets just enough bottom padding for its last row to end above the button (measured; the footer's own padding counts; nothing where the corner is empty; made before the first paint for a returning visitor). Props `className`, `side` (`'left' \| 'right'`), `reserve` (selector of the block that gets the room, default `COOKIE_BUTTON_RESERVE` = footer; `false` = none), `avoid` (placement before 1.17.2: selector it lifts above — `COOKIE_BUTTON_AVOID`). Amount by hand: `--ipal-cookie-button-space` on the footer (`0` = none). Tokens `--ipal-cookie-button-offset`, `--ipal-cookie-button-inset`. Type `CookieButtonProps`. |
|
||||
| `COOKIE_BUTTON_AVOID`, `bottomOverlap(tops, viewportHeight)` | `@intecion/ipal-kit/client` | Footer selector for the placement before 1.17.2 (`<CookieButton avoid={COOKIE_BUTTON_AVOID} />`); pixels the footer covers at the bottom of the screen (how far the button moves up then) |
|
||||
| `COOKIE_BUTTON_RESERVE`, `COOKIE_BUTTON_SPACE_ATTRIBUTE`, `reserveCookieButtonSpace(options)` | `@intecion/ipal-kit/client` | Default selector of the block that gets room for the cookie button (the footer); the attribute that marks it while the room is there; the function that measures and applies (or, with `release: true`, removes) it — options type `CookieButtonSpaceOptions` (`selector`, `side`, `button?`, `release?`, `sheet?`). For a button of your own |
|
||||
| `consentDecidedScript({ version?, gpc?, cookieName? })` | `@intecion/ipal-kit` | JavaScript statements for an inline script: leave `true` in `d` when the browser holds a current consent decision (as `readConsentRecord` decides). The shared start of the plugin's pre-paint scripts |
|
||||
| `TOTP_TEXTS`, `TOTP_VIEW_TITLE` | `@intecion/ipal-kit` | en/pl texts of the 2FA screens (`totpPlugin:*`, merged by `twoFactor`) and their tab title |
|
||||
| `ConsentScript` | `@intecion/ipal-kit/client` | Loads an external script (`src` or `code`) only after consent for `category` — for vendors without Consent Mode (chat, Plausible etc.). Inside `ConsentProvider`. |
|
||||
| `CookieTable` | `@intecion/ipal-kit/rsc` | Server Component: cookie table for the cookie policy page — `{ rows, labels?, locale?, categories?, caption?, classNames?, storageColumn?, storageTypes? }`; `rows` from `getCookieTable()`; a **Type** column when a row is local / session storage (`storageColumn: 'auto' \| boolean`). |
|
||||
@@ -744,6 +751,7 @@ Most routes and metadata are already ready in `createContentHelpers` (`generateP
|
||||
| `setRateLimitStore(store \| null)` | `@intecion/ipal-kit` | Shared store (e.g. Redis) for all plugin limiters (forms, consents, MCP…); `null` = process memory. Call once at startup when several instances run. |
|
||||
| `setUnknownIpFactor(n)` | `@intecion/ipal-kit` | Requests with no client IP share one `unknown-ip` bucket with `n` × the limit (every plugin limiter). Call once at startup; `0` = unlimited (only with a limiter in front, e.g. Cloudflare). |
|
||||
| `UNKNOWN_IP_FACTOR` | `@intecion/ipal-kit` | `20` — the default factor of the no-IP bucket. |
|
||||
| `setIpv6Grouping({ prefix?, wide?, wideFactor? })`, `ipRateKey(ip)`, type `Ipv6Grouping` | `@intecion/ipal-kit` | 1.17.2: how every plugin limiter counts IPv6 — default one client per /64 (`prefix: 64`), no wide counter; `wide: 48` adds a counter per /48 at `wideFactor` (10) × the limit; `prefix: 128` = per address. Out-of-range values throw. `ipRateKey`: an IPv4 as it is, `::ffff:a.b.c.d` as the IPv4, an IPv6 as its network (`2001:db8:1:2:0:0:0:0/64`), anything else unchanged. |
|
||||
|
||||
**Types:** `ClientIpOptions` — `clientIp` options; `RateLimitStore` — store contract (`hit(id, cost, windowMs)` → `{ count, resetAt }`).
|
||||
|
||||
@@ -872,6 +880,9 @@ 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`. |
|
||||
| `jobsRunAccess({ secretVar? })` | `@intecion/ipal-kit` | The rule iapl puts on `jobs.access.run` when the project writes none: `cronSecretMatches(req, process.env[secretVar])` or an admin with the second factor. Reuse it in your own rule: `run: (a) => jobsRunAccess()(a) \|\| myCheck(a)`. Type `JobsRunAccessOptions`. |
|
||||
| `withJobsRunAccess(config, options \| false)` / `jobsRunNotice(config)` | `@intecion/ipal-kit` | The config with that rule (only when `jobs.access.run` is missing; marks `custom.iapl.jobsRunDefault`); the start-up line when the queue is on and the secret is missing (null otherwise). |
|
||||
| `cronSecretMatches(req, secret)`, `CRON_SECRET_ENV`, `CRON_SECRET_MIN_LENGTH` | `@intecion/ipal-kit` | `Authorization: Bearer <secret>` compared in constant time; an unset or shorter-than-16 secret never matches. Default variable `CRON_SECRET`. |
|
||||
| `runRouteCheck({ config, appDir?, snapshot?, update?, graphql?, cwd?, log? })` | `@intecion/ipal-kit/doctor` | `routes:check`: every public route (REST, GraphQL, Next route files) against the judged snapshot (default `e2e/routes.snapshot.json`); returns 1 on a route nobody judged or an entry without a reason; `update` writes new routes with an empty reason. Template: `iapl-audit/resources/routes.template.ts` (security.md "Routes nobody has judged"). Type `RunRouteCheckOptions`. |
|
||||
| `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). |
|
||||
|
||||
@@ -25,6 +25,46 @@ the MANDATORY SET (GEO: llms-full, Markdown, MCP; R2; Turnstile through
|
||||
`getTurnstileConfig`…). Wire each one according to PROGRAMISTA §2 — it is part of the update,
|
||||
not an extra. Skip one only with a client decision in `AGENTS.md` (`iapl-audit-skip:`).
|
||||
|
||||
**→ 1.18.0, sign-in (CHANGELOG 1.18.0; access.md "A stranger cannot lock a staff account out", "Staff sign-in only
|
||||
from the site's own origin", "Changing one's own e-mail or password asks for the current password") — no schema change,
|
||||
no migration, no import-map change; read before deploying:**
|
||||
1. `IAPL_IP_HEADER` must be pinned in production (`x-forwarded-for` behind Coolify/Traefik): failed staff sign-ins are
|
||||
counted per client IP and address. Without it every visitor shares one bucket (20× the limit).
|
||||
2. A staff collection with its own `auth.maxLoginAttempts` / `lockTime` keeps them; otherwise Payload's lock is now 50
|
||||
failures for an hour (beside 5 per IP and address in 15 minutes). Payload's behaviour back: `accounts: { signInLimit: false }`.
|
||||
3. A panel or front end that signs **staff** in from another domain: `accounts: { signInSameOrigin: { origins: ['https://…'] } }`
|
||||
(or `false`). A proxy that rewrites `Host`: set `serverURL`. Customer / visitor logins are not affected.
|
||||
4. Scripts or integrations that change their OWN e-mail or password over the API send `currentPassword`; editors
|
||||
see "Current password" on their account page. Off: `accounts: { confirmOwnChanges: false }`.
|
||||
**Check:** five wrong passwords for an editor from one address → `429` there, `200` from another; the account page
|
||||
shows "Current password"; `curl -X POST <site>/api/users/login -H 'Origin: https://other.example' …` → `403`.
|
||||
|
||||
**→ 1.17.2, security (CHANGELOG 1.17.2; PROGRAMISTA §6, items 84–87) — nothing required, check:** `readVersions:
|
||||
readPublished()` now works (a wrapper of your own around it: use `readPublishedVersions()` inside); behind a proxy
|
||||
that rewrites `Host` without `X-Forwarded-Host`, set `serverURL` or the panel's mail / cookie buttons answer 403
|
||||
(`iapl-doctor` warns); a locked editor sees "incorrect" until the lock ends (`accounts.lockedAnswer: 'payload'` for
|
||||
Payload's text); saving Cookies with a lower consent version is refused (`cookieSettings.allowLowerPolicyVersion`).
|
||||
**Check:** `curl -s <site>/api/pages/versions` as a visitor → 200 (published only), not 500.
|
||||
|
||||
**→ 1.17.2:** (1) Payload jobs: if the project has tasks or workflows and a cron calls `/api/payload-jobs/run` (or
|
||||
`/handle-schedules`) without its own `jobs.access.run`, set `CRON_SECRET` (16+ characters) in the app's environment
|
||||
and send `Authorization: Bearer <CRON_SECRET>` from the cron; in-process runs (`jobs.autoRun`, `payload jobs:run`)
|
||||
and an admin's API key need nothing (security.md "Payload's job queue"). Verify: the run route answers 401 without
|
||||
the header, 200 with it. (2) A front end that posted to `/api/form-submissions` as a customer account (not through
|
||||
`submitForm`): move it to `submitForm` / `createSubmitAction`, or set `forms.formSubmissionOverrides.access.create`.
|
||||
(3) A site with a visitor login collection: `iapl-doctor --url …` lists `visitor-writes`; give each listed collection
|
||||
and global its own write rule (`adminOrEditor`). (4) If the project has `tests/routes.ts`: `update`, judge, commit.
|
||||
|
||||
**→ 1.17.2, cookie button (CHANGELOG 1.17.2; PROGRAMISTA §6, item 83; consent.md "Where the cookie button sits") — nothing is required:**
|
||||
visitors now see the "cookie settings" button in the bottom corner of the window on every page; it never moves and
|
||||
no longer rides up above the footer. While it is shown the footer is a little taller (about 40 px on the reference
|
||||
site), so its last row ends above the button. Check the end of a page on a phone and on desktop: nothing under the
|
||||
button, the last footer link can be tapped. Bottom padding a project added by hand for the button: remove it (the
|
||||
plugin counts existing padding, so it is not doubled, but it is no longer needed). Amount by hand:
|
||||
`--ipal-cookie-button-space` on the footer (`0` = none); no room: `reserve={false}`. The placement before:
|
||||
`cookieButton={<CookieButton avoid={COOKIE_BUTTON_AVOID} />}` on `SiteProviders`. A project e2e that expects the button
|
||||
above the footer, or an exact footer height after a decision: update it.
|
||||
|
||||
**→ 1.17.1:** (1) `src/proxy.ts`: replace the matcher literal with
|
||||
`['/((?!(?:api|admin|_next)(?:/|$)|.*\\..*).*)']` (i18n.md "Next matcher"; `iapl-doctor` rule `proxy-matcher`).
|
||||
The old one skipped every page whose first segment only starts with `api`, `admin` or `_next` (`/administracja`):
|
||||
@@ -252,7 +292,7 @@ and the browser tab shows the same separator.
|
||||
cookie banner only through `--ipal-*-dark`: check the banner in the dark theme.
|
||||
4. Optional: the block library, block by block (block-library.md); after turning blocks on: `pnpm generate:types`,
|
||||
`pnpm payload generate:importmap`, Postgres/SQLite `migrate:create`.
|
||||
5. **CookieButton** lifts above the footer — check a site with its own fixed footer bar; `avoid={false}` keeps it fixed.
|
||||
5. **CookieButton** lifts above the footer — check a site with its own fixed footer bar; `avoid={false}` keeps it fixed. (Since 1.17.2 it stays in the bottom corner by default; the lift is `avoid={COOKIE_BUTTON_AVOID}`.)
|
||||
6. `pnpm exec iapl-skills` (new **iapl-doctor**; updated iapl-reference, iapl-setup, iapl-site, iapl-audit).
|
||||
7. Run `pnpm exec iapl-doctor` (and `--url https://<site>`), fix or silence each finding with a reason in
|
||||
`iapl-doctor.json`. `IAPL_DOCTOR_TOKEN` (≥ 32 characters) only if the deep check runs against production.
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ Write everything in this file in English.
|
||||
<!-- /starter:decisions -->
|
||||
|
||||
<!-- iapl:start -->
|
||||
## IAPL 1.17.1 — agent guide
|
||||
## IAPL 1.17.2 — agent guide
|
||||
|
||||
<!-- Managed by `pnpm exec iapl-skills` — edits between the markers are overwritten. -->
|
||||
This project is built on `@intecion/ipal-kit` (a Payload CMS 3 plugin). Before you write code:
|
||||
|
||||
@@ -36,7 +36,7 @@ async function signIn(caller: Caller, baseURL: string, playwright: { request: {
|
||||
async function ask(api: APIRequestContext, door: (typeof DOORS)[number]): Promise<DoorAnswer> {
|
||||
const res = door.graphql
|
||||
? await api.post('/api/graphql', { data: { query: door.graphql } })
|
||||
: await api.fetch(door.path!, { data: door.body, maxRedirects: 0, method: door.method ?? 'GET' })
|
||||
: await api.fetch(door.path!, { data: door.body, headers: door.headers, maxRedirects: 0, method: door.method ?? 'GET' })
|
||||
const text = await res.text()
|
||||
let body: unknown = text
|
||||
try {
|
||||
@@ -72,6 +72,16 @@ for (const caller of ['anonymous', 'customer', 'editor'] as const) {
|
||||
})
|
||||
}
|
||||
|
||||
test.describe('closed doors: the cron secret opens the job queue (IAWL idea 35, 1.17.2)', () => {
|
||||
test('Authorization: Bearer <CRON_SECRET> runs the queue; nothing else changes', async ({ baseURL, playwright }) => {
|
||||
test.skip(lateStaff !== '1' || !process.env.CRON_SECRET, 'needs the fixture\'s job queue (E2E_LATE_STAFF=1) and CRON_SECRET (pnpm e2e:built sets both)')
|
||||
const cron = await playwright.request.newContext({ baseURL, extraHTTPHeaders: { authorization: `Bearer ${process.env.CRON_SECRET}` } })
|
||||
const res = await cron.get('/api/payload-jobs/run?limit=1')
|
||||
expect([res.status(), await res.text()]).toEqual([200, expect.any(String)])
|
||||
await cron.dispose()
|
||||
})
|
||||
})
|
||||
|
||||
test.describe('closed doors: the proxy skips /api, /admin and /_next as whole segments only (IAWL idea 36)', () => {
|
||||
test('the admin and the API are not sent to a locale; a page that only starts with those letters is', async ({ request }) => {
|
||||
for (const path of ['/admin', '/api/health']) {
|
||||
|
||||
@@ -24,6 +24,8 @@ export type Door = {
|
||||
closed?: (answer: DoorAnswer, ctx: { email?: string }) => boolean
|
||||
closedFor: Caller[]
|
||||
graphql?: string
|
||||
/** Extra request headers (e.g. a wrong bearer token). */
|
||||
headers?: Record<string, string>
|
||||
method?: 'DELETE' | 'GET' | 'PATCH' | 'POST'
|
||||
name: string
|
||||
/** Open for these callers while the owner decides (the finding's question). */
|
||||
@@ -56,7 +58,11 @@ export const DOORS: Door[] = [
|
||||
{ closedFor: ALL, name: 'the deep doctor status answers 404 without its token', path: '/api/ipal/doctor', closed: notFound },
|
||||
|
||||
// ---- jobs, schedules and call-backs (IAWL idea 35) ---------------------------------------------------------
|
||||
{ closedFor: ALL, name: 'Payload\'s job queue has no run route (no jobs on this site)', path: '/api/payload-jobs/run', closed: notFound },
|
||||
// the fixture's do-nothing task turns the queue on; since 1.17.2 (owner's Q2) only an admin or Bearer CRON_SECRET runs it
|
||||
// (the "with the secret" case is its own test in closed-doors.spec.ts). Payload answers 401 when refused.
|
||||
{ closedFor: ALL, name: 'Payload\'s job queue cannot be run (only an admin or the cron secret)', path: '/api/payload-jobs/run' },
|
||||
{ closedFor: ALL, name: 'Payload\'s job schedules cannot be handled (only an admin or the cron secret)', path: '/api/payload-jobs/handle-schedules' },
|
||||
{ closedFor: ALL, name: 'a wrong cron secret runs nothing', path: '/api/payload-jobs/run', headers: { authorization: 'Bearer not-the-cron-secret-not-the-cron-secret' } },
|
||||
{ closedFor: ALL, method: 'POST', name: 'the crawler\'s call-back without its token', path: '/api/ipal/cookie-crawl/results', body: { jobId: 'x', ok: true } },
|
||||
{ closedFor: OUTSIDERS, method: 'POST', name: 'a crawl cannot be started without the schedule\'s token', path: '/api/ipal/cookie-crawl' },
|
||||
{ closedFor: OUTSIDERS, name: 'the crawl status', path: '/api/ipal/cookie-crawl' },
|
||||
@@ -94,30 +100,21 @@ export const DOORS: Door[] = [
|
||||
// ---- content and visitors' data --------------------------------------------------------------------------
|
||||
{ closedFor: OUTSIDERS, name: 'form submissions (visitors\' personal data)', path: '/api/form-submissions' },
|
||||
{ closedFor: OUTSIDERS, graphql: '{ FormSubmissions { docs { id } } }', closed: noData('FormSubmissions'), name: 'form submissions over GraphQL' },
|
||||
{
|
||||
body: { form: NO_ID, submissionData: [] },
|
||||
closedFor: ['anonymous'],
|
||||
method: 'POST',
|
||||
name: 'a submission cannot be posted past submitForm (rate limit, Turnstile, consent, validation)',
|
||||
openFor: { callers: ['customer'], question: 'Q1 (iawl-ideas-c-findings.md): any signed-in account may POST /api/form-submissions' },
|
||||
path: '/api/form-submissions',
|
||||
closed: forbidden,
|
||||
},
|
||||
// since 1.17.2 (owner's Q1): a staff account with its second factor only — an editor may (it reaches validation)
|
||||
{ body: { form: NO_ID, submissionData: [] }, closedFor: OUTSIDERS, method: 'POST', name: 'a submission cannot be posted past submitForm (rate limit, Turnstile, consent, validation)', path: '/api/form-submissions', closed: forbidden },
|
||||
{ body: {}, closedFor: OUTSIDERS, method: 'POST', name: 'Site settings cannot be saved', path: '/api/globals/site-settings', closed: forbidden },
|
||||
{ body: {}, closedFor: OUTSIDERS, method: 'POST', name: 'Cookie settings (legal texts) cannot be saved', path: '/api/globals/cookie-settings', closed: forbidden },
|
||||
{
|
||||
body: {},
|
||||
closedFor: ['anonymous'],
|
||||
method: 'PATCH',
|
||||
name: 'pages cannot be changed',
|
||||
openFor: { callers: ['customer'], question: 'Q3: collections without their own write rules run on Payload\'s default (any signed-in account)' },
|
||||
path: `/api/pages/${NO_ID}`,
|
||||
closed: forbidden,
|
||||
},
|
||||
// the reference site's content has write rules of its own since 1.17.2 (owner's Q3, answer (b)): editors and admins
|
||||
{ body: {}, closedFor: OUTSIDERS, method: 'PATCH', name: 'pages cannot be changed', path: `/api/pages/${NO_ID}`, closed: forbidden },
|
||||
{ body: {}, closedFor: OUTSIDERS, method: 'PATCH', name: 'media cannot be changed', path: `/api/media/${NO_ID}`, closed: forbidden },
|
||||
{ body: {}, closedFor: OUTSIDERS, method: 'POST', name: 'the header (navigation) cannot be saved', path: '/api/globals/header', closed: forbidden },
|
||||
{ body: {}, closedFor: OUTSIDERS, method: 'POST', name: 'the company data cannot be saved', path: '/api/globals/company', closed: forbidden },
|
||||
{
|
||||
closedFor: ['anonymous'],
|
||||
name: 'who edits what (Payload\'s document locks, with the editor\'s account)',
|
||||
openFor: { callers: ['customer'], question: 'Q3: payload-locked-documents runs on Payload\'s default (any signed-in account)' },
|
||||
// Payload's own collection: the plugin-wide default for it is the owner's Q3 answer (a), recorded for 2.0; the doctor's
|
||||
// `visitor-writes` rule lists it on a site with a visitor login collection
|
||||
openFor: { callers: ['customer'], question: 'Q3 (a), 2.0: payload-locked-documents runs on Payload\'s default (any signed-in account)' },
|
||||
path: '/api/payload-locked-documents',
|
||||
closed: forbidden,
|
||||
},
|
||||
|
||||
@@ -20,6 +20,9 @@ export const e2eEarlyStaff: Plugin = (config: Config) =>
|
||||
E2E_LATE_STAFF
|
||||
? {
|
||||
...config,
|
||||
// one do-nothing task turns Payload's job queue on, so the closed-doors spec can ask its run route
|
||||
// (no `jobs.access.run` here: iapl's default applies — an admin with the second factor, or Bearer CRON_SECRET)
|
||||
jobs: { ...config.jobs, tasks: [...(config.jobs?.tasks ?? []), { slug: 'e2eNoop', handler: () => ({ output: {} }) }] },
|
||||
collections: [
|
||||
...(config.collections ?? []),
|
||||
{ slug: 'e2e-crew', auth: true, fields: [{ name: 'roles', type: 'select', hasMany: true, options: ['user', 'editor', 'admin', 'boss'], saveToJWT: true }] },
|
||||
|
||||
@@ -1,29 +1,29 @@
|
||||
{
|
||||
"$comment": "Every public door of this site: REST routes, GraphQL operations, Next route files. One line per entry: who may use it and why it is open (or that it is closed and to whom). A new route fails `routes:check` until somebody judges it here. `--update` adds new routes with an empty reason and drops gone ones. docs/security.md \"Routes nobody has judged\".",
|
||||
"routes": {
|
||||
"DELETE /api/caseStudies": "delete: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"DELETE /api/caseStudies/:id": "deleteByID: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"DELETE /api/caseStudies": "delete: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"DELETE /api/caseStudies/:id": "deleteByID: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"DELETE /api/consent-records": "delete: nobody over the API (create/update false); delete: admin; visitors write through POST /api/ipal/consent",
|
||||
"DELETE /api/consent-records/:id": "deleteByID: nobody over the API (create/update false); delete: admin; visitors write through POST /api/ipal/consent",
|
||||
"DELETE /api/cookie-review": "delete: create/update: editor+; delete: admin",
|
||||
"DELETE /api/cookie-review/:id": "deleteByID: create/update: editor+; delete: admin",
|
||||
"DELETE /api/form-submissions": "delete: create: any signed-in account (owner Q1); update: Payload default; delete: admin",
|
||||
"DELETE /api/form-submissions/:id": "deleteByID: create: any signed-in account (owner Q1); update: Payload default; delete: admin",
|
||||
"DELETE /api/form-submissions": "delete: create: a staff account with its second factor (1.17.2; the site submits through submitForm); update: nobody (form-builder); delete: admin",
|
||||
"DELETE /api/form-submissions/:id": "deleteByID: create: a staff account with its second factor (1.17.2; the site submits through submitForm); update: nobody (form-builder); delete: admin",
|
||||
"DELETE /api/forms": "delete: editor+ (staffAccess)",
|
||||
"DELETE /api/forms/:id": "deleteByID: editor+ (staffAccess)",
|
||||
"DELETE /api/media": "delete: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"DELETE /api/media/:id": "deleteByID: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"DELETE /api/pages": "delete: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"DELETE /api/pages/:id": "deleteByID: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"DELETE /api/media": "delete: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"DELETE /api/media/:id": "deleteByID: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"DELETE /api/pages": "delete: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"DELETE /api/pages/:id": "deleteByID: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"DELETE /api/payload-kv": "delete: nobody (every rule false)",
|
||||
"DELETE /api/payload-kv/:id": "deleteByID: nobody (every rule false)",
|
||||
"DELETE /api/payload-locked-documents": "delete: Payload default: any signed-in account (owner Q3)",
|
||||
"DELETE /api/payload-locked-documents/:id": "deleteByID: Payload default: any signed-in account (owner Q3)",
|
||||
"DELETE /api/payload-locked-documents": "delete: Payload default: any signed-in account (the plugin-wide default is owner's Q3 (a), 2.0; the doctor's visitor-writes lists it)",
|
||||
"DELETE /api/payload-locked-documents/:id": "deleteByID: Payload default: any signed-in account (the plugin-wide default is owner's Q3 (a), 2.0; the doctor's visitor-writes lists it)",
|
||||
"DELETE /api/payload-preferences": "delete: own preferences only (Payload)",
|
||||
"DELETE /api/payload-preferences/:id": "deleteByID: own preferences only (Payload)",
|
||||
"DELETE /api/payload-preferences/:key": "deleteByID: own preferences only (Payload)",
|
||||
"DELETE /api/posts": "delete: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"DELETE /api/posts/:id": "deleteByID: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"DELETE /api/posts": "delete: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"DELETE /api/posts/:id": "deleteByID: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"DELETE /api/users": "delete: create/delete/unlock: an admin with the second factor; update: admin or self; roles field: admin",
|
||||
"DELETE /api/users/:id": "deleteByID: create/delete/unlock: an admin with the second factor; update: admin or self; roles field: admin",
|
||||
"GET /api/access": "Payload: the signed-in account's permissions (what the panel may show); anonymous gets an empty map",
|
||||
@@ -101,11 +101,11 @@
|
||||
"GET /api/payload-kv/count": "count: nobody (Payload: every rule false; the plugin keeps 2FA counts and the mail-service token here)",
|
||||
"GET /api/payload-kv/versions": "versions: readVersions = read (nobody (Payload: every rule false; the plugin keeps 2FA counts and the mail-service token here)); no version history kept here",
|
||||
"GET /api/payload-kv/versions/:id": "versionByID: readVersions = read (nobody (Payload: every rule false; the plugin keeps 2FA counts and the mail-service token here)); no version history kept here",
|
||||
"GET /api/payload-locked-documents": "find: Payload default: any signed-in account (owner Q3)",
|
||||
"GET /api/payload-locked-documents/:id": "findByID: Payload default: any signed-in account (owner Q3)",
|
||||
"GET /api/payload-locked-documents/count": "count: Payload default: any signed-in account (owner Q3)",
|
||||
"GET /api/payload-locked-documents/versions": "versions: readVersions = read (Payload default: any signed-in account (owner Q3)); no version history kept here",
|
||||
"GET /api/payload-locked-documents/versions/:id": "versionByID: readVersions = read (Payload default: any signed-in account (owner Q3)); no version history kept here",
|
||||
"GET /api/payload-locked-documents": "find: Payload default: any signed-in account (the plugin-wide default is owner's Q3 (a), 2.0; the doctor's visitor-writes lists it)",
|
||||
"GET /api/payload-locked-documents/:id": "findByID: Payload default: any signed-in account (the plugin-wide default is owner's Q3 (a), 2.0; the doctor's visitor-writes lists it)",
|
||||
"GET /api/payload-locked-documents/count": "count: Payload default: any signed-in account (the plugin-wide default is owner's Q3 (a), 2.0; the doctor's visitor-writes lists it)",
|
||||
"GET /api/payload-locked-documents/versions": "versions: readVersions = read (Payload default: any signed-in account (the plugin-wide default is owner's Q3 (a), 2.0; the doctor's visitor-writes lists it)); no version history kept here",
|
||||
"GET /api/payload-locked-documents/versions/:id": "versionByID: readVersions = read (Payload default: any signed-in account (the plugin-wide default is owner's Q3 (a), 2.0; the doctor's visitor-writes lists it)); no version history kept here",
|
||||
"GET /api/payload-preferences": "find: the signed-in account's own preferences only (Payload)",
|
||||
"GET /api/payload-preferences/:id": "findByID: the signed-in account's own preferences only (Payload)",
|
||||
"GET /api/payload-preferences/:key": "findByID: the signed-in account's own preferences only (Payload)",
|
||||
@@ -124,36 +124,36 @@
|
||||
"GET /api/users/me": "Payload: the signed-in account itself, or null; no other account",
|
||||
"GET /api/users/versions": "versions: readVersions = read (an admin, or the account itself (adminOrSelfIn users)); no version history kept here",
|
||||
"GET /api/users/versions/:id": "versionByID: readVersions = read (an admin, or the account itself (adminOrSelfIn users)); no version history kept here",
|
||||
"PATCH /api/caseStudies": "update: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"PATCH /api/caseStudies/:id": "updateByID: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"PATCH /api/caseStudies": "update: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"PATCH /api/caseStudies/:id": "updateByID: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"PATCH /api/consent-records": "update: nobody over the API (create/update false); delete: admin; visitors write through POST /api/ipal/consent",
|
||||
"PATCH /api/consent-records/:id": "updateByID: nobody over the API (create/update false); delete: admin; visitors write through POST /api/ipal/consent",
|
||||
"PATCH /api/cookie-review": "update: create/update: editor+; delete: admin",
|
||||
"PATCH /api/cookie-review/:id": "updateByID: create/update: editor+; delete: admin",
|
||||
"PATCH /api/form-submissions": "update: create: any signed-in account (owner Q1); update: Payload default; delete: admin",
|
||||
"PATCH /api/form-submissions/:id": "updateByID: create: any signed-in account (owner Q1); update: Payload default; delete: admin",
|
||||
"PATCH /api/form-submissions": "update: create: a staff account with its second factor (1.17.2; the site submits through submitForm); update: nobody (form-builder); delete: admin",
|
||||
"PATCH /api/form-submissions/:id": "updateByID: create: a staff account with its second factor (1.17.2; the site submits through submitForm); update: nobody (form-builder); delete: admin",
|
||||
"PATCH /api/forms": "update: editor+ (staffAccess)",
|
||||
"PATCH /api/forms/:id": "updateByID: editor+ (staffAccess)",
|
||||
"PATCH /api/media": "update: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"PATCH /api/media/:id": "updateByID: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"PATCH /api/pages": "update: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"PATCH /api/pages/:id": "updateByID: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"PATCH /api/media": "update: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"PATCH /api/media/:id": "updateByID: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"PATCH /api/pages": "update: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"PATCH /api/pages/:id": "updateByID: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"PATCH /api/payload-kv": "update: nobody (every rule false)",
|
||||
"PATCH /api/payload-kv/:id": "updateByID: nobody (every rule false)",
|
||||
"PATCH /api/payload-locked-documents": "update: Payload default: any signed-in account (owner Q3)",
|
||||
"PATCH /api/payload-locked-documents/:id": "updateByID: Payload default: any signed-in account (owner Q3)",
|
||||
"PATCH /api/payload-locked-documents": "update: Payload default: any signed-in account (the plugin-wide default is owner's Q3 (a), 2.0; the doctor's visitor-writes lists it)",
|
||||
"PATCH /api/payload-locked-documents/:id": "updateByID: Payload default: any signed-in account (the plugin-wide default is owner's Q3 (a), 2.0; the doctor's visitor-writes lists it)",
|
||||
"PATCH /api/payload-preferences": "update: own preferences only (Payload)",
|
||||
"PATCH /api/payload-preferences/:id": "updateByID: own preferences only (Payload)",
|
||||
"PATCH /api/posts": "update: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"PATCH /api/posts/:id": "updateByID: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"PATCH /api/posts": "update: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"PATCH /api/posts/:id": "updateByID: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"PATCH /api/users": "update: create/delete/unlock: an admin with the second factor; update: admin or self; roles field: admin",
|
||||
"PATCH /api/users/:id": "updateByID: create/delete/unlock: an admin with the second factor; update: admin or self; roles field: admin",
|
||||
"POST /api/admin/remove-user-totp": "2FA: an admin removes another account's second factor",
|
||||
"POST /api/admin/reset-user-totp": "2FA: an admin resets another account's second factor",
|
||||
"POST /api/caseStudies": "create: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"POST /api/caseStudies/:id/duplicate": "duplicate: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"POST /api/caseStudies": "create: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"POST /api/caseStudies/:id/duplicate": "duplicate: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"POST /api/caseStudies/access/:id?": "the signed-in account's own permissions on caseStudies",
|
||||
"POST /api/caseStudies/versions/:id": "restore a version: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"POST /api/caseStudies/versions/:id": "restore a version: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"POST /api/consent-records": "create: nobody over the API (create/update false); delete: admin; visitors write through POST /api/ipal/consent",
|
||||
"POST /api/consent-records/:id/duplicate": "duplicate: nobody over the API (create/update false); delete: admin; visitors write through POST /api/ipal/consent",
|
||||
"POST /api/consent-records/access/:id?": "the signed-in account's own permissions on consent-records",
|
||||
@@ -162,29 +162,29 @@
|
||||
"POST /api/cookie-review/:id/duplicate": "duplicate: create/update: editor+; delete: admin",
|
||||
"POST /api/cookie-review/access/:id?": "the signed-in account's own permissions on cookie-review",
|
||||
"POST /api/cookie-review/versions/:id": "restore a version: create/update: editor+; delete: admin",
|
||||
"POST /api/form-submissions": "create: create: any signed-in account (owner Q1); update: Payload default; delete: admin",
|
||||
"POST /api/form-submissions/:id/duplicate": "duplicate: create: any signed-in account (owner Q1); update: Payload default; delete: admin",
|
||||
"POST /api/form-submissions": "create: a staff account with its second factor (1.17.2; the site submits through submitForm); update: nobody (form-builder); delete: admin",
|
||||
"POST /api/form-submissions/:id/duplicate": "duplicate: create: a staff account with its second factor (1.17.2; the site submits through submitForm); update: nobody (form-builder); delete: admin",
|
||||
"POST /api/form-submissions/access/:id?": "the signed-in account's own permissions on form-submissions",
|
||||
"POST /api/form-submissions/versions/:id": "restore a version: create: any signed-in account (owner Q1); update: Payload default; delete: admin",
|
||||
"POST /api/form-submissions/versions/:id": "restore a version: create: a staff account with its second factor (1.17.2; the site submits through submitForm); update: nobody (form-builder); delete: admin",
|
||||
"POST /api/forms": "create: editor+ (staffAccess)",
|
||||
"POST /api/forms/:id/duplicate": "duplicate: editor+ (staffAccess)",
|
||||
"POST /api/forms/access/:id?": "the signed-in account's own permissions on forms",
|
||||
"POST /api/forms/versions/:id": "restore a version: editor+ (staffAccess)",
|
||||
"POST /api/globals/company": "update: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"POST /api/globals/company": "update: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"POST /api/globals/company/access": "the signed-in account's own permissions on globals/company",
|
||||
"POST /api/globals/company/versions/:id": "restore a version: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"POST /api/globals/company/versions/:id": "restore a version: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"POST /api/globals/cookie-crawl": "update: admin; the crawl endpoints write it after their own checks",
|
||||
"POST /api/globals/cookie-crawl/access": "the signed-in account's own permissions on globals/cookie-crawl",
|
||||
"POST /api/globals/cookie-crawl/versions/:id": "restore a version: admin; the crawl endpoints write it after their own checks",
|
||||
"POST /api/globals/cookie-settings": "update: editor+",
|
||||
"POST /api/globals/cookie-settings/access": "the signed-in account's own permissions on globals/cookie-settings",
|
||||
"POST /api/globals/cookie-settings/versions/:id": "restore a version: editor+",
|
||||
"POST /api/globals/footer": "update: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"POST /api/globals/footer": "update: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"POST /api/globals/footer/access": "the signed-in account's own permissions on globals/footer",
|
||||
"POST /api/globals/footer/versions/:id": "restore a version: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"POST /api/globals/header": "update: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"POST /api/globals/footer/versions/:id": "restore a version: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"POST /api/globals/header": "update: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"POST /api/globals/header/access": "the signed-in account's own permissions on globals/header",
|
||||
"POST /api/globals/header/versions/:id": "restore a version: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"POST /api/globals/header/versions/:id": "restore a version: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"POST /api/globals/notifications": "update: editor+",
|
||||
"POST /api/globals/notifications/access": "the signed-in account's own permissions on globals/notifications",
|
||||
"POST /api/globals/notifications/versions/:id": "restore a version: editor+",
|
||||
@@ -205,22 +205,22 @@
|
||||
"POST /api/ipal/forms/submit": "public by design: a form with files; the submitForm pipeline (rate limit, Turnstile, consent, validation, file checks)",
|
||||
"POST /api/ipal/test-email": "send a test e-mail: admin",
|
||||
"POST /api/ipal/two-factor/reset": "reset another account's 2FA set-up window: admin signed in with the second factor",
|
||||
"POST /api/media": "create: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"POST /api/media/:id/duplicate": "duplicate: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"POST /api/media": "create: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"POST /api/media/:id/duplicate": "duplicate: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"POST /api/media/access/:id?": "the signed-in account's own permissions on media",
|
||||
"POST /api/media/versions/:id": "restore a version: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"POST /api/pages": "create: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"POST /api/pages/:id/duplicate": "duplicate: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"POST /api/media/versions/:id": "restore a version: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"POST /api/pages": "create: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"POST /api/pages/:id/duplicate": "duplicate: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"POST /api/pages/access/:id?": "the signed-in account's own permissions on pages",
|
||||
"POST /api/pages/versions/:id": "restore a version: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"POST /api/pages/versions/:id": "restore a version: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"POST /api/payload-kv": "create: nobody (every rule false)",
|
||||
"POST /api/payload-kv/:id/duplicate": "duplicate: nobody (every rule false)",
|
||||
"POST /api/payload-kv/access/:id?": "the signed-in account's own permissions on payload-kv",
|
||||
"POST /api/payload-kv/versions/:id": "restore a version: nobody (every rule false)",
|
||||
"POST /api/payload-locked-documents": "create: Payload default: any signed-in account (owner Q3)",
|
||||
"POST /api/payload-locked-documents/:id/duplicate": "duplicate: Payload default: any signed-in account (owner Q3)",
|
||||
"POST /api/payload-locked-documents": "create: Payload default: any signed-in account (the plugin-wide default is owner's Q3 (a), 2.0; the doctor's visitor-writes lists it)",
|
||||
"POST /api/payload-locked-documents/:id/duplicate": "duplicate: Payload default: any signed-in account (the plugin-wide default is owner's Q3 (a), 2.0; the doctor's visitor-writes lists it)",
|
||||
"POST /api/payload-locked-documents/access/:id?": "the signed-in account's own permissions on payload-locked-documents",
|
||||
"POST /api/payload-locked-documents/versions/:id": "restore a version: Payload default: any signed-in account (owner Q3)",
|
||||
"POST /api/payload-locked-documents/versions/:id": "restore a version: Payload default: any signed-in account (the plugin-wide default is owner's Q3 (a), 2.0; the doctor's visitor-writes lists it)",
|
||||
"POST /api/payload-preferences": "create: own preferences only (Payload)",
|
||||
"POST /api/payload-preferences/:id/duplicate": "duplicate: own preferences only (Payload)",
|
||||
"POST /api/payload-preferences/:key": "updateByID: own preferences only (Payload)",
|
||||
@@ -230,10 +230,10 @@
|
||||
"POST /api/plugin-seo/generate-image": "SEO plugin (panel button): Payload default (signed-in account); nothing stored",
|
||||
"POST /api/plugin-seo/generate-title": "SEO plugin (panel button): Payload default (signed-in account); nothing stored",
|
||||
"POST /api/plugin-seo/generate-url": "SEO plugin (panel button): Payload default (signed-in account); nothing stored",
|
||||
"POST /api/posts": "create: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"POST /api/posts/:id/duplicate": "duplicate: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"POST /api/posts": "create: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"POST /api/posts/:id/duplicate": "duplicate: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"POST /api/posts/access/:id?": "the signed-in account's own permissions on posts",
|
||||
"POST /api/posts/versions/:id": "restore a version: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"POST /api/posts/versions/:id": "restore a version: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"POST /api/remove-totp": "2FA: the signed-in account's own second factor, fully signed in",
|
||||
"POST /api/setup-totp": "2FA: sets up the signed-in account's own authenticator; same-origin only",
|
||||
"POST /api/users": "create: create/delete/unlock: an admin with the second factor; update: admin or self; roles field: admin",
|
||||
@@ -248,64 +248,64 @@
|
||||
"POST /api/users/verify/:id": "public by design: needs the e-mailed verification token (verify is off on users)",
|
||||
"POST /api/users/versions/:id": "restore a version: create/delete/unlock: an admin with the second factor; update: admin or self; roles field: admin",
|
||||
"POST /api/verify-totp": "2FA (payload-2fa): the signed-in account's own code; same-origin only, 5 tries per account in 10 min",
|
||||
"graphql mutation createCaseStudy": "GraphQL create: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"graphql mutation createCaseStudy": "GraphQL create: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"graphql mutation createConsentRecord": "GraphQL create: nobody over the API (create/update false); delete: admin; visitors write through POST /api/ipal/consent",
|
||||
"graphql mutation createCookieReview": "GraphQL create: create/update: editor+; delete: admin",
|
||||
"graphql mutation createForm": "GraphQL create: editor+ (staffAccess)",
|
||||
"graphql mutation createFormSubmission": "GraphQL create: create: any signed-in account (owner Q1); update: Payload default; delete: admin",
|
||||
"graphql mutation createMedia": "GraphQL create: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"graphql mutation createPage": "GraphQL create: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"graphql mutation createFormSubmission": "GraphQL create: a staff account with its second factor (1.17.2; the site submits through submitForm); update: nobody (form-builder); delete: admin",
|
||||
"graphql mutation createMedia": "GraphQL create: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"graphql mutation createPage": "GraphQL create: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"graphql mutation createPayloadKv": "GraphQL create: nobody (every rule false)",
|
||||
"graphql mutation createPayloadLockedDocument": "GraphQL create: Payload default: any signed-in account (owner Q3)",
|
||||
"graphql mutation createPayloadLockedDocument": "GraphQL create: Payload default: any signed-in account (the plugin-wide default is owner's Q3 (a), 2.0; the doctor's visitor-writes lists it)",
|
||||
"graphql mutation createPayloadPreference": "GraphQL create: own preferences only (Payload)",
|
||||
"graphql mutation createPost": "GraphQL create: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"graphql mutation createPost": "GraphQL create: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"graphql mutation createUser": "GraphQL create: create/delete/unlock: an admin with the second factor; update: admin or self; roles field: admin",
|
||||
"graphql mutation deleteCaseStudy": "GraphQL delete: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"graphql mutation deleteCaseStudy": "GraphQL delete: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"graphql mutation deleteConsentRecord": "GraphQL delete: nobody over the API (create/update false); delete: admin; visitors write through POST /api/ipal/consent",
|
||||
"graphql mutation deleteCookieReview": "GraphQL delete: create/update: editor+; delete: admin",
|
||||
"graphql mutation deleteForm": "GraphQL delete: editor+ (staffAccess)",
|
||||
"graphql mutation deleteFormSubmission": "GraphQL delete: create: any signed-in account (owner Q1); update: Payload default; delete: admin",
|
||||
"graphql mutation deleteMedia": "GraphQL delete: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"graphql mutation deletePage": "GraphQL delete: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"graphql mutation deleteFormSubmission": "GraphQL delete: create: a staff account with its second factor (1.17.2; the site submits through submitForm); update: nobody (form-builder); delete: admin",
|
||||
"graphql mutation deleteMedia": "GraphQL delete: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"graphql mutation deletePage": "GraphQL delete: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"graphql mutation deletePayloadKv": "GraphQL delete: nobody (every rule false)",
|
||||
"graphql mutation deletePayloadLockedDocument": "GraphQL delete: Payload default: any signed-in account (owner Q3)",
|
||||
"graphql mutation deletePayloadLockedDocument": "GraphQL delete: Payload default: any signed-in account (the plugin-wide default is owner's Q3 (a), 2.0; the doctor's visitor-writes lists it)",
|
||||
"graphql mutation deletePayloadPreference": "GraphQL delete: own preferences only (Payload)",
|
||||
"graphql mutation deletePost": "GraphQL delete: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"graphql mutation deletePost": "GraphQL delete: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"graphql mutation deleteUser": "GraphQL delete: create/delete/unlock: an admin with the second factor; update: admin or self; roles field: admin",
|
||||
"graphql mutation duplicateCaseStudy": "GraphQL duplicate: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"graphql mutation duplicateCaseStudy": "GraphQL duplicate: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"graphql mutation duplicateConsentRecord": "GraphQL duplicate: nobody over the API (create/update false); delete: admin; visitors write through POST /api/ipal/consent",
|
||||
"graphql mutation duplicateCookieReview": "GraphQL duplicate: create/update: editor+; delete: admin",
|
||||
"graphql mutation duplicateForm": "GraphQL duplicate: editor+ (staffAccess)",
|
||||
"graphql mutation duplicateFormSubmission": "GraphQL duplicate: create: any signed-in account (owner Q1); update: Payload default; delete: admin",
|
||||
"graphql mutation duplicateMedia": "GraphQL duplicate: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"graphql mutation duplicatePage": "GraphQL duplicate: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"graphql mutation duplicateFormSubmission": "GraphQL duplicate: create: a staff account with its second factor (1.17.2; the site submits through submitForm); update: nobody (form-builder); delete: admin",
|
||||
"graphql mutation duplicateMedia": "GraphQL duplicate: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"graphql mutation duplicatePage": "GraphQL duplicate: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"graphql mutation duplicatePayloadKv": "GraphQL duplicate: nobody (every rule false)",
|
||||
"graphql mutation duplicatePayloadLockedDocument": "GraphQL duplicate: Payload default: any signed-in account (owner Q3)",
|
||||
"graphql mutation duplicatePayloadLockedDocument": "GraphQL duplicate: Payload default: any signed-in account (the plugin-wide default is owner's Q3 (a), 2.0; the doctor's visitor-writes lists it)",
|
||||
"graphql mutation duplicatePayloadPreference": "GraphQL duplicate: own preferences only (Payload)",
|
||||
"graphql mutation duplicatePost": "GraphQL duplicate: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"graphql mutation duplicatePost": "GraphQL duplicate: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"graphql mutation forgotPasswordUser": "public by design: the same answer for a real and an invented address",
|
||||
"graphql mutation loginUser": "public by design: sign-in (as POST /api/users/login)",
|
||||
"graphql mutation logoutUser": "public by design: ends the caller's own session",
|
||||
"graphql mutation refreshTokenUser": "the signed-in account's own token only",
|
||||
"graphql mutation resetPasswordUser": "public by design: needs the e-mailed reset token",
|
||||
"graphql mutation unlockUser": "admin with the second factor (accounts.adminOnlyWrite)",
|
||||
"graphql mutation updateCaseStudy": "GraphQL update: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"graphql mutation updateCompany": "GraphQL update: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"graphql mutation updateCaseStudy": "GraphQL update: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"graphql mutation updateCompany": "GraphQL update: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"graphql mutation updateConsentRecord": "GraphQL update: nobody over the API (create/update false); delete: admin; visitors write through POST /api/ipal/consent",
|
||||
"graphql mutation updateCookieCrawl": "GraphQL update: admin; the crawl endpoints write it after their own checks",
|
||||
"graphql mutation updateCookieReview": "GraphQL update: create/update: editor+; delete: admin",
|
||||
"graphql mutation updateCookieSetting": "GraphQL update: editor+",
|
||||
"graphql mutation updateFooter": "GraphQL update: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"graphql mutation updateFooter": "GraphQL update: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"graphql mutation updateForm": "GraphQL update: editor+ (staffAccess)",
|
||||
"graphql mutation updateFormSubmission": "GraphQL update: create: any signed-in account (owner Q1); update: Payload default; delete: admin",
|
||||
"graphql mutation updateHeader": "GraphQL update: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"graphql mutation updateMedia": "GraphQL update: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"graphql mutation updateFormSubmission": "GraphQL update: create: a staff account with its second factor (1.17.2; the site submits through submitForm); update: nobody (form-builder); delete: admin",
|
||||
"graphql mutation updateHeader": "GraphQL update: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"graphql mutation updateMedia": "GraphQL update: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"graphql mutation updateNotification": "GraphQL update: editor+",
|
||||
"graphql mutation updatePage": "GraphQL update: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"graphql mutation updatePage": "GraphQL update: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"graphql mutation updatePayloadKv": "GraphQL update: nobody (every rule false)",
|
||||
"graphql mutation updatePayloadLockedDocument": "GraphQL update: Payload default: any signed-in account (owner Q3)",
|
||||
"graphql mutation updatePayloadLockedDocument": "GraphQL update: Payload default: any signed-in account (the plugin-wide default is owner's Q3 (a), 2.0; the doctor's visitor-writes lists it)",
|
||||
"graphql mutation updatePayloadPreference": "GraphQL update: own preferences only (Payload)",
|
||||
"graphql mutation updatePost": "GraphQL update: Payload default (any signed-in account; one login collection here, so staff only — a visitor collection would reach it: owner Q3)",
|
||||
"graphql mutation updatePost": "GraphQL update: editor+ (adminOrEditor, the site's own rule since 1.17.2; Payload's default would let any signed-in account in)",
|
||||
"graphql mutation updateSiteIntegration": "GraphQL update: admin; secrets write-only",
|
||||
"graphql mutation updateSiteSetting": "GraphQL update: editor+",
|
||||
"graphql mutation updateUser": "GraphQL update: create/delete/unlock: an admin with the second factor; update: admin or self; roles field: admin",
|
||||
@@ -332,8 +332,8 @@
|
||||
"graphql query Pages": "GraphQL find: anyone (published content, no drafts)",
|
||||
"graphql query PayloadKv": "GraphQL find: nobody (Payload: every rule false; the plugin keeps 2FA counts and the mail-service token here)",
|
||||
"graphql query PayloadKvs": "GraphQL find: nobody (Payload: every rule false; the plugin keeps 2FA counts and the mail-service token here)",
|
||||
"graphql query PayloadLockedDocument": "GraphQL find: Payload default: any signed-in account (owner Q3)",
|
||||
"graphql query PayloadLockedDocuments": "GraphQL find: Payload default: any signed-in account (owner Q3)",
|
||||
"graphql query PayloadLockedDocument": "GraphQL find: Payload default: any signed-in account (the plugin-wide default is owner's Q3 (a), 2.0; the doctor's visitor-writes lists it)",
|
||||
"graphql query PayloadLockedDocuments": "GraphQL find: Payload default: any signed-in account (the plugin-wide default is owner's Q3 (a), 2.0; the doctor's visitor-writes lists it)",
|
||||
"graphql query PayloadPreference": "GraphQL find: the signed-in account's own preferences only (Payload)",
|
||||
"graphql query PayloadPreferences": "GraphQL find: the signed-in account's own preferences only (Payload)",
|
||||
"graphql query Post": "GraphQL find: anyone (published content, no drafts)",
|
||||
@@ -350,7 +350,7 @@
|
||||
"graphql query countForms": "GraphQL count: anyone (the form renders from it; the Emails tab is staff-only by field access)",
|
||||
"graphql query countPages": "GraphQL count: anyone (published content, no drafts)",
|
||||
"graphql query countPayloadKvs": "GraphQL count: nobody (Payload: every rule false; the plugin keeps 2FA counts and the mail-service token here)",
|
||||
"graphql query countPayloadLockedDocuments": "GraphQL count: Payload default: any signed-in account (owner Q3)",
|
||||
"graphql query countPayloadLockedDocuments": "GraphQL count: Payload default: any signed-in account (the plugin-wide default is owner's Q3 (a), 2.0; the doctor's visitor-writes lists it)",
|
||||
"graphql query countPayloadPreferences": "GraphQL count: the signed-in account's own preferences only (Payload)",
|
||||
"graphql query countPosts": "GraphQL count: anyone (published content, no drafts)",
|
||||
"graphql query countUsers": "GraphQL count: an admin, or the account itself (adminOrSelfIn users)",
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
import { type APIRequestContext, expect, test } from '@playwright/test'
|
||||
import { randomUUID } from 'node:crypto'
|
||||
|
||||
import { totp } from './totp'
|
||||
|
||||
/**
|
||||
* On the BUILT site (pnpm e2e:built, webpack and Turbopack), what 1.17.2 changed at the sign-in and in the panel:
|
||||
* - a locked staff account answers its login exactly like a wrong password (accounts.lockedAnswer) — the hook
|
||||
* recognises Payload's error by the name Payload gives it, which a minified bundle must keep;
|
||||
* - the plugin's panel actions refuse a request from another origin (adminSameOrigin), the site's own still works.
|
||||
* Needs the E2E_* test admin (e2e/create-test-admin.ts). The locked account is a fresh one made here, so the test
|
||||
* admins are never locked.
|
||||
*/
|
||||
const { E2E_ADMIN_EMAIL: adminEmail, E2E_ADMIN_PASSWORD: password, E2E_TOTP_SECRET: secret } = process.env
|
||||
|
||||
let admin: APIRequestContext
|
||||
|
||||
test.beforeAll(async ({ baseURL, playwright }) => {
|
||||
test.skip(!adminEmail || !password || !secret, 'E2E_ADMIN_* values are not set')
|
||||
admin = await playwright.request.newContext({ baseURL, extraHTTPHeaders: { origin: baseURL! } })
|
||||
expect((await admin.post('/api/users/login', { data: { email: adminEmail, password } })).status()).toBe(200)
|
||||
expect((await (await admin.post('/api/verify-totp', { data: { token: totp(secret!) } })).json()).ok).toBe(true)
|
||||
})
|
||||
test.afterAll(async () => {
|
||||
await admin?.dispose()
|
||||
})
|
||||
|
||||
test('a locked staff account gets the wrong-password answer, REST and GraphQL', async ({ baseURL, playwright }) => {
|
||||
const email = `locked-${randomUUID().slice(0, 8)}@example.com`
|
||||
const own = `L-${randomUUID()}`
|
||||
expect((await admin.post('/api/users', { data: { email, password: own, roles: ['editor'] } })).status()).toBe(201)
|
||||
const anon = await playwright.request.newContext({ baseURL })
|
||||
// the site reads the client address from IAPL_IP_HEADER (reference/.env: x-forwarded-for, one proxy)
|
||||
const login = async (address: string, pass: string, ip = '203.0.113.150') => {
|
||||
const res = await anon.post('/api/users/login', { data: { email: address, password: pass }, headers: { 'x-forwarded-for': ip } })
|
||||
return { body: await res.text(), status: res.status() }
|
||||
}
|
||||
// 1.18.0 (accounts.signInLimit): one IP fails at most 5 times per address and Payload locks a staff account at 50
|
||||
// failures — a spray from 50 IPs, one failure each, locks it
|
||||
for (let i = 0; i < 50; i++) {await login(email, 'a-wrong-password-1', `198.51.100.${i + 1}`)}
|
||||
const invented = await login(`nobody-${randomUUID().slice(0, 8)}@example.com`, 'a-wrong-password-1')
|
||||
expect(invented.status).toBe(401)
|
||||
expect(await login(email, own)).toEqual(invented)
|
||||
const gql = async (address: string, pass: string) => {
|
||||
const res = await anon.post('/api/graphql', { data: { query: `mutation { loginUser(email: ${JSON.stringify(address)}, password: ${JSON.stringify(pass)}) { token } }` } })
|
||||
const error = ((await res.json()) as { errors?: { extensions?: { name?: string }; message: string }[] }).errors?.[0]
|
||||
return { message: error?.message, name: error?.extensions?.name }
|
||||
}
|
||||
expect(await gql(email, own)).toEqual(await gql(`nobody-${randomUUID().slice(0, 8)}@example.com`, 'x-wrong-password-1'))
|
||||
await anon.dispose()
|
||||
})
|
||||
|
||||
test('panel actions: another origin gets 403 with the admin cookie, the site itself goes through', async ({ baseURL }) => {
|
||||
const foreign = await admin.fetch('/api/ipal/cookie-approval', {
|
||||
data: '{"ids":[]}',
|
||||
headers: { 'content-type': 'text/plain', origin: 'https://blog.example.test', 'sec-fetch-site': 'same-site' },
|
||||
method: 'POST',
|
||||
})
|
||||
expect(foreign.status()).toBe(403)
|
||||
const own = await admin.fetch('/api/ipal/cookie-approval', { data: '{"ids":[]}', headers: { 'content-type': 'text/plain', origin: baseURL! }, method: 'POST' })
|
||||
expect(own.status()).toBe(200)
|
||||
})
|
||||
@@ -493,6 +493,134 @@ test('consent: withdrawal — reopen, reject: analytics cookies and listed stora
|
||||
expect((await consentRecord(context))!.state).toMatchObject({ analytics: false, functional: false, marketing: false })
|
||||
})
|
||||
|
||||
// The "cookie settings" button stays in the bottom corner of the window (1.17.2) and never moves: not above the
|
||||
// footer, not at the end of the page. The footer gets room under its last row while the button is shown, so the
|
||||
// button covers nothing there (consent.md → "Where the cookie button sits").
|
||||
const BUTTON_PAGES = ['/pl', '/pl/kontakt', '/en', '/pl/blog', '/pl/regulamin']
|
||||
const buttonState = () => {
|
||||
const b = document.querySelector<HTMLElement>('[data-ipal="cookie-button"]')
|
||||
const footer = [...document.querySelectorAll<HTMLElement>('footer, [role="contentinfo"]')].at(-1)!
|
||||
if (!b) {return { button: false, room: footer.hasAttribute('data-ipal-cookie-space') }}
|
||||
const r = b.getBoundingClientRect()
|
||||
const hits = (q: DOMRect) => q.width > 0 && q.height > 0 && q.right > r.left && q.left < r.right && q.bottom > r.top && q.top < r.bottom
|
||||
// every piece of footer text and every control of the page that lies under the button
|
||||
const under: string[] = []
|
||||
const walker = document.createTreeWalker(footer, NodeFilter.SHOW_TEXT)
|
||||
const range = document.createRange()
|
||||
for (let node = walker.nextNode(); node; node = walker.nextNode()) {
|
||||
if (!/\S/.test(node.nodeValue ?? '')) {continue}
|
||||
range.selectNodeContents(node)
|
||||
if ([...range.getClientRects()].some(hits)) {under.push(`text: ${node.nodeValue!.trim().slice(0, 24)}`)}
|
||||
}
|
||||
for (const el of document.querySelectorAll('a[href], button, input, select, textarea, summary')) {
|
||||
if (el !== b && hits(el.getBoundingClientRect())) {under.push(`control: ${(el.textContent ?? '').trim().slice(0, 24)}`)}
|
||||
}
|
||||
return {
|
||||
button: true,
|
||||
gap: Math.round(window.innerHeight - r.bottom),
|
||||
inFooter: !!b.closest('footer'),
|
||||
left: Math.round(r.left),
|
||||
position: getComputedStyle(b).position,
|
||||
room: footer.hasAttribute('data-ipal-cookie-space'),
|
||||
transform: getComputedStyle(b).transform,
|
||||
under,
|
||||
}
|
||||
}
|
||||
const CORNER = { button: true, gap: 16, inFooter: false, left: 16, position: 'fixed', transform: 'none' }
|
||||
|
||||
for (const device of [
|
||||
{ name: 'desktop', viewport: { height: 800, width: 1280 } },
|
||||
{ name: 'phone', viewport: { height: 844, width: 390 } },
|
||||
{ name: 'small phone', viewport: { height: 640, width: 360 } },
|
||||
]) {
|
||||
for (const colorScheme of ['light', 'dark'] as const) {
|
||||
test(`cookie button, ${device.name}, ${colorScheme}: the corner at every scroll position, nothing under it at the end, no layout shift`, async ({ browser }) => {
|
||||
const context = await browser.newContext({ colorScheme, hasTouch: device.name !== 'desktop', viewport: device.viewport })
|
||||
const page = await context.newPage()
|
||||
await page.addInitScript(() => {
|
||||
const w = window as unknown as { __cls: number }
|
||||
w.__cls = 0
|
||||
new PerformanceObserver((list) => {
|
||||
for (const entry of list.getEntries() as unknown as { hadRecentInput: boolean; value: number }[]) {
|
||||
if (!entry.hadRecentInput) {w.__cls += entry.value}
|
||||
}
|
||||
}).observe({ buffered: true, type: 'layout-shift' })
|
||||
})
|
||||
const shifts = () => page.evaluate(() => (window as unknown as { __cls: number }).__cls)
|
||||
const footerPadding = () => page.evaluate(() => getComputedStyle([...document.querySelectorAll('footer')].at(-1)!).paddingBottom)
|
||||
|
||||
// before a decision: no button, the footer as the project made it
|
||||
await page.goto('/pl')
|
||||
await expect(page.locator('[data-ipal="banner"]')).toBeVisible()
|
||||
expect(await page.evaluate(buttonState)).toEqual({ button: false, room: false })
|
||||
const ownPadding = await footerPadding()
|
||||
await page.locator('[data-ipal="reject"]').click()
|
||||
const button = page.locator('[data-ipal="cookie-button"]')
|
||||
|
||||
for (const path of BUTTON_PAGES) {
|
||||
// a returning visitor's page load: the room is there from the first paint, so nothing shifts when the button appears
|
||||
await page.goto(path)
|
||||
await expect(button).toBeVisible()
|
||||
await page.waitForTimeout(400)
|
||||
const height = await page.evaluate(() => document.documentElement.scrollHeight)
|
||||
const end = Math.max(0, height - device.viewport.height)
|
||||
for (const y of [0, end / 2, end - 40, end]) {
|
||||
await page.evaluate((to) => window.scrollTo(0, to), y)
|
||||
await page.waitForTimeout(250)
|
||||
expect(await page.evaluate(buttonState), `${path} at ${Math.round(y)} of ${end}`).toMatchObject(CORNER)
|
||||
}
|
||||
// the very end of the page (measured now: a form or its Turnstile widget may have grown the page since)
|
||||
await page.evaluate(() => window.scrollTo(0, document.documentElement.scrollHeight))
|
||||
await page.waitForTimeout(250)
|
||||
expect(await page.evaluate(() => Math.round(window.innerHeight + window.scrollY - document.documentElement.scrollHeight)), `${path}: at the end`).toBe(0)
|
||||
expect(await page.evaluate(buttonState), `${path} at the very end`).toMatchObject(CORNER)
|
||||
// no footer text and no control under the button
|
||||
expect((await page.evaluate(buttonState)).under, `${path}: under the button at the end`).toEqual([])
|
||||
// and every footer link can be clicked (Playwright refuses a click another element would receive)
|
||||
const links = page.locator('footer a[href]')
|
||||
const count = await links.count()
|
||||
expect(count).toBeGreaterThan(3)
|
||||
for (let i = 0; i < count; i++) {await links.nth(i).click({ timeout: 3000, trial: true })}
|
||||
expect(await shifts(), `${path}: layout shift from load to the end of the page`).toBeLessThan(0.001)
|
||||
}
|
||||
|
||||
// keyboard: reachable and it reopens the banner; the room goes with the button
|
||||
await button.focus()
|
||||
await expect(button).toBeFocused()
|
||||
await page.keyboard.press('Enter')
|
||||
await expect(page.locator('[data-ipal="banner"]')).toBeVisible()
|
||||
expect(await page.evaluate(buttonState)).toEqual({ button: false, room: false })
|
||||
await page.goto('/pl') // decided again? no: reopening does not undo the stored decision, the button is back
|
||||
await expect(button).toBeVisible()
|
||||
await page.locator('[data-ipal="cookie-button"]').click()
|
||||
expect(await footerPadding(), 'banner open: the footer as before a decision').toBe(ownPadding)
|
||||
await context.close()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
test('cookie button: for a returning visitor the room is there before the page hydrates (no application script)', async ({ browser }) => {
|
||||
const context = await browser.newContext({ hasTouch: true, viewport: { height: 844, width: 390 } })
|
||||
const page = await context.newPage()
|
||||
const padding = () => page.evaluate(() => parseFloat(getComputedStyle([...document.querySelectorAll('footer')].at(-1)!).paddingBottom))
|
||||
await page.goto('/pl')
|
||||
const own = await padding()
|
||||
await page.locator('[data-ipal="reject"]').click()
|
||||
await expect(page.locator('[data-ipal="cookie-button"]')).toBeVisible()
|
||||
const live = await padding()
|
||||
expect(live).toBeGreaterThan(own)
|
||||
// the same page with every application script refused: only the inline script can have made the room
|
||||
await page.route(isAppScript, (route) => route.abort())
|
||||
await page.goto('/pl')
|
||||
await expect(page.locator('[data-ipal="cookie-button"]')).toHaveCount(0)
|
||||
// the same room, to the pixel or one off: here the web font may not have arrived yet, and the row's text box follows the font
|
||||
expect(Math.abs((await padding()) - live)).toBeLessThanOrEqual(2)
|
||||
expect(await padding()).toBeGreaterThan(own + 30)
|
||||
// the server's markup is untouched (React hydrates it without a mismatch): the room is in a style sheet
|
||||
expect(await page.evaluate(() => [...document.querySelectorAll('footer')].at(-1)!.getAttribute('style'))).toBeNull()
|
||||
await context.close()
|
||||
})
|
||||
|
||||
test('admin: sign in through 2FA, agency credit, panel link preview', async ({ page, request }) => {
|
||||
const head = await (await request.get('/admin/login')).text()
|
||||
expect(head).toMatch(/noindex/)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { CollectionConfig } from 'payload'
|
||||
|
||||
import { buildRevalidateHook } from '@intecion/ipal-kit'
|
||||
import { adminOrEditor, buildRevalidateHook } from '@intecion/ipal-kit'
|
||||
import { revalidatePath } from 'next/cache'
|
||||
|
||||
import { i18nConfig } from '@/i18n.config'
|
||||
@@ -13,7 +13,8 @@ const revalidate = buildRevalidateHook({ config: i18nConfig, revalidatePath })
|
||||
export const CaseStudies: CollectionConfig = {
|
||||
slug: 'caseStudies',
|
||||
admin: { defaultColumns: ['title', 'publishedAt', 'updatedAt'], useAsTitle: 'title' },
|
||||
access: { read: () => true },
|
||||
// write rules of its own: Payload's default is "any signed-in account" — a visitor login collection would reach it (security.md "Visitor accounts")
|
||||
access: { create: adminOrEditor, delete: adminOrEditor, read: () => true, update: adminOrEditor },
|
||||
defaultSort: '-publishedAt',
|
||||
fields: entryFields,
|
||||
hooks: { afterChange: [revalidate.afterChange], afterDelete: [revalidate.afterDelete] },
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { CollectionConfig } from 'payload'
|
||||
|
||||
import {
|
||||
adminOrEditor,
|
||||
buildMediaPlaceholderField,
|
||||
buildMediaPlaceholderHook,
|
||||
buildOptimizeUploadField,
|
||||
@@ -11,7 +12,8 @@ import {
|
||||
/** media.md "Full collection", 1:1. */
|
||||
export const Media: CollectionConfig = {
|
||||
slug: 'media',
|
||||
access: { read: () => true }, // public files; media are served by the app (/api/media/file/…)
|
||||
// write rules of its own: Payload's default is "any signed-in account" — a visitor login collection would reach it (security.md "Visitor accounts")
|
||||
access: { create: adminOrEditor, delete: adminOrEditor, read: () => true, update: adminOrEditor }, // public files; media are served by the app (/api/media/file/…)
|
||||
upload: { focalPoint: true, mimeTypes: ['image/*', 'application/pdf', 'video/mp4', 'video/webm'] },
|
||||
hooks: {
|
||||
beforeOperation: [normalizeFilenameHook, buildOptimizeUploadHook(), buildMediaPlaceholderHook()],
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { CollectionConfig } from 'payload'
|
||||
|
||||
import {
|
||||
adminOrEditor,
|
||||
buildNoindexField,
|
||||
buildPreventDeleteSystemPage,
|
||||
buildRevalidateHook,
|
||||
@@ -19,7 +20,8 @@ const revalidate = buildRevalidateHook({ config: i18nConfig, revalidatePath })
|
||||
export const Pages: CollectionConfig = {
|
||||
slug: 'pages',
|
||||
admin: { defaultColumns: ['title', 'slug', 'updatedAt'], useAsTitle: 'title' },
|
||||
access: { read: () => true },
|
||||
// write rules of its own: Payload's default is "any signed-in account" — a visitor login collection would reach it (security.md "Visitor accounts")
|
||||
access: { create: adminOrEditor, delete: adminOrEditor, read: () => true, update: adminOrEditor },
|
||||
fields: [
|
||||
{ name: 'title', type: 'text', localized: true, required: true },
|
||||
buildSlugField({ from: 'title' }),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { CollectionConfig } from 'payload'
|
||||
|
||||
import { buildRevalidateHook } from '@intecion/ipal-kit'
|
||||
import { adminOrEditor, buildRevalidateHook } from '@intecion/ipal-kit'
|
||||
import { revalidatePath } from 'next/cache'
|
||||
|
||||
import { i18nConfig } from '@/i18n.config'
|
||||
@@ -13,7 +13,8 @@ const revalidate = buildRevalidateHook({ config: i18nConfig, revalidatePath })
|
||||
export const Posts: CollectionConfig = {
|
||||
slug: 'posts',
|
||||
admin: { defaultColumns: ['title', 'publishedAt', 'updatedAt'], useAsTitle: 'title' },
|
||||
access: { read: () => true },
|
||||
// write rules of its own: Payload's default is "any signed-in account" — a visitor login collection would reach it (security.md "Visitor accounts")
|
||||
access: { create: adminOrEditor, delete: adminOrEditor, read: () => true, update: adminOrEditor },
|
||||
defaultSort: '-publishedAt',
|
||||
fields: entryFields,
|
||||
hooks: { afterChange: [revalidate.afterChange], afterDelete: [revalidate.afterDelete] },
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import type { GlobalConfig } from 'payload'
|
||||
|
||||
import { buildGlobalRevalidateHook, rowLabel } from '@intecion/ipal-kit'
|
||||
import { adminOrEditor, buildGlobalRevalidateHook, rowLabel } from '@intecion/ipal-kit'
|
||||
import { revalidatePath } from 'next/cache'
|
||||
|
||||
/** Company data for a PL market site: footer, contact block details, LocalBusiness JSON-LD. */
|
||||
export const Company: GlobalConfig = {
|
||||
slug: 'company',
|
||||
access: { read: () => true },
|
||||
// write rules of its own: Payload's default is "any signed-in account" — a visitor login collection would reach it (security.md "Visitor accounts")
|
||||
access: { read: () => true, update: adminOrEditor },
|
||||
fields: [
|
||||
{ name: 'name', type: 'text', required: true },
|
||||
{ name: 'legalName', type: 'text' },
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import type { GlobalConfig } from 'payload'
|
||||
|
||||
import { buildGlobalRevalidateHook, buildLinkField, rowLabel } from '@intecion/ipal-kit'
|
||||
import { adminOrEditor, buildGlobalRevalidateHook, buildLinkField, rowLabel } from '@intecion/ipal-kit'
|
||||
import { revalidatePath } from 'next/cache'
|
||||
|
||||
/** iapl-nav: link columns and a note. Legal links come from System pages (getSystemLinks), not from here. */
|
||||
export const Footer: GlobalConfig = {
|
||||
slug: 'footer',
|
||||
access: { read: () => true },
|
||||
// write rules of its own: Payload's default is "any signed-in account" — a visitor login collection would reach it (security.md "Visitor accounts")
|
||||
access: { read: () => true, update: adminOrEditor },
|
||||
fields: [
|
||||
{
|
||||
name: 'columns',
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import type { GlobalConfig } from 'payload'
|
||||
|
||||
import { buildGlobalRevalidateHook, buildLinkField, buildLinksField, rowLabel } from '@intecion/ipal-kit'
|
||||
import { adminOrEditor, buildGlobalRevalidateHook, buildLinkField, buildLinksField, rowLabel } from '@intecion/ipal-kit'
|
||||
import { revalidatePath } from 'next/cache'
|
||||
|
||||
/** iapl-nav: menu with one submenu level, a CTA button, the mobile menu label. Logo comes from Site settings. */
|
||||
export const Header: GlobalConfig = {
|
||||
slug: 'header',
|
||||
access: { read: () => true },
|
||||
// write rules of its own: Payload's default is "any signed-in account" — a visitor login collection would reach it (security.md "Visitor accounts")
|
||||
access: { read: () => true, update: adminOrEditor },
|
||||
fields: [
|
||||
{
|
||||
name: 'navItems',
|
||||
|
||||
Reference in New Issue
Block a user