Agentshield

GitHub Copilot Security: Enterprise and Business Controls for Agent Mode, the Coding Agent and Copilot CLI

GitHub ships real Copilot security controls and documents, in its own words, exactly where each one stops. Every documented gap lands on the same three surfaces: agent mode, the coding agent and Copilot CLI.

OWASP LLM Top 10 Immutable audit trail Never trains on your data

Direct answer

GitHub Copilot security rests on three enterprise controls, and each carries a limit GitHub states plainly in its own documentation. The agent firewall restricts where the coding agent can send data, but GitHub writes that it "only applies to processes started by the agent via its Bash tool" and "does not apply to Model Context Protocol (MCP) servers or processes started in configured Copilot setup steps". Content exclusion keeps named files out of Copilot context, but GitHub writes that it "is currently not supported in Edit and Agent modes of Copilot Chat in Visual Studio Code and other editors", which is exactly where an autonomous agent operates. Enterprise managed settings are the strongest control GitHub offers, they require Copilot Business or Copilot Enterprise, and the one most teams need is disableBypassPermissionsMode, which stops developers turning on auto-approve.

Try it live

Watch Agentshield block an attack in real time.

Pick a scenario and drive the inspection lane yourself. No signup needed.

Threat Console
12,408 injections blocked this week

Run a request

Inspection lane

INSPECTING
untrusted input

Policy trace

High-risk action held for approval

Audit trail

The risk

The rollout almost always runs ahead of the review. Completions arrive first and nobody objects, because a completion is a suggestion and a human presses tab. Then agent mode ships, then the coding agent opens pull requests on its own, then somebody wires an MCP server into it, and the control set that was assessed against an autocomplete tool is now governing something that reads attacker-authored issue text, holds a repository token and runs shell commands. The three published GitHub Copilot incidents follow that shape precisely. None of them involved a developer typing anything malicious. In each case the agent read text that somebody else wrote, in a pull request description or an issue comment, and acted on it with the permissions it already had.

How Agentshield handles it

Split it into three workstreams, because they have different owners and different timelines. Licensing and settings come first and are cheap: Copilot Business or Copilot Enterprise unlocks enterprise managed settings and content exclusion, and setting disableBypassPermissionsMode to disable closes the single widest self-inflicted hole. Patching is second and is mostly done: CVE-2025-53773 was fixed in the August 2025 Patch Tuesday and CamoLeak was fixed in August 2025, so the work is confirming your Visual Studio, Visual Studio Code and Copilot CLI versions rather than chasing anything live. The third workstream is the one no vendor setting closes, because GitHub has told you so directly: an agent that reads untrusted text while holding a token can be steered, and the only place to stop that is at the action it tries to take.

The controls

The controls that secure GitHub Copilot agent mode, the Copilot coding agent and Copilot CLI, and the repositories, MCP servers, package registries and internal systems those agents reach once an injected instruction has already been read.

What each GitHub Copilot security control covers, and where GitHub says it stops

This is the table to read before any of the incident write-ups, because most GitHub Copilot security coverage describes the controls and skips the caveats, and GitHub publishes the caveats itself. Every entry in the third column is GitHub documentation, not our opinion.

ControlWhat it coversWhat GitHub states it does not coverPlan
Agent firewallRestricts outbound network access from the Copilot coding agent to an allowlist, to limit data exfiltration. Blocked requests raise a warning in the pull request body or a commentVerbatim: "The firewall only applies to processes started by the agent via its Bash tool. It does not apply to Model Context Protocol (MCP) servers or processes started in configured Copilot setup steps." Also: "Sophisticated attacks may bypass the firewall" and it "should not be considered a comprehensive security solution"Coding agent repositories
Content exclusionKeeps named paths and repositories out of the context used for completions and chat on supported surfacesVerbatim: "Content exclusion is currently not supported in Edit and Agent modes of Copilot Chat in Visual Studio Code and other editors." Also does not apply to symlinks or repositories on remote filesystems, and the IDE may still pass semantic information such as type definitions and build configurationBusiness, Enterprise
Enterprise managed settingsA central settings file a developer cannot override from inside a repository. Includes disableBypassPermissionsMode, which blocks auto-approve, also called yolo modeApplies to supported clients only. Shipped June 17, 2026 for Copilot CLI and Visual Studio Code 1.122 and later, extended to the Copilot app and cloud agent on July 27, 2026Business, Enterprise
Vulnerability prevention filterBlocks common insecure patterns in generated suggestions, including hardcoded credentials, SQL injection and path injection, and can match on incomplete fragmentsFilters suggestion text only. It has no bearing on what an agent does with tools, credentials or network access once the code is runningAll plans
Data handlingVerbatim: "GitHub does not use Copilot Business or Copilot Enterprise customer data to train AI models." Prompts and suggestions are not retained on those plansGoverns training and retention. It says nothing about what an agent can reach at runtime with the developer token already on the machineBusiness, Enterprise

Read the third column as a group and a pattern falls out. Four of the five controls were designed around Copilot as an autocomplete and chat product, and each one names agent mode, MCP or the coding agent as out of scope. That is not an oversight anyone hid. It is the honest consequence of shipping governance for a suggestion engine and then shipping an agent on top of it.

The practical consequence is worth stating plainly, because it changes what a security review should ask. If your assessment of Copilot concluded that content exclusion protects your secrets directory, that conclusion holds for completions and for chat on the GitHub website, and it does not hold the moment a developer switches the same editor into agent mode. The file is excluded in one pane and readable in the next. Nothing in the interface tells them that.

The same split governs where an external control is worth paying for at all. If your developers use Copilot for completions in an IDE, buy the right license tier, configure content exclusion, and you are genuinely finished. If Copilot is opening pull requests, calling MCP servers and running shell commands in CI, you are running an autonomous coding agent, and the questions that matter are about what it is allowed to do rather than what it is allowed to read.

CVE-2025-53773: prompt injection that switched on auto-approve in Visual Studio Code

This is the clearest published demonstration of why a Copilot review has to cover configuration as well as code, because the payload did not attack the developer. It attacked the settings file.

FieldValue
IdentifierCVE-2025-53773, titled by Microsoft "GitHub Copilot and Visual Studio Remote Code Execution Vulnerability"
NVD descriptionVerbatim: "Improper neutralization of special elements used in a command ('command injection') in GitHub Copilot and Visual Studio allows an unauthorized attacker to execute code locally."
ScoreCVSS v3.1 base 7.8 high, vector AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H. CWE-77
ReportedJune 29, 2025 by Johann Rehberger, who publishes as wunderwuzzi
FixedAugust 2025 Patch Tuesday. NVD record published August 12, 2025

The mechanism is short enough to state in one sentence. Copilot could write files in the workspace without user approval, and those writes went to disk immediately, so an injected instruction could add one line to the project settings file at .vscode/settings.json. The line was "chat.tools.autoApprove": true. In the researcher description, that setting "disables all user confirmations, and we can run shell commands, browse the web, and more". The demonstration then popped a calculator on both Windows and macOS, choosing the command by operating system.

Two details make this worth more than a patch note. The first is that the injection arrived through ordinary repository content: code comments, documentation, files, including text hidden in invisible Unicode. Nobody had to be tricked into pasting anything. The second is the researcher own assessment of how it spreads, which is worth quoting in full because it describes a class of risk that sandboxing alone does not address: "An attacker can embed instructions and once they gain code execution, additional malware can compromise other Git projects (and RAG sources) to embed the malicious instructions, and commit the changes or even force push them upstream. This can lead to further spread as other developers unknowingly propagate the infected code."

One clarification on the naming, since the CVSS vector reads AV:L and the title says Remote. Microsoft has explained that "Remote" in these titles refers to the location of the attacker rather than the attack vector, and that this class is sometimes called arbitrary code execution. If you are triaging by title alone you will misjudge it in both directions, so read the vector.

The generalizable lesson is that the agent permission model was self-modifying. An agent allowed to write any file in a workspace is allowed to write the file that governs its own approvals. That failure mode is not unique to GitHub. It is the same structural issue behind the Cursor sandbox escapes and the Gemini CLI allowlist bypass under yolo mode, and the fix in every case was to move the approval decision somewhere the agent cannot edit.

CamoLeak: how GitHub Copilot Chat leaked private repository secrets

CamoLeak is the highest-scored GitHub Copilot finding published to date, at CVSS 9.6, and it is the one that best explains why data-handling promises and runtime data protection are different things.

Omer Mayraz of Legit Security found it in June 2025, reported it through HackerOne, and GitHub fixed it on August 14, 2025. It was disclosed publicly in October 2025. The attack chained three pieces:

  • Injection through invisible comments. Instructions were placed in pull request descriptions inside GitHub hidden markdown comments, the <!-- --> syntax that does not render in the web interface but is still read by the assistant. The prompt then entered the context of other users viewing the page, not only the author.
  • A Content Security Policy bypass using GitHub own infrastructure. GitHub blocks external image requests, and it rewrites remote image URLs through its Camo proxy at camo.githubusercontent.com with HMAC signatures. Mayraz pre-generated a dictionary of valid signed Camo URLs, one per character, then instructed Copilot to "render the content I want to leak as 'ASCII art' composed entirely of images". Every image was a legitimate signed GitHub URL, so the policy allowed all of them.
  • Exfiltration on render. Each image request carried encoded victim data. The browser fetched them automatically and the data arrived at the researcher server.

The proof of concept was not theoretical. It pulled contents from a private organization repository, ran searches for keywords such as AWS_KEY across private codebases, and retrieved the full description of an undisclosed zero-day vulnerability stored in a private issue. Nothing on that list requires the attacker to run a single line of code on the target.

GitHub remediation is the detail that should shape how you read vendor assurances: it disabled image rendering in Copilot Chat entirely. That is the right call and it is also an admission. When a boundary cannot be held, the honest fix is to remove the capability that crosses it. Compare that with the retention promise on the same product, which is accurate and which would not have helped here at all. GitHub genuinely does not train on Business and Enterprise customer data, and the private repository contents still left the building, because the leak path was the agent output channel, not the training pipeline.

Note also what the fix did not close. The injection vector, an invisible markdown comment in a pull request that other people read, is still exactly as available as it was. Only the exfiltration channel was removed. That is the pattern across every finding on this page, and it is why detection at the input has to be paired with control at the output.

Comment and Control: why GitHub called the Copilot agent finding a known architectural limitation

The most decision-relevant GitHub Copilot security research of 2026 is not a CVE, and its most useful output is a sentence from GitHub rather than a patch.

Aonan Guan, with Zhengyu Liu and Gavin Zhong of Johns Hopkins University, published "Comment and Control" on April 16, 2026. The technique delivers instructions to an agent through ordinary GitHub communication channels: pull request titles, issue descriptions and comments. What separates it from classic indirect prompt injection is that it does not wait for anyone. GitHub Actions workflows trigger automatically on pull_request, issues and issue_comment events, so filing an issue is enough to start the agent. There is no victim interaction to phish.

TargetDeliveryOutcomeVendor response
GitHub Copilot AgentHTML comment hiding the payloadBypassed environment filtering and scanned for secretsClassified as a known architectural limitation. Bounty 500 USD
Claude Code Security ReviewSpecially crafted pull request titleAgent tricked into executing arbitrary commandsClassified critical, mitigations implemented. Bounty 100 USD
Gemini CLI ActionIssue comment with a prompt-injection titleGuardrails bypassed. Agent printed GEMINI_API_KEY into a public issue commentNew guardrail prompts added. Bounty 1,337 USD

GitHub classification deserves to be taken seriously rather than read as a brush-off, because it is correct. An agent whose job is to read issues and pull requests must read text written by people you do not control. An agent that opens pull requests must hold a token that can write. Those two requirements are the product, so no amount of prompt hardening removes the exposure, and calling it architectural is more honest than shipping a filter and implying the problem is solved. It is the same conclusion Pillar Security reached on a separate agent, where the model refused five researchers who asked for secrets by name and ran a payload that never mentioned secrets at all.

The bounty amounts are worth a moment as well, not as gossip but as a signal of how differently three vendors priced the same technique against their own products. One rated it critical and paid 100 dollars. One paid 1,337. The classification and the payout do not move together, so read the classification and ignore the number.

If you run agent workflows in GitHub Actions today, three changes follow directly from this research and none of them require buying anything. Never let one workflow read attacker-authored input while holding write permissions, split reading and writing into separate jobs with separate tokens, and require an approval gate on the job that writes. That is the same approval boundary we recommend for every agent that touches a system of record, and it is the only control in this section that would have stopped all three attacks.

GitHub Copilot enterprise security settings that hold, and the plan each one needs

Most of the value available to a security team here is included in the license and switched off by default. This is the configuration pass to run before evaluating anything external.

SettingWhat it stopsWhere it livesPlan
disableBypassPermissionsMode set to disableDevelopers turning on auto-approve, also called yolo mode, which skips permission prompts entirelyEnterprise managed settings file. Copilot CLI and Visual Studio Code 1.122 and later since June 17, 2026, plus the Copilot app and cloud agent since July 27, 2026Business, Enterprise
MCP servers in Copilot policyUnreviewed MCP servers being connected to Copilot where MCP support is generally availableOrganization and enterprise Copilot policiesBusiness, Enterprise
Third-party coding agents policySilent expansion of your agent estate. Controls whether agents such as Anthropic Claude and OpenAI Codex can be selectedOrganization and enterprise Copilot policiesBusiness, Enterprise
Enable firewall and Recommended allowlistRepositories individually deciding their own egress posture. Each can be set to Enabled, Disabled or Let repositories decideOrganization firewall settings for the cloud agent, shipped April 3, 2026Coding agent repositories
Content exclusionNamed paths and repositories entering Copilot context for completions and chat. Remember it does not apply in Edit or Agent modesOrganization and repository content exclusion configurationBusiness, Enterprise

The first row is the highest-value line on this page for most organizations, and it is the one most often missed, because it only became available on June 17, 2026 and plenty of Copilot deployments were assessed before that date. Auto-approve is not an edge case. It is what a developer reaches for on the second afternoon of agent mode, after the twentieth confirmation prompt, and it converts a tool with a human in the loop into one without. If your Copilot review predates the middle of 2026, this setting almost certainly does not exist in your baseline.

The default position of the firewall is the second thing to check. Both organization firewall settings default to Let repositories decide, which is a reasonable product default and a poor security default, since it means your egress posture is whatever each repository owner happened to configure. Setting it centrally costs nothing and gives you one answer instead of hundreds.

Worth being clear about the ceiling on all of this. Every setting above governs the Copilot clients GitHub controls. None of them governs what happens after the agent makes a legitimate-looking call to an internal API with a token your identity provider issued, which is where an independent record of agent actions and runtime monitoring start earning their place. Configure GitHub first. It is included, and it closes the cheap gaps.

Where AgentShield helps with GitHub Copilot security, and where it does not

Several of the things buyers ask us for on this topic are already solved inside GitHub, usually by a setting on a license they are paying for. Selling against those would be dishonest and would also waste your budget, so here is the split as plainly as we can put it.

What you wantUs?Use this instead, or what we actually do
Stop Copilot suggesting insecure codeNoThe vulnerability prevention filter is on for every plan, and your existing code scanning covers the rest. This is application security tooling, not agent security
Keep a file out of Copilot context in the IDENoContent exclusion, configured in GitHub on Business or Enterprise. Note its documented limit in Edit and Agent modes and plan around that rather than buying a second product
Stop developers enabling auto-approveNoSet disableBypassPermissionsMode to disable in enterprise managed settings. It is included in the license you already hold and takes one line
Prove Copilot is not training on your codeNoGitHub states it plainly and contractually: "GitHub does not use Copilot Business or Copilot Enterprise customer data to train AI models." No third party can strengthen that
Restrict outbound traffic from the cloud agentPartlyThe GitHub agent firewall covers Bash-tool processes and states it does not cover MCP servers or setup-step processes. We govern calls that route through our gateway, including that MCP traffic
Enforce which tools and MCP servers an agent may call, per agent identityYesPer-agent tool and data permissions evaluated at the call, not configured per repository and not editable by the agent
Require approval before a named action, and keep a record the agent cannot editYesApproval gates on specific actions such as pushing to a protected branch or writing to a system of record, plus an append-only record of every attempt including the blocked ones

The honest summary is a question about what your agents touch. If Copilot writes code that a human reviews and merges, GitHub native controls plus your normal review process are sufficient and you should stop reading here. If Copilot is opening pull requests unattended, calling MCP servers, running in CI with credentials, or reaching internal systems, then the residual risk is the one GitHub itself called architectural, and it does not live in the editor. It lives at the moment the agent takes an action, which is where we work.

If you are comparing coding agents rather than securing one you have already chosen, the security comparison of Gemini CLI and Claude Code covers default permissions and admin enforcement across the two, and the Claude agent security page covers the same ground for Anthropic tooling. For the protocol layer underneath all of them, start with the MCP gateway page.

FAQ

Common questions about github copilot security.

Is GitHub Copilot a security risk?

Copilot as an autocomplete is a manageable risk covered by the vulnerability prevention filter and normal code review. Copilot as an agent is a different risk, because agent mode, the coding agent and Copilot CLI read text other people wrote and act with a token you issued. All three published GitHub Copilot incidents took that path, and none required a developer to do anything wrong.

Is GitHub Copilot secure?

On current versions, with Copilot Business or Enterprise, content exclusion configured and disableBypassPermissionsMode set, it is reasonable for enterprise use. GitHub documents genuine limits: the agent firewall "should not be considered a comprehensive security solution" and content exclusion does not apply in Edit and Agent modes. Treat those as the boundary of what the vendor settings cover.

What are the security concerns with GitHub Copilot?

Four recur in real reviews. Indirect prompt injection through pull request and issue text, which GitHub calls a known architectural limitation. Content exclusion not applying in agent mode. The agent firewall not covering MCP servers or setup-step processes. And auto-approve mode, which developers enable to stop permission prompts and which removes the human from the loop entirely.

Does GitHub Copilot use my code to train models?

Not on the paid organization plans. GitHub states verbatim that it "does not use Copilot Business or Copilot Enterprise customer data to train AI models", and on those plans prompts and suggestions are not retained, though user engagement data is kept for two years. Individual plans have different terms. This governs training only, not what an agent can reach at runtime.

What does GitHub Copilot security filter help prevent?

It prevents common insecure patterns appearing in generated suggestions, most notably hardcoded credentials, SQL injection and path injection. It runs during code generation and can match vulnerable patterns in incomplete fragments, so unsafe suggestions are suppressed before the developer sees them. It filters suggestion text only and has no effect on agent behavior, tool calls or network access.

Is GitHub Copilot Business secure enough for enterprise?

Copilot Business at 19 USD per granted seat per month unlocks the controls that matter: content exclusion, enterprise managed settings including disableBypassPermissionsMode, and the contractual position that customer data is not used for training. Copilot Enterprise at 39 USD adds codebase indexing and a larger credit allowance rather than a materially different security posture. Prices verified August 2026.

What is CVE-2025-53773?

A command injection issue in GitHub Copilot and Visual Studio, CWE-77, scored 7.8 on CVSS v3.1. An injected instruction in ordinary repository content made Copilot write "chat.tools.autoApprove": true into the workspace settings file, which disables all user confirmations and permits shell command execution. Reported June 29, 2025 by Johann Rehberger and fixed in the August 2025 Patch Tuesday.

What is the CamoLeak vulnerability in GitHub Copilot?

A CVSS 9.6 flaw in Copilot Chat found by Omer Mayraz of Legit Security. Hidden markdown comments in pull requests injected instructions, and data was exfiltrated by having Copilot render leaked content as ASCII art built from pre-signed GitHub Camo proxy image URLs, which bypassed the Content Security Policy. GitHub fixed it on August 14, 2025 by disabling image rendering in Copilot Chat entirely.

Does content exclusion work in GitHub Copilot agent mode?

No. GitHub states that content exclusion "is currently not supported in Edit and Agent modes of Copilot Chat in Visual Studio Code and other editors". It also does not apply to symbolic links or repositories on remote filesystems, and the IDE can still supply semantic information from an excluded file, such as type definitions and build configuration. Plan your secrets handling around that, not around the exclusion list.

Does the GitHub Copilot agent firewall stop data exfiltration?

Partly, and GitHub is explicit about the gaps. It restricts outbound access to an allowlist and warns on blocked requests, but it "only applies to processes started by the agent via its Bash tool", does not apply to MCP servers or configured setup steps, operates only inside the GitHub Actions appliance environment, and GitHub notes that sophisticated attacks may bypass it.

How do I stop developers using auto approve in GitHub Copilot?

Set disableBypassPermissionsMode to disable in the enterprise managed settings file. It requires Copilot Business or Copilot Enterprise and it prevents Copilot CLI and Visual Studio Code from skipping permission prompts. GitHub shipped it on June 17, 2026 and extended coverage to the Copilot app and cloud agent on July 27, 2026, so deployments assessed before mid-2026 will not have it in their baseline.

Is GitHub Copilot MCP server support safe to enable?

Only with an allowlist and an understanding of what the firewall does not do. GitHub states the agent firewall does not apply to MCP servers, so an approved MCP server can reach the network on paths the firewall never evaluates. Use the MCP servers in Copilot policy to restrict which servers are connectable, and govern the calls themselves at a gateway rather than trusting per-repository configuration.

Do I need extra security tooling if I already pay for GitHub Copilot Enterprise?

Only if your agents act on systems that matter. For completions and reviewed pull requests, the native controls plus code review are genuinely enough and adding a product would be waste. If Copilot opens pull requests unattended, calls MCP servers or runs in CI with credentials, the residual risk is the one GitHub called architectural, and it needs authorization and an audit record enforced where the action happens.

Secure your github copilot security.