On Sun, Mar 21, 2021 at 05:34:21PM -0400, Karl Dahlke wrote:
> This is just me thinking out loud.
> 
> Let's say we share the Table class in the master window mw$.
> I don't have to replicate it and its methods for every web page.
> Saves time and memory etc. All good.

Agreed, if we can do so safely.

[...]

> If the prototype object exists, and you can see it, you can add something to 
> it.
> Maybe you can't change what's there, but you can add to it.
> So we would have to be 100% perfect, with a function or at least a stub for 
> every method that exists,
> and we would have to stay current with this as the DOM evolves,
> cause if we don't, a shared class opens up a security risk.

Does it also open us up to any other unintended interaction (e.g.  someone
getting their hands on our prototype object somehow without using our shared
window object)? I simply don't know js well enough to know if there's any
way to get hold of an object's prototype from the object or, in a browser
context, its own window and for that to cascade to other windows if one does 
that.

> That's how it looks to me anyways.
> 
> Do you follow what I'm saying?
> 
> No wonder every browser writes all its classes in C, thus shared at a level 
> that can't be hijacked;
> but of course we don't have the manpower to do that.
> And if we did, we are, at that point, heavily invested in an engine;
> I couldn't just switch engines in a couple weeks as I just did with quick.
> 
> That's my discouraging thought for the day.

Even if I'm concerned about nothing above, your security explanation makes
perfect sense (unfortunately).  I'm not sure of the best way around this
other than not to share classes.  This'd suck a bit from a performance
perspective (and possibly others) however it'd mean we had a somewhat better
isolation model from a security perspective.

In the spirit of coming up with an overly positive take on this; at least
we're thinking of security and getting to a point where this matters.
That's a good, if work-intensive, thing.

Cheers,
Adam.

Reply via email to