DescriptionBrowser native Proxies can observe the emulated WeakMap HIDDEN_NAMEs,
which leaks the name and breaks WeakMap's invariants. Therefore to be
reliably safe we must either have all proxies in Caja compatible with
WeakMap, or avoid ever putting a proxy in an emulated WeakMap. The
latter is already the case, and this change merely helps enforce that.
Specifically, no existant platform supports Proxy but not WeakMap.
Native WeakMaps are safe, so we only have to worry about DoubleWeakMap,
which is used to deal with funky host objects (on Firefox) that cannot
be put in a native WeakMap. All WeakMaps in Caja fall into the
categories of either:
1. containing no funky host objects, or
2. containing no proxies.
In case 1, DoubleWeakMap can always use the native WeakMap, so it is
safe. In case 2, no proxy is involved in order to observe the hidden
name.
In this change, we loosely enforce the above division: DoubleWeakMap
will refuse to fall back to emulated weak maps unless the weak map has
been flagged to permit it using a privileged operation; the weak maps
used by the taming membrane are so flagged since they encounter said
funky host objects, and do not contain any Caja-created proxies.
Supporting changes:
* If we ever do encounter a platform with Proxy and not WeakMap, delete
Proxy so that nothing breaks.
* Remove WeakMap magic name detector from Domado, as it is now
unnecessary and ineffective.
* Fixed an incomplete change in r5039: getOwnPropertyNames hides hidden
names from any frame, but getPropertyNames does not. This is only
a problem for multiple interacting SES frames (which we no longer use
in Caja) on platforms which have Object.getPropertyNames (which does
not include current Chrome or Firefox), so it is not a current
vulnerability in Caja.
Fixes <https://code.google.com/p/google-caja/issues/detail?id=1725>.
@r5453
Patch Set 1 #
Total comments: 4
Patch Set 2 : Defend WeakMap against leaking its HIDDEN_NAME to proxies. #
Total comments: 5
Patch Set 3 : Defend WeakMap against leaking its HIDDEN_NAME to proxies. #
MessagesTotal messages: 13
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||