GitHub Copilot security is two questions. The first, what Copilot sees and keeps, depends on your plan, Free to Enterprise, and on the surface: content exclusion does not work in the Edit and Agent modes of Copilot Chat in VS Code. The second is whether its code is safe to ship, and no plan setting answers that.
GitHub Copilot security by plan: what each tier controls
GitHub Copilot’s plans split in two. On Free, Pro, Pro+ and Max, GitHub may use your interactions to train models unless you opt out, and there are no organization controls. Business and Enterprise exclude customer data from training and add content exclusion, policy management and IP indemnity. No plan inspects the app you ship.
The split comes from GitHub’s Copilot plans page and GitHub’s policy docs, both read on October 21, 2026. Since April 24, 2026, GitHub may use inputs, outputs, code snippets and associated context from Free, Pro, Pro+ and Max accounts to train and improve AI models, and the account holder can switch that off; GitHub says it does not use Copilot Business or Copilot Enterprise customer data to train AI models.
| Plan | Interactions used for training | Prompt retention | Content exclusion | MCP policy | Public-code filter | IP indemnity |
|---|---|---|---|---|---|---|
| Free | May be used unless you opt out | Not stated on GitHub’s plans page | Not available | Not governed by the organization policy | Included; Allow or Block in your settings | Not included |
| Pro | May be used unless you opt out | Not stated on GitHub’s plans page | Not available | Not governed by the organization policy | Included; Allow or Block in your settings | Not included |
| Pro+ | May be used unless you opt out | Not stated on GitHub’s plans page | Not available | Not governed by the organization policy | Included; Allow or Block in your settings | Not included |
| Max | May be used unless you opt out | Not stated on GitHub’s plans page | Not available | Not governed by the organization policy | Included; Allow or Block in your settings | Not included |
| Business | Not used | IDE chat and completions: not retained; other surfaces: 28 days | Yes, set by repository, organization or enterprise admins | MCP servers in Copilot, disabled by default | Set by the organization or enterprise | For unmodified suggestions with filtering enabled |
| Enterprise | Not used | IDE chat and completions: not retained; other surfaces: 28 days | Yes, at the same levels as Business | MCP servers in Copilot, disabled by default | Set by the organization or enterprise | For unmodified suggestions with filtering enabled |
The tool and the app are separate questions for every assistant, and the same two questions asked of Cursor get the same split.
Two GitHub Copilot security features sit outside the table, and both are GitHub’s description of its own product: a duplication detection filter that suppresses suggestions containing code segments over a certain length that match public code on GitHub, which an enterprise administrator can enable, and a scan of Copilot’s outputs for vulnerable code. GitHub’s wider security material for Copilot sits in the GitHub Copilot Trust Center.
For GitHub Copilot security at enterprise level, Business and Enterprise add policy and audit: administrators set Copilot policies for the organization, and the enterprise audit log records changes to Copilot settings, policies and licenses plus agent activity on the GitHub website, though not the prompts a user sends to Copilot locally. So a company’s settings apply through the seat it assigns, and a developer’s own account sits outside them.
Copilot’s settings do not check the app it helps write
Copilot’s settings govern what the assistant sees, keeps and may reuse; none of them tests the deployed app. Whether each route checks who is asking, whether keys stay on the server, and whether an old key in git history still works are answered only by the running app and the repository.
Our June and July 2026 audits covered 21 third-party apps, and 6 of them shipped a real secret. Three of the audited apps had a real secret permanently in git history: a webhook signing secret, a live AI-provider key, and a Stripe test key with its webhook secret.
Those 21 apps were built with several tools and are a selected set, not a random sample, so they give no rate for any one assistant; the records do not tie a secret to the tool that wrote it.
Content exclusion and the training setting decide what Copilot reads and keeps. Neither removes a key that a commit already holds, and the fix for that is to scan the full history and rotate the key.
When a launch date with paying customers is set and nobody outside the editor has looked at the app’s secrets, authorization and recovery, that is the moment to ask for help: in a free audit we go over with you which of those to settle first. In the Production Hardening Sprint, our engineers work through all 123 deliverables across 13 engineering areas.
What is the primary risk of using GitHub Copilot? Six risks no plan setting removes
GitHub Copilot’s primary risk is code that looks finished and is not checked: a missing authorization check, a secret in the repository, a package name that does not exist. Six risks survive every plan, and four of them have no Copilot setting on any tier: insecure suggestions, secrets, prompt injection and hallucinated packages.
GitHub’s own notes on its agents point the same way: code the cloud agent or the CLI generates may appear valid without being correct, and GitHub tells users to review and test it, particularly for critical or sensitive applications.
| Risk | How it happens | Copilot setting | The control that narrows it |
|---|---|---|---|
| Insecure suggestions | Suggestions can repeat known weakness patterns from the code around them | None | Review, code scanning and tests |
| Secrets in the repository | A key typed into code or config is committed and stays in history | None | Secret scanning and push protection |
| Prompt injection | Text an agent reads in issues, comments or repository files carries instructions | None | Approval before commands, narrow MCP tools |
| Hallucinated packages | Generated code names a package that does not exist | None | Lockfile review and a registry check |
| Public-code matches | A suggestion matches code in a public repository | Public-code filter, Allow or Block | Block, or read the code references |
| Agent surfaces past content exclusion | Edit and Agent modes do not apply content exclusion, and MCP servers add tools | MCP servers in Copilot policy, organization plans only | The policy plus a short list of servers |
Asked whether GitHub Copilot is secure, we’d answer yes for the editor feature on an organization plan, going by GitHub’s documented controls, and not yet for the code it writes, because the four rows with no setting sit outside every plan. Whether GitHub Copilot is safe for a given team then turns on review, scanning and tests. Most of the security concerns people raise about GitHub Copilot come back to those same four risks.
Does GitHub Copilot generate secure code?
GitHub Copilot can generate insecure code, and the research agrees on the pattern more than on one rate. A 2021 NYU study found about 40 percent of 1,689 programs Copilot produced in security-relevant scenarios vulnerable, and a later Stanford study found people using an AI assistant wrote less secure code and were more likely to believe it was secure.
Both are lab studies: the “Asleep at the Keyboard?” study prompted Copilot with 89 scenarios built around high-risk weakness types such as MITRE’s Top 25, and a Stanford study of assistant users studied 47 participants, 33 of whom had an assistant built on OpenAI’s codex-davinci-002 model rather than Copilot itself. Our reading of why: Copilot completes the pattern in front of it, so the security weaknesses in generated code tend to copy the file around them, and an insecure pattern already in a GitHub repository is likely to be continued. So code security with GitHub Copilot depends on what checks the code after a suggestion is accepted.
There is no setting to stop Copilot from suggesting insecure code, beyond the scan for vulnerable code GitHub says it runs on outputs. A repository instructions file, .github/copilot-instructions.md, gives Copilot context on how to understand the project and how to build, test and validate its changes, and code scanning and review catch what gets through (the setup section below). GitGuardian, a secrets-detection vendor, reported in March 2025 that in a sample of about 20,000 repositories where Copilot was active, 6.4 percent leaked at least one secret, against 4.6 percent across all public repositories.
Hallucinated and typosquatted packages
An assistant can name a package that does not exist, and someone can then publish a package under that name; the researchers behind a study of package hallucinations call this a form of package confusion attack. Across 576,000 code samples from 16 popular models, they found the average share of hallucinated packages was at least 5.2 percent for commercial models and 21.7 percent for open-source models.
To stop developers accepting hallucinated packages from Copilot, make three rules: install only from a lockfile that changed in a reviewed pull request, open a new dependency’s registry page and check its age and publisher before merging, and keep package installs off any agent’s auto-approve list. On the cloud agent’s own pull requests, GitHub also checks newly introduced dependencies against the GitHub Advisory Database for malware advisories. A real package that has been taken over is a different problem, and how compromised npm packages spread follows that route.
Prompt injection: the risk no plan setting covers
An agent that reads issues, README files, pull request comments or web pages is reading text an outsider can write, and that text can carry instructions. GitHub’s risk notes for the cloud agent say users can include hidden messages in issues or comments for it as a form of prompt injection, and that GitHub filters hidden characters, such as text inside an HTML comment, before passing the input on. For automations, GitHub says input from untrusted users could become part of the prompt.
What narrows it is permission: keep approval before commands, give each MCP server only the tools a task needs, and never run an agent with auto-approval in a repository that holds production credentials (the CLI switches are below). One editor case, CVE-2025-53773, is told in the advisory section. Injection into an app’s own model calls is a separate subject, prompt injection inside your own AI feature, with its own defenses.
Does GitHub Copilot steal your code? Training, privacy and retention by plan
GitHub Copilot does not train on Business or Enterprise customer data. On Free, Pro, Pro+ and Max, interactions may be used for training unless the account holder opts out, a policy in force since April 24, 2026. Retention depends on the surface: on organization plans, IDE chat and completion prompts are not retained, and other surfaces keep them 28 days.
The plain answer to whether GitHub Copilot steals your code is that GitHub’s terms and settings govern what it may keep and train on, and the three facts below are what GitHub’s Copilot policy settings and plans page say as of October 21, 2026. None of it is a claim about intent.
- Training on individual plans: GitHub may use inputs, outputs, code snippets and associated context from Free, Pro, Pro+ and Max to train AI models. The opt-out is under your profile picture, Copilot settings, where “Allow GitHub to use my data for AI model training” can be set to Disabled; accounts on a Business or Enterprise license do not see the setting.
- Retention on Business and Enterprise: by default, prompts and suggestions from IDE chat and code completions are not retained, all other Copilot access keeps them 28 days, and user engagement data is kept two years. For individual plans, GitHub’s plans page refers to the GitHub Terms of Service and Privacy Statement and gives no figure; the line about prompts retained 28 days describes the organization-plan default for Copilot outside the IDE.
- Newer features keep their own data: Copilot Memory, on all paid plans, stores facts about a repository and your preferences and deletes any entry unused for 28 days; it is on by default for individual plans, and on organization plans an administrator must enable it first.
Most GitHub Copilot security and privacy concerns come down to those three facts and to which account is signed in to the editor. Whether your code is safe with GitHub Copilot, in the privacy sense, depends on that seat, and GitHub Copilot data security on organization plans also rests on GitHub’s Data Protection Agreement, which GitHub says prohibits training on Business and Enterprise customer data without customer authorization. None of this covers what your own app sends to a model when it has an AI feature of its own; that is a different data flow.
A personal Copilot license on work or client code
An organization’s controls follow the license it pays for, not a personal subscription open in the same editor. GitHub’s plans page notes that a company can use its network firewall to allow Copilot Business and block Copilot Pro or Free. Three questions settle which rules apply:
- 01 Who pays for the Copilot license that is active in this editor: the company or the person?
- 02 Which surface is in use: inline completion, chat, the CLI or an agent?
- 03 Can that surface only suggest text, or can it also read files, run commands and push?
Whether GitHub Copilot is safe to use at work is the employer’s policy call, and what puts the employer’s settings in force is a company seat on Business or Enterprise. For an enterprise that asks for proof, the evidence to show is the seat assignment, the policies and the audit log, which keeps events for the last 180 days.
IP indemnity: which plans carry it, and the filter it needs
GitHub’s plans page lists IP indemnity as not included on Free, Pro, Pro+ and Max, and says you’re entitled to IP indemnification from GitHub for the unmodified suggestions when Copilot’s filtering is enabled; it describes Copilot Pro as having all the features of Copilot Business except organizational license management, policy management and IP indemnity. That puts IP indemnity for GitHub Copilot on Business and Enterprise only.
The filter is the setting for suggestions matching public code, documented in GitHub’s public-code filter docs. With Block, in most GitHub Copilot products, Copilot checks a suggestion with about 150 characters of surrounding code against public code on GitHub and does not show a match or a near match; with Allow, matching suggestions come with code references to their source and license. On a company seat the organization or enterprise sets it, so the setting that meets that condition is suggestions matching public code set to Block at that level. Any claim runs under the agreement your company has with GitHub, and nothing here is legal advice.
What content exclusion protects, and the surfaces it misses
Content exclusion keeps listed files out of Copilot’s inline suggestions and responses on Business and Enterprise. It is not supported in the Edit and Agent modes of Copilot Chat in VS Code and other editors, and GitHub warns the IDE can still pass semantic information such as type information. It narrows what Copilot reads; the files stay put.
Repository administrators, organization owners and enterprise owners can set it, according to GitHub’s content exclusion docs. In supported tools, an excluded file gets no inline suggestions, does not inform suggestions in other files or Copilot’s responses, and is skipped by Copilot code review. Support varies by tool, and on October 21, 2026, GitHub’s own pages disagree about the CLI: the content exclusion page lists chat and agent support in Copilot CLI, the GitHub website, GitHub Mobile and the GitHub Copilot app, while the page on setting exclusions says Copilot CLI and Agent mode in IDEs do not support content exclusion. The content exclusion page lists chat in Xcode and Eclipse as not supported and says nothing about the cloud agent. Exclusions also do not apply to symbolic links or to repositories on remote filesystems, and a change can take up to 30 minutes to reach an IDE that already loaded the settings.
The paths go into the repository’s Copilot settings in the fnmatch format GitHub documents, one quoted pattern a line, matched without regard to case. The block below is an illustration, not a complete list:
# Illustration: paths in a repository's Copilot content exclusion setting.
# No effect in the Edit and Agent modes of Copilot Chat in VS Code and other editors.
- ".env"
- "secrets.json"
- "/scripts/**"
- "*.pem"
Keep credentials out of the repository altogether. Exclusion changes what Copilot reads, and a key in a committed file is still in the repository and its history, which is the problem the app section above deals with.
Copilot CLI, MCP servers and the cloud agent
Four facts from GitHub’s docs, read on October 21, 2026, are what to know about Copilot CLI and the agents before giving them a repository:
- Whether MCP is allowed at all. On Business and Enterprise, the MCP servers in Copilot policy turns MCP on or off for members and is disabled by default; Free, Pro, Pro+ and Max are not governed by it.
- Whether that policy reaches the terminal. GitHub’s CLI docs say Copilot CLI can’t currently support the MCP servers in Copilot organization policy, so switching MCP off for the organization does not switch it off in the CLI.
- What the CLI may run. It asks before commands that may be dangerous; approving a tool for the rest of a session lets it use that tool in any way, so one approved
rmcovers everyrm;--allow-all-toolsgives it your own file access and any shell command without asking;--deny-tool='shell(git push)'blocks a command outright. - What the cloud agent can push. Only to a single branch, its own
copilot/branch or the pull request’s branch, never directly to the default branch; it is subject to branch protections and required checks, cannot approve or merge its own pull request, analyzes its new code with CodeQL, secret scanning and dependency analysis, and calls configured MCP tools without asking for approval.
The sources are GitHub’s MCP docs for Copilot, GitHub Copilot CLI docs and GitHub’s responsible-use notes for agents. An approval is a decision about one tool at one moment, so re-read the MCP configuration whenever it changes. The cloud agent works through GitHub Actions and pull requests, which makes the pipeline’s own settings part of Copilot’s security, and the usual CI/CD security best practices apply to it.
GitHub Copilot vulnerabilities: what the advisories record
The public record for a GitHub Copilot vulnerability is its NVD entry and the vendor advisory it cites. Five of the high-severity entries, read on October 21, 2026, starting from the NVD record for CVE-2025-53773:
| Advisory | Product and surface | What it allowed | Affected before | Published |
|---|---|---|---|---|
| CVE-2025-53773 | GitHub Copilot and Visual Studio 2022 | Command injection; an unauthorized attacker could execute code locally | 17.14.12 | 2025-08-12 |
| CVE-2025-64660 | GitHub Copilot and Visual Studio Code | Improper access control; an authorized attacker could execute code over a network | 1.106.2 | 2025-11-20 |
| CVE-2026-29783 | GitHub Copilot CLI | Bash parameter expansion could hide commands from the read-only safety check, reachable through prompt injection | 0.0.423 | 2026-03-06 |
| CVE-2026-45033 | GitHub Copilot CLI | A malicious bare git repository nested in a project could run commands when the agent ran git | 1.0.43 | 2026-05-13 |
| CVE-2026-70335 | GitHub Copilot and Visual Studio Code | OS command injection; an unauthorized attacker could elevate privileges locally | 1.132.1 | 2026-08-11 |
The versions are historical minimums, so the advice is to keep the editor, the extension and the CLI current, not to aim for one version number.
CVE-2025-53773 shows how short the path from text to command can be. NVD records it as command injection in GitHub Copilot and Visual Studio that let an unauthorized attacker execute code locally, rated 7.8 (high), with Visual Studio 2022 versions from 17.14.0 to before 17.14.12 affected; Microsoft’s advisory adds that a user has to trigger the payload. The researcher’s write-up that the NVD record cites, on the Embrace The Red blog, describes the route: Copilot could create and write to files in the workspace without user approval, so injected instructions could add "chat.tools.autoApprove": true to the project’s settings.json and turn off confirmations before running shell commands; it was reported on June 29, 2025 and fixed in the August Patch Tuesday release. The lesson we take from it: an agent that can edit its own settings file can turn one injected instruction into standing permission to run commands, so the files that decide approval need the same protection as the code.
Security vendors and independent researchers publish their own write-ups of Copilot issues, and they are worth reading, but the table holds only what a primary record states. In our view a patched advisory is evidence that an issue was found and fixed, not a security score for the product. The GitHub Copilot controversy, the licensing lawsuit, is not a vulnerability at all; the FAQ below covers it.
How to secure GitHub Copilot: eight settings and habits
Securing GitHub Copilot takes eight settings and habits: an organization license for company code, the training setting checked, the public-code filter set to block, content exclusion on secret paths, MCP limited by policy, code and secret scanning on, agent pull requests behind branch protection, and a two-account test of the app.
Each of these GitHub Copilot security best practices names the thing you can see that proves it, so secure Copilot usage becomes something you can show a customer rather than a line in a policy.
- 01 Put company and client code on a Business or Enterprise seat. Proof: a seat assignment for that person in the organization's Copilot settings or the audit log.
- 02 On any individual account, open Copilot settings and decide on the Allow GitHub to use my data for AI model training setting. Proof: the dropdown shows the choice you made.
- 03 Set suggestions matching public code to Block. Proof: the setting reads Block in personal settings or, on a company seat, at the organization or enterprise.
- 04 On Business or Enterprise, add content exclusion paths for secret files and folders. Proof: an excluded file gets no inline suggestions in a supported editor.
- 05 Leave the MCP servers in Copilot policy off unless the team needs it, and keep a short written list of approved servers. Proof: the policy state in the organization's Copilot settings and the list itself.
- 06 Turn on code scanning, secret scanning with push protection, and Dependabot. Proof: alerts appear on the repository's Security and quality tab.
- 07 Merge agent pull requests only through branch protection and human review. Proof: the default branch rule requires an approval, and the agent's pull requests wait for it.
- 08 Test the app with two accounts before launch: sign in as one user and try to read or change the other's data. Proof: every attempt fails.
GitHub’s own advice to Copilot users, in an April 2025 post on its blog, names the same three tools as step 6: Dependabot, code scanning and secret scanning. According to GitHub’s secret scanning docs, secret scanning runs free on public repositories and needs GitHub Secret Protection on GitHub Team or GitHub Enterprise Cloud for organization-owned private repositories, and push protection for a repository is disabled by default.
A repository instructions file steers Copilot, and a CI check enforces the rule when the file is ignored: instruction files and the CI check behind them set that up. Scanning is its own subject, from what a code scan reads to what GitHub Advanced Security adds, and the wider set of controls sits under engineering standards for an AI-assisted team.
In the sprint, the two controls closest to this list have written verify steps: for AI repository guardrails (deliverable 10.8), we review the guidance and demonstrate CI catching a representative forbidden regression, and for repository history scan and rotation (deliverable 2.2), we retain scan results and confirm exposed credentials have been invalidated and replacements work.
Common questions about using GitHub Copilot safely
What is the GitHub Copilot controversy?
The GitHub Copilot controversy is the licensing lawsuit Doe v. GitHub, in which programmers who published code on public GitHub repositories allege that Copilot and Codex reproduced their code without attribution; they brought it against GitHub, Microsoft and OpenAI in the Northern District of California (case 4:22-cv-06823-JST). On September 16, 2026, the Ninth Circuit affirmed the dismissal of the DMCA claim, and two breach-of-contract claims remain pending in the district court. It is a dispute about licensing, not a security flaw.
What are the downsides of using GitHub Copilot?
The main downsides are suggestions that look finished and still need review, and four risks no plan setting covers: insecure code, secrets committed to the repository, prompt injection through text an agent reads, and package names that do not exist. On Free, Pro, Pro+ and Max, GitHub may also use your interactions to train AI models unless you opt out.
Is Copilot safe for confidential information?
It can be, on a Business or Enterprise seat: GitHub does not use that customer data to train AI models, and content exclusion can keep listed files out of suggestions and responses, though not in the Edit and Agent modes of Copilot Chat in editors. Secrets and regulated data still belong outside the repository, because exclusion limits what Copilot reads and leaves the files where they are.
When does a team need outside help with code Copilot wrote?
A team needs outside help once its app is close to holding real customers or their data and nobody has tested who can see which records, where its keys live, or how it would recover from a bad deploy anywhere but the editor. AxonBuild weighs up those risks with you in a free audit, so you know which one to fix before launch day.
Using an AI assistant on code that matters?
Plan settings protect your prompts and licenses, but they say nothing about the safety of the app your users touch. During the audit, we look at the app with you and your team and point out the security risks that matter most for real users.
Book a free audit →
Free · 30 minutes · No code access needed