Repository navigation
fix(deps): override happy-dom to 21.0.4 for GHSA-834v-8h66-3h79 - #1037
sydevs-bot wants to merge 1 commit into
Conversation
happy-dom's ES-module compiler does not validate an import specifier's
alias before interpolating it into a generated destructuring binding, so
`import { missing as injected = <expression> }` — invalid ESM — compiles
to valid JavaScript and runs, reaching `process` and Node built-ins.
GHSA-834v-8h66-3h79 rates it high (8.8) and fixes it in 21.0.4.
The dependency is runtime-scope: @payloadcms/richtext-lexical pulls
@lexical/headless, which declares happy-dom. Every published
@lexical/headless, through 0.52.0, still caps at `^20.9.0`, so an
in-range refresh cannot reach the fix and the override has to cross a
major — the second line here to do so, after nodemailer (#931).
Nothing loads the vulnerable code. happy-dom sits behind
@lexical/headless's `/dom` export subpath, which nothing in the installed
tree imports: @payloadcms/richtext-lexical takes only the root entry's
`createHeadlessEditor`. Even reached, the compiler runs only under
`enableJavaScriptEvaluation`, which DefaultBrowserSettings leaves false
and which @lexical/headless never sets. So this closes a counted
advisory rather than live exposure — runtime scope is what `pnpm audit
--audit-level=high` and the Dependabot check both read.
The bump is free. @lexical/headless touches six symbols (Window,
document, DOMParser, MutationObserver, getComputedStyle,
happyDOM.close), all unchanged in 21, and 21.0.0's one breaking change
turns CSS and iframe file loading off by default — an in-memory DOM
never used either.
Checked: `pnpm peers check` reports nothing new, the lean gate passes
(227 files, 2909 tests), and the six integration specs that exercise
richtext conversion pass (164 tests) — pages, content-index-block,
translations-globals, translations-field, lessons,
user-submissions-create. `pnpm audit --audit-level=high` drops from two
high advisories to one.
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0122a4LsrUHcTpjRw35ZPudV
|
🚅 Deployed to the SahajCloud-pr-1037 environment in sahajcloud
1 service not affected by this PR
|
|
Not fixable from this PR, and nothing was pushed. The diff is green: lint, format, typecheck and all 1662 tests passed. Only the smoke lane failed. Railway published no preview host. The commit status reads a bare It broke in the last day. #1036 got Fix: restore the Railway-provided domain on Every new PR here fails this check until that domain returns. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
Summary
happy-domto^21.0.4inpnpm-workspace.yaml, clearing the one high runtime-scope advisorypnpm auditreported (GHSA-834v-8h66-3h79, CVSS 8.8).Preview
The diff changes a resolved version, so there is no visual change — these open the two admin editors whose lexical richtext field sits downstream of
happy-dom's parent, to confirm the editor still boots:Data: not seeded.
previewUrl.seedis unset for this repo, so both links open on an empty list until someone creates a document. The richtext path itself is covered by the 164 integration tests below.Test results
pages,content-index-block,translations-globals,translations-field,lessons,user-submissions-create)pnpm audit --audit-level=highdrops from 2 high advisories to 1.Notes for reviewer
The judgement worth checking: whether to cross a declared major for an advisory nothing reaches. The two facts behind it:
@lexical/headlessdeclareshappy-dom: ^20.9.0, and so does every published version through0.52.0.@payloadcms/[email protected]pinslexicalat0.50.0, so no in-range refresh and no parent bump reaches21.0.4. This is the second⚠line in the overrides block, afternodemailer(chore(deps): settle the three high advisories no in-range bump reaches #931).happy-domsits behind@lexical/headless's/domexport subpath. Nothing in the installed tree imports it —@payloadcms/richtext-lexicaltakes only the root entry'screateHeadlessEditor. Even reached, the ES-module compiler runs only underenableJavaScriptEvaluation, whichDefaultBrowserSettingsleavesfalseand which@lexical/headlessnever sets (it callsnew Window()bare).I shipped it because the dependency is runtime-scope, which is what both
pnpm audit --audit-level=highand the daily Dependabot check read, so leaving it open re-fires the dependency audit every Monday — and because the bump costs nothing to verify:@lexical/headlesstouches six happy-dom symbols, all unchanged in 21.The alternative — journal it as unreachable and leave
20.14.6— is defensible. Say so and I will revert.The remaining high advisory is deliberately not in this PR: see the Detail block.
Detail
What I checked for breakage.
21.0.0's only breaking change turns CSS and iframe file loading off by default (enableCSSFileLoading,enableIframePageLoadingare the new opt-ins;disableCSSFileLoadingis deprecated). An in-memory DOM used neither.@lexical/headless/dist/dom.*uses exactly six symbols —Window,document,DOMParser,MutationObserver,getComputedStyle,happyDOM.close— all present and unchanged in21.0.4.pnpm peers checkreports nothing new. No vitest project uses thehappy-domenvironment; both areenvironment: 'node'.The advisory. The named-import handler in
ECMAScriptModuleCompiler.tsdoes not validate an import specifier's alias as a JavaScript identifier before interpolating it into a generated destructuring binding as a default initializer.import { missing as injected = <expression> }is invalid ESM, but happy-dom compiles it to valid JavaScript, so the expression runs and can reachprocessand Node built-ins. It is an incomplete fix for CVE-2026-33943, which validated only theexport { … }path.The second high advisory, left out on purpose. GHSA-587h-7wmj-h5pm (
vite≤ 7.3.6,launch-editor'sfs.existsSync()bypass on Windows) is dev-only: every one of its six paths is a devDependency, and the bypass needs the dev server's open-in-editor endpoint on Windows. Its fix is also one character —vite: '7.3.6'→'7.3.7'in the same overrides block, staying inside@vitejs/[email protected]'s^7peer cap. It is not here because a cross-major security override and an unrelated bump must stay separately revertable; it belongs in the next routine dependency batch.