I am making a sandbox environment for javascript. For this I create a webworker with this function:
(self
is a webworkers global context)
(() => {
Function("\"use strict\";\nlet self,fetch;fetch,globalThis;(async()=>{try{"+arbitrary_code+"}}catch{})").apply({});
return;
})();
With this, people are only able to use vanilla javascript with no access to any browser api's. Is there any way to defeat this sandbox, is it secure enough?