summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2026-08-28 14:39:48 +0100
committerMichael Williamson <mike@zwobble.org>2026-08-28 14:39:48 +0100
commit31f0c370be4b95ac4fa285fea3be970606735f16 (patch)
treec774a0195cb32e8ff95632f72630a7ca15306fef /test
parente3b9cecdaa3df0d9007ed7b06add53c65516e429 (diff)
Avoid prototype pollution when reading styles
Diffstat (limited to 'test')
-rw-r--r--test/docx/styles-reader.tests.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/docx/styles-reader.tests.js b/test/docx/styles-reader.tests.js
index b63bb6a..8f964c1 100644
--- a/test/docx/styles-reader.tests.js
+++ b/test/docx/styles-reader.tests.js
@@ -120,6 +120,18 @@ test('when multiple style elements have same style ID then only first element is
assert.equal(styles.findTableStyleById("TableNormal").name, "Normal Table");
});
+test('w:type of __proto__ does not cause prototype pollution', function() {
+ readStylesXml(
+ new XmlElement("w:styles", {}, [
+ new XmlElement("w:style", {"w:type": "__proto__", "w:styleId": "List1"}, [
+ new XmlElement("w:name", {"w:val": "List 1"}, [])
+ ])
+ ])
+ );
+
+ assert.equal({}["List1"], undefined);
+});
+
function paragraphStyleElement(id, name) {
return styleElement("paragraph", id, name);
}