Skip to content

Fix for prototype pollution#1

Merged
rachaelshaw merged 2 commits intomasterfrom
defaultsdeep-patch
Aug 21, 2019
Merged

Fix for prototype pollution#1
rachaelshaw merged 2 commits intomasterfrom
defaultsdeep-patch

Conversation

@rachaelshaw
Copy link
Copy Markdown
Member

@sailsbot
Copy link
Copy Markdown

Hi @rachaelshaw! It looks like the title of your pull request doesn’t quite match our guidelines yet. Would you please edit your pull request's title so that it begins with [proposal], [patch], [fixes #<issue number>], [implements #<other PR number>], or [misc]? Once you've edited it, I'll take another look!

@Kirill89
Copy link
Copy Markdown

Kirill89 commented Aug 20, 2019

👋 I still can reproduce the issue locally with

_.defaultsDeep({}, JSON.parse('{"constructor": {"prototype": {"a0": "polluted!"}}}'));
console.log(({}).a0);

I believe you also need to change line

var value = object[key],
to

var value = safeGet(object, key),

according to https://github.com/lodash/lodash/blob/master/.internal/baseMergeDeep.js#L30

Copy link
Copy Markdown

@Kirill89 Kirill89 left a comment

Choose a reason for hiding this comment

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

👍

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants