Skip to content

Conversation

@yadhukrishnam
Copy link
Contributor

Set the prototype of parsed xml object to undefined, so that prototype pollution is prevented.

Copy link
Owner

@fiznool fiznool left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to sanitize nested objects as well? What about an XML payload of (e.g.)

<foo>
  <bar>
    <__proto__>
      <name>Bob</name>
    </__proto__>
  </bar>
</foo>

From what I can gather about prototype pollution, it can happen if __proto__ is overridden on any object?

@fiznool fiznool changed the title Fixes #68 Fix prototype pollution vulnerability May 18, 2021
yadhukrishnam and others added 2 commits May 18, 2021 21:13
@yadhukrishnam yadhukrishnam requested a review from fiznool May 18, 2021 16:44
@fiznool
Copy link
Owner

fiznool commented May 18, 2021

Do we need to sanitize nested objects as well?

Did you have any thoughts on this?

@yadhukrishnam
Copy link
Contributor Author

Do we need to sanitize nested objects as well?

Did you have any thoughts on this?

I tested that. But doesn't seem to be vulnerable. The fix seems perfect for me now.

@fiznool
Copy link
Owner

fiznool commented May 18, 2021

CI is failing: need to run npm run prettier to fix. Once this is done and CI is passing I will merge in.

@fiznool fiznool merged commit 18581a7 into fiznool:master May 19, 2021
Copy link
Owner

@fiznool fiznool left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution, released as 2.0.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants