chore(deps): update dependency @xmldom/xmldom to v0.9.9 [security]#1115
Merged
chore(deps): update dependency @xmldom/xmldom to v0.9.9 [security]#1115
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1115 +/- ##
=======================================
Coverage 63.83% 63.83%
=======================================
Files 19 19
Lines 2425 2425
Branches 575 575
=======================================
Hits 1548 1548
Misses 877 877 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
This PR contains the following updates:
0.9.8→0.9.9GitHub Vulnerability Alerts
CVE-2026-34601
Summary
@xmldom/xmldomallows attacker-controlled strings containing the CDATA terminator]]>to be inserted into aCDATASectionnode. During serialization,XMLSerializeremitted the CDATA content verbatim without rejecting or safely splitting the terminator. As a result, data intended to remain text-only became active XML markup in the serialized output, enabling XML structureinjection and downstream business-logic manipulation.
The sequence
]]>is not allowed inside CDATA content and must be rejected or safely handled during serialization. (MDN Web Docs)Attack surface
Document.createCDATASection(data)is the most direct entry point, but it is not the only one. The WHATWG DOM spec intentionally does not validate]]>in mutation methods — onlycreateCDATASectioncarries that guard. The following paths therefore also allow]]>to enter a CDATASection node and reach the serializer:CharacterData.appendData()CharacterData.replaceData()CharacterData.insertData().data.textContent(Note: assigning to
.nodeValuedoes not update.datain this implementation — the serializer reads.datadirectly — so.nodeValueis not an exploitable path.)Parse path
Parsing XML that contains a CDATA section is not affected. The SAX parser's non-greedy
CDSectregex stops at the first]]>, so parsed CDATA data never contains the terminator.Impact
If an application uses
xmldomto generate "trusted" XML documents that embed untrusted user input inside CDATA (a common pattern in exports, feeds, SOAP/XML integrations, etc.), an attacker can inject additional XML elements/attributes into the generated document.This can lead to:
<approved>true</approved>,<role>admin</role>, workflow flags, or other security-relevant elements).This issue does not require malformed parsers or browser behavior; it is caused by serialization producing attacker-influenced XML markup.
Root Cause (with file + line numbers)
File:
lib/dom.js1. No validation in
createCDATASectioncreateCDATASection: function (data)accepts any string and appends it directly.2. Unsafe CDATA serialization
Serializer prints CDATA sections as:
without handling
]]>in the data.Because CDATA content is emitted verbatim, an embedded
]]>closes the CDATA section early and the remainder of the attacker-controlled payload is interpreted as markup in the serialized XML.Proof of Concept — Fix A:
createCDATASectionnow throwsOn patched versions, passing
]]>directly tocreateCDATASectionthrowsInvalidCharacterErrorinstead of silently accepting the payload:Expected output on patched versions:
Proof of Concept — Fix B: mutation vector now safe
On patched versions, injecting
]]>via a mutation method (appendData,replaceData,.data =,.textContent =) no longer produces injectable output. The serializer splits the terminator so the result round-trips as safe text:Expected output on patched versions:
Fix Applied
Both mitigations were implemented:
Option A — Strict/spec-aligned: reject
]]>increateCDATASection()Document.createCDATASection(data)now throwsInvalidCharacterError(per the WHATWG DOM spec) whendatacontains]]>. This closes the direct entry point.Code that previously passed a string containing
]]>tocreateCDATASectionand relied on the silent/unsafe behaviour will now receiveInvalidCharacterError. Use a mutation method such asappendDataif you intentionally need]]>in a CDATASection node's data (the serializer split in Option B will keep the output safe).Option B — Defensive serialization: split the terminator during serialization
XMLSerializernow replaces every occurrence of]]>in CDATA section data with the split sequence]]]]><![CDATA[>before emitting. This closes all mutation-vector paths that Option A alone cannot guard, and means the serialized output is always well-formed XML regardless of how]]>entered the node.Release Notes
xmldom/xmldom (@xmldom/xmldom)
v0.9.9Compare Source
Added
ParentNode.childrengetter#960/#410Fixed
createCDATASectionnow throwsInvalidCharacterErrorwhendatacontains"]]>", as required by the WHATWG DOM spec.GHSA-wh4c-j3r5-mjhpXMLSerializernow splits CDATASection nodes whose data contains"]]>"into adjacent CDATA sections at serialization time, preventing XML injection via mutation methods (appendData,replaceData,.data =,.textContent =).GHSA-wh4c-j3r5-mjhpNode.contains#931Code that passes a string containing
"]]>"tocreateCDATASectionand relied on the previously unsafe behavior will now receiveInvalidCharacterError. Use a mutation method such asappendDataif you intentionally need"]]>"in a CDATASection node's data.Chore
Thank you,
@stevenobiajulu,
@yoshi389111,
@thesmartshadow,
for your contributions
Configuration
📅 Schedule: Branch creation - "" in timezone Europe/Berlin, Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR is behind base branch, 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.