From 31f0c370be4b95ac4fa285fea3be970606735f16 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Fri, 28 Aug 2026 14:39:48 +0100 Subject: Avoid prototype pollution when reading styles --- test/docx/styles-reader.tests.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test') 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); } -- cgit v1.2.3