Learning resourcesReviewed · GitHub

GitHub Copilot: Using local sandboxing

This GitHub Docs guide shows developers using GitHub Copilot CLI or the Copilot app how to turn on local sandboxing, which limits the files, network access and credentials available to commands Copilot runs on their machine. Permitted bypasses give commands the user's normal access. It explains platform requirements, session controls, access policies, credential masking and troubleshooting. In the CLI, outbound internet access remains enabled by default.

Researched 15 Nov 2026

In short.

This guide helps GitHub Copilot CLI and app users limit local agent access, but approved bypasses can expose real credentials and the user's wider environment. It explains how to enable sandboxing, inspect effective permissions and troubleshoot blocked operations. CLI defaults allow writes in the working directory and temporary folders, plus selected additional locations, and permit outbound internet access. The app has different commands and persistence rules. No commands were executed; runtime isolation and tool compatibility were not assessed, and pricing is unknown.

Researched and written by an AI model and checked by a second AI model. How it works

Coverage includes the complete captured page at the exact source address, including its CLI and app instructions, prerequisites, notes, troubleshooting and bypass caveats. Linked conceptual, configuration, VS Code, Microsoft update and enterprise-policy pages are excluded; their contents and related notices were not assessed. No separate license notice is supplied. All runtime behavior remains untested.

The overview

Identity

Using local sandboxing is a GitHub Docs instructional page about restricting the files, networks and credentials available to commands run by GitHub Copilot. Its substantive instructions cover Copilot CLI and the Copilot app.

The page points VS Code users to separate documentation. It also links to conceptual explanations and detailed configuration guidance, whose contents are outside this page's scope. Original source: [https://docs.github.com/api/article/body?pathname=/en/copilot/how-tos/cloud-and-local-sandboxes/using-local-sandboxing].

Assessment

The guide is useful for enabling sandboxing and understanding what an active session actually permits. Its practical strengths include policy previews, explanations of credential handling and troubleshooting for blocked paths, Windows behavior and authentication failures.

Enabling the feature does not establish that every command is isolated or every secret is concealed. The page says most CLI commands and tools run inside the sandbox but does not identify which ones do not, and it allows policy-controlled bypasses. Detailed configuration requires the linked guidance, and the page provides no independent security evaluation.

Users

The guide suits developers who let Copilot run local commands and want to control access beyond their task directory. Beginners get enablement and status commands; experienced developers get effective-policy inspection, programmatic invocation and credential-proxy details.

Developers working under enterprise management need to distinguish personal settings from enforced policy. Administrators may be needed when a managed restriction blocks required access or an operating-system update is unavailable.

Capabilities

In Copilot CLI, /sandbox status reports the current session's enforced sandbox state, including whether managed settings require it. /sandbox policy shows effective filesystem permissions, network settings and capabilities. Adding a command previews its developer-tool access without executing it.

/sandbox config opens settings, as does /sandbox alone. /sandbox enable and /sandbox disable control enablement subject to managed policy. The --sandbox and --no-sandbox flags provide invocation-specific control, although --no-sandbox cannot override an enterprise requirement.

The page also covers session-only directory access through /add-dir PATH, optional masking of additional environment variables, credential authentication controls and policy-dependent retries outside the sandbox.

Using it

Requirements

For Windows, the page requires Windows 11 version 25H2 with KB5124010 or later, or version 26H1 with KB5124006 or later, with support for the BaseContainer tier of the ProcessContainer backend. On Linux, Bubblewrap version 0.5.0 or later and slirp4netns must be installed and available on PATH.

On Windows, masking additional environment variables requires a version that supports connections from the sandbox to services on the computer (host loopback) and enabling Allow local network on the Network tab in /sandbox config, which also permits private-network access. The page does not say whether these requirements also apply to the default Git and gh authentication.

Minimum Copilot CLI and app versions, supported macOS releases and subscription eligibility are not specified. The app cannot use local sandboxing for a cloud sandbox session or a session running on a remote host.

Mechanism

Copilot CLI places most invoked commands and tools inside an operating-system sandbox. Defaults permit writes in the current working directory and temporary folders. Within a Git repository, Git metadata is also writable, while repository content above the working directory is readable but not writable. Selected system and developer-tool locations are readable, and some caches are writable; these allowances do not expose the entire home directory.

Outbound internet access is enabled by default, while local-network access is disabled. Platform differences affect enforcement. Git and GitHub CLI authentication are enabled by default through placeholder credentials that a local proxy replaces only for approved HTTPS destinations. Git retains its original host, port and repository-path restrictions; gh credentials are limited to github.com, api.github.com and uploads.github.com.

Additional configured environment variables can receive the same placeholder treatment in sandboxed commands, local MCP servers and language servers. Real values are supplied only to specified HTTPS hosts through supported credential formats. An approved command bypass skips both masking and the proxy.

Setup

In an interactive CLI session, /sandbox enable activates sandboxing immediately. Ordinary enablement persists for future interactive and programmatic sessions through sandbox.enabled in the personal settings file, normally ~/.copilot/settings.json. Other sessions already open need their own /sandbox enable command or a restart, such as copilot --continue.

Ordinary /sandbox disable affects the current session and future sessions. If enterprise settings require sandboxing, disabling is refused unless effective policy permits bypass; that exception lasts only for the current session and leaves the saved policy unchanged. /sandbox enable restores protection in that session.

In an active Copilot app session, use /sandbox on or /sandbox off. These commands take effect immediately unless enterprise managed settings prevent the change. The choice survives that session's restart and overrides the repository default without changing other sessions. Entering either command before a session starts instead changes the selected repository or folder default. In the app, /sandbox alone does not open settings.

Example

For a dependency-installation task, an illustrative inspection sequence is /sandbox enable, then /sandbox status, then /sandbox policy npm install. The last command previews the access associated with npm install without installing packages. Its Notes can identify settings that could not be applied.

If required access is blocked, the guide recommends adjusting the necessary path or host rules through /sandbox config before requesting another attempt. /add-dir PATH grants session-only directory read and write access, subject to managed policy.

The guide's programmatic example is copilot --sandbox -p "PROMPT". It requests sandboxing for that invocation without enabling it for other sessions. None of these commands was executed.

Assessment & evidence

Limitations

Credential masking covers only configured environment variables and enabled Git and gh authentication. It does not hide secrets in credential files, other environment variables or remote MCP authentication. For masked variables, supported HTTPS credential headers and HTTP Basic passwords can receive real values; plaintext HTTP, request bodies, URLs and signed requests cannot.

Proxy compatibility can fail even when credentials and network rules are correct. Copilot supplies a temporary certificate bundle, but some tools ignore it. HTTP/2 requirements, certificate pinning, client certificates and request signing can remain incompatible. Optional certificate-authority installation on macOS or Windows changes trust outside Copilot too; Windows installation requires administrator approval.

Blocking a nonexistent path can create a directory at that path and any missing parents, which are not automatically removed. Blocking a nonexistent .env therefore creates a directory named .env. A policy preview does not create these directories, and Linux previews omit nonexistent paths even though their configured restrictions remain.

On Windows without required updates, PowerShell can report a drive root as its working directory and break directory-dependent Git operations. An absolute repository path can work around that specific issue. In the app, disabling sandboxing through a bypass prompt is temporary until restart or reattachment, unlike a saved /sandbox off setting. An enterprise owner can prevent users from running tools outside the sandbox in the app.

Reasoning

The documented controls make this guide a useful starting point when a developer wants Copilot commands constrained to intended files and services. Effective-policy inspection helps connect a blocked operation to a specific permission before expanding access.

The defaults need attention if the goal includes preventing outbound traffic or protecting all credentials: internet access starts enabled in the CLI, and masking has explicit coverage limits. Bypass permissions also determine whether those boundaries remain in effect. These suitability judgments follow from the documented behavior; security effectiveness was not assessed.

Alternatives

The page points VS Code users to its agent terminal sandboxing documentation at [https://code.visualstudio.com/docs/agents/run/agent-sandboxing]. That linked page's setup and capabilities were not assessed here.

Within the documented CLI, persistent enablement and invocation-only --sandbox control suit different usage patterns. The Copilot app uses separate session and repository defaults. Cloud sandboxes and remote-host sessions are mentioned but not explained or compared, and this page supplies no basis for comparing competing tools.

Evidence

The sole source is GitHub Docs' complete Using local sandboxing page at [https://docs.github.com/api/article/body?pathname=/en/copilot/how-tos/cloud-and-local-sandboxes/using-local-sandboxing]. It supports the command descriptions, prerequisites, defaults and troubleshooting details in this report.

These are documented behavior claims. No commands were executed, and filesystem isolation, network enforcement, credential substitution, enterprise-policy enforcement and cross-platform compatibility were not independently assessed. Linked pages and their additional requirements are outside the evidence.

Access & freshness

Costs

The page does not state Copilot subscription prices, required plan eligibility, a separate sandbox fee or usage charges. Those costs and entitlements are unknown.

It identifies operating-system and Linux dependency requirements but supplies no estimates for setup effort, resource consumption or administrative overhead.

Rights

The supplied page contains no license statement or redistribution grant for the documentation, Copilot software or named dependencies. Permission to reproduce, modify or redistribute those materials is not established by this evidence.

Freshness

The source was captured on 15 November 2026 at 04:42:55.457 UTC. Its captured source revision is sha256:e1bf071a6427b9101f461b56c2755efe7320f9131a33bb3fae04fd6ff6a9efd6.

The page references September 2026 Windows updates but provides no publication date, last-updated date or minimum Copilot CLI or app version. Capture time does not establish when each behavior was introduced or whether it remains unchanged afterward.

Actions

Confirm the listed platform prerequisites and applicable enterprise restrictions, then follow the commands for the interface you use. In the CLI, check /sandbox status and /sandbox policy after enabling protection, including writable Git metadata, caches and permitted network access.

For a blocked operation, preview its policy and inspect Notes before changing the necessary path or host rules. Check credential-proxy compatibility if authentication fails. For masking additional environment variables on Windows, account for the host-loopback requirement and the private-network access permitted by enabling Allow local network.

Decide whether a saved setting, invocation-only sandbox or session-only directory grant matches the task. Review the described access before approving a bypass, since a command outside the sandbox loses its credential masking and proxy restrictions. Consult the linked configuration guidance for settings not explained on this page.

Evidence for this report

selected-page.txtselected · checked 2026-11-15