Repository navigation
Update dependency happy-dom to v21 [SECURITY] - #449
Open
renovate[bot] wants to merge 1 commit into
Open
renovate[bot] wants to merge 1 commit into
renovate[bot] wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
renovate
Bot
force-pushed
the
renovate/npm-happy-dom-vulnerability
branch
from
October 21, 2025 14:33
80f1e60 to
23d5866
Compare
renovate
Bot
force-pushed
the
renovate/npm-happy-dom-vulnerability
branch
from
November 10, 2025 22:00
23d5866 to
be8c395
Compare
renovate
Bot
force-pushed
the
renovate/npm-happy-dom-vulnerability
branch
from
November 18, 2025 23:40
be8c395 to
cc12023
Compare
renovate
Bot
force-pushed
the
renovate/npm-happy-dom-vulnerability
branch
from
December 3, 2025 16:33
cc12023 to
82f100c
Compare
renovate
Bot
force-pushed
the
renovate/npm-happy-dom-vulnerability
branch
from
December 31, 2025 17:57
82f100c to
118c1f9
Compare
renovate
Bot
force-pushed
the
renovate/npm-happy-dom-vulnerability
branch
from
January 8, 2026 21:14
118c1f9 to
5c147fd
Compare
renovate
Bot
force-pushed
the
renovate/npm-happy-dom-vulnerability
branch
from
January 19, 2026 17:10
5c147fd to
98c0375
Compare
renovate
Bot
force-pushed
the
renovate/npm-happy-dom-vulnerability
branch
from
February 2, 2026 16:15
98c0375 to
9c52ba1
Compare
renovate
Bot
force-pushed
the
renovate/npm-happy-dom-vulnerability
branch
from
February 12, 2026 12:34
9c52ba1 to
c2e4d21
Compare
renovate
Bot
force-pushed
the
renovate/npm-happy-dom-vulnerability
branch
from
March 5, 2026 16:55
c2e4d21 to
3d4b341
Compare
renovate
Bot
force-pushed
the
renovate/npm-happy-dom-vulnerability
branch
from
March 13, 2026 12:41
3d4b341 to
c5cac76
Compare
renovate
Bot
force-pushed
the
renovate/npm-happy-dom-vulnerability
branch
from
March 30, 2026 19:03
ea498fa to
c5cac76
Compare
renovate
Bot
force-pushed
the
renovate/npm-happy-dom-vulnerability
branch
from
May 12, 2026 13:58
7f8a4ce to
491b4dc
Compare
renovate
Bot
force-pushed
the
renovate/npm-happy-dom-vulnerability
branch
from
May 18, 2026 14:01
491b4dc to
3c1a1f7
Compare
renovate
Bot
force-pushed
the
renovate/npm-happy-dom-vulnerability
branch
from
May 28, 2026 22:30
3c1a1f7 to
2d26516
Compare
renovate
Bot
force-pushed
the
renovate/npm-happy-dom-vulnerability
branch
from
June 11, 2026 22:06
2d26516 to
883336c
Compare
renovate
Bot
force-pushed
the
renovate/npm-happy-dom-vulnerability
branch
from
July 12, 2026 14:53
883336c to
ec72dc6
Compare
renovate
Bot
force-pushed
the
renovate/npm-happy-dom-vulnerability
branch
from
July 17, 2026 03:51
ec72dc6 to
40e785d
Compare
renovate
Bot
force-pushed
the
renovate/npm-happy-dom-vulnerability
branch
from
July 21, 2026 00:04
40e785d to
e253db1
Compare
renovate
Bot
force-pushed
the
renovate/npm-happy-dom-vulnerability
branch
from
July 24, 2026 23:04
e253db1 to
21781ca
Compare
renovate
Bot
force-pushed
the
renovate/npm-happy-dom-vulnerability
branch
from
July 30, 2026 19:39
21781ca to
68b7bf1
Compare
renovate
Bot
force-pushed
the
renovate/npm-happy-dom-vulnerability
branch
from
August 12, 2026 02:58
68b7bf1 to
a5efc40
Compare
renovate
Bot
force-pushed
the
renovate/npm-happy-dom-vulnerability
branch
from
August 26, 2026 23:03
a5efc40 to
8a4eeb3
Compare
renovate
Bot
force-pushed
the
renovate/npm-happy-dom-vulnerability
branch
from
September 3, 2026 00:29
8a4eeb3 to
da917bd
Compare
renovate
Bot
force-pushed
the
renovate/npm-happy-dom-vulnerability
branch
from
September 7, 2026 20:04
da917bd to
5e0e6f6
Compare
renovate
Bot
force-pushed
the
renovate/npm-happy-dom-vulnerability
branch
from
September 10, 2026 19:16
5e0e6f6 to
9a27607
Compare
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
This PR body was truncated due to platform limits.
This PR contains the following updates:
^17.0.0→^21.0.0Happy DOM: VM Context Escape can lead to Remote Code Execution
CVE-2025-61927 / GHSA-37j7-fg3j-429f
More information
Details
Escape of VM Context gives access to process level functionality
Summary
Happy DOM v19 and lower contains a security vulnerability that puts the owner system at the risk of RCE (Remote Code Execution) attacks.
A Node.js VM Context is not an isolated environment, and if the user runs untrusted JavaScript code within the Happy DOM VM Context, it may escape the VM and get access to process level functionality.
It seems like what the attacker can get control over depends on if the process is using ESM or CommonJS. With CommonJS the attacker can get hold of the
require()function to import modules.Happy DOM has JavaScript evaluation enabled by default. This may not be obvious to the consumer of Happy DOM and can potentially put the user at risk if untrusted code is executed within the environment.
Reproduce
CommonJS (Possible to get hold of require)
ESM (Not possible to get hold of import or require)
Potential Impact
Server-Side Rendering (SSR)
Testing Frameworks
Any test suite using Happy-DOM with untrusted content may be at risk
Attack Scenarios
Recommended Immediate Actions
eval()andFunction()can still be used within the Happy DOM VM without any known security riskTechnical Root Cause
All classes and functions inherit from Function. By walking the constructor chain it's possible to get hold of Function at process level. As Function can evaluate code from strings, it's possible to execute code at process level.
Running Node with the "--disallow-code-generation-from-strings" flag protects against this.
Severity
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H/E:PReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
Happy DOM ECMAScriptModuleCompiler: unsanitized export names are interpolated as executable code
CVE-2026-33943 / GHSA-6q6h-j7hj-3r64
More information
Details
Summary
A code injection vulnerability in
ECMAScriptModuleCompilerallows an attacker to achieve Remote Code Execution (RCE) by injecting arbitrary JavaScript expressions insideexport { }declarations in ES module scripts processed by happy-dom. The compiler directly interpolates unsanitized content into generated code as an executable expression, and the quote filter does not strip backticks, allowing template literal-based payloads to bypass sanitization.Details
Vulnerable file:
packages/happy-dom/src/module/ECMAScriptModuleCompiler.ts, lines 371-385The "Export object" handler extracts content from
export { ... }using the regexexport\s*{([^}]+)}, then generates executable code by directly interpolating it:The issue has three root causes:
STATEMENT_REGEXPuses{[^}]+}which matches any content inside braces, not just valid JavaScript identifiersimportNameis placed in code context (as a JS expression to evaluate), not in string context.replace(/["']/g, '')strips"and'but not backticks, so template literal strings like`child_process`survive the filterAttack flow:
Note: This is a different vulnerability from CVE-2024-51757 (SyncFetchScriptBuilder injection) and CVE-2025-61927 (VM context escape). Those were patched in v15.10.2 and v20.0.0 respectively, but this vulnerable code path in
ECMAScriptModuleCompilerremains present in v20.8.4 (latest). In v20.0.0+ where JavaScript evaluation is disabled by default, this vulnerability is exploitable when JavaScript evaluation is explicitly enabled by the user.PoC
Standalone PoC script — reproduces the vulnerability without installing happy-dom by replicating the compiler's exact code generation logic:
Execution result:
HTML attack vector — when processed by happy-dom with JavaScript evaluation enabled:
Impact
An attacker who can inject or control HTML content processed by happy-dom (with JavaScript evaluation enabled) can achieve arbitrary command execution on the host system.
Realistic attack scenarios:
Suggested fix: Validate that
importNameis a valid JavaScript identifier before interpolating it into generated code:Severity
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:HReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
Happy DOM's fetch credentials include uses page-origin cookies instead of target-origin cookies
CVE-2026-34226 / GHSA-w4gp-fjgq-3q4g
More information
Details
Summary
happy-dommay attach cookies from the current page origin (window.location) instead of the request target URL whenfetch(..., { credentials: "include" })is used. This can leak cookies from origin A to destination B.Details
In
packages/happy-dom/src/fetch/utilities/FetchRequestHeaderUtility.ts(getRequestHeaders()), cookie selection is performed withoriginURL:Here,
originURLrepresents the page URL, not the request destination URL. For outgoing requests, cookie lookup should use the request URL (for example:new URL(options.request[PropertySymbol.url])).PoC Script Content
Environment:
happy-dom20.6.1*.127.0.0.1.nip.ioReproduction steps:
page_cookie=PAGE_ONLYona.127.0.0.1.nip.ioapi_cookie=API_ONLYonb.127.0.0.1.nip.iocredentials: "include"Cookieheader received by the target hostExpected:
api_cookie=API_ONLYpage_cookie=PAGE_ONLYActual (observed):
page_cookie=PAGE_ONLYapi_cookie=API_ONLYObserved output:
Impact
Cross-origin sensitive information disclosure (cookie leakage).
Impacted users are applications relying on
happy-dombrowser-like fetch behavior in authenticated/session-based flows (for example SSR/test/proxy-like scenarios), where cookies from one origin can be sent to another origin.Severity
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:NReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
Happy DOM: Incomplete fix for CVE-2026-33943: unsanitized import alias leads to host code execution
CVE-2026-115895 / GHSA-834v-8h66-3h79
More information
Details
Summary
The ESM compiler in
happy-dom@20.14.5does not validate imported local binding aliases before interpolating them into generated JavaScript.As a result, an invalid ESM import alias can be transformed into a valid JavaScript destructuring default initializer and executed.
This appears to be an alternate injection path and incomplete remediation of GHSA-6q6h-j7hj-3r64 / CVE-2026-33943. The previous fix validates
importNamein the localexport { ... }handler, but the named import handler still places an unvalidatedaliasdirectly into code context.These issues were confirmed through the public
Windowand<script type="module">APIs using the publishedhappy-domnpm package. The PoC reaches the Node.js hostprocess, obtainsnode:fs, and creates a proof directory on the host filesystem.Confirmed affected versions
The PoC was directly tested against:
happy-dom@17.0.0happy-dom@20.0.0happy-dom@20.1.0happy-dom@20.14.5The same PoC does not trigger on
happy-dom@16.8.1.The ESM compiler was introduced by commit
7bc831df2, first released inv17.0.0. The vulnerable interpolation remains present throughv20.14.5, the latest release at the time of testing.Suggested affected range:
No patched version is currently available.
Preconditions
enableJavaScriptEvaluation: true.Technical details
In
packages/happy-dom/src/module/ECMAScriptModuleCompiler.ts, the named import handler splits an import specifier and extracts its alias:Unlike the patched
export { ... }handler, the value ofaliasis not validated as a JavaScript identifier.It is subsequently inserted directly into generated binding syntax:
Consider the following source:
This is invalid ECMAScript module syntax. Node.js rejects it at the
=token.Happy DOM instead transforms it into the equivalent of:
This generated JavaScript is valid. Because the imported JSON object does not contain a
missingproperty, the default initializer executes.The
with { type: 'json' }attribute is relevant because the compiler only generates its circular import resolver for ESM imports:Using a JSON module prevents the malicious alias from being emitted again in a later circular-import assignment, leaving the generated function syntactically valid.
Backtick strings also survive the existing quote removal. This allows the injected initializer to reach Node.js host APIs:
Proof of concept
The following PoC uses only the public Happy DOM API and performs a harmless filesystem action by creating a directory named
HAPPY_DOM_RCE_PROOF.1. Create
package.json{ "name": "happy-dom-import-alias-rce-poc", "private": true, "type": "module", "dependencies": { "happy-dom": "20.14.5" } }2. Create
dep.json{}3. Create
payload.mjsThis file is used as a control to demonstrate that a native ECMAScript parser rejects the source:
4. Create
poc.mjs5. Run the control test
Expected result:
This confirms that the source is not valid ESM.
6. Run the Happy DOM PoC
node poc.mjsExpected result:
The existence of
HAPPY_DOM_RCE_PROOFconfirms that the expression injected through the import alias executed and reached the host filesystem.The PoC was also verified inside a
node:24-alpineDocker container, where it created:Impact
An attacker who can supply module source to an application that evaluates JavaScript through Happy DOM can cause syntactically invalid import declarations to be transformed into executable JavaScript.
This may bypass upstream syntax validation or application assumptions that malformed import clauses will be rejected.
The demonstrated payload reaches Node.js
processand built-in modules. It can therefore be adapted to read or modify files, access environment data, or execute operating-system commands with the privileges of the Happy DOM host process.Relationship to CVE-2026-33943
CVE-2026-33943 covers expression injection through a local export declaration:
Its fix added identifier validation to the
importNameused by theexport { ... }handler:This report uses a different parsing and code-generation path:
The unvalidated value is the local import
alias, and the injection occurs in a generated destructuring binding rather than the export assignment patched by CVE-2026-33943.The issue remains reproducible in versions released after the CVE-2026-33943 fix, including
20.14.5.Suggested fix
Validate the imported local binding before placing it into code context. The existing
VALID_VARIABLE_NAME_REGEXPcan be reused:A regression test should compile and execute the malicious import declaration, then verify that the initializer was not evaluated.
This change was tested locally. The focused
ECMAScriptModuleCompilertest suite passes with 30 tests, and ESLint reports no errors.For additional hardening, generated property keys should use
JSON.stringify()instead of manual quote interpolation.Verification record
24.14.1happy-dom@20.14.5v20.14.50d4cdbe7442af49d16b49ddf1acf7cc9684ed31817.0.016.8.1Severity
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:HReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
Release Notes
capricorn86/happy-dom (happy-dom)
v21.0.4Compare Source
👷♂️ Patch fixes
data:iframes cannot access their parent or top window - By @capricorn86v21.0.3Compare Source
👷♂️ Patch fixes
v21.0.2Compare Source
👷♂️ Patch fixes
v21.0.1Compare Source
👷♂️ Patch fixes
--cssand--iframefor enabling CSS and iframe loading to @happy-dom/server-renderer - By @capricorn86v21.0.0Compare Source
💣 Breaking Changes
<iframe>or<link rel="stylesheet">elements in untrusted HTML to make Happy DOM send HTTP requests from the server to attacker-chosen URLs, including internal services. This could allow access to otherwise unreachable endpoints or trigger unintended actions, depending on the application and its network access.disableCSSFileLoadinghas been deprecated<=v20.14.6by sending in{ enableCSSFileLoading: true, enableIframePageLoading: true }as broswer settings (e.g.new Window({ settings }));v20.14.6Compare Source
👷♂️ Patch fixes
v20.14.5Compare Source
👷♂️ Patch fixes
v20.14.4Compare Source
👷♂️ Patch fixes
v20.14.3Compare Source
👷♂️ Patch fixes
v20.14.2Compare Source
👷♂️ Patch fixes
getComputedStyle()- By @klaesra in task #2344v20.14.1Compare Source
👷♂️ Patch fixes
v20.14.0Compare Source
🎨 Features
v20.13.2Compare Source
👷♂️ Patch fixes
v20.13.1Compare Source
👷♂️ Patch fixes
v20.13.0Compare Source
🎨 Features
v20.12.2Compare Source
👷♂️ Patch fixes
v20.12.1Compare Source
🎨 Features
CSSStyleDeclaration- By @capricorn86 in task #2256CSSStyleDeclaration- By @capricorn86 in task #2256👷♂️ Patch fixes
v20.12.0Compare Source
🎨 Features
Animation,AnimationTimeline,DocumentTimelineandKeyframeEffect- By @capricorn86Element.animate()- By @capricorn86v20.11.15Compare Source
👷♂️ Patch fixes
v20.11.14Compare Source
👷♂️ Patch fixes
v20.11.13Compare Source
👷♂️ Patch fixes
v20.11.12Compare Source
👷♂️ Patch fixes
v20.11.11Compare Source
👷♂️ Patch fixes
v20.11.10Compare Source
👷♂️ Patch fixes
v20.11.9Compare Source
👷♂️ Patch fixes
v20.11.8Compare Source
👷♂️ Patch fixes
adoptedStyleSheetarray should be validated - By @capricorn86 in task #2315v20.11.7Compare Source
👷♂️ Patch fixes
Document.adoptedStyleSheetsandShadowRoot.adoptedStyleSheetsshould validate it's value - By @capricorn86 in task #2313v20.11.6Compare Source
👷♂️ Patch fixes
v20.11.5Compare Source
👷♂️ Patch fixes
querySelector<HTMLInputElement>(".my-input")) - By @cyphercodesv20.11.4Compare Source
👷♂️ Patch fixes
fetch()to match origins instead of host and protocol - By @rexxars in task #1490v20.11.3Compare Source
👷♂️ Patch fixes
v20.11.2Compare Source
👷♂️ Patch fixes
v20.11.1Compare Source
👷♂️ Patch fixes
v20.11.0Compare Source
🎨 Features
v20.10.6Compare Source
👷♂️ Patch fixes
v20.10.5Compare Source
👷♂️ Patch fixes
v20.10.4Compare Source
👷♂️ Patch fixes
v20.10.3Compare Source
👷♂️ Patch fixes
v20.10.2Compare Source
👷♂️ Patch fixes
v20.10.1Compare Source
v20.10.0Compare Source
🎨 Features
v20.9.0Compare Source
🎨 Features
Window.onkeydown) - By @capricorn86 in task #2131v20.8.9Compare Source
👷♂️ Patch fixes
v20.8.8Compare Source
👷♂️ Patch fixes
v20.8.7Compare Source
👷♂️ Patch fixes
Consolewith commonIConsoleinterface to support latest version of Bun - By @YevheniiKotyrlo in task [#18Configuration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.