fix: inheriting NODE_OPTIONS on macOS with integrated terminal#204682
fix: inheriting NODE_OPTIONS on macOS with integrated terminal#204682deepak1556 merged 1 commit intomainfrom
Conversation
| // Restore NODE_OPTIONS if it was set | ||
| if (env['VSCODE_NODE_OPTIONS']) { | ||
| env['NODE_OPTIONS'] = env['VSCODE_NODE_OPTIONS']; | ||
| delete env['VSCODE_NODE_OPTIONS']; |
There was a problem hiding this comment.
sanitizeProcessEnvironment will remove VSCODE_ variables, this is not necessary but no harm in being explicit.
There was a problem hiding this comment.
We do this so as to not leak our own NODE_OPTIONS into terminal/debug processes where it could cause problems.
bpasero
left a comment
There was a problem hiding this comment.
Curious why we would only do this on macOS and not other platforms?
|
The equivalent on windows would be app container but we don't have a demonstration of similar issue there. This is only an issue on macOS (where we also got the report) since LaunchServices allows calling into an unsandboxed app from a sandboxed app. |
Tyriar
left a comment
There was a problem hiding this comment.
fyi @connor4312 in case this new NODE_OPTIONS info is going to break JS debug terminals.
|
Will this be on 1.87? |
|
I believe there are other NODE_* variables that are affected too - e.g., if you install node via Nix then NODE_PATH is set and required to be set. |
|
@GBrachetta yes this will be on |
fix: inheriting NODE_OPTIONS on macOS with integrated terminal (#204682)
Fixes #204005
With electron/electron#40770
NODE_OPTIONSandNODE_REPL_EXTERNAL_MODULEwill be removed if the application launching the VS Code application does not share the same codesign attributes. This is to prevent sandboxed applications on macOS from bypassing the sandbox by using theELECTRON_RUN_AS_NODEmode of our application.One downside with the detection is that launching the application from CLI will remove these variables if the user had set them in their terminal config files, so any external applications like nodejs binary cannot use these variables from integrated terminal if shell integration is not in play. This patch adds a workaround to temporarily store the variables in
VSCODE_and restore them in the terminal environment.Alternative take on #204396 /cc @forivall