keepcalculator

06 Numbers and Powers

Copilot Sandboxing in VS Code: What It Isolates

Card No. 06·29247 · Updated · Standard formula, shown below

Copilot sandboxing in Visual Studio Code limits what certain Copilot coding-agent actions can access or change, especially when they run commands or work with files. It is a boundary around the agent’s execution environment—not a guarantee that every part of VS Code, every extension, or every network connection is isolated.

What the sandbox is intended to isolate

When an agent works on a coding task, it may need to inspect project files, edit code, run tests, or execute shell commands. Sandboxing is meant to constrain those actions so they operate within an approved workspace or environment instead of having unrestricted reach across the computer. The exact boundary depends on the agent feature, operating system, VS Code configuration, and permissions in use.

In practical terms, the controls may restrict:

  • File access: which directories or files an agent-run process can read or modify.
  • Command execution: whether commands run in a constrained environment and which actions require approval.
  • Network access: whether processes launched by the agent can make network requests, where supported by the particular setup.

These are separate dimensions. A restriction on writing outside a workspace does not automatically mean the process cannot read outside it, and a file boundary does not by itself establish a network boundary. Check the specific feature’s documentation and displayed permission controls rather than assuming all three are enforced in the same way.

How it works in an agent workflow

A coding agent typically receives a task, gathers context, proposes or makes changes, and may invoke tools such as a terminal or test runner. Sandboxing applies to the relevant execution path: it can limit the environment in which agent-initiated operations happen, while VS Code still provides the editor interface and the user decides whether to allow actions when prompted.

For example, if you ask an agent to fix a failing test, it may need to read project files, edit a test or source file, and run a test command. A sandbox can keep those operations within a permitted project area. If the agent’s proposed command would access a location or capability outside that boundary, the environment may block it or ask for authorization, depending on the feature and configuration.

Sandboxing is not the same as previewing a change. Review the diff to see what files were edited, and inspect commands before approving them. If a command has side effects—such as deleting files, installing packages, or changing system settings—understand those effects independently of whether it runs in a sandbox.

What it does not isolate

Sandboxing should not be read as a blanket promise that Copilot cannot see sensitive information or that a project is safe to open. The agent may need access to files you have made available as context, and its capabilities depend on the permissions and tools enabled. A sandbox can narrow what a process can do; it does not determine whether the code or instructions it receives are trustworthy.

It also does not necessarily isolate the entire VS Code application. The editor, extensions, integrated terminal, and agent-run tools can have different permissions and execution models. Nor does sandboxing automatically protect secrets that are deliberately included in a prompt, committed to a repository, exposed through environment variables, or accessible to an authorized process.

Finally, “sandbox” does not mean “offline.” Network restrictions are implementation-specific. If a task handles confidential code or credentials, check the applicable product settings and organizational policies, avoid pasting secrets into prompts, and limit access to what the task needs.

Permissions, approvals, and practical use

Depending on the workflow, VS Code may ask before an agent runs a command or performs a consequential action. An approval prompt is a permission checkpoint; it is not proof that the command is harmless, and approving one action should not be treated as approval for unrelated future actions.

For a safer routine, use these habits:

  1. Open only the repository or folder needed for the task, rather than a broad directory containing unrelated personal files.
  2. Read the proposed command and consider what it reads, writes, downloads, or launches before approving it.
  3. Review the source-control diff after agent edits, then run relevant tests yourself or through a command you understand.
  4. Keep credentials and private data out of prompts and project files unless their use is necessary and permitted.
  5. If an action is blocked, check the relevant sandbox and permission settings instead of immediately disabling protections.

These practices are useful whether the sandbox is strict or limited: they reduce unnecessary access and make changes easier to audit.

Common misunderstandings and troubleshooting

A frequent misconception is that sandboxing means the agent can only see the file currently open. In many coding workflows, an agent may use other files in the workspace to understand the project. The meaningful question is which workspace content and tools are available—not simply which editor tab is selected.

Another misconception is that a blocked command proves the project is broken. The command may be outside the permitted boundary, require a capability that has not been granted, or depend on network access that is restricted. Check the message, confirm the command is needed, and use the narrowest appropriate permission. If an expected file cannot be accessed, verify that it is inside the opened workspace and that the relevant feature allows access.

When behavior differs between computers, compare the operating system, VS Code and agent configuration, workspace trust state, and organization-managed policies. Avoid relying on a setting name or behavior found in an old guide without confirming it is present in your current installation; product capabilities and labels can change.

Frequently Asked Questions

Does Copilot sandboxing isolate my whole computer?
No. It is intended to constrain particular agent-related actions, not to make all of VS Code and the operating system a single isolated environment. The scope depends on the feature and configuration.

Can Copilot still read files in my workspace?
It may access workspace files needed for the task, subject to the available context and permissions. Sandboxing is not necessarily a restriction to the active file alone.

Does sandboxing block internet access?
Not necessarily. Network access is a separate capability and must be checked for the specific agent workflow and setup.

Why was an agent command blocked?
It may have crossed a file or execution boundary, lacked permission, or requested a restricted capability. Review the message and command, then grant access only if the action is necessary and understood.

Is a sandbox a replacement for reviewing agent changes?
No. Inspect diffs and commands, run appropriate tests, and keep sensitive information out of the workflow. Sandboxing limits certain actions; it does not verify code quality or intent.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →