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

Stop enabling O.p.constructor to be overridden by assignment. #587

Merged
merged 5 commits into from
Feb 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions packages/ses/src/enablements.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,24 @@
* leads to another record explaining which properties {@code
* Function.prototype} need to be repaired.
*/

export const moderateEnablements = {
'%ObjectPrototype%': {
constructor: true, // set by "acorn" v7.
// Acorn 7 does override `constructor` by assignment, but
// this is fixed as of acorn 8. Including the commented out
// line below in this list confuses the Node console.
// See https://github.com/Agoric/agoric-sdk/issues/2324
//
// So please update all
// acorn dependencies to at least 8 instead. We are unable to do
// so at this time due to a dependency via rollup. Instead we
// do a post-install patch of acorn.
// See https://github.com/Agoric/SES-shim/pull/588
// If you are similarly stuck, do likewise. Or uncomment out
// the following line and let us know why. The only known
// cost is the ugly display from the Node console.
//
// constructor: true, // set by acorn 7

hasOwnProperty: true, // set by "vega-util".
toString: true,
valueOf: true,
Expand Down
7 changes: 1 addition & 6 deletions packages/ses/test/test-enable-property-overrides.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,7 @@ test('enablePropertyOverrides - on', t => {

harden(intrinsics);

testOverriding(t, 'Object', {}, [
'constructor',
'hasOwnProperty',
'toString',
'valueOf',
]);
testOverriding(t, 'Object', {}, ['hasOwnProperty', 'toString', 'valueOf']);
// We allow 'length' *not* because it is in enablements; it is not;
// but because each array instance has its own.
testOverriding(t, 'Array', [], ['toString', 'length']);
Expand Down