Re: Object.freeze(Object.prototype) VS reality

2015-02-19 Thread Luke Scott
On Feb 19, 2015, at 9:23 AM, David Bruant bruan...@gmail.com wrote: Hi, Half a million times the following meta-exchange happened on es-discuss: - if an attacker modifies Object.prototype, then you're doomed in all sorts of ways - Don't let anyone modify it. Just do

Re: Object.freeze(Object.prototype) VS reality

2015-02-19 Thread Andri Möll
this, and the fact descriptors suffer inheritance which for 3 boolean properties or a method are absolutely not helpful and make the env doomed by `Object.prototype.writable = true` shenanigans. Umm, those solutions are in opposition. If you seal-freeze-scotch-tape Object.prototype up,

Re: Object.freeze(Object.prototype) VS reality

2015-02-19 Thread Mark S. Miller
On Thu, Feb 19, 2015 at 10:14 AM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: uhm ... have I forgotten a `delete` or should I have set `{value: Object.prototype[name], writable: false, configurable: false}` instead ? (enumerable should be preserved as false too) Either would

Re: Object.freeze(Object.prototype) VS reality

2015-02-19 Thread Andrea Giammarchi
uhm ... have I forgotten a `delete` or should I have set `{value: Object.prototype[name], writable: false, configurable: false}` instead ? (enumerable should be preserved as false too) Yep, actually you got me there, this is a light side effect since usually nobody redefines the

Re: Object.freeze(Object.prototype) VS reality

2015-02-19 Thread Andrea Giammarchi
Yeah, beside the fact whenever you freeze something, and you create a module, or a library, or whatever, you don't know what you are freezing up. Since priority is arbitrary, if script A sets stuff before script B then you are done. Also, I use Object.prototype without causing any sort of

Object.freeze(Object.prototype) VS reality

2015-02-19 Thread David Bruant
Hi, Half a million times the following meta-exchange happened on es-discuss: - if an attacker modifies Object.prototype, then you're doomed in all sorts of ways - Don't let anyone modify it. Just do Object.freeze(Object.prototype)! I've done it on client-side projects with reasonable success.

Re: Object.freeze(Object.prototype) VS reality

2015-02-19 Thread Mark S. Miller
On Thu, Feb 19, 2015 at 9:23 AM, David Bruant bruan...@gmail.com wrote: Hi, Half a million times the following meta-exchange happened on es-discuss: - if an attacker modifies Object.prototype, then you're doomed in all sorts of ways - Don't let anyone modify it. Just do

Re: Object.freeze(Object.prototype) VS reality

2015-02-19 Thread Andrea Giammarchi
this, and the fact descriptors suffer inheritance which for 3 boolean properties or a method are absolutely not helpful and make the env doomed by `Object.prototype.writable = true` shenanigans. Yes, I'd personally +1 all these fixes that made these ES5 features not the easiest one to play with

Re: Object.freeze(Object.prototype) VS reality

2015-02-19 Thread Mark S. Miller
On Thu, Feb 19, 2015 at 9:54 AM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: Just as workaround, if you really need that much to freeze the `Object.prototype`, you could: ```js Object .getOwnPropertyNames(Object.prototype) .filter((name) =