Safeguard
Developer Tools•

VS Code Workspace Trust and Restricted Mode, explained

What VS Code Workspace Trust does, what Restricted Mode turns off, and which settings control it, so you can open unfamiliar code without running it.

Safeguard Security Team
4 min read

Workspace Trust is the VS Code feature that asks whether you trust the authors of a folder before the editor or its extensions run code from it. If you say no, the folder opens in Restricted Mode, where tasks, debugging, the terminal and some settings are blocked or limited while plain text editing keeps working.

Why the prompt exists

Opening a repository in an editor feels like reading. It is not. Editors read project files that can start build tasks, point settings at executables, and activate extensions. A cloned repository from a stranger can therefore carry instructions that run the moment you open it.

Workspace Trust puts a gate in front of that. New, unfamiliar folders open in Restricted Mode, and a banner and a Status Bar badge show the state.

What Restricted Mode limits

According to the VS Code documentation, Restricted Mode affects these areas:

  • AI agents are disabled in the workspace.
  • Opening a terminal is blocked by default and prompts for trust.
  • Running or listing tasks prompts for trust.
  • Starting a debug session prompts for trust.
  • A set of workspace settings that can point to executables is disabled.
  • Extensions that have not opted into Workspace Trust are disabled or run with limited functionality.

You can see which extensions are affected with the @workspaceUnsupported filter in the Extensions view. Settings that need trust carry the @tag:requireTrustedWorkspace tag.

Trusting and untrusting

Use the Manage link on the banner, the Status Bar badge, or the Workspace Trust editor. You can also run Workspaces: Manage Workspace Trust from the Command Palette. Trusting a parent folder trusts every subfolder under it, which is convenient and also the easiest way to over-trust. Think before trusting a folder like your whole projects directory.

Codespaces and attached Docker containers are trusted automatically.

Settings worth knowing

  • security.workspace.trust.enabled turns the feature on or off. The default is true.
  • security.workspace.trust.startupPrompt controls the startup dialog. The default is never, and once prompts on the first open of each folder.
  • security.workspace.trust.untrustedFiles controls what happens when you open a file from outside a trusted folder.
  • extensions.supportUntrustedWorkspaces overrides an extension's own trust declaration.

There is also a command line switch, --disable-workspace-trust, which turns the feature off for one session. Avoid it as a habit.

A practical routine

Keep the startup prompt on if you open code from many sources. Setting security.workspace.trust.startupPrompt to once asks the first time you open each folder, which turns trust into a conscious choice rather than something you click past. Review the Trusted Folders and Workspaces list now and then, and remove entries for projects you no longer work on or whose authors you no longer know.

For teams, agree on what counts as trusted: repositories your organisation owns, for example, but not forks from strangers or code samples from the internet. Write it down so new developers do not guess.

What it does not do

The docs are direct that Workspace Trust cannot stop a malicious extension from running code. It governs what a folder can trigger, not what an extension you installed will do. Pair it with care about which extensions you install, covered in our guide to vetting a VS Code extension.

Quick check

Does Restricted Mode stop me from reading code?

No. Text editing still works. What is blocked is running things: tasks, debugging, the terminal, and settings or extensions that execute code.

Is trusting a parent folder safe?

It trusts all subfolders, including repositories you clone there later. Trust specific project folders unless you control everything under the parent.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.