Skip to content

fix: upgrade happy-dom and pin transitive deps to fix known CVEs#167

Open
brentrockwood wants to merge 5 commits into
coder:mainfrom
brentrockwood:security/fix-dep-vulnerabilities
Open

fix: upgrade happy-dom and pin transitive deps to fix known CVEs#167
brentrockwood wants to merge 5 commits into
coder:mainfrom
brentrockwood:security/fix-dep-vulnerabilities

Conversation

@brentrockwood
Copy link
Copy Markdown

@brentrockwood brentrockwood commented May 19, 2026

Summary

Addresses known vulnerabilities in dev dependencies found by `npm audit`, with exact version pinning.

Critical / High — happy-dom upgrade

`@happy-dom/global-registrator` upgraded from `^15.11.0` → exact `20.9.0`:

Advisory Severity Description
GHSA-37j7-fg3j-429f Critical VM context escape → Remote Code Execution
GHSA-6q6h-j7hj-3r64 High Unsanitized ES module export names executed as code (CVSS 8.8)
GHSA-w4gp-fjgq-3q4g High `fetch` credentials use page-origin cookies instead of target-origin

`GlobalRegistrator.register()` API is unchanged between v15 and v20. The only required code change is passing `url: 'http://localhost/'\` to `register()`, which happy-dom v20 requires so relative-URL `fetch` calls have a valid base (it previously defaulted to `about:blank`, which v20 no longer allows for relative URL resolution).

High — rollup path traversal (transitive)

Added `overrides` to pin `rollup` to exact `3.30.0`:

Advisory Severity Description
GHSA-mw96-cpmx-2vgc High Arbitrary file write via path traversal

Moderate — postcss XSS (transitive)

Added `overrides` to pin `postcss` to exact `8.5.10`:

Advisory Severity Description
GHSA-qx2v-qp2m-jg93 Moderate XSS via unescaped `</style>` in CSS stringify output

Supply-chain hardening

All new version constraints use exact pins (no `^`) so lockfile regeneration cannot silently pull in a different version.

Test plan

  • `bun install` regenerates lockfile cleanly with all updated versions
  • Full test suite with WASM built: 331 pass, 0 fail

Out of scope

`vite@4.5.14` and `esbuild@0.18.20` also have known advisories but require a major Vite version bump (v4 → v6+). Separate effort.

🤖 Generated with Claude Code

brentrockwood and others added 5 commits May 18, 2026 23:42
Addresses three advisories identified by npm audit:

- @happy-dom/global-registrator: ^15.11.0 → ^20.9.0
  GHSA-37j7-fg3j-429f (critical) — VM context escape → RCE
  GHSA-6q6h-j7hj-3r64 (high)     — unsanitized export names executed as code
  GHSA-w4gp-fjgq-3q4g (high)     — fetch credentials leak

- rollup (transitive, via overrides): 3.29.5 → 3.30.0
  GHSA-mw96-cpmx-2vgc (high) — arbitrary file write via path traversal

- postcss (transitive, via overrides): 8.5.6 → 8.5.14
  GHSA-qx2v-qp2m-jg93 (moderate) — XSS via unescaped </style> in output

happy-dom v20 requires a document URL when using relative-URL fetch calls,
so GlobalRegistrator.register() is updated to pass url: 'http://localhost/'
as recommended by the library. Test pass/fail counts are unchanged (38/293
failures are all pre-existing and caused by the absent WASM build artifact).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Security hardening on top of the CVE fixes:

- Remove ^ ranges from @happy-dom/global-registrator, rollup override,
  and postcss override so lockfile regeneration cannot silently pull in
  a newer (potentially compromised) version.

- Add .devcontainer/devcontainer.json for DevPod / VS Code Dev Containers.
  The container image is pinned by SHA256 content digest (not just tag).
  postCreateCommand enables Nix flakes, initializes the git submodule, and
  pre-populates the Nix store from flake.lock so `nix develop` is instant.
  All downloads inside the container are hash-verified by Nix against
  flake.lock, including the pinned Zig 0.15.2 toolchain.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The SSH_AUTH_SOCK bind mount failed on macOS where the socket path is
inside a sandboxed temp directory Docker can't reach. Removing it keeps
the devcontainer portable. The // comments also caused a JSON parse
error in DevPod; devcontainer.json is strict JSON, not JSONC.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant