问题描述
我刚刚启动 VS Code 1.57 并看到以下消息:您信任此文件夹中文件的作者吗?"
为什么我会看到这条消息?
我应该信任当前的工作区吗?
背景
VS Code 1.57 引入了
在命令面板中运行 Workspaces: Manage Workspace Trust
命令
这将打开一个新的编辑器,让您管理对当前工作区的信任:
选择信任
切换到信任的工作区
我可以禁用受信任的工作区吗?
是的,但请记住,这样做会带来安全性权衡.这里有几个选项:
使用单个受信任的文件夹来保存您的项目
如果您处理多个您信任的项目并且不想被提示单独信任每个项目,您可以考虑信任它们的父文件夹.
- 运行
工作区:管理工作区信任
命令 - 向下滚动到
Trusted folders and workspaces
部分,然后单击Add Folder
- 选择所有受信任工作区的父文件夹
现在您在父文件夹下打开的任何项目都将被自动信任.
完全禁用受信任的工作区
如果您真的想完全禁用受信任的工作区,您可以使用Security › Workspace › Trust: Enabled
设置.
security.workspace.trust.enabled":false
I just launched VS Code 1.57 and see this message: "Do you trust the authors of the files in this folder?"
Why am I seeing this message?
Should I trust the current workspace?
Background
VS Code 1.57 introduces the concept of trusted workspaces. Trusted workspaces try to make it clear that while simply browsing through code is safe, enabling all editor features in a folder/project that came from a malicious source could potentially put you in danger.
The prompt is shown when you open a new folder for the first time. Here VS Code is asking if it should be trusted or not:
If you select
No, I don't trust the authors
, VS Code will open the workspace in 'restricted mode'. This is the default for all new workspaces. It lets you safely browse through code but disables some editor feature, including debugging, tasks, and many extensions. However keep in mind that 'restricted mode' is all you need for many use cases.If you select
Yes, I trust the authors
, VS Code will trust the current workspace and enable all of the editor feature you are used to in it.
You can easily change your choice later on too
So should I trust this workspace or not?
Ultimately you will need to decide for yourself if you are comfortable trusting a workspace or not. Here are a few general guidelines:
Stick with restricted mode if:
You just need to quickly read some code.
You got the workspace from an unfamiliar/untrusted source (such as that random zip someone posted on a sketchy forum)
Consider trusting the workspace if:
You trust the source of the workspace and know how code ends up in your workspace
And you also need all the features of VS Code, such as debugging
What if I change my mind?
Say you start in restricted mode but later realize that you now need to use the debugger (and you are confident in where the contents of the workspace came from). To switch to trusted mode, you can:
Click on the
restricted mode
entry in the status barRun the
Workspaces: Manage Workspace Trust
command in the command palette
This will open a new editor that lets you manage trust of the current workspace:
Select Trust
to switch into a trusted workspace
Can I disable trusted workspaces?
Yes, but keep in mind that doing so comes with security tradeoffs. Here are a few options:
Using a single trusted folder to hold your projects
If you work with many projects that you trust and don't want to be prompted about trusting each one individually, you can consider trusting their parent folder.
- Run the
Workspaces: Manage Workspace Trust
command - Scroll down to the
Trusted folders and workspaces
section and clickAdd Folder
- Select the parent folder of all your trusted workspaces
Now any project you open under the parent folder will be trusted automatically.
Disabling the trusted workspaces entirely
If you really want to disable trusted workspaces entirely, you can use the Security › Workspace › Trust: Enabled
setting.
"security.workspace.trust.enabled": false
这篇关于VS Code:您信任此文件夹中文件的作者吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!