VS Code Workspace Trust and Restricted Mode Explained

Workspace Trust protects you from automatic code execution when you open an unfamiliar project. Learn what Restricted Mode disables, how to trust a folder, and when to override extension trust.

5 min read

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:

FeatureBehavior in Restricted Mode
TerminalBlocked by default. Opening one prompts you to trust the folder.
TasksRunning or listing tasks prompts you to trust the folder.
DebuggingDisabled. Starting a session prompts you to trust the folder.
Workspace settingsSome settings are ignored, especially paths to executables.
ExtensionsExtensions that do not support Workspace Trust are disabled or limited.
AI agentsDisabled. 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.

jsonjson
{
  "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

SettingWhat it doesDefault
security.workspace.trust.enabledTurns Workspace Trust on or offtrue
security.workspace.trust.startupPromptWhether to show a trust dialog on opennever (uses banner instead)
security.workspace.trust.emptyWindowWhether empty windows are trustedtrue
security.workspace.trust.untrustedFilesHow to handle files outside trusted foldersprompt

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

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.
RunePowered by Rune AI

Frequently Asked Questions

Can I still edit code in Restricted Mode?

Yes. Text editing remains available, although some language and extension features may be limited.

How do I untrust a folder I already trusted?

Run Workspaces: Manage Workspace Trust. Select Don't Trust, or remove the location from Trusted Folders & Workspaces. If trust comes from a parent folder, change the parent entry.

Does Workspace Trust apply to remote development?

Some managed workflows, including GitHub Codespaces and attaching to a running Docker container, are automatically trusted. Workspace trust is also shared between the VS Code window and the Agents window.

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.