Copilot Code security considerations (Preview)

Important

Microsoft Copilot uses AI and might make mistakes or misinterpret instructions. Review requests and results carefully, especially before Copilot Code runs commands, connects to the internet, changes files, or before you share personal information. You're responsible for actions Copilot takes on your behalf. By using Copilot, you agree to the Terms of Use. For more information, see the Microsoft Privacy Statement.

Microsoft Copilot Code for personal accounts is currently in Preview.

This information relates to a prerelease product that may be substantially modified before it's released. Microsoft makes no warranties, expressed or implied, with respect to the information provided here.

Copilot Code can write and run software and take actions on your device for you. Microsoft built safeguards into Copilot Code to help reduce risk. You're still responsible for reviewing and approving what it does.

How Copilot Code helps keep you safe

  • Approval before sensitive actions. Copilot Code can read and write files in the project folder you select. By default it asks for your approval before it accesses other locations, connects to the internet, runs a command, or deletes files.
  • Sandbox for local projects. When Copilot Code works on a project on your device, it uses a sandbox. The sandbox limits which files and network resources Copilot Code and the commands it runs can access, and its limits also apply to the web preview. The sandbox is on by default and works alongside approval requests. Approving an action doesn't override a sandbox restriction. If an action isn't allowed, Copilot Code tells you what it blocked and why. It doesn't quietly retry the action without permission.
  • Limits of the sandbox. The sandbox helps reduce risk, but it doesn't remove it. You can turn the sandbox off in settings. While it's off, its file and network restrictions no longer apply, although your approval settings still do. The sandbox also doesn't cover an app you start yourself outside a Copilot Code session. Review generated code before you run it yourself.
  • Approvals limited to your session. Approval you give during a session applies to that session and doesn't carry over to other conversations. This rule doesn't apply when Always allow is on, because Always allow persists across sessions.
  • Harmful content filters. AI-based classifiers and content filters help find and block harmful content in your prompts and in Copilot Code's responses. This content includes hate speech, violence, sexual content, self-harm, and protected material.
  • Built-in instructions to decline unsafe requests. System instructions direct Copilot Code to decline inappropriate requests and to avoid generating insecure or malicious code.
  • Visible progress. Copilot Code shows each step as it works and shows a live preview where supported, so you can tell if it's going in a direction you didn't intend.
  • Testing before release. Microsoft tested Copilot Code with adversarial prompts, red-team exercises, and automated classifiers. The tests covered harmful content, insecure or malicious code, jailbreak attempts, and attempts to make it take actions without your approval.

Risks to be aware of

  • Unintended actions. Copilot Code might misunderstand your request and change, overwrite, or delete files you didn't intend. Review approval requests carefully, and stop a task if something looks wrong.
  • Prompt injection. Files, repositories, web pages, or packages that Copilot Code reads might contain hidden instructions meant to manipulate it. If Copilot Code asks for an approval you don't expect or tries an action you didn't ask for, cancel the task and review it.
  • Running commands and downloading code. When you approve a command or a download, Copilot Code can install packages and run code from the internet. Approve only what you understand and trust.
  • Always allow. When Always allow is on, Copilot Code doesn't ask before it takes actions, including file changes, deletions, downloads, and GitHub pushes. Learn more about the risks and how to turn it off in Use Always allow.
  • GitHub. When you connect GitHub, Copilot Code can read your repositories and, with your approval, push changes. Check which repository and branch it's working in, especially for public repositories.
  • Insecure or incorrect code. Code that AI generates might contain bugs or security weaknesses. Test what Copilot Code builds before you rely on it or share it.
  • Personal information. Don't put passwords, keys, or other sensitive data in prompts or project files. Before you share an app, make sure it doesn't contain information you want to keep private.
  • Sensitive uses. Don't use Copilot Code to build software for consequential or safety-critical purposes without proper testing and human review. Examples include software that diagnoses health conditions or affects someone's access to credit, housing, or employment.

Note

Copilot Code doesn't take sensitive actions without your approval unless you turn on Always allow. You can stop an action before it's complete, pause Copilot Code, or cancel the task at any time.

More ways to work with Copilot Code