(from @bpasero) We want to explore a model where the workbench in Electron does not access node.js APIs. In that model the Electron renderer process runs in sandboxed mode, much like any browser tab would do. Privileged code has to either move into a backend process and be accessible via IPC communication or into a preload script that exposes certain methods to the page.
script tags too (ASAR support?)vscode-sqlite3 native non-context-aware - @bpaseronative-keymap native context-aware - @alexdima _approach would be to move the code to the main process_Goal: foundations for sandbox without enabling sandbox
spdlog native non-context-aware - Sandeepchokidar native context-aware - @bpaserovscode-nsfw native non-context-aware - @bpaseronode-pty native non-context-aware - Danielwindows-process-tree native non-context-aware - Daniel (should move where terminal moves)handshake native unsure context??? (--> depends on where from remote connection is made)v8-inspect-profiler - Jograceful-fs - @bpaserovscode-proxy-agentelectron-browser modules into electron-sandbox by using preload APIselectron-sandbox back to electron-browser once completeelectron-browser (i.e. no node.js) Goal: enable sandbox
contextIsolation and use contextBridge for workbench preload script devTools: false)?TODO@sandbox in code that still need cleanupcode command)Uint8Array over Buffer<webview><webview> is unsupported in sandboxed renderers with contextIsolation:truenative-keymap is being removed from the rendererAn "implict" node-dependency that's not listed here is code loading. Today, the loader uses the fs and vm-modules which allows for v8 cached data usage.
Bootstrap sandboxed workbench code pointers:
sandbox & contextIsolation in window.tsworkbench-sandboxed.html from doGetUrlwindow.js so we need something like workbench-sandboxed.js and possibly workbench-preload.js that work properly in this modevs/workbench/workbench.desktop.main load a vs/workbench/workbench.desktop-sandboxed.main here with those things commented out that are not yet adoptedvs/workbench/electron-browser/desktop.main, require a vs/workbench/browser/desktop-sandboxed.main here that brings up the workbench without depending on node.js@bpasero we shouldn't mix localization support in the Web with support for Node free renderer. We need a very different story for the Web whereas for a node free renderer we can still install the LP on the local disk. We can simply not access them from the renderer. So I will change the item (I have discussed it that way with @egamma as well)
A minimal workbench in sandbox and contextIsolation mode can now be run via scripts/code.sh --__sandbox. It provides a in-memory file system and stubbed services for many things that are not yet adopted:

Some notes about vscode-ripgrep from Rob:
@bpasero given this we can move out the module from the transition list
Notes from discussion with Daniel:
node-pty
xterm, xterm-addon-*
windows-process-tree
node-pty livesA few more notes on node-pty:
node-pty, file watchers, etc.@deepak1556
@bpasero given this we can move out the module from the transition list
Sort of, are we saying that search can move 100% into the extension host? If so, we should do this on master already and thus the ripgrep dependency would move out of the renderer into the extension host.
Perhaps we need a general pure node process (off main or shared) which hosts native modules like node-pty, file watchers, etc.
@Tyriar Would the shared process not be sufficient for this already? Does it have to be a child-process of the shared process?
I agree that e.g. the file watcher must be a child-process simply because it uses a lot of CPU cycles potentially, but not sure about others.
@bpasero it would be for most things. In order to fix this bug on Windows where closing a terminal can deadlock the UI thread https://github.com/microsoft/node-pty/pull/415, we need node-pty to support workers. Doing it with a web worker is an option, but node-pty is a node library and supporting web workers is a hack that I'd rather not do.
That was just an idea though, it probably makes more sense to have a node process just for managing terminal processes to consolidate logic between main (local terminals) and ext host processes (remote terminals).
Most helpful comment
A minimal workbench in
sandboxandcontextIsolationmode can now be run viascripts/code.sh --__sandbox. It provides a in-memory file system and stubbed services for many things that are not yet adopted: