Join our Newsletter — 33% off our NHI Course
Home› Guides› GitHub Copilot Security Guide: Governing AI Coding Assistants
Guide AI Platforms

GitHub Copilot Security Guide: Governing AI Coding Assistants

PDF for newsletter subscribers · free to read online

← All guides
By Lalit Choda, NHI Mgmt Group Updated 24 October 2026 14 min read
On this page

GitHub Copilot now spans inline suggestions, chat, a command-line agent and a cloud agent that opens pull requests, and each surface reads code and acts with a different identity and a different set of controls. Most organisations govern the seat licence and stop there, leaving content exclusion, MCP servers, the agent firewall and personal Copilot plans on the corporate network unmanaged. This guide covers the platform controls GitHub documents for Copilot Business and Copilot Enterprise: how access and policy precedence work, who can change settings, the tokens and integrations involved, what the audit log does and does not record, and a hardening baseline. It is for GitHub organisation and enterprise owners, platform engineering and application security teams. Editor-level permission settings for agent mode are covered in the AI IDE and Coding Agent Security Guide and reviewing the code itself in the AI-Generated Code Review Guide; this page does not repeat them. Details were checked against GitHub Docs in October 2026 and change often.

Key takeaways

  • Enterprise policy wins. When an enterprise owner enables or disables a Copilot policy everywhere, organisation owners cannot override it, so set the non-negotiables at enterprise level.
  • Content exclusion has holes. GitHub states it is not supported in Edit and Agent modes of Copilot Chat in VS Code and other editors, does not apply to symbolic links, and may still leak semantic information from excluded files; it is not a secrets control.
  • The cloud agent is fenced but not sealed. It pushes only to its own branch, cannot approve or merge, and runs behind a firewall, but the firewall covers only processes started by its Bash tool, not MCP servers or setup steps.
  • Prompts are not in the audit log. The GitHub audit log records seats, policy changes and agent activity for 180 days; local prompts need your own collection.
  • Personal plans bypass your policies. Subscription-based network routing lets you allow the Business and Enterprise endpoints and block individual plans on corporate networks.

How identity and access work in GitHub Copilot

Copilot Business and Copilot Enterprise seats are assigned by an organisation or enterprise to a GitHub account. That account's repository permissions decide what Copilot can read on GitHub.com, and the developer's local workspace decides what it can read in the editor. Copilot adds no separate permission model on top.

  • Policy precedence: organisation owners set policies under Settings, Copilot, Policies and Models. Each policy has an enforcement dropdown. An enterprise setting of enabled everywhere, disabled everywhere or enabled for selected organisations cannot be overridden by an organisation.
  • Who can trigger the cloud agent: only users with write access to a repository; comments from other users are never passed to the agent.
  • Partner agents: owners can allow third-party coding agents (GitHub names Anthropic Claude and OpenAI Codex) under Copilot, Cloud agent, Partner agents. They can access the same repositories where the Copilot cloud agent is enabled, so enabling them widens the set of models acting on your code, not the repository scope.
  • Models: the Models page controls access to models beyond the basic set. Treat each model provider as a supplier decision.

The surfaces and what each can touch

SurfaceActs asReadsMain controls
Inline suggestions in the IDEThe signed-in developerOpen files and nearby contextContent exclusion, public code matching policy
Copilot Chat ask modeThe developerWorkspace context; on GitHub.com, repositories the user can readContent exclusion (not in Edit or Agent modes)
Agent mode in the editorThe developer's local sessionWorkspace, terminal, MCP toolsEditor policies, MCP servers in Copilot policy
Copilot CLIAn OAuth token or fine-grained PATTrusted directory and belowCopilot CLI policy, tool approval flags
Copilot cloud agentCopilot, with commits co-authored by the requesterThe assigned repositoryAgent firewall, branch protection, workflow approval, MCP configuration
Copilot code reviewCopilotThe pull request; skips excluded filesContent exclusion, code review firewall

Admin roles and privileged access

RoleCopilot controlNotes
Enterprise ownerEnterprise policies, content exclusion under AI controls, network routing, partner agents at enterprise levelHighest impact; keep few and protected with phishing-resistant MFA
Organisation ownerOrganisation policies, models, seat assignment, organisation content exclusion, agent firewall defaults and organisation custom allowlistCannot override enterprise-enforced policies
Repository administratorRepository content exclusion, MCP server JSON for the cloud agent, repository firewall rules where allowed, setup steps workflowCan add MCP servers that the agent uses without asking
Users with write accessAssign issues to and prompt the cloud agent, approve workflow runs on agent pull requestsThe person who asked for a pull request cannot approve it
"Read enterprise audit logs" custom roleReview Copilot audit eventsGive to security operations instead of owner rights
  • Repository admins are agent configurators: MCP servers and setup steps are configured per repository, so the number of repository admins is the number of people who can change what the cloud agent can reach. Reduce it and alert on changes.
  • Branch protection is the real gate: the agent is subject to branch protections and required checks. A repository without them relies on a single human merge. See the GitHub and GitHub Actions Security Guide.

Integrations, API tokens and service accounts

Cloud agent credentials and environment

  • Agent credentials: GitHub states the agent's credentials allow only simple push operations to a single branch (the existing pull request branch or a new copilot/ branch), and that it cannot run git push or other Git commands directly. Commits are signed and show as Verified.
  • Setup steps: the environment is customised with .github/workflows/copilot-setup-steps.yml containing a single job named copilot-setup-steps, active only once on the default branch. Only steps, permissions, runs-on, services, snapshot and timeout-minutes (maximum 59) are honoured. Give it the lowest permissions it needs, such as contents: read, and keep secrets out unless a step needs them. See the CI/CD Pipeline Identity Security Guide.
  • Self-hosted runners: supported through runs-on, but they require disabling the integrated firewall. GitHub recommends ephemeral, single-use runners; never place the agent on a long-lived runner that holds cloud credentials.

MCP servers

  • Defaults: the cloud agent gets a GitHub MCP server using a token with read-only access to the current repository, and a Playwright server limited to localhost and 127.0.0.1. Replacing the GitHub token with a broader one widens what an injected instruction could reach.
  • No approval prompts: GitHub states that Copilot "will use available tools autonomously, and will not ask for approval before use". Limit the tools field of each server to what the task needs and leave out write tools.
  • Scope of the policy: the "MCP servers in Copilot" policy does not govern the GitHub MCP server used from third-party hosts such as Cursor, Windsurf or Claude. Those need their own controls. See the MCP Security Guide.

Copilot CLI tokens

  • Supported tokens: OAuth tokens (gho_) from copilot login, fine-grained PATs (github_pat_) owned by a personal account with the Copilot Requests permission, and GitHub App user-to-server tokens (ghu_). Classic PATs (ghp_) are not supported.
  • Precedence: COPILOT_GITHUB_TOKEN, then GH_TOKEN, then GITHUB_TOKEN, then the stored OAuth token, then the GitHub CLI token. An environment variable silently overrides the stored login, so a CI token exported in a shell profile can become the CLI's identity.
  • Storage: the OAuth token is kept in the OS keychain under copilot-cli. Without a keychain, for example headless Linux without libsecret, the CLI offers to write it in plaintext to ~/.copilot/config.json. Decline on shared hosts. See the SaaS API Token Security Guide.
  • Tool approval: the CLI asks to trust the launch directory and to approve tools once or for the session. --allow-all-tools gives Copilot "the same access as you do to files on your computer"; --deny-tool takes precedence over allow options. GitHub describes the directory scoping as heuristic and recommends a VM, container or sandbox for automatic approval.

Logging and detection

The organisation and enterprise audit log records Copilot plan changes, policy and setting changes, seat assignment and agent activity on GitHub.com, and keeps events for 180 days. It does not include client session data such as prompts sent from the IDE or CLI; GitHub suggests a custom solution such as hooks that forward CLI events to your own logging service.

SourceQuery or locationWhat to watch
Audit logaction:copilotPolicy changes, model enablement, partner agent enablement
Audit logaction:copilot.cfb_seat_assignment_createdSeats outside the approved groups; for team-based assignment the actor may not be the person who changed membership
Audit logactor:CopilotAgent activity by repository and time
Agent session logsLinked from each agent commit and pull requestCommands run, firewall blocks, code reference matches
Pull request warningsFirewall block notices on the pull requestUnexpected destinations, which can indicate injected instructions
Repository settings historyMCP configuration, firewall rules, content exclusionChanges by repository admins outside change control
  • Stream the audit log: 180 days is too short for most investigations. Stream to the SIEM, as GitHub recommends. See the SIEM Guide.
  • Agent code checks: GitHub runs CodeQL, secret scanning and an Advisory Database check for malware and High or Critical dependencies on cloud agent output, plus Copilot code review, without requiring a GitHub Advanced Security licence. Record their findings as a metric rather than assuming a clean pass.

Metrics that show it is working

  • Percentage of Copilot policies enforced at enterprise level rather than left to organisations.
  • Repositories with the cloud agent enabled that have branch protection and required checks on the default branch.
  • Repositories with the agent firewall disabled or with custom allowlist entries, reviewed quarterly.
  • Number of MCP servers configured across repositories and the share limited by a tools list.
  • Connections to *.individual.githubcopilot.com from corporate networks after routing is enforced.

Hardening baseline

AreaSettingBaseline
Policy levelEnterprise Copilot policiesEnforce MCP, preview features, partner agents and CLI at enterprise level
Public codeSuggestions matching public codeBlock, or allow with code references so licence information is logged; matching uses about 150 characters of context against public GitHub repositories only
Content exclusionOrganisation rule "*" with "**/.env" plus repository paths such as "secrets.json" or "/scripts/**"Applied, while accepting it does not cover agent modes or the CLI
Agent firewallEnable firewall: Enabled; Recommended allowlist: Enabled; Allow repository custom rules: off for sensitive organisationsOrganisation custom allowlist for internal package mirrors only
Workflow runs"Approve and run workflows" on agent pull requestsKeep manual approval; do not enable automatic runs
MCPRepository MCP JSON with explicit toolsDefault GitHub MCP token kept read-only
CLICopilot CLI policyEnabled only for groups that run it in containers or VMs; no --allow-all-tools on workstations
NetworkSubscription-based network routingAllow *.business.githubcopilot.com or *.enterprise.githubcopilot.com; block *.individual.githubcopilot.com
PatchingIDE and extension versionsManaged updates; for example CVE-2025-53773, a command injection flaw in GitHub Copilot and Visual Studio allowing local code execution, affected Visual Studio 2022 17.14.0 to before 17.14.12

Rolling out the baseline

  1. Inventory: list seats, organisations with Copilot enabled, repositories with the cloud agent on, existing MCP configurations and any personal plan traffic seen at the proxy.
  2. Set enterprise policy: decide which features are enabled everywhere, disabled everywhere or delegated, and record why.
  3. Pilot ring: enable the cloud agent on a few repositories with branch protection and required checks, the firewall on and the recommended allowlist. Watch firewall warnings and session logs for two weeks.
  4. Apply content exclusion and network routing: roll the organisation-wide rules out, reload editors (VS Code: "Developer: Reload Window"; changes can take up to 30 minutes), and confirm developers on minimum client versions (Copilot Chat in VS Code 0.17, Visual Studio 2022 17.11).
  5. Expand: enable the agent and partner agents organisation by organisation once the pilot shows no blocked-destination surprises.
  6. Roll back: disabling a policy at enterprise level, removing a repository's MCP configuration or setting the firewall back to Enabled takes effect without code changes; agent pull requests are drafts and can simply be closed.

Decision guidance

  • Cloud agent or local agent mode: the cloud agent runs in a GitHub Actions environment with a firewall, a scoped token and mandatory human merge; local agent mode runs with the developer's full workstation credentials. For untrusted issues or unfamiliar code the cloud agent is the more contained option.
  • Block or reference public code: blocking avoids licence questions but hides useful matches; allowing with references suits organisations whose open source review process can act on the logged licence names.
  • Small teams: one organisation, enterprise policies left at defaults except MCP and the firewall, and branch protection on every repository may be enough. Large enterprises need enterprise-level enforcement, a private package mirror on the firewall allowlist and SIEM streaming.

Common misconfigurations

  • Relying on content exclusion for secrets: excluded files still reach agent modes and the CLI. GitHub's own pages differ on CLI support, so test it, and remove secrets from repositories instead. See the Secrets Management Guide.
  • Trusting text in issues and pull requests: Legit Security's CamoLeak research (CVSS 9.6) hid instructions in a pull request description that Copilot Chat read with the viewing user's permissions, and used GitHub's Camo image proxy to move private repository content out. GitHub fixed it on 14 August 2025 by disabling image rendering in Copilot Chat. The cloud agent now filters hidden text such as HTML comments, but Chat users still read untrusted content with their own access.
  • Disabling the firewall to make a build work: GitHub warns this lets the agent connect to any host. Add the specific package domain or URL instead.
  • Broad MCP tokens: swapping the read-only GitHub MCP token for an organisation-wide PAT so the agent can "see more", which turns any injected instruction into cross-repository access.
  • Self-hosted runners with standing credentials: the agent runs without the firewall on a runner that also deploys to production.
  • Ignoring personal plans: developers sign in to Copilot Free or Pro on corporate machines, outside every policy above, because network routing was never enforced.

Framework mapping

RiskOWASP LLM Top 10 2025MITRE ATT&CK / ATLASNIST SP 800-53 Rev. 5 / CSF 2.0
Instructions hidden in issues, pull requests or repositoriesLLM01 Prompt InjectionAML.T0051.001 IndirectSI-4; DE.CM-09
Private code or secrets in suggestions or chat outputLLM02 Sensitive Information DisclosureAML.T0057 LLM Data Leakage; T1552.001 Credentials In FilesAC-3, SC-28
Agent tools and MCP servers with too much reachLLM06 Excessive AgencyAML.T0053 AI Agent Tool InvocationAC-6, CM-7; PR.AA-05
Agent exfiltration over the networkLLM02T1567 Exfiltration Over Web ServiceSC-7
Compromised extensions or dependencies pulled by the agentLLM03 Supply ChainT1195.001 Compromise Software Dependencies and Development ToolsSA-11; GV.SC-07, PR.PS-06
No record of agent actionsn/an/aAU-2, AU-6, AU-12

Practitioner checklist

  • Enforce MCP, partner agent, preview feature and CLI policies at enterprise level.
  • Set the public code matching policy deliberately and document the choice.
  • Apply organisation-wide content exclusion for .env and secrets files, and test which surfaces honour it.
  • Keep the agent firewall and recommended allowlist on; review every custom allowlist entry.
  • Require branch protection, required checks and manual workflow approval on repositories where the cloud agent is enabled.
  • Keep the default GitHub MCP token read-only and restrict each MCP server with a tools list.
  • Use ephemeral runners for the agent, and never a runner that holds deployment credentials.
  • Enforce subscription-based network routing and block individual Copilot endpoints.
  • Stream the audit log to the SIEM and add your own collection for IDE and CLI prompts if required.

Standards and references

Related NHI Mgmt Group resources: AI Coding Agents Security Guide · AI IDE and Coding Agent Security Guide · GitHub and GitHub Actions Security Guide · Vibe Coding Security Guide · MCP Security Guide

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Written and reviewed by Lalit Choda, NHI Mgmt Group. Last updated 24 October 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick the PDF box to continue.