Properties from Object's prototype are including during XML creation (original) (raw)

Description

If a custom property is added to Object's prototype, it is included in generated XML. It shouldn't happen because in some cases users can't control pollution of Object / Array prototypes.

Input

{a: 1}

Code

const { XMLBuilder } = require("fast-xml-parser");

// emulate pollution of Object's prototype Object.prototype.something = 'strange';

const builder = new XMLBuilder(); const xml = builder.build({ a: 1 });

console.log(xml);

Output

<a>1</a><something>strange</something> 

Expected output

Would you like to work on this issue?

Bookmark this repository for further updates. Visit SoloThought to know about recent features.