Skip to content

Instantly share code, notes, and snippets.

@muedsa
Last active August 23, 2019 07:25
Show Gist options
  • Save muedsa/90cee976165dacdd4fcec8aa69d0c4ae to your computer and use it in GitHub Desktop.
Save muedsa/90cee976165dacdd4fcec8aa69d0c4ae to your computer and use it in GitHub Desktop.
Wbe-JS-SandBox
let sandBox = {
g: {
document: {
write: function() {
document.writeln("document.write is unavailable <br>");
}
}
}, // new Proxy() https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Proxy
evals: []
};
sandBox.evals.push('document.write("233<br>");');
eval(sandBox.evals[0]);
with (sandBox.g) {
eval(sandBox.evals[0]);
} //https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Statements/with
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment