VS Code Workspace Trust is a security boundary for unfamiliar project folders. Restricted Mode tries to prevent automatic code execution by disabling or limiting features until you trust the folder.
You can still read and edit files while you review the project. Workspace Trust is an extra layer, not a complete sandbox: a malicious extension can ignore Restricted Mode, so install extensions only from publishers you trust.
What Restricted Mode disables
Restricted Mode prevents automatic code execution by limiting these features:
| Feature | Behavior in Restricted Mode |
|---|---|
| Terminal | Blocked by default. Opening one prompts you to trust the folder. |
| Tasks | Running or listing tasks prompts you to trust the folder. |
| Debugging | Disabled. Starting a session prompts you to trust the folder. |
| Workspace settings | Some settings are ignored, especially paths to executables. |
| Extensions | Extensions that do not support Workspace Trust are disabled or limited. |
| AI agents | Disabled. Agents cannot run in untrusted workspaces. |
The trust state is shared between the main VS Code window and the Agents window. If a workspace is untrusted, agents are blocked in both places. The current official Workspace Trust guide lists the affected features and settings.
How to trust a folder
Open an unfamiliar folder
Use File > Open Folder and select a new project. VS Code opens it in Restricted Mode. You see a banner at the top and a Restricted Mode badge in the Status Bar.
Review the project contents
Look at the files. Check the .vscode folder for any tasks, launch configurations, or settings that point to unexpected executables. Read any scripts you plan to run.
Trust the folder
Click Manage in the Restricted Mode banner, then select Trust. You can also click the Restricted Mode badge in the Status Bar and choose Trust.
The banner disappears and the Workspace Trust restrictions are lifted.
You can also trust a folder from the Command Palette. Run Workspaces: Manage Workspace Trust and select Trust.
Understanding the trust decision
Trust a folder only when you know and trust its authors and maintainers. A familiar organization is a useful signal, but review the repository and its current contents before allowing execution.
Be cautious with:
- A random repository from an unfamiliar author
- A project shared through a file-sharing link
- A template or starter project you have not reviewed
- Any project that asks you to disable security features
When in doubt, stay in Restricted Mode. You can still read and edit code. You only lose automatic execution features until you decide to trust.
Managing trusted folders
VS Code keeps a list of folders and workspaces you have trusted. Open it by running Workspaces: Manage Workspace Trust from the Command Palette.
The Trusted Folders & Workspaces list shows every location you have trusted. You can add or remove entries manually. The currently open folder is shown in bold.
To trust many folders at once, trust a parent folder. Every subfolder under a trusted parent inherits trust. For example, trust a TrustedRepos folder and clone all your known-good repositories inside it.
Extension behavior in Restricted Mode
Extensions handle Restricted Mode in three ways:
- Disabled: The extension does not run, and its Activity Bar items and commands are not displayed.
- Limited: The extension runs but disables features that could be unsafe. For example, the built-in PHP extension disables the php.validate.executablePath setting.
- Full support: The extension declares support for untrusted workspaces and continues to run normally.
To see which extensions are affected, open the Workspace Trust editor and select the extensions are disabled or have limited functionality link. This opens the Extensions view filtered by @workspaceUnsupported.
Overriding extension trust
If an extension you trust is disabled in Restricted Mode, you can override its declared support. Open Settings, search for Extensions: Support Untrusted Workspaces, and select Edit in settings.json.
{
"extensions.supportUntrustedWorkspaces": {
"esbenp.prettier-vscode": {
"supported": true
}
}
}This complete settings example uses the identifier from the official VS Code documentation. The optional version field can limit an override to one extension version.
Be careful with any override. The extension author may have disabled or limited features for a security reason. Review the current publisher, version, changelog, workspace access, and trust support before enabling it.
Important Workspace Trust settings
| Setting | What it does | Default |
|---|---|---|
| security.workspace.trust.enabled | Turns Workspace Trust on or off | true |
| security.workspace.trust.startupPrompt | Whether to show a trust dialog on open | never (uses banner instead) |
| security.workspace.trust.emptyWindow | Whether empty windows are trusted | true |
| security.workspace.trust.untrustedFiles | How to handle files outside trusted folders | prompt |
Disabling Workspace Trust with security.workspace.trust.enabled is not recommended. It removes protection against malicious code execution without your knowledge.
Workspace Trust in multi-root workspaces
When you add a new folder to a trusted multi-root workspace, VS Code prompts you to decide whether to trust it. If you choose not to trust the new folder, the entire workspace switches to Restricted Mode.
Learn more about multi-root setups in the article on how to create and use a multi-root workspace. If you are deciding between folder and workspace setups, see VS Code folder vs workspace.
Command-line bypass
The --disable-workspace-trust command-line switch disables Workspace Trust for the current VS Code session. It removes the protection described above, so do not use it as a routine fix for an unfamiliar repository.
Rune AI
Key Insights
- Restricted Mode disables or limits terminals, tasks, debugging, AI agents, settings, and extensions.
- Workspace Trust is an extra safety layer, not a complete sandbox.
- Trust a folder from the banner, Status Bar, or Workspace Trust editor.
- A trusted parent makes all its subfolders trusted.
- Extension overrides and command-line bypasses weaken the boundary.
Frequently Asked Questions
Can I still edit code in Restricted Mode?
How do I untrust a folder I already trusted?
Does Workspace Trust apply to remote development?
Conclusion
Keep unfamiliar code in Restricted Mode while you review its authors, scripts, workspace configuration, and extension requirements. Trust the location only when you are comfortable allowing its tools to execute code.
More in this topic
How to Use VS Code with WSL 2 on Windows
Run VS Code connected to Windows Subsystem for Linux so you can develop in a full Linux environment with native tools, terminals, and debugging, all from Windows.
20 Best VS Code Extensions for Web Developers in 2026
Twenty carefully chosen VS Code extensions every web developer should know. Covers formatting, linting, frameworks, debugging, Git, and developer experience.
How to Install, Disable, Update, and Uninstall VS Code Extensions
Learn how to install, disable, update, and uninstall VS Code extensions from the Marketplace and the command line. Step-by-step instructions for every action.