Skip to content

Implement a node.js-free, sandboxed, context isolated renderer Β #92164

Closed

Description

@egamma

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.

July

Backlog

  • Tests:
    • common/browser: run in BrowserWindow with sandbox: true
    • node.js/electron-browser: run in ELECTRON_RUN_AS_NODE

Architecture

image

Activity

  1. jrieken commented on Mar 9, 2020

    @jrieken
    Contributor

    An "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.

  2. bpasero commented on Mar 12, 2020

    @bpasero
    Contributor

    Bootstrap sandboxed workbench code pointers:

    • enable sandbox & contextIsolation in window.ts
    • load something like a workbench-sandboxed.html from doGetUrl
    • this will likely fail early on because of our AMD loader requiring node.js for cached data etc. and some other things we depend on from window.js so we need something like workbench-sandboxed.js and possibly workbench-preload.js that work properly in this mode
    • instead of vs/workbench/workbench.desktop.main load a vs/workbench/workbench.desktop-sandboxed.main here with those things commented out that are not yet adopted
    • instead of vs/workbench/electron-browser/desktop.main, require a vs/workbench/browser/desktop-sandboxed.main here that brings up the workbench without depending on node.js
  3. dbaeumer commented on Apr 15, 2020

    @dbaeumer
    Member

    Benjamin Pasero (@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 Erich Gamma (@egamma) as well)

  4. changed the title [-]Exploration: node.js-free, sandboxed renderer [/-] [+]node.js-free, sandboxed renderer [/+] on May 24, 2020
  5. 12 remaining items

  6. mjbvz commented on Mar 30, 2021

    @mjbvz
    Contributor

    368f44e enables iframe based webviews on desktop when search functionality is not required. We'll get testing of the iframe based webviews during 1.56 insiders

  7. Tyriar commented on Aug 27, 2021

    @Tyriar
    Contributor

    FYI following up on #116337, I believe the slowness I sometimes see with terminals is a result of the multiple process jumps since we can't communicate directly between the renderer and pty host yet. Was there an issue tracking this direct channel between renderer to arbitrary node process?

  8. bpasero commented on Aug 27, 2021

    @bpasero
    Contributor

    Daniel Imms (@Tyriar) we had it on our project board, but not as issue. I converted it to one and suggest you ping Deepak about status: #131798

  9. metmeylmz commented on Oct 31, 2021

    @metmeylmz
  10. sandy081 commented on Jan 4, 2022

    @sandy081
    Member

    CachedExtensionScanner is owned by Alexandru Dima (@alexdima) and hence removing my name.

  11. wzhudev commented on Feb 18, 2022

    @wzhudev

    Will floating window get supported (or easier to implement) under this new architecture?

  12. bpasero commented on Feb 18, 2022

    @bpasero
    Contributor

    No, it should not have any impact on that.

  13. bpasero commented on Jul 22, 2022

    @bpasero
    Contributor

    I think it is about time to close this one, insider builds are out on all platforms that allow to enable the sandbox via "window.experimental.useSandbox": true and #155827 is a test plan item to verify it works.

    Remaining issues are tracked with sandbox label: sandbox Running VSCode in a node-free environment

    Thinking on the timeline:

    • enable sandbox by default in insiders in August
    • enable sandbox by default in stable in September/October pending issues found

    πŸ₯‡

  14. locked and limited conversation to collaborators on Sep 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

plan-itemVS Code - planned item for upcomingsandboxRunning VSCode in a node-free environment

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions