Skip to content

GUIDE, read 12 Nov 2026

Copilot's local agent mode needs sandboxing turned on, and its cloud agent firewall is not a full control

See the full indexAll guides

Surfaces this guide covers

  • Desktop apps
  • IDE assistants
  • Command-line agents
  • MCP servers
  • Browser extensions
  • SaaS copilots

Actions it covers

  • File read
  • Shell command
  • Network call
  • Credential access
  • Data paste
  • Package install

Copilot agent mode runs in two places with two different security models

Developers use Copilot's agent in two ways, and the controls do not carry across. Agent mode in VS Code works on the laptop, in the developer's workspace, with the developer's credentials. GitHub's cloud agent works in a GitHub-hosted environment, opens a pull request and never touches the laptop. GitHub's current documentation calls the second one the Copilot cloud agent; this guide uses that name.

The VS Code security documentation draws the line itself: managed compute is a different boundary from process-level agent sandboxing, and local sandbox or approval settings do not configure the cloud service. A security review therefore needs two checklists. The local one is about shell, files, MCP and credentials on the device. The cloud one is about branches, workflows and a network firewall.

Local approvals come in four levels, and the top two remove the review

Per the VS Code security page, a Copilot session has a permissions picker. Manual permissions uses the configured approval settings. Assisted permissions uses an LLM judge to evaluate each tool call and asks the developer when the judge does not approve it. Allow all auto-approves every tool call. Autopilot is an agent mode that auto-approves all tools and drives the agent to continue until the task is complete.

The page recommends keeping auto-approval scoped to the session rather than the workspace or user level, which limits how long wider trust lasts. When a tool or terminal command is approved automatically, VS Code shows an information message with a link to the setting that enabled it, which helps a developer notice drift but does not alert an administrator.

Untrusted projects are the other entry point. VS Code's guidance is to open them in restricted mode, which disables agents in that workspace until the project has been reviewed. Trust decisions cover the workspace, extension publishers, MCP servers and network domains, and MCP servers in .vscode/mcp.json and a workspace-root .mcp.json inherit Workspace Trust.

Terminal commands need approval, and the sandbox does not restrict the network by default

VS Code states that before executing terminal commands the agent requests explicit user approval. When terminal auto-approval is enabled, configurable per-command rules, including regex patterns, approve safe commands and prompt for potentially dangerous ones. Every subcommand in a compound command must match an approved rule. The docs add that terminal controls apply to Local harness sessions and configurations using the integrated terminal.

Agent sandboxing is available on supported platforms and restricts file system access for shell commands the agent runs and their child processes. The security page is specific about its network default: outbound network access stays enabled because chat.agent.sandbox.network.allowNetwork defaults to true, and network access has to be configured separately. A team that turns on sandboxing and stops there has limited file access but not exfiltration paths.

VS Code also documents a direct shell shortcut: a chat message that starts with ! runs the command immediately in the session's default shell without sending it to the agent or asking for approval. That is a developer action, not an agent action, but it is worth knowing when reading shell history.

  • Turn on agent sandboxing on supported platforms and set the network setting to match your egress policy.
  • Keep terminal auto-approval rules short. Review regex rules the way you review firewall rules, because an over-broad pattern approves everything it matches.
  • Use restricted mode for any repository the developer has not reviewed.

File edits are reviewable only for edits made through the editor's own tools

VS Code offers a setting, chat.tools.edits.autoApprove, with glob patterns such as "**/.env": false that require manual approval for edits to sensitive files. The security page recommends it for protecting those files.

The review surface has a stated limit. Keep and Undo tracks only edits made through supported edit tools, so changes made through terminal commands need separate review. The docs also say that keeping an edit acknowledges an already saved change; it is not approval before execution. The review is after the fact, which is why the terminal approval and sandbox settings carry the real weight.

MCP servers run with the developer's permissions and have an organization allowlist

VS Code's MCP documentation says plainly that local MCP servers can run code on the machine and that tools can access services using the developer's permissions. It tells users to review the publisher, the command or endpoint and the requested access before installing or starting a server, and not to enter passwords or API keys in server input forms. The security page adds that sensitive input parameters are stored in VS Code's secure credentials store and that VS Code implements the MCP authorization specification for OAuth.

For an organization, the enterprise page describes allowedMcpServers and deniedMcpServers in Copilot enterprise-managed settings. The allowlist limits which MCP servers developers can install and run, and the denylist blocks servers even when they match the allowlist. GitHub's example permits remote servers under one URL prefix while blocking one endpoint. These keys must be delivered through a managed-settings method, not through a developer's editor settings or mcp.json.

Managed settings, device policy and GitHub account settings are three separate layers

The VS Code enterprise page names three management solutions. Copilot enterprise-managed settings apply guardrails across supported clients such as VS Code and Copilot CLI, delivered as server-managed, MDM-managed or file-based settings, with team overrides for server-managed deployments. VS Code device policies are deployed through Group Policy, Microsoft Intune or macOS configuration profiles and override the corresponding user settings. GitHub organization and enterprise settings cover account-level controls such as Copilot access, model availability and content exclusions, and follow the signed-in GitHub account rather than the device.

When enterprise-managed settings and a device policy configure the same control, the enterprise-managed setting wins and the values are not merged. Not every setting applies to every client, so check the supported-clients column in GitHub's reference. Developer: Policy Diagnostics in VS Code shows the effective value and its source, which is the quickest way to confirm a rollout reached a laptop.

One interaction affects tool choice. The security page says Claude and Codex harnesses cannot enforce Copilot enterprise-managed settings, and they are disabled when enterprise-managed settings apply, including managed permission or sandbox settings. If your developers expect to use several agents inside VS Code, that is a decision to communicate before the policy lands.

The cloud agent limits what it can push, but its firewall has stated gaps

GitHub's risk documentation for the cloud agent lists its mitigations. It can push to a single branch: the pull request's branch when mentioned there, otherwise a new copilot/ branch. It cannot run git push directly, and branch protections and required checks still apply. Pull requests it creates are drafts that a human must review and merge. It cannot mark them ready for review, approve them or merge them, and the person who asked for the work cannot approve the pull request. By default, GitHub Actions workflows do not run until a user with write access clicks Approve and run workflows. GitHub also filters hidden characters, such as HTML comments, from issue and comment text before the agent sees it.

Network access is limited by a firewall configurable at the organization and repository level, with a recommended allowlist enabled by default so the agent can download dependencies. GitHub is explicit about its limits. The firewall applies only to processes the agent starts through its Bash tool, not directly to MCP server processes or processes started in configured setup steps. It applies only inside the agent's environment. GitHub also says sophisticated attacks may bypass it and that it should not be considered a comprehensive security solution. When the firewall blocks a request, a warning appears in the pull request with the blocked address and the command.

For automations that run on a schedule or on events, GitHub says input from untrusted users could become part of the prompt, so the owner chooses exactly which tools the automation may use.

An endpoint control fills the local half that GitHub's controls leave to the device

GitHub's cloud controls sit on GitHub's side, so an endpoint tool adds nothing there. The gap is local. Agent mode runs on the laptop, the sandbox network default is open, and the review surface does not track terminal changes. Vendors that say they cover Copilot at the endpoint include Microsoft, which says Defender collects installed VS Code extension data for agents like GitHub Copilot, and applies audit or block decisions through vendor event interfaces for GitHub Copilot CLI. CrowdStrike says hooks for GitHub Copilot can inspect prompts and block malicious activity before harmful actions run, and Zenity makes a similar pre-execution claim. Those are the vendors' statements, read on 12 Nov 2026.

Ask each vendor which Copilot surface it covers. Microsoft's own Defender documentation separates VS Code extension collection from Copilot CLI inspection, and the two are not the same interface.

Where this sits in the index

Sources

  1. Microsoft: VS Code docs, Copilot security, read 12 Nov 2026
  2. Microsoft: VS Code docs, agent tools, read 12 Nov 2026
  3. Microsoft: VS Code docs, agent mode in chat, read 12 Nov 2026
  4. Microsoft: VS Code docs, MCP servers, read 12 Nov 2026
  5. Microsoft: VS Code docs, AI settings in enterprise environments, read 12 Nov 2026
  6. GitHub: Docs, Copilot cloud agent risks and mitigations, read 12 Nov 2026
  7. GitHub: Docs, customizing or disabling the agent firewall, read 12 Nov 2026
  8. Microsoft: Defender AI agent support matrix, read 12 Nov 2026
  9. Microsoft: Defender AI agent runtime protection overview, read 12 Nov 2026
  10. CrowdStrike: Falcon Guardian blog post, read 12 Nov 2026
  11. Zenity: coding and personal agents use case, read 12 Nov 2026

Last reviewed 12 Nov 2026.