Skip to content

fix(deps): override happy-dom to 21.0.4 for GHSA-834v-8h66-3h79 - #1037

Closed
sydevs-bot wants to merge 1 commit into
mainfrom
claude/fix-deps-happy-dom
Closed

sydevs-bot wants to merge 1 commit into
mainfrom
claude/fix-deps-happy-dom

Conversation

@sydevs-bot

@sydevs-bot sydevs-bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Pins happy-dom to ^21.0.4 in pnpm-workspace.yaml, clearing the one high runtime-scope advisory pnpm audit reported (GHSA-834v-8h66-3h79, CVSS 8.8).
  • Nothing loads the vulnerable code today; this closes a counted advisory, not live exposure. Reasoning below.

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.seed is 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

  • Lean gate: ✓ lint, format, typecheck (src + tests), unit lane — 227 files, 2909 tests
  • Targeted specs: 164 passed — the six integration specs that exercise richtext conversion (pages, content-index-block, translations-globals, translations-field, lessons, user-submissions-create)
  • Build: N/A — CI runs it

pnpm audit --audit-level=high drops 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:

  • The fix needs a cross-major override. @lexical/headless declares happy-dom: ^20.9.0, and so does every published version through 0.52.0. @payloadcms/[email protected] pins lexical at 0.50.0, so no in-range refresh and no parent bump reaches 21.0.4. This is the second ⚠ line in the overrides block, after nodemailer (chore(deps): settle the three high advisories no in-range bump reaches #931).
  • Nothing imports the vulnerable path. happy-dom sits behind @lexical/headless's /dom export subpath. Nothing in the installed tree imports it — @payloadcms/richtext-lexical takes only the root entry's createHeadlessEditor. Even reached, the ES-module compiler runs only under enableJavaScriptEvaluation, which DefaultBrowserSettings leaves false and which @lexical/headless never sets (it calls new Window() bare).

I shipped it because the dependency is runtime-scope, which is what both pnpm audit --audit-level=high and 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/headless touches 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, enableIframePageLoading are the new opt-ins; disableCSSFileLoading is 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 in 21.0.4. pnpm peers check reports nothing new. No vitest project uses the happy-dom environment; both are environment: 'node'.

The advisory. The named-import handler in ECMAScriptModuleCompiler.ts does 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 reach process and Node built-ins. It is an incomplete fix for CVE-2026-33943, which validated only the export { … } path.

The second high advisory, left out on purpose. GHSA-587h-7wmj-h5pm (vite ≤ 7.3.6, launch-editor's fs.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 ^7 peer 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.

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
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-1037 October 26, 2026 19:42 Destroyed
@railway-app

railway-app Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

🚅 Deployed to the SahajCloud-pr-1037 environment in sahajcloud

Service Status Web Updated
SahajCloud ✅ Success (View Logs) Oct 26, 2026 at 7:45 pm UTC
1 service not affected by this PR
  • mailpit

@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Oct 26, 2026
@sydevs-bot

sydevs-bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 no session running
CI fix 1

recent dispatches
  • 19:53Z fix-ci · attempt 1 · session · done
  • 19:53Z fix-ci · attempt 1 · session

Written by the sydevs dispatcher. Sessions never edit this comment.

@sydevs-bot

Copy link
Copy Markdown
Contributor Author

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 Success, and the railway-app comment's Web column is empty for SahajCloud. That is the #661 shape: the SahajCloud service in Railway's production environment has lost its Railway-provided *.up.railway.app domain.

It broke in the last day. #1036 got Success - sahajcloud-sahajcloud-pr-1036.up.railway.app at 2026-10-25 21:38Z. This head got a bare Success at 2026-10-26 19:45Z.

Fix: restore the Railway-provided domain on production's SahajCloud service, target port 8080. See RAILWAY_RUNBOOK.md, "PR previews inherit their domain from production". Re-running will not help. Existing PR environments do not backfill, so this PR may get no preview URL even afterwards.

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

This branch was successfully deployed

No deployments
sahajcloud / SahajCloud-pr-1037 — 780aa124 Deployed Oct 26, 2026 by railway-app[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants