Merge claude/inspiring-goldstine-66f9c2: mongoose and happy-dom overrides, doctor rule transitive-min
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -98,8 +98,9 @@ pnpm add @payloadcms/[email protected] # only with R2 media
|
||||
|
||||
Keep every `@payloadcms/*` at exactly the same version as `payload`
|
||||
(`pnpm.overrides` — see PROGRAMISTA.md §1). Then run `pnpm audit --prod`: with
|
||||
`payload` 3.90.x, Payload's own tree pins a vulnerable `undici`, `dompurify` and
|
||||
`graphql-scalars` (the last one even in the latest Payload) — add the three overrides from [AGENT.md §4 item 12](./docs/agent/AGENT.md) (recommended, not
|
||||
`payload` 3.90.x, Payload's own tree pins a vulnerable `undici`, `dompurify`,
|
||||
`graphql-scalars`, `mongoose` (MongoDB adapter) and `happy-dom` (the last three even in the latest Payload) — add the
|
||||
five overrides from [AGENT.md §4 item 12](./docs/agent/AGENT.md) (recommended, not
|
||||
required by the plugin). Upload optimization and image
|
||||
placeholders also use the `sharp` you pass to `buildConfig({ sharp })`
|
||||
(standard in a `create-payload-app` project).
|
||||
|
||||
@@ -8,6 +8,39 @@ versions at once, go through every "Requires project changes" section in order,
|
||||
version you have. A new release = a new section at the top; we remove the oldest ones only
|
||||
once there are more than 20.
|
||||
|
||||
## Unreleased
|
||||
|
||||
### Security
|
||||
- **`mongoose` and `happy-dom` overrides for Payload's own dependencies.** `@payloadcms/db-mongodb` pins `mongoose`
|
||||
8.24.1 exactly (still so in Payload 3.93.0). 8.x below 8.24.7 has five advisories published 2026-11-10:
|
||||
[GHSA-pcrw-h46h-c93h](https://github.com/advisories/GHSA-pcrw-h46h-c93h) (critical, `sanitizeFilter` not applied on
|
||||
`countDocuments`; fixed in 8.24.3), [GHSA-gg4r-jv3p-qx3c](https://github.com/advisories/GHSA-gg4r-jv3p-qx3c) and
|
||||
[GHSA-8332-j7wj-wjw4](https://github.com/advisories/GHSA-8332-j7wj-wjw4) (high),
|
||||
[GHSA-wr5m-5jph-8m96](https://github.com/advisories/GHSA-wr5m-5jph-8m96) and
|
||||
[GHSA-6972-9mcm-vhwj](https://github.com/advisories/GHSA-6972-9mcm-vhwj) (moderate) — all fixed in 8.24.7.
|
||||
`@payloadcms/richtext-lexical` → `@lexical/headless` 0.50 brings `happy-dom` 20.x, which has
|
||||
[GHSA-c8p4-j97h-3vg8](https://github.com/advisories/GHSA-c8p4-j97h-3vg8) (high, fixed in 21.0.0) and
|
||||
[GHSA-834v-8h66-3h79](https://github.com/advisories/GHSA-834v-8h66-3h79) (high, fixed in 21.0.4). The plugin has no
|
||||
part in either; only the project's lockfile can lift them. The reference site and the project starter now carry
|
||||
`"mongoose@>=8 <8.24.7": "~8.24.10"` and `"happy-dom@<21.0.4": "^21.0.4"` in `pnpm.overrides`; with them
|
||||
`pnpm audit --prod` on the reference site reports no known vulnerabilities, and its seed, production build, smoke
|
||||
tests and doctor pass. The plugin forces neither override on a project.
|
||||
|
||||
### Added
|
||||
- **ipal-doctor `transitive-min`** (group `versions`): reports a `mongoose` 8.x below 8.24.7 (error) and a `happy-dom`
|
||||
below 21.0.4 (warning) anywhere in the dependency tree, read from `pnpm-lock.yaml`, and prints the exact
|
||||
`pnpm.overrides` line. Silence it in `ipal-doctor.json` like any rule
|
||||
(`"transitive-min": { "off": true, "reason": "…" }`). `DoctorContext.installedAll(name)` is the building block for
|
||||
your own rules on transitive packages.
|
||||
|
||||
### Changed
|
||||
- AGENT.md §4 item 12, the `ipal-setup` and `ipal-upgrade` skills, doctor.md and the README list five overrides.
|
||||
|
||||
### What projects must update
|
||||
- **Every MongoDB site:** add the two lines to `pnpm.overrides` in `package.json`, `pnpm install`, `pnpm build`, commit
|
||||
`package.json` and the lockfile, redeploy on Coolify. No data change, no migration. `pnpm audit --prod` → no high or
|
||||
critical; `pnpm exec ipal-doctor` → no `transitive-min` finding. `pnpm ipal:skills` for the updated skills.
|
||||
|
||||
## 1.16.1
|
||||
|
||||
### Security
|
||||
|
||||
+16
-2
@@ -516,13 +516,25 @@ No abbreviations (`HeroSection`, not `HeroSec`). Do not create `lib/pages.ts`,
|
||||
finding; `pnpm dev` prints no security-upgrade warning.
|
||||
12. **No open production advisories.** Node.js 20 or later (the plugin's `nodemailer` 10 requires it). Run
|
||||
`pnpm audit --prod`. The plugin's own dependencies are clean; what remains comes from Payload's tree, which only
|
||||
the project's lockfile can fix. With `payload` 3.90.x three packages are pinned exactly and need `pnpm.overrides`
|
||||
the project's lockfile can fix. With `payload` 3.90.x five packages are pinned below a fix and need `pnpm.overrides`
|
||||
next to the `@payloadcms/*` ones:
|
||||
```json
|
||||
"dompurify@<3.4.17": "^3.4.17",
|
||||
"graphql-scalars@<2.0.1": "^2.0.1",
|
||||
"happy-dom@<21.0.4": "^21.0.4",
|
||||
"mongoose@>=8 <8.24.7": "~8.24.10",
|
||||
"undici@>=7 <7.30.1": "^7.30.1"
|
||||
```
|
||||
`mongoose` (MongoDB sites — every site that uses `@payloadcms/db-mongodb`): the adapter pins 8.24.1 exactly, up
|
||||
to the latest Payload (3.93.0). 8.x below 8.24.7 has five advisories: GHSA-pcrw-h46h-c93h (critical,
|
||||
`sanitizeFilter` not applied on `countDocuments`, fixed in 8.24.3), GHSA-gg4r-jv3p-qx3c and GHSA-8332-j7wj-wjw4
|
||||
(high), GHSA-wr5m-5jph-8m96 and GHSA-6972-9mcm-vhwj (moderate), all fixed in 8.24.7. The override stays on the
|
||||
8.24 patch line (`~8.24.10`), the line Payload itself tests; the reference site seeds, builds and passes its smoke
|
||||
tests on it. `happy-dom` comes from `@payloadcms/richtext-lexical` → `@lexical/headless` 0.50 (`^20.9.0`); every
|
||||
20.x has GHSA-c8p4-j97h-3vg8 (high, SSRF when parsing untrusted HTML, fixed in 21.0.0) and GHSA-834v-8h66-3h79
|
||||
(high, host code execution, fixed in 21.0.4). 21 is a major, but only `@lexical/headless/dom` (`withDOM`) loads
|
||||
it — Payload 3.90 never imports that entry, and Lexical 0.53 itself moved to `^21.0.4`; `withDOM` HTML parsing and
|
||||
export are checked on 21.0.4. Both overrides stop matching once Payload ships a fixed version — remove them then.
|
||||
`undici` comes from `payload` (3.92.1 and later already ship 7.30.1), `dompurify` from the admin code editor
|
||||
(`@payloadcms/ui` → `monaco-editor`, which pins 3.2.7). `graphql-scalars` comes from `@payloadcms/graphql`, which
|
||||
pins 1.22.2 up to the latest Payload (3.92.1); every version up to 2.0.0 has a high ReDoS advisory in the
|
||||
@@ -533,7 +545,9 @@ No abbreviations (`HeroSection`, not `HeroSec`). Do not create `lib/pages.ts`,
|
||||
lockfile picks up the fix; add an override like the ones above only if it does not. These are recommendations —
|
||||
the plugin forces none of them. Never add a project dependency on `nodemailer` or `@types/nodemailer`.
|
||||
**Check:** `pnpm audit --prod` → no high or critical (only the `deepmerge` low may remain);
|
||||
`pnpm why undici dompurify graphql-scalars` → only the fixed versions; with GraphQL in use, a query that reads a
|
||||
`pnpm why undici dompurify graphql-scalars mongoose happy-dom` → only the fixed versions (mongoose 8.24.7 or
|
||||
later, happy-dom 21.0.4 or later); `pnpm exec ipal-doctor` → no `transitive-min` finding; after the mongoose
|
||||
override run `pnpm build`, open the panel and save a document; with GraphQL in use, a query that reads a
|
||||
`createdAt` (DateTime) and filters on `email` (EmailAddress) returns data.
|
||||
|
||||
---
|
||||
|
||||
@@ -97,7 +97,10 @@ pnpm add @intecion/ipal-kit @payloadcms/plugin-seo @payloadcms/plugin-form-build
|
||||
GHSA-mfr8-8qww-v76h — AGENT.md §4 item 11): `pnpm add [email protected] [email protected] sharp@^0.35.5` when
|
||||
create-payload-app gave you an older one.
|
||||
**Node.js 20 or later** (the plugin's `nodemailer` 10 requires it). After the install, `pnpm audit --prod` → no high or
|
||||
critical; with `payload` 3.90.x add the `dompurify`, `graphql-scalars` and `undici` overrides from AGENT.md §4 item 12.
|
||||
critical; with `payload` 3.90.x add the `dompurify`, `graphql-scalars`, `happy-dom`, `mongoose` and `undici` overrides
|
||||
from AGENT.md §4 item 12 (`"mongoose@>=8 <8.24.7": "~8.24.10"` lifts the 8.24.1 that `@payloadcms/db-mongodb` pins —
|
||||
one critical and two high advisories; `"happy-dom@<21.0.4": "^21.0.4"` fixes two high ones). `pnpm exec ipal-doctor`
|
||||
→ no `transitive-min` finding.
|
||||
`nodemailer`, `lucide-react`, `slugify`, `server-only` come with the plugin — do not add them (your own
|
||||
`lucide-react` only `~0.400.0`). In `package.json`: pin every `@payloadcms/*` (ui, next, db-*, richtext-lexical,
|
||||
plugin-seo, plugin-form-builder, storage-s3) in `pnpm.overrides` **to the exact `payload` version**, then
|
||||
|
||||
@@ -88,8 +88,17 @@ the banner → `<CookieBanner settings="detailed">` and remove the copy. With `d
|
||||
prints no security-upgrade warning.
|
||||
|
||||
**Every upgrade — dependency advisories** (AGENT.md §4 item 12): `pnpm audit --prod`; with `payload` 3.90.x add the
|
||||
`dompurify`, `graphql-scalars` and `undici` overrides, `pnpm install`, audit again. **Check:** no high or critical (the
|
||||
`deepmerge` low has no fix yet).
|
||||
`dompurify`, `graphql-scalars`, `happy-dom`, `mongoose` and `undici` overrides to `pnpm.overrides`, `pnpm install`, audit
|
||||
again. MongoDB sites need the `mongoose` one now: `@payloadcms/db-mongodb` pins 8.24.1 (up to Payload 3.93.0), which has
|
||||
a critical advisory (GHSA-pcrw-h46h-c93h) and four more, all fixed in 8.24.7:
|
||||
```json
|
||||
"happy-dom@<21.0.4": "^21.0.4",
|
||||
"mongoose@>=8 <8.24.7": "~8.24.10"
|
||||
```
|
||||
Then `pnpm install`, `pnpm build`, commit `package.json` and the lockfile, redeploy on Coolify (the new image ships the
|
||||
fixed packages; no data or schema change, no migration). **Check:** `pnpm audit --prod` → no high or critical (the
|
||||
`deepmerge` low has no fix yet); `pnpm why mongoose happy-dom` → 8.24.7 or later, 21.0.4 or later;
|
||||
`pnpm exec ipal-doctor` → no `transitive-min` finding; the panel opens and a document saves.
|
||||
|
||||
**→ 1.14.0 (PROGRAMISTA §6, items 48–49; CHANGELOG "What projects must update" — do all 8, in order):**
|
||||
1. `pnpm payload generate:importmap` — `@intecion/ipal-kit/admin#FaviconCheck` (hint under Site settings → Site icon)
|
||||
|
||||
@@ -81,6 +81,7 @@ Turn off: `ipalKit({ doctor: false })`. Adapt: `ipalKit({ doctor: { tokenVar: 'M
|
||||
| | `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) |
|
||||
| | `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), `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 |
|
||||
| | `pnpm-pinned` | info | `packageManager` is set |
|
||||
| | `deps-audit` | error on critical/high, info on moderate/low | `pnpm audit --prod` (registry) |
|
||||
|
||||
@@ -204,6 +204,7 @@
|
||||
"fast-copy@<3.1.0": "^3.1.0",
|
||||
"fast-uri@<3.1.9": "^3.1.9",
|
||||
"graphql-scalars@<2.0.1": "^2.0.1",
|
||||
"happy-dom@<21.0.4": "^21.0.4",
|
||||
"js-yaml@>=4 <4.3.2": "^4.3.2",
|
||||
"source-map-js@<1.2.2": "^1.2.2",
|
||||
"undici@>=7 <7.30.1": "^7.30.1"
|
||||
|
||||
Generated
+9
-8
@@ -11,6 +11,7 @@ overrides:
|
||||
fast-copy@<3.1.0: ^3.1.0
|
||||
fast-uri@<3.1.9: ^3.1.9
|
||||
graphql-scalars@<2.0.1: ^2.0.1
|
||||
happy-dom@<21.0.4: ^21.0.4
|
||||
js-yaml@>=4 <4.3.2: ^4.3.2
|
||||
source-map-js@<1.2.2: ^1.2.2
|
||||
undici@>=7 <7.30.1: ^7.30.1
|
||||
@@ -142,7 +143,7 @@ importers:
|
||||
version: 6.0.5([email protected])([email protected](@types/[email protected])([email protected])([email protected]))
|
||||
vitest:
|
||||
specifier: 5.0.4
|
||||
version: 5.0.4(@types/[email protected])(happy-dom@20.10.6)([email protected](@types/[email protected])([email protected])([email protected]))
|
||||
version: 5.0.4(@types/[email protected])(happy-dom@21.0.4)([email protected](@types/[email protected])([email protected])([email protected]))
|
||||
|
||||
packages:
|
||||
|
||||
@@ -3764,8 +3765,8 @@ packages:
|
||||
resolution: {integrity: sha512-Chq1s4CY7jmh8gO2qvLIJyfCDIN+EHLFW/9iShnp1z8FjBQMoodWP1kDC36VAMXXIvAjj4ARa7ntfAV2BrjsbA==}
|
||||
engines: {node: ^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0}
|
||||
|
||||
happy-dom@20.10.6:
|
||||
resolution: {integrity: sha512-6QD0ilzDDt93tX44y8tbmZdAcdTRYDhUP+Asgi6pC8Pp5IA3cvaZGyoVN/EGtlq9ziT65iPuBBn3ASLr6hCgVw==}
|
||||
happy-dom@21.0.4:
|
||||
resolution: {integrity: sha512-tFm+GaLBgo6o0awHnvHaNoraVo27qJ+2tZEtZ+cIa08hXbeitrxAJajLI05hsUy/2/YTKcUjQYzHe5mCcraLBw==}
|
||||
engines: {node: '>=20.0.0'}
|
||||
|
||||
[email protected]:
|
||||
@@ -5478,7 +5479,7 @@ packages:
|
||||
'@vitest/coverage-istanbul': 5.0.4
|
||||
'@vitest/coverage-v8': 5.0.4
|
||||
'@vitest/ui': 5.0.4
|
||||
happy-dom: '*'
|
||||
happy-dom: ^21.0.4
|
||||
jsdom: '*'
|
||||
vite: ^6.4.0 || ^7.0.0 || ^8.0.0
|
||||
peerDependenciesMeta:
|
||||
@@ -6738,7 +6739,7 @@ snapshots:
|
||||
'@lexical/[email protected]([email protected])':
|
||||
dependencies:
|
||||
'@lexical/internal': 0.50.0([email protected])
|
||||
happy-dom: 20.10.6
|
||||
happy-dom: 21.0.4
|
||||
lexical: 0.50.0([email protected])
|
||||
optionalDependencies:
|
||||
typescript: 5.9.3
|
||||
@@ -9818,7 +9819,7 @@ snapshots:
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
happy-dom@20.10.6:
|
||||
happy-dom@21.0.4:
|
||||
dependencies:
|
||||
'@types/node': 22.20.5
|
||||
'@types/whatwg-mimetype': 3.0.2
|
||||
@@ -11786,7 +11787,7 @@ snapshots:
|
||||
sass: 1.77.4
|
||||
tsx: 4.22.4
|
||||
|
||||
[email protected](@types/[email protected])(happy-dom@20.10.6)([email protected](@types/[email protected])([email protected])([email protected])):
|
||||
[email protected](@types/[email protected])(happy-dom@21.0.4)([email protected](@types/[email protected])([email protected])([email protected])):
|
||||
dependencies:
|
||||
'@types/chai': 5.2.3
|
||||
'@vitest/mocker': 5.0.4([email protected](@types/[email protected])([email protected])([email protected]))
|
||||
@@ -11804,7 +11805,7 @@ snapshots:
|
||||
why-is-node-running: 3.2.1
|
||||
optionalDependencies:
|
||||
'@types/node': 22.20.5
|
||||
happy-dom: 20.10.6
|
||||
happy-dom: 21.0.4
|
||||
transitivePeerDependencies:
|
||||
- msw
|
||||
|
||||
|
||||
@@ -97,7 +97,10 @@ pnpm add @intecion/ipal-kit @payloadcms/plugin-seo @payloadcms/plugin-form-build
|
||||
GHSA-mfr8-8qww-v76h — AGENT.md §4 item 11): `pnpm add [email protected] [email protected] sharp@^0.35.5` when
|
||||
create-payload-app gave you an older one.
|
||||
**Node.js 20 or later** (the plugin's `nodemailer` 10 requires it). After the install, `pnpm audit --prod` → no high or
|
||||
critical; with `payload` 3.90.x add the `dompurify`, `graphql-scalars` and `undici` overrides from AGENT.md §4 item 12.
|
||||
critical; with `payload` 3.90.x add the `dompurify`, `graphql-scalars`, `happy-dom`, `mongoose` and `undici` overrides
|
||||
from AGENT.md §4 item 12 (`"mongoose@>=8 <8.24.7": "~8.24.10"` lifts the 8.24.1 that `@payloadcms/db-mongodb` pins —
|
||||
one critical and two high advisories; `"happy-dom@<21.0.4": "^21.0.4"` fixes two high ones). `pnpm exec ipal-doctor`
|
||||
→ no `transitive-min` finding.
|
||||
`nodemailer`, `lucide-react`, `slugify`, `server-only` come with the plugin — do not add them (your own
|
||||
`lucide-react` only `~0.400.0`). In `package.json`: pin every `@payloadcms/*` (ui, next, db-*, richtext-lexical,
|
||||
plugin-seo, plugin-form-builder, storage-s3) in `pnpm.overrides` **to the exact `payload` version**, then
|
||||
|
||||
@@ -88,8 +88,17 @@ the banner → `<CookieBanner settings="detailed">` and remove the copy. With `d
|
||||
prints no security-upgrade warning.
|
||||
|
||||
**Every upgrade — dependency advisories** (AGENT.md §4 item 12): `pnpm audit --prod`; with `payload` 3.90.x add the
|
||||
`dompurify`, `graphql-scalars` and `undici` overrides, `pnpm install`, audit again. **Check:** no high or critical (the
|
||||
`deepmerge` low has no fix yet).
|
||||
`dompurify`, `graphql-scalars`, `happy-dom`, `mongoose` and `undici` overrides to `pnpm.overrides`, `pnpm install`, audit
|
||||
again. MongoDB sites need the `mongoose` one now: `@payloadcms/db-mongodb` pins 8.24.1 (up to Payload 3.93.0), which has
|
||||
a critical advisory (GHSA-pcrw-h46h-c93h) and four more, all fixed in 8.24.7:
|
||||
```json
|
||||
"happy-dom@<21.0.4": "^21.0.4",
|
||||
"mongoose@>=8 <8.24.7": "~8.24.10"
|
||||
```
|
||||
Then `pnpm install`, `pnpm build`, commit `package.json` and the lockfile, redeploy on Coolify (the new image ships the
|
||||
fixed packages; no data or schema change, no migration). **Check:** `pnpm audit --prod` → no high or critical (the
|
||||
`deepmerge` low has no fix yet); `pnpm why mongoose happy-dom` → 8.24.7 or later, 21.0.4 or later;
|
||||
`pnpm exec ipal-doctor` → no `transitive-min` finding; the panel opens and a document saves.
|
||||
|
||||
**→ 1.14.0 (PROGRAMISTA §6, items 48–49; CHANGELOG "What projects must update" — do all 8, in order):**
|
||||
1. `pnpm payload generate:importmap` — `@intecion/ipal-kit/admin#FaviconCheck` (hint under Site settings → Site icon)
|
||||
|
||||
@@ -67,6 +67,8 @@
|
||||
"@payloadcms/ui": "3.90.2",
|
||||
"dompurify@<3.4.17": "^3.4.17",
|
||||
"graphql-scalars@<2.0.1": "^2.0.1",
|
||||
"happy-dom@<21.0.4": "^21.0.4",
|
||||
"mongoose@>=8 <8.24.7": "~8.24.10",
|
||||
"undici@>=7 <7.30.1": "^7.30.1"
|
||||
}
|
||||
},
|
||||
|
||||
Generated
+20
-18
@@ -15,6 +15,8 @@ overrides:
|
||||
'@payloadcms/ui': 3.90.2
|
||||
dompurify@<3.4.17: ^3.4.17
|
||||
graphql-scalars@<2.0.1: ^2.0.1
|
||||
happy-dom@<21.0.4: ^21.0.4
|
||||
mongoose@>=8 <8.24.7: ~8.24.10
|
||||
undici@>=7 <7.30.1: ^7.30.1
|
||||
|
||||
importers:
|
||||
@@ -1641,8 +1643,8 @@ packages:
|
||||
resolution: {integrity: sha512-Chq1s4CY7jmh8gO2qvLIJyfCDIN+EHLFW/9iShnp1z8FjBQMoodWP1kDC36VAMXXIvAjj4ARa7ntfAV2BrjsbA==}
|
||||
engines: {node: ^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0}
|
||||
|
||||
happy-dom@20.14.6:
|
||||
resolution: {integrity: sha512-5DDsf4QmEIlRL6NkCv/fxSjYHHkZceL/IaYQdJc2h3G7DRTEai++VTjbfL0LB9geW2VrA3+vrjF3Efx+OTtX0Q==}
|
||||
happy-dom@21.0.4:
|
||||
resolution: {integrity: sha512-tFm+GaLBgo6o0awHnvHaNoraVo27qJ+2tZEtZ+cIa08hXbeitrxAJajLI05hsUy/2/YTKcUjQYzHe5mCcraLBw==}
|
||||
engines: {node: '>=20.0.0'}
|
||||
|
||||
[email protected]:
|
||||
@@ -2080,14 +2082,14 @@ packages:
|
||||
resolution: {integrity: sha512-8chOqpVE3bcoWT2pIgcJeIZlXaOfQCavZgQZF4qytUtjRBqsNMyzUoR16qdw9XL2kC478N8iA8z0AA+NSS0d1A==}
|
||||
engines: {node: '>=16.20.1'}
|
||||
peerDependencies:
|
||||
mongoose: '>=5.11.10'
|
||||
mongoose: ~8.24.10
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-0LOsVEQmjrbJKVDi/IvFEhIezmuRjUE4loGgslv57j9nK/NMC+mbKT0QnaPSPpib4lByKVBcy3VbDa1TvlHZjA==}
|
||||
engines: {node: '>=4.0.0'}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-UpHBA0l5kHyKJQFjmBaFYQFo5sgz1DK0TRqDkOyBLYbqiIbKKhIvBpHWBXqeo0rgW4kGI1UhhAw+kTQZoj1BdA==}
|
||||
[email protected]0:
|
||||
resolution: {integrity: sha512-mvIBeudAZjSXteYMl66KA/2SJoTPAYqkkFLiZK5mzrquNDbDwmtvnK9azSRXKz0TWcCcc5ATG6WiOU0qsp2xNw==}
|
||||
engines: {node: '>=16.20.1'}
|
||||
|
||||
[email protected]:
|
||||
@@ -2098,8 +2100,8 @@ packages:
|
||||
resolution: {integrity: sha512-ikJRQTk8hw5DEoFVxHG1Gn9T/xcjtdnOKIU1JTmGjZZlg9LST2mBLmcX3/ICIbgJydT2GOc15RnNy5mHmzfSew==}
|
||||
engines: {node: '>=4.0.0'}
|
||||
|
||||
[email protected].0:
|
||||
resolution: {integrity: sha512-iQMncpmEK8R8ncT8HJGsGc9Dsp8xcgYMVSbs5jgnm1lFHTZqMJTUWTDx1LBO8+mK3tPNZWFLBghQEIOULSTHZg==}
|
||||
[email protected].1:
|
||||
resolution: {integrity: sha512-C99lWV0TFI34pS008jBsi3JrE2xZPnTgUw5yApQR71nRP0hxLy8D5m1Lbbk83c8AQWJwdJ0329HzFtZ1MRTUIw==}
|
||||
engines: {node: '>=14.0.0'}
|
||||
|
||||
[email protected]:
|
||||
@@ -3405,7 +3407,7 @@ snapshots:
|
||||
'@lexical/[email protected]([email protected])':
|
||||
dependencies:
|
||||
'@lexical/internal': 0.50.0([email protected])
|
||||
happy-dom: 20.14.6
|
||||
happy-dom: 21.0.4
|
||||
lexical: 0.50.0([email protected])
|
||||
optionalDependencies:
|
||||
typescript: 5.9.3
|
||||
@@ -3624,8 +3626,8 @@ snapshots:
|
||||
|
||||
'@payloadcms/[email protected]([email protected]([email protected])([email protected]))':
|
||||
dependencies:
|
||||
mongoose: 8.24.1
|
||||
mongoose-paginate-v2: 1.9.4([email protected])
|
||||
mongoose: 8.24.10
|
||||
mongoose-paginate-v2: 1.9.4([email protected]0)
|
||||
payload: 3.90.2([email protected])([email protected])
|
||||
prompts: 2.4.2
|
||||
uuid: 13.0.2
|
||||
@@ -4368,7 +4370,7 @@ snapshots:
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
happy-dom@20.14.6:
|
||||
happy-dom@21.0.4:
|
||||
dependencies:
|
||||
'@types/node': 22.20.5
|
||||
'@types/whatwg-mimetype': 3.0.2
|
||||
@@ -4877,24 +4879,24 @@ snapshots:
|
||||
bson: 6.10.4
|
||||
mongodb-connection-string-url: 3.0.2
|
||||
|
||||
[email protected]([email protected]):
|
||||
[email protected]([email protected]0):
|
||||
dependencies:
|
||||
mongoose: 8.24.1
|
||||
mongoose: 8.24.10
|
||||
mpath: 0.8.4
|
||||
|
||||
[email protected]([email protected]):
|
||||
[email protected]([email protected]0):
|
||||
dependencies:
|
||||
mongoose-lean-virtuals: 1.1.1([email protected])
|
||||
mongoose-lean-virtuals: 1.1.1([email protected]0)
|
||||
transitivePeerDependencies:
|
||||
- mongoose
|
||||
|
||||
[email protected]:
|
||||
[email protected]0:
|
||||
dependencies:
|
||||
bson: 6.10.4
|
||||
kareem: 2.6.3
|
||||
mongodb: 6.20.0
|
||||
mpath: 0.9.0
|
||||
mquery: 5.0.0
|
||||
mquery: 5.0.1
|
||||
ms: 2.1.3
|
||||
sift: 17.1.3
|
||||
transitivePeerDependencies:
|
||||
@@ -4911,7 +4913,7 @@ snapshots:
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected].0:
|
||||
[email protected].1:
|
||||
dependencies:
|
||||
debug: 4.4.3
|
||||
transitivePeerDependencies:
|
||||
|
||||
@@ -23,6 +23,11 @@ export type DoctorContext = {
|
||||
importMap: null | string
|
||||
/** Installed version of a package in the project's node_modules, or null. */
|
||||
installed: (name: string) => null | string
|
||||
/**
|
||||
* Every version of a package in the project's dependency tree, direct or transitive: from `pnpm-lock.yaml`
|
||||
* (what a deploy installs), else from `node_modules/.pnpm`, plus the top-level install. Empty when not found.
|
||||
*/
|
||||
installedAll: (name: string) => string[]
|
||||
launched: boolean
|
||||
list: (rel: string) => string[]
|
||||
live: DoctorLive | null
|
||||
@@ -121,6 +126,25 @@ export function createDoctorContext(options: ProjectOptions): DoctorContext {
|
||||
}
|
||||
}
|
||||
|
||||
const installedAll = (name: string) => {
|
||||
const escaped = name.replace(/[.*+?^${}()|[\]\\/]/g, '\\$&')
|
||||
const found = new Set<string>()
|
||||
// pnpm-lock.yaml v6+: ` [email protected]:` keys under packages: / snapshots: (the overrides: block comes before them)
|
||||
const lock = read('pnpm-lock.yaml')
|
||||
const packages = lock.slice(Math.max(0, lock.search(/^packages:\s*$/m)))
|
||||
for (const m of packages.matchAll(new RegExp(`^ {2}'?${escaped}@(\\d+\\.\\d+\\.\\d+[\\w.+-]*)`, 'gm'))) {found.add(m[1])}
|
||||
if (!found.size) {
|
||||
const dir = new RegExp(`^${escaped.replace('\\/', '\\+')}@(\\d+\\.\\d+\\.\\d+[^_(]*)`)
|
||||
for (const entry of list('node_modules/.pnpm')) {
|
||||
const m = entry.match(dir)
|
||||
if (m) {found.add(m[1])}
|
||||
}
|
||||
}
|
||||
const top = installed(name)
|
||||
if (top) {found.add(top)}
|
||||
return [...found]
|
||||
}
|
||||
|
||||
let pkg: DoctorContext['pkg'] = {}
|
||||
try {
|
||||
pkg = JSON.parse(read('package.json') || '{}') as DoctorContext['pkg']
|
||||
@@ -166,6 +190,7 @@ export function createDoctorContext(options: ProjectOptions): DoctorContext {
|
||||
exists,
|
||||
importMap: adminDir ? `${src}app/(payload)/${adminDir}/importMap.js` : null,
|
||||
installed,
|
||||
installedAll,
|
||||
launched: config.launched ?? launchedInAgents,
|
||||
list,
|
||||
live: options.live ?? null,
|
||||
|
||||
@@ -8,6 +8,28 @@ export const NEXT_MIN_SAFE = '16.4.5'
|
||||
/** The version the plugin, the reference site and the starter use. */
|
||||
export const NEXT_RECOMMENDED = '16.4.6'
|
||||
|
||||
/**
|
||||
* Packages from Payload's own dependency tree that Payload pins below a security fix (AGENT.md §4 item 12). Only the
|
||||
* project's lockfile can lift them, with a `pnpm.overrides` entry. `major` limits the check to the line Payload uses.
|
||||
*/
|
||||
export const TRANSITIVE_MIN_SAFE: { major?: number; min: string; name: string; override: string; severity: 'error' | 'warning'; why: string }[] = [
|
||||
{
|
||||
name: 'mongoose',
|
||||
major: 8,
|
||||
min: '8.24.7',
|
||||
override: '"mongoose@>=8 <8.24.7": "~8.24.10"',
|
||||
severity: 'error',
|
||||
why: 'GHSA-pcrw-h46h-c93h (critical, sanitizeFilter not applied on countDocuments) and four more; @payloadcms/db-mongodb pins 8.24.1',
|
||||
},
|
||||
{
|
||||
name: 'happy-dom',
|
||||
min: '21.0.4',
|
||||
override: '"happy-dom@<21.0.4": "^21.0.4"',
|
||||
severity: 'warning',
|
||||
why: 'GHSA-c8p4-j97h-3vg8 and GHSA-834v-8h66-3h79 (high); comes with @payloadcms/richtext-lexical → @lexical/headless',
|
||||
},
|
||||
]
|
||||
|
||||
export const versionRules: DoctorRule[] = [
|
||||
{
|
||||
id: 'plugin-installed',
|
||||
@@ -58,6 +80,27 @@ export const versionRules: DoctorRule[] = [
|
||||
group: 'versions',
|
||||
source: 'static',
|
||||
},
|
||||
{
|
||||
id: 'transitive-min',
|
||||
check: (ctx) => {
|
||||
const out: RuleFinding[] = []
|
||||
for (const dep of TRANSITIVE_MIN_SAFE) {
|
||||
const old = ctx.installedAll(dep.name).filter((v) => (dep.major === undefined || parseVersion(v)?.[0] === dep.major) && lt(v, dep.min))
|
||||
if (old.length) {
|
||||
out.push({
|
||||
file: 'package.json',
|
||||
fix: `add ${dep.override} to pnpm.overrides in package.json, then pnpm install (AGENT.md §4 item 12)`,
|
||||
message: `${dep.name} ${old.join(', ')} < ${dep.min} — ${dep.why}`,
|
||||
severity: dep.severity,
|
||||
})
|
||||
}
|
||||
}
|
||||
return out
|
||||
},
|
||||
docs: 'docs/agent/AGENT.md#4-next-16--rendering-seo-build',
|
||||
group: 'versions',
|
||||
source: 'static',
|
||||
},
|
||||
{
|
||||
id: 'node-22',
|
||||
check: (ctx) => {
|
||||
|
||||
@@ -133,6 +133,32 @@ describe('versions', () => {
|
||||
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 })
|
||||
})
|
||||
test('transitive-min: mongoose 8 below 8.24.7 (error) and happy-dom below 21.0.4 (warning), read from the lockfile', async () => {
|
||||
const lock = (mongoose: string, happyDom: string) =>
|
||||
`lockfileVersion: '9.0'\n\noverrides:\n [email protected]: 8.24.1\n\npackages:\n\n happy-dom@${happyDom}:\n resolution: {integrity: x}\n\n [email protected]:\n resolution: {integrity: x}\n\n mongoose@${mongoose}:\n resolution: {integrity: x}\n\nsnapshots:\n\n mongoose@${mongoose}:\n dependencies:\n mongodb: 6.20.0\n`
|
||||
const at = (mongoose: string, happyDom: string) => project({ ...base(), 'pnpm-lock.yaml': lock(mongoose, happyDom) })
|
||||
const old = await doctor(at('8.24.1', '20.14.6'), ['transitive-min'])
|
||||
expect(rules(old)).toEqual(['transitive-min:error', 'transitive-min:warning'])
|
||||
expect(old.findings[0].message).toContain('mongoose 8.24.1 < 8.24.7')
|
||||
expect(old.findings[0].message).toContain('GHSA-pcrw-h46h-c93h')
|
||||
expect(old.findings[0].fix).toContain('"mongoose@>=8 <8.24.7": "~8.24.10"')
|
||||
expect(old.findings[1].message).toContain('happy-dom 20.14.6 < 21.0.4')
|
||||
expect(old.findings[1].fix).toContain('"happy-dom@<21.0.4": "^21.0.4"')
|
||||
// 8.24.3 fixes only the critical one
|
||||
expect(rules(await doctor(at('8.24.6', '21.0.3'), ['transitive-min']))).toEqual(['transitive-min:error', 'transitive-min:warning'])
|
||||
expect(rules(await doctor(at('8.24.7', '21.0.4'), ['transitive-min']))).toEqual([])
|
||||
expect(rules(await doctor(at('8.24.10', '21.1.0'), ['transitive-min']))).toEqual([])
|
||||
// another major line (Payload 4 uses mongoose 9) is not compared with the 8.x minimum
|
||||
expect(rules(await doctor(at('9.11.4', '21.0.4'), ['transitive-min']))).toEqual([])
|
||||
// no MongoDB adapter, no lexical: nothing to report
|
||||
expect(rules(await doctor(project(base()), ['transitive-min']))).toEqual([])
|
||||
const silenced = await doctor(at('8.24.1', '20.14.6'), ['transitive-min'], { config: { rules: { 'transitive-min': { off: true, reason: 'Payload upgrade booked' } } } })
|
||||
expect(silenced.summary).toMatchObject({ error: 0, silenced: 2, warning: 0 })
|
||||
})
|
||||
test('transitive-min: without a pnpm lockfile it reads node_modules/.pnpm', async () => {
|
||||
const root = project({ ...base(), 'node_modules/.pnpm/[email protected][email protected]/node_modules/mongoose/package.json': { name: 'mongoose', version: '8.24.1' } })
|
||||
expect(rules(await doctor(root, ['transitive-min']))).toEqual(['transitive-min:error'])
|
||||
})
|
||||
test('file: / link: specs are not compared', async () => {
|
||||
expect(rules(await doctor(project({ ...base(), 'package.json': pkgJson({ dependencies: { '@intecion/ipal-kit': 'file:..' } }) }), ['plugin-installed']))).toEqual([])
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user