microsoft / vscode-remote-release

Visual Studio Code Remote Development: Open any folder in WSL, in a Docker container, or on a remote machine using SSH and take advantage of VS Code's full feature set.
https://aka.ms/vscode-remote
Other
3.69k stars 296 forks source link

Preventing Terminal Trust prompt #10219

Open jhhcs opened 2 months ago

jhhcs commented 2 months ago

System

C:\>ver
Microsoft Windows [Version 10.0.19045.4780]
C:\>code --version
1.92.2
fee1edb8d6d72a0ddff41e5f71a671c23ed924b9
x64

Description

When I open some files in an untrusted workspace, the following banner pops up:

image

Transcribed for searchability:

Do you trust the authors of the files in this folder?

Creating a terminal process requires executing code

If you don't trust the authors of these files, we do not recommend continuing as the files may be malicious. See our docs to learn more.

I would like to request the ability to disable this pop-up. To clarify, I very much want to keep the workspace untrusted and I very much want to prevent the creation of a terminal session, I just don't want to be prompted about it. I have the following settings enabled already:

{
 "security.workspace.trust.startupPrompt": "never",
 "security.workspace.trust.banner": "never",
}

but neither achieves the desired result.

In a recent session, this banner actually became a potential security risk; as I had assumed to be rid of the banner, I started typing immediately after opening the file. I happened to press Space in the exact moment that this banner popped up, confirming the default selection to trust the workspace, which was absolutely not what I intended.

meganrogge commented 2 months ago

we are using the workspaceTrustService here. I'd expect that to handle your configured settings properly.

https://github.com/microsoft/vscode/blob/5affce68172f0bcbcb69af1cad2418ad019468fa/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts#L1787

jhhcs commented 2 months ago

To reproduce, create a workspace that is not trusted. With an external file manager, create a file inside that workspace that requests a terminal to be spawned - in my case that is a Python file, but that is likely due to something the Python extension does. When that file is opened in VSCode, the above popup always appears and no setting I have tried can silence it.

jhhcs commented 6 days ago

Just following up on this briefly; is this recognized as an issue and reproducible? Do you need anything else from my end?

sbatten commented 1 day ago

What is the file that is causing the terminal to show automatically on startup? How can I reproduce that?