Skip to content

Use Object.hasOwnProperty instead of prototype method #1233

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

Merged
merged 1 commit into from
Jun 24, 2019

Conversation

mhamrah
Copy link
Contributor

@mhamrah mhamrah commented May 31, 2019

This PR addresses a situation uncovered with #1232 where the encode method calls hasOwnProperty of an object which may not have a prototype. This situation came about when mapping an express request to a grpc call, where a oneOf object is a sub-message of a parent object. Using Object.hasOwnProperty.call appears to a safer approach which doesn't make assumptions about the underlying object's inheritance.

@alexander-fenster
Copy link
Contributor

Thanks @mhamrah!

@alexander-fenster alexander-fenster merged commit 4d490eb into protobufjs:master Jun 24, 2019
@mbaranovski
Copy link

@alexander-fenster Is this going to be released anytime soon?

@alexander-fenster
Copy link
Contributor

@mbaranovski I don't have rights to release it, please ask @dcodeIO who is the owner of this library :)

johncsnyder pushed a commit to johncsnyder/protobuf.js that referenced this pull request Sep 21, 2019
pgherveou pushed a commit to pgherveou/protobuf.js that referenced this pull request Mar 28, 2020
taylorcode pushed a commit to taylorcode/protobuf.js that referenced this pull request Oct 16, 2020
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