Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/assets/sandbox/sandbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,21 @@ try {
console.error('Import failed', e);
}

//Block XHR, fetch, importScripts in sandbox
(function () {
XMLHttpRequest.prototype.open = () => {
throw new Error("XHR not allowed");
};

fetch = async () => {
throw new Error("fetch not allowed");
};

importScripts = () => {
throw new Error("Imports not allowed");
};
}) ();

onmessage = function(e) {
const data = e.data;
const api = new PecuniAPI.default()
Expand Down