-
Notifications
You must be signed in to change notification settings - Fork 0
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
Prevent access of protected props with prototype manipulation #6
Comments
We can prevent prototype from being modified with |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The following example from tc39/ecma262#1341 (comment) shows a way to gain access to the protected members due to having access to the instance's class via the
.constructor
prop:It only works with
Protected
, notPrivate
.We can prevent it with a simple monkey patch of the
Object.get/setPrototypeOf
or__proto__
descriptors. Is there another way?We could also delete the
.constructor
prop and provide aStatic
helper for accessing static members without revealing the class constructor. Does anyone ever need the.constructor
prop for anything other than accessing static members?Another example (using infamous):
The text was updated successfully, but these errors were encountered: