Locking down the "process" and "Buffer" globals #235
Description
ES modules provide a strong encapsulation. It can be guaranteed that a module only has access to the global and imported bindings. This means module-level security becomes a very real possibility by providing import permissions per-module, which is quite exciting (and possible future directions for this group and related modules work in Node).
One thing that puts a spanner in all this is the process
and Buffer
globals in Node.js. They are always available in ES modules and if we ship modules with these then they could turn out difficult to deprecate. For example, process
gives access to high-resolution timers, OS details, base-level hooks and all native bindings. All of these are huge access vectors inhibiting security of modules.
I previously attempted to lock down these globals in nodejs/ecmascript-modules#5 but this was shot down pretty quickly for being a bad approach in terms of performance.
I'd like to reopen this discussion though, because if we can stop the ecosystem from using the process
and Buffer
globals, this will put us on a strong path for enabling modular security in Node.js going forward, and there will be no easier time to make this change than in the switch to modules. Once code in the wild relies on this stuff, deprecation gets much harder.