Using Local Sandboxing (GitHub Copilot CLI)
- Source
- docs.github.com
- Author
- github
- Date

Context
GitHub's updated documentation for local sandboxing in Copilot CLI explains how the feature confines the commands Copilot runs on a developer's own machine, and where that confinement ends. After a user runs /sandbox enable, Copilot CLI runs most of the commands and tools it invokes inside an operating-system sandbox, for the current session and every later one until it is disabled. On Linux this requires Bubblewrap and slirp4netns; on Windows it requires specific recent Windows 11 updates.
By default, sandboxed commands can write only within the current working directory and temporary folders, plus the repository's and some build and package caches. The rest of a repository above the working directory is readable but not writable, selected system and developer-tool locations are readable, the default does not open the whole home directory, and other paths are blocked unless the user grants access. Outbound internet access is on and local network access is off. Running /sandbox policy shows the effective paths and network settings, and adding a command, as in /sandbox policy npm install, previews the access that command would get without running it.
Credentials are handled by substitution. Sandboxed commands receive placeholder Git and GitHub CLI credentials, and a local proxy replaces them with the real ones only for approved HTTPS destinations; GitHub CLI credentials are used only for github.com, api.github.com and uploads.github.com. Users can mask other environment variables, such as API tokens, the same way and name the hosts allowed to receive each real value. The proxy inserts a real value only into an HTTPS request header or a Basic-auth password, not into plaintext HTTP, request bodies, URLs or signed requests. The documentation is explicit that masking does not hide secrets in credential files, in other environment variables or in remote .
The protection stops when a command runs outside the sandbox. When the sandbox blocks something, Copilot can offer to retry the command with broader access, and these bypass requests are on by default. An approved bypass skips credential masking and the proxy, so the command runs with its ordinary environment, which can contain real secret values. Disabling the sandbox for the session goes further and gives every later command broader access, not only the blocked one. Enterprise-managed settings can require sandboxing and block the --no-sandbox option, though a session-only opt-out is still possible when the managed policy permits bypass. The documentation calls /sandbox status the reliable way to confirm whether Copilot's commands are actually being sandboxed. GitHub later made local sandboxing generally available across Copilot CLI, the Copilot app and VS Code.
- Git and version control — A system for recording and comparing changes to a codebase.
- Metadata — Data about a file, such as its name, size and timestamps, as distinct from its contents.
- Model Context Protocol (MCP) — A published agreement for an AI application to discover what a separate program offers and ask it to run one of those offerings.
- Authentication — The check that a presented credential matches the identity it claims.
articleGemini 3.8 Flash arrives in GitHub Copilot across IDEs, CLI and cloud agent- postAI coding agents can generate features fast, but can package them in one giant,
postWhat does it take to modernize an 8-year-old codebase? Stacks (on stacks). 🥞
articleGo from an empty repo to a live GitHub Pages site on a custom domain, secured wi
Checking sign-in…
Loading comments…

