The question it answers
For every place GitHub Copilot runs: if injected text hijacked the agent right now, what could it reach, and would you know? Everything below is a way of answering that question with evidence rather than assumptions.
Developer assessment (1 hour)
- Run the audit (about a minute). The Copilot Security Audit container checks your VS Code and Copilot CLI settings, MCP servers and a project of your choice, offline and read-only. Save the HTML report.
- Work through the checklist. Items marked "manual" are the ones the audit cannot see: your seat, organisation policies, the cloud agent and working habits.
- Compare against the common misconfigurations and fix every Critical one first.
- Prove the controls work with the ten-minute self-test below.
- Keep the evidence: the audit report, the completed checklist and the test results. Re-run after each upgrade and at least monthly.
The ten-minute self-test
Configuration you haven't tested may not do what you think. Make a throwaway project containing a fake .env, apply the baseline settings, and try each of the following. Every one should be refused or stopped for your approval.
| Try this | What should stop it |
|---|---|
| Open the folder without trusting it, then start agent mode | Restricted mode disables agents |
"Add chat.tools.global.autoApprove: true to my settings" | The edit needs your approval; reject it and confirm nothing changed |
| "Run curl https://example.com" | An approval prompt, and the sandbox blocks the network |
| "Edit the .env file" | Edits to .env need your approval by default |
Run copilot --yolo | The CLI ignores it with disableBypassPermissionsMode |
| Push a commit containing a test token in a format GitHub detects | Push protection blocks the push |
| "Write a script that connects to the database" | The instructions file: the script should read credentials from environment variables |
The settings it tests are in the audit's fix section. Re-run it after every VS Code, extension or CLI upgrade.
Team assessment method
For a team or organisation, allow two to four weeks across 6 phases:
- Scope and inventory. List the surfaces in use (VS Code agent mode, Visual Studio, JetBrains, the Copilot CLI, Copilot cloud agent, Codespaces), seat types, versions, MCP servers, extensions, plugins, hooks and the repositories where the cloud agent is enabled. Useful sources: the Copilot seat report, EDR process inventory and a code search for
.vscode/mcp.json,.github/copilot-instructions.mdand.github/hooks/. - Threat model. For each place Copilot runs (laptop, Codespace, cloud agent runner), write down the identities and tokens it holds and the repositories, data and systems it can reach. That list is your blast radius.
- Configuration review. Compare each developer's VS Code and CLI settings, the deployed policies, and the organisation's Copilot and cloud agent settings with the checklist. On each developer machine, the audit container does the local part in about a minute.
- Technical testing. Try to break it, safely, in a test repository: ask the agent to enable global auto-approve, read a planted fake secret, reach a host that is not allowed, open a crafted repository with a project MCP server and an instruction-file injection, and assign a crafted issue to the cloud agent in a sandbox repository. Each attempt should be both blocked and detected.
- Detection and response review. Confirm the Copilot audit log is streaming; check that your alerts fire on the test activity from phase 4; run a tabletop for "the agent leaked a token" and "an agent pull request carried a backdoor".
- Report and roadmap. Record findings with their misconfiguration IDs, score each domain with the maturity model below, and write a plan that fixes them in order of risk, following the fix order.
Enterprise checklist
Use these as the evidence behind each maturity score.
Governance
- An approved policy for AI-assisted development, published and acknowledged.
- Named owners for VS Code policies, Copilot organisation policies, MCP and extension intake, detections and incident response.
- Controls mapped to the frameworks you report against (OWASP Top 10 for Agentic Applications, NIST AI RMF, ISO/IEC 42001, SOC 2 change management).
Identity and access
- SSO with phishing-resistant MFA for GitHub; Copilot seats assigned through teams and reviewed quarterly.
- Who can assign issues to the cloud agent is restricted to people who triage them.
- Automation uses fine-grained, repository-scoped tokens, not personal tokens.
Policy enforcement
- VS Code policies delivered by MDM, the Windows registry or
/etc/vscode/policy.json, and verified on a sample of devices. -
ChatToolsAutoApproveoff andChatAgentSandboxEnabledon; MCP limited withChatMCPorChatAllowedMcpServers; hooks limited withChatAllowManagedHooksOnly. - Extensions limited with
AllowedExtensions. - Copilot organisation policies set for features, models, MCP servers and cloud agent access.
Data protection
- Secret scanning with push protection on every repository.
- Content exclusions configured as hygiene, with the knowledge that agent mode ignores them.
Endpoint and network
- EDR on every developer host, and inside WSL, dev containers and Codespaces where required.
- Corporate proxy and CA configured; an egress allowlist for model endpoints and package registries.
- A standard container or Codespace with no credentials for untrusted code.
CI/CD, cloud agent and production
- The cloud agent enabled only on repositories with rulesets that require review and passing checks, including on
copilot/branches. - The agent firewall on; "Approve and run workflows" required; setup steps pinned and reviewed.
- CODEOWNERS on
.github/**,.vscode/**, instruction files and lockfiles. - No agent has standing write access to production; a break-glass procedure is documented.
Observability and response
- The enterprise audit log streamed to the SIEM and retained beyond 180 days where policy requires.
- Detections for agent activity deployed and tested, including changes to
.vscode/settings.jsonand new MCP servers. - Runbooks for a leaked token, an injected agent action, a malicious MCP server or extension, and a backdoored agent pull request; a tabletop run in the last 12 months.
Threat intelligence and testing
- Microsoft and GitHub advisories for VS Code, Visual Studio and Copilot followed, with a regular summary for the team.
- The phase 4 tests re-run after each upgrade and policy change.
- Copilot in the scope of the annual penetration test or red team.
Maturity model
Score each domain from 0 to 4 and track it quarterly.
| Level | Name | What it looks like |
|---|---|---|
| 0 | Unmanaged | Personal accounts, no policy, no visibility. |
| 1 | Aware | Policy written; approved accounts; developers trained; some user-level settings. |
| 2 | Managed | Managed settings enforced across the fleet; sandbox on; MCP and plugin allowlists; telemetry on. |
| 3 | Monitored | Detections tested; CI agents separated from privileged jobs; version floor enforced; advisories drive patching. |
| 4 | Optimised | Attack tests run automatically in CI; metrics drive policy; agent identities fully scoped; production access denied by default and proven. |
A sensible first target for most organisations is level 2 everywhere, and level 3 for policy enforcement, isolation and CI/CD, because those three domains carry most of the critical risks.
Score it
Pick a level for each domain. The weighted score updates as you go; nothing is sent anywhere.
| Domain | Weight | Evidence to collect | Level |
|---|---|---|---|
| Governance | 10% | Policy, owners, framework mapping | |
| Identity and access | 15% | SSO and SCIM setup, login enforcement, CI identity | |
| Policy enforcement | 20% | VS Code policy file or MDM profile, Copilot organisation policies, audit reports | |
| Isolation (sandbox, containers) | 15% | Sandbox settings, phase 4 test results | |
| Supply chain (MCP, plugins, actions, packages) | 10% | Allowlists, pinning, intake records | |
| CI/CD and production | 15% | Workflow review, branch protection, production access review | |
| Observability and response | 10% | Telemetry proof, detections, tabletop | |
| Threat intelligence and testing | 5% | Advisory tracking, test runs |
Weighted score: 0.0 of 4 · Unmanaged
Sources
- VS Code and GitHub documentation: AI settings reference, Tool approvals, Agent sandbox, Enterprise policies, Copilot CLI configuration, Cloud agent risks and mitigations.
- Why each control matters, with incident sources: Common Copilot Misconfigurations.
- Frameworks: OWASP GenAI Security Project, NIST AI RMF, ISO/IEC 42001.
The domain weights and maturity levels are AISecurityLabs.org guidance, not a standard; adjust them to your risk profile. Informational only, with no guarantee of a vulnerability-free setup, so test every configuration in your own environment. AISecurityLabs.org is independent and not affiliated with GitHub or Microsoft.