Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable contextIsolation for all windows #128099

Closed
bpasero opened this issue Jul 7, 2021 · 4 comments
Closed

Enable contextIsolation for all windows #128099

bpasero opened this issue Jul 7, 2021 · 4 comments
Assignees
Labels
debt Code quality issues sandbox Running VSCode in a node-free environment

Comments

@bpasero
Copy link
Member

bpasero commented Jul 7, 2021

We should explore to enable contextIsolation for all windows and ensure:

  • there are no critical performance regressions doing so
    • we could explore to implement message port based communication from renderer to main process to bypass the context bridge hop
  • there are no issues from the contextBridge when using the exposed API from our preload script
@bpasero bpasero added the sandbox Running VSCode in a node-free environment label Jul 7, 2021
@bpasero bpasero added this to the On Deck milestone Jul 7, 2021
@bpasero
Copy link
Member Author

bpasero commented Jul 7, 2021

Looks like there is a native crash when running from my macOS ARM device out of sources (branch: https://github.com/microsoft/vscode/tree/ben/contextIsolation):

03644fe8-2020-4c3f-8ec7-fc8f10755d5d.dmp.zip

@deepak1556
Copy link
Collaborator

Its a crash when trying to proxy process.env

get env() { return process.env; },
. Specifically, node environment object has a custom property interceptor which gets called when accessing enumerable properties https://github.com/nodejs/node/blob/394fdecc9141aa4c6a8ea7f1aecaf5fcaaaf5c72/src/node_env_var.cc#L368-L376, for whatever reason the v8 context passed to this interceptor is of the main world instead of the isolated world hence leading to EXC_BAD_ACCESS crash.

Temporary workaround until further investigation is to avoid hitting the custom interceptor by
get env() { return { ...process.env }; },

@bpasero
Copy link
Member Author

bpasero commented Jul 9, 2021

Thanks, pushed a fix for that.

We still cannot launch with contextIsolation: true, there are things we depend on that will not work. I wonder if sandbox: true has to happen first because some of these things seem node.js dependent.

enableASARSupport() is only available in node.js environments
Uncaught (in promise) TypeError: require.__$__nodeRequire is not a function
Uncaught TypeError: Cannot read property '__$__isRecorded' of undefined

@bpasero bpasero modified the milestones: On Deck, Backlog Jul 9, 2021
@bpasero bpasero added the debt Code quality issues label Aug 31, 2021
@bpasero bpasero modified the milestones: Backlog, On Deck Sep 21, 2021
@bpasero bpasero modified the milestones: On Deck, November 2021 Oct 17, 2021
@deepak1556 deepak1556 removed this from the November 2021 milestone Nov 16, 2021
@bpasero bpasero added this to the On Deck milestone Dec 6, 2021
@bpasero
Copy link
Member Author

bpasero commented Jul 3, 2022

I came to the conclusion that we can just go for sandbox: #154006

@bpasero bpasero closed this as completed Jul 3, 2022
@bpasero bpasero removed this from the July 2022 milestone Jul 3, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Aug 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
debt Code quality issues sandbox Running VSCode in a node-free environment
Projects
None yet
Development

No branches or pull requests

4 participants