diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 3be3afe..8ac9d01 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -141,6 +141,12 @@ This heading and the 1.17.2 section below (never released on its own) become one > 7. **New doctor findings the first time** (the suites below): `iapl-doctor --only security` reads the project's own > code and configs. Judge each; a correct place gets `// iapl-security-ok: `. > +> 8. **The minimum safe Next.js is 16.4.6** (was 16.4.5): a site on 16.4.5 now gets a `next-min` error from +> `iapl-doctor`. Fix: `pnpm add next@16.4.6 eslint-config-next@16.4.6`, `rm -rf .next`, build, redeploy. 16.4.6 is +> the version the plugin, the reference site and the starter are tested with, and its React copy carries the fix for +> React's RSC advisory GHSA-xqc2-xf4c-x3h3 (checked in the code, AGENT.md §4 item 11). Silence with a reason in +> `iapl-doctor.json` → `rules.next-min` if an upgrade must wait. +> > **Recommended for projects:** a text field of your own whose value goes into `href` (social profiles, a website) > becomes `buildUrlField()` and its render goes through `safeHref()` (F2) — no schema change, it stays a text column. > The reference site and every new site from `iapl create` do it for Company → Profiles (also in the `sameAs` of the @@ -168,9 +174,10 @@ This heading and the 1.17.2 section below (never released on its own) become one > `refuseOperatorSort`, `lockedDocuments`; `createProxy({ markdown: { prefix, negotiate } })`; > `createCspReportRoute({ maxReports, rateLimit })`; `markdownResponse(md, { negotiated })`. > -> **Watch (no change in this release):** React's RSC advisory GHSA-xqc2-xf4c-x3h3 is fixed in React 19.3.1; whether -> Next 16.4.6 carries the fix is not confirmed by any Next release note or advisory. The minimum safe Next version in -> AGENT.md §4 is raised when Next publishes one that names it. +> **GHSA-xqc2-xf4c-x3h3 (React RSC, critical) and Next:** Next 16.4.6 vendors a React copy labelled +> `19.3.0-canary-278794d7-20261002`; its code carries the fix (React commit 0c9913ae: the new backing-store reads, +> the `"S"` stream key and error 612 "Cannot transport a detached buffer"). No watch remains; AGENT.md §4 item 11 says +> how to check after a Next upgrade. ## 1.17.2 — version history with readPublished, sign-in and panel actions, staff-only REST submissions and jobs, the cookie button diff --git a/docs/agent/AGENT.md b/docs/agent/AGENT.md index f4be6f2..be442f8 100644 --- a/docs/agent/AGENT.md +++ b/docs/agent/AGENT.md @@ -553,19 +553,24 @@ No abbreviations (`HeroSection`, not `HeroSec`). Do not create `lib/pages.ts`, 9. **RSC by default.** `'use client'` only for state/interaction, in a separate file; the section stays a server component and passes data to it. Secrets: `import 'server-only'`. 10. **Blocks do not import `lib/*`** (cycle). Server-side data → `enhanceProps`. -11. **Next.js 16.4.5 or later** (minimum safe version; the plugin, the reference site and the starter use 16.4.6). +11. **Next.js 16.4.6 or later** (minimum safe version since 1.18.0; the plugin, the reference site and the starter use 16.4.6). 16.0.0–16.4.0 have unauthenticated RCE and DoS advisories (GHSA-2464-fhr4-w9xw, GHSA-673q-mjm6-r5xr, GHSA-p3m5-59mp-jv5r); 16.3.0–16.4.4 have GHSA-mfr8-8qww-v76h (information disclosure across root params when a - `'use cache'` function is called through `unstable_cache()`, moderate; fixed in 16.4.5). Payload supports no - patched 15.x line. Pin `next` and `eslint-config-next` to the same 16.4.x (≥ 16.4.5): + `'use cache'` function is called through `unstable_cache()`, moderate; fixed in 16.4.5). 16.4.6 is the tested + version; its React copy carries the fix for React's RSC advisory GHSA-xqc2-xf4c-x3h3 (critical, fixed in + `react-server-dom-*` 19.3.1). Payload supports no patched 15.x line. Pin `next` and `eslint-config-next` to the + same 16.4.x (≥ 16.4.6): `pnpm add next@16.4.6 eslint-config-next@16.4.6`, and make sure `sharp` resolves to 0.35.5 or later (`pnpm why sharp`). The plugin's peer range stays open (`next >=15`) — the minimum is yours to keep. - **Check:** `pnpm ls next sharp` → next ≥ 16.4.5, sharp ≥ 0.35.5; `pnpm exec iapl-doctor` → no `next-min` + **Check:** `pnpm ls next sharp` → next ≥ 16.4.6, sharp ≥ 0.35.5; `pnpm exec iapl-doctor` → no `next-min` finding; `pnpm dev` prints no security-upgrade warning. - **Watch (security audit 2026-12, O1):** React's RSC advisory GHSA-xqc2-xf4c-x3h3 (critical) is fixed in - `react-server-dom-*` 19.3.1; Next vendors its own React copy, and no Next release note or advisory says yet whether - 16.4.6 carries the fix. When Next publishes one that names it, move to the version it names and raise this - minimum; until then `deps-audit` does not flag `next` for it. + **GHSA-xqc2-xf4c-x3h3 in Next (security audit 2026-12, O1, settled):** Next vendors its own React copy + (`next/dist/compiled/react-server-dom-{webpack,turbopack}`), labelled `19.3.0-canary-278794d7-20261002`. That + label is older than the fix, but the code carries it: compared with React's fix commit 0c9913ae (#37846), the + vendored server has the new backing-store reads (`getBackingBlob`), stream chunks under their own `"S"` key, and + the fix's new error 612 ("Cannot transport a detached buffer"), and none of the old helpers. `pnpm audit` does not + flag `next` for it (the advisory names `react-server-dom-*`, not `next`). After a Next upgrade, check the same way: + `grep -c "detached buffer" node_modules/next/dist/compiled/react-server-dom-webpack/cjs/*server.node.production.js` → 1. 12. **No open production advisories.** Node.js 20 or later for the plugin itself (its `nodemailer` 10 requires it); **Payload 3.94 needs Node.js 22.23.5 or later** on the 22 line (`engines`: `">=22.23.5 <23"`, `.nvmrc` `22`), locally, in CI and in Coolify (Nixpacks takes the major from `engines` / `.nvmrc` and the patch from its own release: check diff --git a/docs/agent/skills/iapl-setup/SKILL.md b/docs/agent/skills/iapl-setup/SKILL.md index 4583bad..7affb3e 100644 --- a/docs/agent/skills/iapl-setup/SKILL.md +++ b/docs/agent/skills/iapl-setup/SKILL.md @@ -94,8 +94,8 @@ legacy-peer-deps=true pnpm add @intecion/ipal-kit @payloadcms/plugin-seo @payloadcms/plugin-form-builder \ @payloadcms/storage-s3 @clocklimited/payload-2fa@3.0.0-beta.7 tailwindcss @tailwindcss/postcss ``` -**Next.js 16.4.5 or later** (minimum safe version: 16.0.0–16.4.0 have critical advisories, 16.3.0–16.4.4 have -GHSA-mfr8-8qww-v76h — AGENT.md §4 item 11): `pnpm add next@16.4.6 eslint-config-next@16.4.6 sharp@^0.35.5` when +**Next.js 16.4.6 or later** (minimum safe version: 16.0.0–16.4.0 have critical advisories, 16.3.0–16.4.4 have +GHSA-mfr8-8qww-v76h; 16.4.6 is the tested version — AGENT.md §4 item 11): `pnpm add next@16.4.6 eslint-config-next@16.4.6 sharp@^0.35.5` when create-payload-app gave you an older one. **Payload 3.94.1** (what the reference site and the starter use; the plugin accepts `^3.90.2`): every `payload` / `@payloadcms/*` on the same exact version, `react` and `react-dom` 19.3.1 (Payload 3.94 requires `^19.3.1`), and @@ -111,7 +111,7 @@ plugin-seo, plugin-form-builder, storage-s3) in `pnpm.overrides` **to the exact `"build": "cross-env NODE_OPTIONS=\"--max-old-space-size=3072\" next build --webpack"`. **Check.** `ls node_modules/@intecion/ipal-kit/docs/agent/AGENT.md` exists; -`pnpm ls payload @payloadcms/ui @payloadcms/plugin-seo` — one, identical version; `pnpm ls next sharp` → next ≥ 16.4.5, +`pnpm ls payload @payloadcms/ui @payloadcms/plugin-seo` — one, identical version; `pnpm ls next sharp` → next ≥ 16.4.6, sharp ≥ 0.35.5; `ls src/middleware.ts` → not found. 404 on `pnpm add` = missing `@intecion:registry` line; 401 = stale `_authToken` in `~/.npmrc` (PROGRAMISTA §1). diff --git a/docs/agent/skills/iapl-upgrade/SKILL.md b/docs/agent/skills/iapl-upgrade/SKILL.md index 21ecdec..679630b 100644 --- a/docs/agent/skills/iapl-upgrade/SKILL.md +++ b/docs/agent/skills/iapl-upgrade/SKILL.md @@ -169,7 +169,7 @@ the banner → `` and remove the copy. With `d `buildGlobalRevalidateHook({ revalidatePath })`; `consentFieldName` passed only because the option was ignored → `forms.consentFieldName` works now; your own seed guard / upsert code → `@intecion/ipal-kit/seed` (`createSeeder`). -**Every upgrade — Next.js 16.4.5 or later** (AGENT.md §4 item 11): `pnpm ls next sharp`; below 16.4.5 → +**Every upgrade — Next.js 16.4.6 or later** (AGENT.md §4 item 11): `pnpm ls next sharp`; below 16.4.6 → `pnpm add next@16.4.6 eslint-config-next@16.4.6 sharp@^0.35.5`, `rm -rf .next`, build, redeploy on Coolify (a new image ships the fixed next and sharp). **Check:** `pnpm exec iapl-doctor` → no `next-min` finding; `pnpm dev` prints no security-upgrade warning. @@ -210,7 +210,7 @@ panel opens and a document saves. `engines`. Remove `nodemailer` and `@types/nodemailer` from the project's own `package.json` if someone added them (the plugin's copy is the one `mailAdapter` uses). **Check:** Site integrations → E-mail sending → send a test e-mail over SMTP (and over Microsoft Graph when the project uses it). -3. **Next.js** — the "Every upgrade — Next.js" step above (today 16.4.5 or later, `sharp@^0.35.5`). +3. **Next.js** — the "Every upgrade — Next.js" step above (today 16.4.6 or later, `sharp@^0.35.5`). 4. **Dependency advisories** — the "Every upgrade — dependency advisories" step above (`dompurify` / `graphql-scalars` / `undici` overrides on payload 3.90.x). **Check:** `pnpm audit --prod` → no high or critical. 5. **Cookie list kept by hand** → offer `cookieScanner: true` (+ `crawl: true` with `IAPL_COOKIE_SCAN_URL`, diff --git a/docs/doctor.md b/docs/doctor.md index 501fead..09a7f5a 100644 --- a/docs/doctor.md +++ b/docs/doctor.md @@ -92,7 +92,7 @@ Turn off: `iapl({ doctor: false })`. Adapt: `iapl({ doctor: { tokenVar: 'MY_TOKE |---|---|---|---| | versions | `plugin-installed` | error | `node_modules` has `@intecion/ipal-kit` and it satisfies `package.json` | | | `plugin-latest` | warning; error two or more minors behind | the installed plugin is the newest on the team registry (registry) | -| | `next-min` | error | `next` ≥ 16.4.5 (below 16.4.1: RCE/DoS advisories; 16.3.0–16.4.4: GHSA-mfr8-8qww-v76h); `eslint-config-next` on the same minor (warning) | +| | `next-min` | error | `next` ≥ 16.4.6 (below 16.4.1: RCE/DoS advisories; 16.3.0–16.4.4: GHSA-mfr8-8qww-v76h; 16.4.5: below the minimum since 1.18.0 — 16.4.6 is the tested version and its React copy carries the GHSA-xqc2-xf4c-x3h3 fix); `eslint-config-next` on the same minor (warning) | | | `sharp-min` | error | `sharp` ≥ 0.35.5 | | | `transitive-min` | error (`mongoose`), warning (`happy-dom`) | packages Payload pins below a security fix, in any depth of the tree (read from `pnpm-lock.yaml`, else `node_modules/.pnpm`): `mongoose` 8.x ≥ 8.24.7 (GHSA-pcrw-h46h-c93h and four more; Payload 3.90–3.93 pin 8.24.1, 3.94.0+ ship 8.24.7 — the fix it prints names the Payload upgrade first), `happy-dom` ≥ 21.0.4 (GHSA-c8p4-j97h-3vg8, GHSA-834v-8h66-3h79). The fix it prints is the `pnpm.overrides` line from AGENT.md §4 item 12 | | | `node-22` | warning | `engines.node` only 22 (`">=22 <23"`), `.nvmrc` / `.node-version` = 22; with `--deep`, the running Node | diff --git a/reference/.agents/skills/iapl-setup/SKILL.md b/reference/.agents/skills/iapl-setup/SKILL.md index 4583bad..7affb3e 100644 --- a/reference/.agents/skills/iapl-setup/SKILL.md +++ b/reference/.agents/skills/iapl-setup/SKILL.md @@ -94,8 +94,8 @@ legacy-peer-deps=true pnpm add @intecion/ipal-kit @payloadcms/plugin-seo @payloadcms/plugin-form-builder \ @payloadcms/storage-s3 @clocklimited/payload-2fa@3.0.0-beta.7 tailwindcss @tailwindcss/postcss ``` -**Next.js 16.4.5 or later** (minimum safe version: 16.0.0–16.4.0 have critical advisories, 16.3.0–16.4.4 have -GHSA-mfr8-8qww-v76h — AGENT.md §4 item 11): `pnpm add next@16.4.6 eslint-config-next@16.4.6 sharp@^0.35.5` when +**Next.js 16.4.6 or later** (minimum safe version: 16.0.0–16.4.0 have critical advisories, 16.3.0–16.4.4 have +GHSA-mfr8-8qww-v76h; 16.4.6 is the tested version — AGENT.md §4 item 11): `pnpm add next@16.4.6 eslint-config-next@16.4.6 sharp@^0.35.5` when create-payload-app gave you an older one. **Payload 3.94.1** (what the reference site and the starter use; the plugin accepts `^3.90.2`): every `payload` / `@payloadcms/*` on the same exact version, `react` and `react-dom` 19.3.1 (Payload 3.94 requires `^19.3.1`), and @@ -111,7 +111,7 @@ plugin-seo, plugin-form-builder, storage-s3) in `pnpm.overrides` **to the exact `"build": "cross-env NODE_OPTIONS=\"--max-old-space-size=3072\" next build --webpack"`. **Check.** `ls node_modules/@intecion/ipal-kit/docs/agent/AGENT.md` exists; -`pnpm ls payload @payloadcms/ui @payloadcms/plugin-seo` — one, identical version; `pnpm ls next sharp` → next ≥ 16.4.5, +`pnpm ls payload @payloadcms/ui @payloadcms/plugin-seo` — one, identical version; `pnpm ls next sharp` → next ≥ 16.4.6, sharp ≥ 0.35.5; `ls src/middleware.ts` → not found. 404 on `pnpm add` = missing `@intecion:registry` line; 401 = stale `_authToken` in `~/.npmrc` (PROGRAMISTA §1). diff --git a/reference/.agents/skills/iapl-upgrade/SKILL.md b/reference/.agents/skills/iapl-upgrade/SKILL.md index 21ecdec..679630b 100644 --- a/reference/.agents/skills/iapl-upgrade/SKILL.md +++ b/reference/.agents/skills/iapl-upgrade/SKILL.md @@ -169,7 +169,7 @@ the banner → `` and remove the copy. With `d `buildGlobalRevalidateHook({ revalidatePath })`; `consentFieldName` passed only because the option was ignored → `forms.consentFieldName` works now; your own seed guard / upsert code → `@intecion/ipal-kit/seed` (`createSeeder`). -**Every upgrade — Next.js 16.4.5 or later** (AGENT.md §4 item 11): `pnpm ls next sharp`; below 16.4.5 → +**Every upgrade — Next.js 16.4.6 or later** (AGENT.md §4 item 11): `pnpm ls next sharp`; below 16.4.6 → `pnpm add next@16.4.6 eslint-config-next@16.4.6 sharp@^0.35.5`, `rm -rf .next`, build, redeploy on Coolify (a new image ships the fixed next and sharp). **Check:** `pnpm exec iapl-doctor` → no `next-min` finding; `pnpm dev` prints no security-upgrade warning. @@ -210,7 +210,7 @@ panel opens and a document saves. `engines`. Remove `nodemailer` and `@types/nodemailer` from the project's own `package.json` if someone added them (the plugin's copy is the one `mailAdapter` uses). **Check:** Site integrations → E-mail sending → send a test e-mail over SMTP (and over Microsoft Graph when the project uses it). -3. **Next.js** — the "Every upgrade — Next.js" step above (today 16.4.5 or later, `sharp@^0.35.5`). +3. **Next.js** — the "Every upgrade — Next.js" step above (today 16.4.6 or later, `sharp@^0.35.5`). 4. **Dependency advisories** — the "Every upgrade — dependency advisories" step above (`dompurify` / `graphql-scalars` / `undici` overrides on payload 3.90.x). **Check:** `pnpm audit --prod` → no high or critical. 5. **Cookie list kept by hand** → offer `cookieScanner: true` (+ `crawl: true` with `IAPL_COOKIE_SCAN_URL`, diff --git a/src/modules/doctor/rules/versions.ts b/src/modules/doctor/rules/versions.ts index 5506805..487a798 100644 --- a/src/modules/doctor/rules/versions.ts +++ b/src/modules/doctor/rules/versions.ts @@ -3,8 +3,11 @@ import type { DoctorRule, RuleFinding } from '../types.js' import { compareVersions, isSemverSpec, lt, parseVersion, run } from '../util.js' const PKG = '@intecion/ipal-kit' -/** Lowest Next.js without a known advisory: 16.4.5 fixes GHSA-mfr8-8qww-v76h (16.3.0–16.4.4). */ -export const NEXT_MIN_SAFE = '16.4.5' +/** + * The minimum the team keeps (1.18.0): 16.4.6, the version the plugin, the reference site and the starter are tested + * with; its React copy carries the GHSA-xqc2-xf4c-x3h3 fix. 16.4.5 fixed GHSA-mfr8-8qww-v76h (16.3.0–16.4.4). + */ +export const NEXT_MIN_SAFE = '16.4.6' /** The version the plugin, the reference site and the starter use. */ export const NEXT_RECOMMENDED = '16.4.6' @@ -57,7 +60,9 @@ export const versionRules: DoctorRule[] = [ if (lt(next, NEXT_MIN_SAFE)) { const why = lt(next, '16.4.1') ? 'RCE and DoS advisories, and GHSA-mfr8-8qww-v76h' - : 'GHSA-mfr8-8qww-v76h: information disclosure across root params in \'use cache\'' + : lt(next, '16.4.5') + ? 'GHSA-mfr8-8qww-v76h: information disclosure across root params in \'use cache\'' + : `below the minimum the team keeps; ${NEXT_MIN_SAFE} is the tested version, its React copy carries the GHSA-xqc2-xf4c-x3h3 fix` out.push({ fix: `pnpm add next@${NEXT_RECOMMENDED} eslint-config-next@${NEXT_RECOMMENDED}`, message: `next ${next} < ${NEXT_MIN_SAFE} (${why})`, severity: 'error' }) } const eslint = ctx.installed('eslint-config-next') diff --git a/test/doctor.test.ts b/test/doctor.test.ts index db78942..ca9c265 100644 --- a/test/doctor.test.ts +++ b/test/doctor.test.ts @@ -326,7 +326,7 @@ describe('versions', () => { 'pnpm-pinned:info', ]) }) - test('next-min: 16.4.1–16.4.4 is an error (GHSA-mfr8-8qww-v76h), 16.4.5 passes, and the rule can be silenced', async () => { + test('next-min: 16.4.1–16.4.4 is an error (GHSA-mfr8-8qww-v76h), 16.4.5 too (minimum 16.4.6 since 1.18.0), 16.4.6 passes, and the rule can be silenced', async () => { const at = (version: string) => project({ ...base(), ...installed('next', version), ...installed('eslint-config-next', version) }) const old = await doctor(at('16.4.3'), ['next-min']) expect(rules(old)).toEqual(['next-min:error']) @@ -334,7 +334,10 @@ describe('versions', () => { expect(old.findings[0].fix).toBe('pnpm add next@16.4.6 eslint-config-next@16.4.6') expect(rules(await doctor(at('16.4.4'), ['next-min']))).toEqual(['next-min:error']) expect((await doctor(at('16.4.0'), ['next-min'])).findings[0].message).toContain('RCE and DoS') - expect(rules(await doctor(at('16.4.5'), ['next-min']))).toEqual([]) + const five = await doctor(at('16.4.5'), ['next-min']) + expect(rules(five)).toEqual(['next-min:error']) + expect(five.findings[0].message).toContain('GHSA-xqc2-xf4c-x3h3') + expect(rules(await doctor(at('16.4.6'), ['next-min']))).toEqual([]) expect(rules(await doctor(at('16.5.0'), ['next-min']))).toEqual([]) const silenced = await doctor(at('16.4.3'), ['next-min'], { config: { rules: { 'next-min': { off: true, reason: 'upgrade booked' } } } }) expect(silenced.summary).toMatchObject({ error: 0, silenced: 1 })