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

Fix prototype pollution vulnerability #69

Merged
merged 6 commits into from
May 19, 2021
Merged

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?

index.js Outdated Show resolved Hide resolved
test.js Outdated Show resolved Hide resolved
@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
@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