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

prefer-primordials: Add check for applying null [[Prototype]] objects to {Object,Reflect}.defineProperty #1113

Closed
petamoriken opened this issue Jan 11, 2023 · 0 comments · Fixed by #1307

Comments

@petamoriken
Copy link
Contributor

// prototype pollution
Object.prototype.configurable = true;

const foo = Object.defineProperty({}, "foo", { value: 123 });

// { value: 123, writable: false, enumerable: false, configurable: true }
console.log(Object.getOwnPropertyDescriptor(foo, "foo"));
// OK
Object.defineProperty({}, "foo", { __proto__: null, value: 123 });

How about checking for __proto__: null if the third argument is object literal?

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 a pull request may close this issue.

1 participant