Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properties from Object's prototype are including during XML creation #610

Closed
4 of 6 tasks
aparshin opened this issue Sep 5, 2023 · 2 comments
Closed
4 of 6 tasks
Labels

Comments

@aparshin
Copy link

aparshin commented Sep 5, 2023

  • Are you running the latest version?
  • Have you included sample input, output, error, and expected output?
  • Have you checked if you are using correct configuration?
  • Did you try online tool?

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

<a>1</a>

Would you like to work on this issue?

  • Yes
  • No

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

@github-actions
Copy link

github-actions bot commented Sep 5, 2023

We're glad you find this project helpful. We'll try to address this issue ASAP. You can vist https://solothought.com to know recent features. Don't forget to star this repo.

@aparshin
Copy link
Author

aparshin commented Sep 5, 2023

Maybe #268 is somehow related to this issue...

@amitguptagwl amitguptagwl added the Pending Pending to be confirmed by user/author for some check/update/implementation label Sep 10, 2023
@amitguptagwl amitguptagwl added bug and removed Pending Pending to be confirmed by user/author for some check/update/implementation labels Sep 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants