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

Make Object.prototype an Immutable Prototype Exotic Object #308

Closed
wants to merge 1 commit into from

Conversation

littledan
Copy link
Member

This patch builds a mechanism to fix the Proxy security issue documented
in bug #272 by locking down the prototype chain of the global object, as
Firefox has experimented with. Although the global object is provided by
the embedding environment, many embedding environments will include Object
in the prototype chain; preventing modification of Object.prototype
addresses the issue by making it impossible to insert a Proxy in that part
of the prototype chain of the global object. Embedding environments that
want to prohibit a Proxy from being in the proto chain of their global
object can make their global object and associated proto chain Immutable
Prototype exotic objects.


<emu-clause id="sec-immutable-prototype-exotic-objects">
<h1>Immutable Prototype Exotic Objects</h1>
<p>An <em>immutable prototype object</em> is an exotic object that disallows mutation of its prototype.</p>
Copy link
Member

Choose a reason for hiding this comment

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

I think this should be a dfn not an em.

Throughout the document you are inconsistent as to whether it's "immutable prototype exotic object" or "immutable prototype object" or "exotic immutable prototype object".

Copy link
Member Author

Choose a reason for hiding this comment

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

These should be fixed in the latest draft.

@bterlson bterlson added the needs consensus This needs committee consensus before it can be eligible to be merged. label Jan 22, 2016
This patch builds a mechanism to fix the Proxy security issue documented
in bug tc39#272 by locking down the prototype chain of the global object, as
Firefox has experimented with. Although the global object is provided by
the embedding environment, many embedding environments will include Object
in the prototype chain; preventing modification of Object.prototype
addresses the issue by making it impossible to insert a Proxy in that part
of the prototype chain of the global object. Embedding environments that
want to prohibit a Proxy from being in the proto chain of their global
object can make their global object and associated proto chain Immutable
Prototype exotic objects.
<p>When the [[SetPrototypeOf]] internal method of a immutable prototype exotic object _O_ is called with argument _V_ the following steps are taken:</p>
<emu-alg>
1. Assert: Either Type(_V_) is Object or Type(_V_) is Null.
1. Return *false*.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think that the following steps should be added before that one:

1. Let _current_ be the value of the [[Prototype]] internal slot of _O_.
1. If SameValue(_V_, _current_), return *true*.

Rationale: it is the behaviour, for ordinary objects, even when they are frozen (9.1.2, steps 3-4).

Copy link
Member

Choose a reason for hiding this comment

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

I agree with this. Unless I hear objections in the next few minutes I will spec it!

@littledan
Copy link
Member Author

By the way, I don't mean for this PR to be granted any time soon--the intention is just to open discussion around something more concrete.

@littledan
Copy link
Member Author

I think we had consensus on this change at the recent TC39 meeting. Merge?

@ljharb
Copy link
Member

ljharb commented Jan 29, 2016

@littledan it'll need rebasing, it's got conflicts

@bterlson
Copy link
Member

Rebase please.

@bterlson bterlson removed the needs consensus This needs committee consensus before it can be eligible to be merged. label Jan 29, 2016
leobalter added a commit to bocoup/test262 that referenced this pull request Feb 2, 2016
@@ -22734,7 +22748,7 @@
<!-- es6num="19.1.3" -->
<emu-clause id="sec-properties-of-the-object-prototype-object">
<h1>Properties of the Object Prototype Object</h1>
<p>The Object prototype object is the intrinsic object %ObjectPrototype%. The Object prototype object is an ordinary object.</p>
<p>The Object prototype object is the intrinsic object %ObjectPrototype%. The Object prototype object is an <a href="#sec-immutable-prototype-exotic-objects">immutable prototype exotic object</a>.</p>
Copy link
Member

Choose a reason for hiding this comment

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

don't need the manual xref here (dfn autolinking will take care of it).

@bterlson
Copy link
Member

bterlson commented Feb 4, 2016

Will address the outstanding comments, rebase, and merge.

@bterlson bterlson closed this in 935dad4 Feb 4, 2016
leobalter added a commit to bocoup/test262 that referenced this pull request Feb 11, 2016
Object.prototype is the immutable prototype exotic object

Ref tc39/ecma262#308
leobalter added a commit to bocoup/test262 that referenced this pull request Feb 12, 2016
Object.prototype is extensible and an immutable prototype exotic object,
it's [[Prototype]] value is null

Ref tc39/ecma262#308
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.

5 participants