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 (collections/includesValue): prevent enumerable prototype check #1225

Merged
merged 1 commit into from
Sep 13, 2021
Merged

fix (collections/includesValue): prevent enumerable prototype check #1225

merged 1 commit into from
Sep 13, 2021

Conversation

ayame113
Copy link
Contributor

Add an Object.hasOwn() check to the for...in loop to prevent enumeration of keys that exist in prototype.

before:

Object.prototype.a = "hello";
includesValue({}, "hello"); // => true

after fix:

Object.prototype.a = "hello";
includesValue({}, "hello"); // => false

Copy link
Contributor

@LionC LionC left a comment

Choose a reason for hiding this comment

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

LGTM - and good timing, as this is not breaking now (function has not been released yet)

Pinging @kt3k

Copy link
Member

@kt3k kt3k left a comment

Choose a reason for hiding this comment

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

@ayame113 LGTM. Nice!

@kt3k kt3k merged commit c319a6d into denoland:main Sep 13, 2021
@ayame113 ayame113 deleted the includes-value-prototype-fix branch September 13, 2021 12:06
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.

3 participants