policy: feature preloadAlways , preloadAllowed
This adds the ability for enforcement of what must be and is allowed to be preloaded. This can be used to harden or instrument globals as needed. It can be used for example to ensure censorship of process.binding
as can be seen in the test. Currently ESM does not have a way of preloading modules and blocking user code from completing until preloading is finished; this PR likely should not land until an answer of how to determine if something should be preloaded via the ESM loader vs the CJS loader is answered and test is written for them.
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
documentation is changed or added -
commit message follows commit guidelines