In VS Code 1.57, I see this on the left of my status bar:
What is Restricted mode
and how I can I remove this from my status bar?
This will disable all prompts and trust mode features, making vscode behave exactly like it did before this feature was added.
GUI (ctrl ,)
security.workspace.trust.enabled
settings.json
"security.workspace.trust.enabled": false
At first glance, this new "Restricted Mode" seems unnecessary and obtrusive.
I believe its purpose is to prevent execution of untrusted code - e.g. as a result of an extension or using the "debug" option on an untrusted file. It seems to work in a similar manner to the restricted mode on MS Office apps, like MS Word, which restricts editing, saving and printing files until manually enabled.
From the Visual Studio Code documentation on Workspace Trust:
Restricted Mode tries to prevent automatic code execution by disabling or limiting the operation of several VS Code features: tasks, debugging, workspace settings, and extensions.
Personally, I have never come up against a situation where this would have been a problem and it seems like a constant nuisance for the sake of the one occasion it could be useful. That said, I imagine some people work with potentially dodgy files more often.
There are four new settings that allow us to customise this feature:
If you wanted to remove the feature, you can just switch off Trust, which "Controls whether or not workspace trust is enabled within VS Code". I have tried this and it does seem to completely disable this new feature - even removing related options from the command palette.
You can also control how VS Code works when opening an empty environment and how VS Code behaves with regards to untrusted files.
If you keep "Trust" enabled, you can also configure folders that you consider "safe" - for example your usual workspace, vs. your downloads folder.
Follow these steps to configure your trusted folders:
Workspaces: Manage Workspace Trust
and select the entry when it comes up.The release notes for VS Code v1.57 can be found on GitHub. There is also a specific page dedicated to workspace trust on code.visualstudio.com.
Another new option, from VSCode 1.58 (June 2021)
Workspace Trust Banner Setting
Speaking of settings to configure the Workspace Trust feature, you'll notice a new setting to configure when the banner appears to notify indicate the current window is in restricted mode.
Like the
security.workspace.trust.startupPrompt
setting, the newsecurity.workspace.trust.banner
allows you to completely disable the banner after you've become familiar with the Workspace Trust feature and don't need any indication of which of your windows are in restricted mode.By default, this banner shows once per workspace and remains until it is dismmissed.
Note: the new (July 2021) article "Workspace Trust" by Chris Dias details that "Trust" concept.
We specifically ask if you trust the authors of this workspace because VS Code can't tell if the code is malicious or not (hey, we just know 1's and 0's), where it came from, if you intend to contribute to the project, etc.
You, on the other hand, are smart and you know where the code came from: you (ok), your company (probably ok), your buddy Kai (depends), or some random person on the internet (definitely not).
That knowledge helps make the tool smarter. If you trust the author, great! The tools and extensions have the green light to do their thing and provide a magical experience, and we're not going to bug you again.
If you don't, you are telling us be careful VS Code, don't execute any code. This is what we call Restricted Mode, where potentially harmful functionality is disabled so you can more safely browse the code and eventually make an informed decision.
Note:
From our own dogfooding as well as through interviews with other developers, we found that people generally have a primary folder where they put all their sources and consider it trustworthy.
We therefore added the ability to trust the parent folder directly from the dialog.
You can trust it and all the sub folders with one click and then you won't see the trust prompt again.
When prompted by the Workspace Trust dialog, if you choose No, I don't trust the authors, VS Code will go into Restricted Mode to prevent code execution. The workbench will display a banner at the top with links to Manage your folder via the Workspace Trust editor and Learn More about Workspace Trust.
You will also see a Restricted Mode badge in the Status bar.
Restricted Mode tries to prevent automatic code execution by disabling or limiting the operation of several VS Code features tasks, debugging, workspace settings, and extensions.
To see the full list of features disabled in Restricted Mode, you can open the Workspace Trust editor via the Manage link in the banner, or by clicking the Restricted Mode badge in the Status bar.
Restricted mode
means that you are currently working in an untrusted workspace ('restricted mode'). In 'restricted mode', some editor features (debugging, tasks, some extensions) are disabled to keep you safe when dealing with a project from an unknown source.
To disable the Restricted mode
status bar entry:
workspace trust
entryNote that this only hides the status bar entry, it does not change the trusted state of the workspace. This answer covers more details on workspace trust, how to trust a workspace (which also removes the status bar entry), and how to disable workspace trust entirely if needed
Even after disabling the Restricted Mode
status bar entry, you can always trust the workspace with the Workspace: Manage Workspace Trust
command