browserify / browserify/vm-browserify

Prevent DOM access (i.e. XHR and such)

Open
#2 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
205
Forks
41
PR merge metrics
No merged PRs in 30d

Description

Just spent today working on a sandboxing thing from a different angle before I found this. Turns out it's actually somewhat complementary!
1. The `iframe.contentWindow.eval` trick does a great job preventing an untrusted script from messing with other people's object prototypes.
2. Combining `"use strict";` with a silly closure trick it seems possible to prevent access to all global objects…except object literal prototypes!

You can take a look at what I got on this in https://github.com/natevw/evel/blob/master/evel.js#L49 — I do whitelist the ES5 globals because I assume most code should be allowed to expect them. I'll be the first to admit that masking every global every function call is kind of "not ideal" but AFAICT combining https://github.com/natevw/evel's tricks with this iframe stuff yields a fairly declawed environment.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.