abort first sframe boot stage if eval is possible

pull/1/head
ansuz 3 years ago
parent 07afa4640b
commit f495a6cbc8

@ -11,6 +11,25 @@ if (window === window.top) {
window.alert(s); window.alert(s);
}); });
} }
if (typeof(Promise) !== 'function') {
return void setTimeout(function () {
var s = "Internet Explorer is not supported anymore, including by Microsoft.\n\nMost of CryptPad's collaborative functionality requires a modern browser to work.\n\nWe recommend Mozilla Firefox.";
window.alert(s);
});
}
var caughtEval;
try {
eval('true'); // jshint ignore:line
} catch (err) { caughtEval = true; }
if (!/^\/(sheet|doc|presentation)/.test(window.location.pathname) && !caughtEval) {
return void setTimeout(function () {
window.alert("aborting because eval should not be permitted.");
});
}
var afterLoaded = function (req) { var afterLoaded = function (req) {
req.cfg = req.cfg || {}; req.cfg = req.cfg || {};
if (req.pfx) { if (req.pfx) {

@ -43,22 +43,5 @@ define([
throw e; throw e;
}; };
if (typeof(Promise) !== 'function') {
return void setTimeout(function () {
var s = "Internet Explorer is not supported anymore, including by Microsoft.\n\nMost of CryptPad's collaborative functionality requires a modern browser to work.\n\nWe recommend Mozilla Firefox.";
window.alert(s);
});
}
var caughtEval;
try {
eval('true'); // jshint ignore:line
} catch (err) { caughtEval = true; }
if (!/^\/(sheet|doc|presentation)/.test(window.location.pathname) && !caughtEval) {
return void setTimeout(function () {
window.alert("aborting because eval should not be permitted.");
});
}
require([document.querySelector('script[data-bootload]').getAttribute('data-bootload')]); require([document.querySelector('script[data-bootload]').getAttribute('data-bootload')]);
}); });

Loading…
Cancel
Save