VS Code Restricted Mode is a Visual Studio Code security mode that opens untrusted workspaces with limited features. It disables or constrains extensions, tasks, debugging and some workspace actions until the folder or project is trusted, reducing the chance that unreviewed code runs automatically.
What Restricted Mode Changes in VS Code
Restricted Mode is the trust boundary inside Visual Studio Code. When a workspace is not trusted, VS Code limits features that can execute code or interact with the environment, so the editor can still be used for inspection while reducing the chance that an unreviewed project triggers automatic execution.
The practical effect is not simply “fewer features”, it is selective friction around the riskiest actions. That matters because modern developer workspaces often contain tasks, launch configurations, scripts, and extension hooks that can run before a user fully understands what the repository does.
Why Workspace Trust Matters
Workspace trust exists because source trees are not passive text. A repository can include build steps, debugger launch files, shell commands, extension recommendations, or settings that shape how the editor behaves. In a trusted workspace those conveniences improve productivity; in an untrusted workspace they can become an execution path.
Restricted Mode therefore treats trust as a prerequisite for automation. It is especially relevant for cloned repositories, take-home tests, sample projects, and any codebase whose provenance is uncertain. The core security idea is to separate “viewing code” from “running code that the workspace asks the editor to run”.
What Is Limited Until a Workspace Is Trusted
VS Code does not try to make every action impossible. Instead it constrains the parts most likely to invoke code, launch processes, or hand control to extensions. That includes tasks, debugging, some extension behaviors, and other workspace actions that could otherwise execute automatically on open or on demand.
This selective limitation is useful because it keeps read-only investigation available. A developer can inspect files, review changes, and decide whether the project merits trust, while the editor withholds higher-risk automation until the workspace is explicitly trusted.
Security Consequences of Trust Decisions
Workspace trust is a security control, not a convenience toggle. If a user trusts a malicious or tampered repository too early, the risk is that commands run in the background, extensions perform unintended actions, or debugger and task workflows expose local secrets, tokens, or files.
Just as importantly, Restricted Mode reduces hidden execution paths that defenders may otherwise overlook during code review. The security value is strongest when teams treat trust as part of intake and review, not as a one-time popup to dismiss.
Risk and Threat Considerations
Untrusted workspaces are a common entry point for developer-targeted attacks because they can mix malicious code with a persuasive reason to open the project. The danger is not only direct malware execution, but also a project that persuades the editor to run setup tasks, load risky extensions, or surface local material that should stay private.
Failure mechanism: An attacker places execution logic inside a repository or project file so that trust, automation, or extension behavior turns a routine open action into code execution or data exposure.
Impact: The result can be credential theft, environment tampering, source disclosure, or a foothold on a developer workstation that later spreads through signed commits, package publishing, or connected cloud access.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP ASVS, CIS Controls v8 and NIST SP 800-53 Rev 5 set the technical controls, while ISO/IEC 27001:2022 defines the regulatory obligations.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP ASVS | V13 — Configuration | Workspace trust constrains risky editor configuration paths and automation. |
| Recommendation — Review workspace configuration paths and limit execution-bearing settings until a project is trusted. | ||
| CIS Controls v8 | CIS-4 — Secure Configuration of Enterprise Assets and Software | Restricted Mode enforces safer defaults for untrusted developer software and workspace actions. |
| Recommendation — Harden developer workstations so untrusted projects cannot auto-run risky tasks or extensions. | ||
| NIST SP 800-53 Rev 5 | CM-7 — Least Functionality | Restricted Mode limits unnecessary capability until the workspace is explicitly trusted. |
| AC-3 — Access Enforcement | Trust gates which workspace actions and extensions are permitted to execute. | |
| Recommendation — Allow only the minimum editor functions needed before a workspace is trusted. Enforce trust-based access decisions for workspace actions that can execute code. | ||
| ISO/IEC 27001:2022 | A.8.9 — Configuration management | Workspace trust is a configuration control that changes execution exposure in the IDE. |
| Recommendation — Treat workspace trust settings as governed configuration and review them consistently. | ||
Practitioner Guidance
Why practitioners should care: Restricted Mode only helps if teams understand that trust is a deliberate decision point, not an inconvenience to bypass. The right model is to trust a workspace only after provenance, purpose, and expected behavior are understood.
What to watch for: Pay special attention to repositories that ask for immediate setup, prompt unusual extension installs, or rely on scripts and launch profiles before you have reviewed the code. Those are the moments where Workspace Trust should remain restrictive until the project is validated.
Related resources from NHI Mgmt Group
- What breaks when code mode gives agents more runtime freedom?
- What breaks when Restricted Admin mode and Credential Guard are not in place?
- What happens when LLMs are used to generate exploit code or jailbreak restricted models?
- Why does code mode reduce the cost and latency of long-horizon agent workflows?
Deepen Your Knowledge
Free weekly newsletter
Subscribe to the NHI & AI Identity Journal
The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.
Bonus 33% off our NHI Course when you subscribe.
Reviewed and updated by the NHIMG editorial team on November 25, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org