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:
Radosław Smoliński
2026-12-01 12:57:52 +01:00
co-authored by Claude Opus 5.5
113 changed files with 3468 additions and 317 deletions
+21 -57
View File
@@ -2,7 +2,7 @@
<!-- Generated by scripts/reference-index.mjs from reference/ — do not edit by hand (pnpm reference:index). -->
The reference site is one complete client site on IAPL 1.17.1 ("Example Studio", made up) that uses
The reference site is one complete client site on IAPL 1.17.2 ("Example Studio", made up) that uses
every convention in AGENT.md. It lives in the plugin repo (`reference/`, not in the npm package). Copy the
PATTERN of the file you need; change only the project's content. Files up to
40 lines are below in full; open the rest in the repo at the tag of your plugin version:
@@ -279,7 +279,7 @@ Rules: AGENT.md §5, iapl-nav, iapl-collection.
| `src/collections/Pages.ts` | Pages: slug, blocks layout, AI summary, noindex, slug history, revalidation, system-page delete guard (below) |
| `src/collections/Posts.ts` | the blog collection (archive in System pages) (below) |
| `src/collections/entryFields.ts` | shared fields of archive collections (names the entry card reads) (below) |
| `src/globals/Company.ts` | company data (PL market): footer, contact details, LocalBusiness JSON-LD (below) |
| `src/globals/Company.ts` | company data (PL market): footer, contact details, LocalBusiness JSON-LD |
| `src/globals/Footer.ts` | footer navigation global (below) |
| `src/globals/Header.ts` | header navigation global (below) |
@@ -288,7 +288,7 @@ Rules: AGENT.md §5, iapl-nav, iapl-collection.
```ts
import type { CollectionConfig } from 'payload'
import { buildRevalidateHook } from '@intecion/ipal-kit'
import { adminOrEditor, buildRevalidateHook } from '@intecion/ipal-kit'
import { revalidatePath } from 'next/cache'
import { i18nConfig } from '@/i18n.config'
@@ -301,7 +301,8 @@ const revalidate = buildRevalidateHook({ config: i18nConfig, revalidatePath })
export const CaseStudies: CollectionConfig = {
slug: 'caseStudies',
admin: { defaultColumns: ['title', 'publishedAt', 'updatedAt'], useAsTitle: 'title' },
access: { read: () => true },
// write rules of its own: Payload's default is "any signed-in account" — a visitor login collection would reach it (security.md "Visitor accounts")
access: { create: adminOrEditor, delete: adminOrEditor, read: () => true, update: adminOrEditor },
defaultSort: '-publishedAt',
fields: entryFields,
hooks: { afterChange: [revalidate.afterChange], afterDelete: [revalidate.afterDelete] },
@@ -315,6 +316,7 @@ export const CaseStudies: CollectionConfig = {
import type { CollectionConfig } from 'payload'
import {
adminOrEditor,
buildMediaPlaceholderField,
buildMediaPlaceholderHook,
buildOptimizeUploadField,
@@ -325,7 +327,8 @@ import {
/** media.md "Full collection", 1:1. */
export const Media: CollectionConfig = {
slug: 'media',
access: { read: () => true }, // public files; media are served by the app (/api/media/file/…)
// write rules of its own: Payload's default is "any signed-in account" — a visitor login collection would reach it (security.md "Visitor accounts")
access: { create: adminOrEditor, delete: adminOrEditor, read: () => true, update: adminOrEditor }, // public files; media are served by the app (/api/media/file/…)
upload: { focalPoint: true, mimeTypes: ['image/*', 'application/pdf', 'video/mp4', 'video/webm'] },
hooks: {
beforeOperation: [normalizeFilenameHook, buildOptimizeUploadHook(), buildMediaPlaceholderHook()],
@@ -344,6 +347,7 @@ export const Media: CollectionConfig = {
import type { CollectionConfig } from 'payload'
import {
adminOrEditor,
buildNoindexField,
buildPreventDeleteSystemPage,
buildRevalidateHook,
@@ -362,7 +366,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' }),
@@ -385,7 +390,7 @@ export const Pages: CollectionConfig = {
```ts
import type { CollectionConfig } from 'payload'
import { buildRevalidateHook } from '@intecion/ipal-kit'
import { adminOrEditor, buildRevalidateHook } from '@intecion/ipal-kit'
import { revalidatePath } from 'next/cache'
import { i18nConfig } from '@/i18n.config'
@@ -398,7 +403,8 @@ const revalidate = buildRevalidateHook({ config: i18nConfig, revalidatePath })
export const Posts: CollectionConfig = {
slug: 'posts',
admin: { defaultColumns: ['title', 'publishedAt', 'updatedAt'], useAsTitle: 'title' },
access: { read: () => true },
// write rules of its own: Payload's default is "any signed-in account" — a visitor login collection would reach it (security.md "Visitor accounts")
access: { create: adminOrEditor, delete: adminOrEditor, read: () => true, update: adminOrEditor },
defaultSort: '-publishedAt',
fields: entryFields,
hooks: { afterChange: [revalidate.afterChange], afterDelete: [revalidate.afterDelete] },
@@ -431,63 +437,19 @@ export const entryFields: Field[] = [
]
```
### `src/globals/Company.ts`
```ts
import type { GlobalConfig } from 'payload'
import { buildGlobalRevalidateHook, rowLabel } from '@intecion/ipal-kit'
import { revalidatePath } from 'next/cache'
/** Company data for a PL market site: footer, contact block details, LocalBusiness JSON-LD. */
export const Company: GlobalConfig = {
slug: 'company',
access: { read: () => true },
fields: [
{ name: 'name', type: 'text', required: true },
{ name: 'legalName', type: 'text' },
{ name: 'taxId', type: 'text', label: 'NIP' },
{ name: 'taxIdLabel', type: 'text', admin: { description: 'Shown before the tax ID in the footer.' }, defaultValue: 'NIP', label: 'Tax ID label', localized: true },
{
name: 'address',
type: 'group',
fields: [
{ name: 'street', type: 'text' },
{ name: 'postalCode', type: 'text' },
{ name: 'city', type: 'text' },
{ name: 'country', type: 'text', defaultValue: 'PL' },
],
},
{ name: 'phone', type: 'text' },
{ name: 'email', type: 'email' },
{ name: 'hours', type: 'text', localized: true, admin: { description: 'Shown next to the contact form, e.g. "Mon–Fri 9:00–17:00".' } },
{
name: 'socials',
type: 'array',
admin: { components: rowLabel('label', 'Profile'), initCollapsed: true },
labels: { plural: 'Profiles', singular: 'Profile' },
fields: [
{ name: 'label', type: 'text', required: true },
{ name: 'url', type: 'text', required: true },
],
},
],
hooks: { afterChange: [buildGlobalRevalidateHook({ revalidatePath })] },
}
```
### `src/globals/Footer.ts`
```ts
import type { GlobalConfig } from 'payload'
import { buildGlobalRevalidateHook, buildLinkField, rowLabel } from '@intecion/ipal-kit'
import { adminOrEditor, buildGlobalRevalidateHook, buildLinkField, rowLabel } from '@intecion/ipal-kit'
import { revalidatePath } from 'next/cache'
/** iapl-nav: link columns and a note. Legal links come from System pages (getSystemLinks), not from here. */
export const Footer: GlobalConfig = {
slug: 'footer',
access: { read: () => true },
// write rules of its own: Payload's default is "any signed-in account" — a visitor login collection would reach it (security.md "Visitor accounts")
access: { read: () => true, update: adminOrEditor },
fields: [
{
name: 'columns',
@@ -517,13 +479,14 @@ export const Footer: GlobalConfig = {
```ts
import type { GlobalConfig } from 'payload'
import { buildGlobalRevalidateHook, buildLinkField, buildLinksField, rowLabel } from '@intecion/ipal-kit'
import { adminOrEditor, buildGlobalRevalidateHook, buildLinkField, buildLinksField, rowLabel } from '@intecion/ipal-kit'
import { revalidatePath } from 'next/cache'
/** iapl-nav: menu with one submenu level, a CTA button, the mobile menu label. Logo comes from Site settings. */
export const Header: GlobalConfig = {
slug: 'header',
access: { read: () => true },
// write rules of its own: Payload's default is "any signed-in account" — a visitor login collection would reach it (security.md "Visitor accounts")
access: { read: () => true, update: adminOrEditor },
fields: [
{
name: 'navItems',
@@ -1176,6 +1139,7 @@ Rules: AGENT.md §8a.
| `e2e/own-account.spec.ts` | built-site test (pnpm e2e:built, 1.18.0): the account page asks for the current password before a new e-mail is saved (accounts.confirmOwnChanges); five failed staff sign-ins from one place answer 429 there, not elsewhere (accounts.signInLimit); a staff sign-in from another origin gets 403 (accounts.signInSameOrigin) |
| `e2e/routes.snapshot.json` | every public route of the site (REST, GraphQL, Next route files) with one line saying who may use it and why — the judged list `routes:check` compares with |
| `e2e/routes.ts` | `routes:check`: the site's public routes against e2e/routes.snapshot.json (`pnpm payload run e2e/routes.ts [update]`; from the repository `pnpm routes:check`) (below) |
| `e2e/sign-in-answers.spec.ts` | built-site test (pnpm e2e:built, 1.17.2): a locked staff account gets the wrong-password answer over REST and GraphQL (accounts.lockedAnswer); the plugin's panel actions refuse another origin and take the site's own (adminSameOrigin) |
| `e2e/sign-in-look.spec.ts` | browser test of the sign-in look (whiteLabel.signIn): the panel comes with the form, sits above it on a phone in both themes, is on forgot / reset / logout too, the language links work, the 2FA code screen keeps its boxes (now named) |
| `e2e/smoke.spec.ts` | the smoke tests every release must pass: pages, showcase, forms (also a file sent by e-mail), sitemap, SEO/GEO, headers, consent, 2FA |
| `e2e/smtp-sink.ts` | a local mail sink for the smoke tests: reads what the site really sent (recipients, attachments) |