Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(168)

Issue 10162044: Defend WeakMap against leaking its HIDDEN_NAME to proxies. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 9 months ago by kpreid2
Modified:
12 years, 9 months ago
CC:
caja-discuss-undisclosed_googlegroups.com, MarkM, felix8a, Jasvir, metaweta, MikeSamuel
Base URL:
http://google-caja.googlecode.com/svn/trunk/
Visibility:
Public.

Description

Browser 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. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+91 lines, -101 lines) Patch
M src/com/google/caja/plugin/domado.js View 1 2 8 chunks +3 lines, -76 lines 0 comments Download
M src/com/google/caja/plugin/es53-frame-group.js View 1 2 1 chunk +2 lines, -1 line 0 comments Download
M src/com/google/caja/plugin/ses-frame-group.js View 1 2 2 chunks +5 lines, -3 lines 0 comments Download
M src/com/google/caja/plugin/taming-membrane.js View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M src/com/google/caja/plugin/taming-schema.js View 1 2 2 chunks +12 lines, -5 lines 0 comments Download
M src/com/google/caja/ses/WeakMap.js View 1 2 9 chunks +66 lines, -15 lines 0 comments Download
M tests/com/google/caja/plugin/es53-test-scan-guest.js View 1 2 1 chunk +2 lines, -1 line 0 comments Download

Messages

Total messages: 13
kpreid2
12 years, 9 months ago (2013-06-11 00:33:02 UTC) #1
MarkM
ses/* parts LGTM https://codereview.appspot.com/10162044/diff/1/src/com/google/caja/ses/WeakMap.js File src/com/google/caja/ses/WeakMap.js (right): https://codereview.appspot.com/10162044/diff/1/src/com/google/caja/ses/WeakMap.js#newcode28 src/com/google/caja/ses/WeakMap.js:28: * @provides cajaWeakMapPermitHostObjects I dont like ...
12 years, 9 months ago (2013-06-11 01:28:27 UTC) #2
kpreid2
Browser native Proxies can observe the emulated WeakMap HIDDEN_NAMEs, which leaks the name and breaks ...
12 years, 9 months ago (2013-06-11 16:51:51 UTC) #3
kpreid2
https://codereview.appspot.com/10162044/diff/1/src/com/google/caja/ses/WeakMap.js File src/com/google/caja/ses/WeakMap.js (right): https://codereview.appspot.com/10162044/diff/1/src/com/google/caja/ses/WeakMap.js#newcode28 src/com/google/caja/ses/WeakMap.js:28: * @provides cajaWeakMapPermitHostObjects On 2013/06/11 01:28:27, MarkM wrote: > ...
12 years, 9 months ago (2013-06-11 16:52:05 UTC) #4
MarkM
LGTM
12 years, 9 months ago (2013-06-12 14:59:38 UTC) #5
kpreid2
On 2013/06/12 14:59:38, MarkM wrote: > LGTM Do you agree that this does not need ...
12 years, 9 months ago (2013-06-12 16:34:48 UTC) #6
MarkM
Cheers --MarkM On Jun 12, 2013, at 9:34 AM, kpreid.switchb.org@gmail.com wrote: > On 2013/06/12 14:59:38, ...
12 years, 9 months ago (2013-06-12 17:15:53 UTC) #7
ihab.awad
lgtm++ https://codereview.appspot.com/10162044/diff/5001/src/com/google/caja/plugin/domado.js File src/com/google/caja/plugin/domado.js (right): https://codereview.appspot.com/10162044/diff/5001/src/com/google/caja/plugin/domado.js#newcode827 src/com/google/caja/plugin/domado.js:827: if ((lookup = this.col_lookup(name))) { Can remove an ...
12 years, 9 months ago (2013-06-13 19:45:56 UTC) #8
kpreid2
Browser native Proxies can observe the emulated WeakMap HIDDEN_NAMEs, which leaks the name and breaks ...
12 years, 9 months ago (2013-06-13 20:04:47 UTC) #9
kpreid2
Ihab, do you agree (as discussed earlier in the thread) that this patch need not ...
12 years, 9 months ago (2013-06-13 20:04:52 UTC) #10
MarkM
https://codereview.appspot.com/10162044/diff/5001/src/com/google/caja/plugin/domado.js File src/com/google/caja/plugin/domado.js (right): https://codereview.appspot.com/10162044/diff/5001/src/com/google/caja/plugin/domado.js#newcode827 src/com/google/caja/plugin/domado.js:827: if ((lookup = this.col_lookup(name))) { On 2013/06/13 20:04:52, kpreid2 ...
12 years, 9 months ago (2013-06-13 20:18:59 UTC) #11
ihab.awad
Given Kevin's assessment of the risk to date on actual browsers, I don't think we ...
12 years, 9 months ago (2013-06-18 20:07:12 UTC) #12
Mark S. Miller
12 years, 9 months ago (2013-06-18 20:27:57 UTC) #13
+1


On Tue, Jun 18, 2013 at 1:07 PM, <ihab.awad@gmail.com> wrote:

> Given Kevin's assessment of the risk to date on actual browsers, I don't
> think we need to keep this issue undisclosed.
>
>
>
https://codereview.appspot.**com/10162044/<https://codereview.appspot.com/101...
>
> --
> --
> ---You received this message because you are subscribed to the Google
> Groups "caja-discuss-undisclosed" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
caja-discuss-undisclosed+**unsubscribe@googlegroups.com<caja-discuss-undisclo...
> .
> For more options, visit
https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/o...
> .
>
>
>


-- 
    Cheers,
    --MarkM
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b