diff options
| author | Michael Williamson <mike@zwobble.org> | 2026-08-28 14:39:48 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2026-08-28 14:39:48 +0100 |
| commit | 31f0c370be4b95ac4fa285fea3be970606735f16 (patch) | |
| tree | c774a0195cb32e8ff95632f72630a7ca15306fef /test/docx/styles-reader.tests.js | |
| parent | e3b9cecdaa3df0d9007ed7b06add53c65516e429 (diff) | |
Avoid prototype pollution when reading styles
Diffstat (limited to 'test/docx/styles-reader.tests.js')
| -rw-r--r-- | test/docx/styles-reader.tests.js | 12 |
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); } |
