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

Preventing Terminal Trust prompt #24770

Open
jhhcs opened this issue Sep 4, 2024 · 13 comments
Open

Preventing Terminal Trust prompt #24770

jhhcs opened this issue Sep 4, 2024 · 13 comments
Assignees
Labels
triage-needed Needs assignment to the proper sub-team

Comments

@jhhcs
Copy link

jhhcs commented Sep 4, 2024

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
Copy link

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
Copy link
Author

jhhcs commented Sep 26, 2024

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
Copy link
Author

jhhcs commented Nov 20, 2024

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

@sbatten
Copy link
Member

sbatten commented Nov 25, 2024

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

@sbatten sbatten added the info-needed Issue requires more information from poster label Nov 25, 2024
@jhhcs
Copy link
Author

jhhcs commented Nov 27, 2024

You can reproduce this as follows. Create a folder that is not trusted by VSCode, I will assume this location:

x:\workspace

Install the Python and Pylance extensions, and add the following to your VSCode settings:

    "extensions.supportUntrustedWorkspaces": {
        "ms-python.python": {
            "supported": true,
        },
        "ms-python.vscode-pylance": {
            "supported": true,
        },
    }

Create a file named

x:\workspace\test.py

Open the folder in VSCode. Inside VSCode, open the file test.py. This should produce the prompt shown in the original post.

@sbatten
Copy link
Member

sbatten commented Dec 10, 2024

Ah, I see, you force override the Python extensions to run in an untrusted workspace. While we support you doing this, it is not a supported flow. This is a feature request on the python extensions to support untrusted workspaces and live with some features disabled. @luabud @karthiknadig

@sbatten sbatten assigned karthiknadig and luabud and unassigned lszomoru and sbatten Dec 10, 2024
@sbatten sbatten removed the info-needed Issue requires more information from poster label Dec 10, 2024
@karthiknadig
Copy link
Member

karthiknadig commented Dec 10, 2024

@sbatten Python extension already supports running in untrusted workspace to provide completions, features like code execution, Testing, REPL, etc are disabled in this mode. I think the user ask here is about the popups and notifications from core when opening untrusted workspaces.

@jhhcs
Copy link
Author

jhhcs commented Dec 10, 2024

user ask here is about the popups and notifications from core when opening untrusted workspaces

That is correct.

@karthiknadig karthiknadig assigned sbatten and unassigned karthiknadig and luabud Jan 2, 2025
@jhhcs
Copy link
Author

jhhcs commented Jan 28, 2025

Just checking in, are there any updates here? Should I do something?

@sbatten
Copy link
Member

sbatten commented Jan 31, 2025

@karthiknadig if you support running in an untrusted mode, then I don't think you should be auto-triggering any actions which require workspace trust. That seems to be the cause of the dialogs.

@karthiknadig
Copy link
Member

@jhhcs Was this something that showed up automatically, or after triggering something?

@sbatten We don't allow anything other than LS features in untrusted mode.

@jhhcs
Copy link
Author

jhhcs commented Feb 2, 2025

Dear @karthiknadig, as explained here, this happens as soon as I open a Python file.

@karthiknadig
Copy link
Member

I apologize for missing that. Moving this to Python repo for further investigation.

@karthiknadig karthiknadig transferred this issue from microsoft/vscode-remote-release Feb 2, 2025
@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Feb 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

7 participants