Overrides for Payload's mongoose and happy-dom advisories; doctor rule transitive-min
@payloadcms/db-mongodb pins mongoose 8.24.1 (one critical, two high, two moderate advisories, fixed by 8.24.7) and @lexical/headless 0.50 brings happy-dom 20.x (two high, fixed by 21.0.4). Payload 3.93.0 fixes neither. - reference/package.json (and so the starter): pnpm.overrides for mongoose (~8.24.10) and happy-dom (^21.0.4); pnpm audit --prod on the reference is clean - root package.json: the happy-dom override for the plugin's own dev tree - ipal-doctor: transitive-min reports mongoose 8.x < 8.24.7 (error) and happy-dom < 21.0.4 (warning) from the lockfile and prints the override line; DoctorContext.installedAll(name) - AGENT.md §4 item 12, ipal-setup, ipal-upgrade, doctor.md, README, CHANGELOG Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5.2
parent
7c034a07ef
commit
de8362820f
@@ -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