If I
delete global.process
in a nodejs worker thread can it be restored or has it been permanently removed from the worker thread?
Trusted user code is running in the worker thread via Function() object which means that require is not available. In this post Node "ReferenceError: require is not defined" when executing a Function object it shows that require can be defined via:
var testF = new Function("x","y", "var require = global.require || global.process.mainModule.constructor._load; var http = require('http');");
but since process is not available on global (because of delete global.process in worker) that does not work and attempt to restore process via require("process")
will fail.
The code is run by trusted users but I nevertheless want to assert some control over it, hence the question.