"Remaining Hazards and Mitigating Patterns of Secure Mashups in ECMAScript 5"

Mark S. Miller erights at google.com
Mon Mar 19 22:27:19 PDT 2012


On Mon, Mar 19, 2012 at 3:10 PM, Aymeric Vitte <vitteaymeric at gmail.com>wrote:

>  'Avoid “this”. Use closures rather than prototypes'
>
> Probably the public was stunned by that one... (technical problems too,
> could not hear the video, just saw the slides)
>

Not really. I expected more resistance than I got. During the 20 minutes of
lively Q&A, this came up again. I clarified then something I should have
said earlier in the talk. The objects that need to be defensive are those
that might be exposed across a trust boundary, such as the counter in the
first example. For objects purely inside one trust domain, given that we
really are confident they cannot escape, they do not need to be defensive
since their clients are all presumably intimately cooperative.


> Technically for the purpose of your presentation, it is correct, but I am
> coming back again to real life, you are using strict mode and other means
> (such as questionnable setTimeout(xxx,0)) to secure Bob.
>

Sorry, but we're using these techniques in real life. And what's
questionable about setTimeout? (or better, <
http://dbaron.org/log/20100309-faster-timeouts>)


> Then what is the use of Bob if he can not do anything outside of himself ?
>

Please do make an effort to surmount whatever technical difficulties you
encountered, so that you can listen to the audio of the presentation. The
slides were not constructed to be self explanatory, and the talk was clear
on this point.



>
> A much more trivial security leak could be that the calling context does
> somewhere unexpectedly (or not) something like counter.x.y.z=window (Ex :
> like passing a node to Bob since it seems that Bob has to do some stuff
> with the dom to be usefull)
>

If Alice does not trust Bob, Alice should generally never give Bob direct
unmediated access to one of her dom nodes. Instead, she gives him access to
a virtual dom tree that wraps the real dom tree, allowing Bob to manipulate
a subtree of Alice's dom tree. We constructed the Domado library <
http://code.google.com/p/google-caja/source/browse/trunk/src/com/google/caja/plugin/domado.js>
for exactly this purpose.

The difficultly of emulating the dom faithfully in JS was also the original
impetus for the proxy work. The Domado library above does not rely on
proxies, as they are not yet as available as ES5.


>
> It's the same issue as multiple globals (if the concept of globals still
> exist in the future) I believe : how to separate completely several
> contexts while using objects between each others ? Looks very difficult
>
> I might be wrong, but on what today's examples the demonstration here
> could apply without Bob being useless or just returning something like a
> mathematical calculation or such not touching anything in the page ?
>

I'm sorry, I didn't understand these last two paragraphs. Could you clarify?

You might also want to try some of the scenarios you have in mind at <
https://caja.appspot.com/>.


-- 
    Cheers,
    --MarkM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120319/2b8fd066/attachment.html>


More information about the es-discuss mailing list