The short answer
An AI coding policy settles three questions: which code and data may reach an AI model, what an AI agent may do on its own, and what must happen before AI-written code reaches production. GitHub Copilot, Cursor and Claude Code each ship controls for all three, but most are optional, and several sit with the individual developer rather than the company. Companies that capture the productivity without the incidents set those controls centrally, keep a named human accountable for every merge, and review the policy every quarter.
Most engineering teams adopted coding assistants bottom-up: one developer tried Copilot, a few moved to Cursor, someone installed Claude Code on a Friday. The tools spread faster than the rules. For leadership, the question is no longer whether engineers use AI, but whether the company can show, with evidence, how it is used. This article sets out the five risks that matter, the controls each tool actually offers, and a one-page policy you can adopt as written.
If you do three things this quarter
- Approve the tools and plans, then switch on the data controls centrally: Copilot content exclusion, Cursor Privacy Mode and Claude Code managed settings.
- Give coding agents least privilege: no production credentials, an explicit allow/ask/deny list for commands, and a sandbox for anything that executes code.
- Treat AI-written code as untrusted input: human review plus automated secret and security scanning before every merge.
Why this matters now
AI-assisted development has moved from experiment to default faster than any previous developer tool. The evidence on its effects is now substantial, and it points in two directions at once.
By the numbers
- 84% of developers use or plan to use AI tools, up from 76% a year earlier, while 46% say they do not trust the accuracy of the output (Stack Overflow Developer Survey, July 2025).
- 38% of AI coding tasks still produced vulnerable code in Veracode’s October 2026 tests, down from 44%, but still nearly four in ten (Veracode, October 2026).
- 6.4% of public repositories using Copilot leaked at least one secret, against 4.6% of all public repositories, a 40% higher rate (GitGuardian, 2025). In 2025, Claude Code-assisted commits leaked secrets at about 3.2%, roughly twice the GitHub-wide baseline (GitGuardian, March 2026).
- For every 25% increase in AI adoption, Google’s DORA research estimates a 7.2% fall in delivery stability and a 1.5% fall in throughput, even as documentation quality (+7.5%) and code review speed (+3.1%) improve (DORA 2024).
- In a randomised study, experienced open-source developers took 19% longer with AI tools while believing they were 20% faster (METR, July 2025). METR’s 2026 follow-up suggests gains have likely grown since, though the evidence is weak.
The pattern is consistent. Individual output rises; system-level risk accumulates where no one is looking: secrets in commits, changes merged on trust, agents running with a developer’s full permissions. The perception gap in the METR study is the governance problem in miniature. If teams overestimate the gains, they will under-invest in the controls.
The same pressure is arriving from the business side. Vibe coding, building software mostly by prompting rather than writing code, has moved from founders’ side projects into product teams. Enterprise customers and auditors are starting to ask how AI-written code is governed. A written, enforced policy is becoming part of the answer to a security questionnaire.
Five risks, one framework
Most AI coding incidents fall into five categories. Each needs a different control, which is why a single “use AI responsibly” sentence in the engineering handbook does not work.
| Risk | What it looks like | Evidence | First control |
|---|---|---|---|
| 1. Data exposure | Source code, credentials or customer data sent to a model provider, retained, or used for training. | With Cursor’s Privacy Mode off, code, prompts and snippets “may” be stored and used to train models (Cursor). | Approved business plans with zero data retention; exclude sensitive paths from AI context. |
| 2. Insecure or wrong code | Code that compiles and passes a demo but carries a vulnerability or a logic error. | 38% of AI coding tasks produced vulnerable code (Veracode, Oct 2026); delivery stability falls as adoption rises (DORA). | Human review and static application security testing (SAST) on every pull request. |
| 3. Agent overreach | A coding agent, an assistant that edits files and runs commands on its own, acts with the developer’s full permissions, including against production. | A Replit agent wiped records for 1,200+ executives during a declared code freeze (Fortune, July 2025). | No production credentials on developer machines; deny rules; a sandbox. |
| 4. Instruction and supply-chain attacks | Hidden instructions in rules files, READMEs or tool servers steer the agent. This is prompt injection applied to code. | The “Rules File Backdoor” hid instructions in Copilot and Cursor rules files using invisible Unicode (The Hacker News, March 2025). CurXecute (CVE-2025-54135, CVSS 8.5) let a prompt injection rewrite Cursor’s tool configuration and run commands; fixed in Cursor 1.3.9 (Tenable, August 2025). | Review rules files and tool configurations like code; allowlist MCP servers; keep tools patched. |
| 5. Secrets and intellectual property | Keys committed by an assistant, or suggestions that reproduce public code under a licence you cannot accept. | Secret leak rates in AI-assisted code ran at roughly double the GitHub-wide baseline in 2025 (GitGuardian, 2026). | Secret scanning with push protection; block or reference public-code matches. |
Two terms recur in the rest of this article. MCP, the Model Context Protocol, is the open standard that lets an assistant call external tools such as a database, a ticketing system or a browser. Every MCP server you connect extends what the agent can reach, and what an attacker can reach through it. Rules files (.cursor/rules, CLAUDE.md, AGENTS.md, .github/copilot-instructions.md) are standing instructions the assistant reads on every request. They are code in all but name, and they deserve the same review.
What each tool lets you control
The three tools solve the same problems in different places. The table below maps the controls that matter for policy to the vendor’s own documentation. Where a vendor documents no equivalent, the policy has to rely on process.
| Control | GitHub Copilot | Cursor | Claude Code |
|---|---|---|---|
| Keep sensitive code out of the model | Content exclusion for files and repositories on Business and Enterprise plans. GitHub’s documentation notes it is not supported in the Edit and Agent modes of Copilot Chat. | Privacy Mode: no training on your code, and zero-data-retention agreements with model providers. Data may still be stored if abuse detection is triggered. | Permission rules can deny the agent read access to paths such as .env or secrets/. |
| Limit what the agent may do | Organisation policies decide which Copilot features and agents members can use. | MCP servers require approval. Update to 1.3.9 or later: earlier versions allowed approved configurations to be changed silently (CVE-2025-54135 and CVE-2025-54136). | Rules are evaluated deny, then ask, then allow. Modes range from plan-only to fully autonomous. OS-level sandboxing restricts file and network access for shell commands. |
| Enforce it centrally | Policies set at enterprise and organisation level. | Check which settings your plan lets administrators enforce; Cursor documents Privacy Mode as a setting. | Managed settings, deployed by file or MDM, which developers’ own settings cannot override. |
| Public code and licences | Code referencing: block suggestions matching public code, or show them with the source and licence. Matches occur in under 1% of suggestions. | No documented equivalent; rely on review and licence scanning. | No documented equivalent; rely on review and licence scanning. |
Two implications follow. First, no single tool covers every risk, so the policy must be written around risks, not products. Second, the strongest controls are the ones an administrator sets once. Anything that depends on each developer remembering a toggle will drift within a quarter.
A one-page AI coding policy you can adopt this week
The template below is deliberately short. A policy that fits on one page gets read; a twenty-page standard gets filed. Copy it, replace the bracketed text, and have engineering, security and legal sign it off together. Each clause maps to one or more of the five risks above.
AI CODING POLICY · [Company] · Version 1.0 · Owner: [CTO / Head of Engineering] 1. SCOPE Applies to every employee and contractor who writes, reviews or deploys code, and to every AI assistant or agent used for that work. 2. APPROVED TOOLS Only these tools, on company-managed business plans: [GitHub Copilot Business, Cursor Business, Claude Code via company account]. Personal accounts and free tiers are not permitted for company code. 3. DATA CONTROLS Training on company code is switched off and retention minimised for every approved tool. These paths are excluded from AI context: [.env*, secrets/, customer data exports, infrastructure state]. Administrators enforce this; individuals may not change it. 4. AGENT PERMISSIONS Agents run with least privilege. They may not hold production credentials, run destructive database or infrastructure commands, or push to protected branches. Autonomous modes are limited to sandboxed environments. 5. TOOL CONNECTIONS (MCP) AND RULES FILES Only MCP servers on the approved list may be connected. Changes to rules files (.cursor/rules, CLAUDE.md, AGENTS.md, copilot-instructions.md) and MCP configuration require code review, like any other code change. 6. REVIEW AND TESTING AI-generated code is untrusted input. Every change is reviewed by a person who understands it, and passes automated tests, static security analysis and dependency checks before merge. The author remains accountable. 7. SECRETS Secret scanning with push protection is on for every repository. A leaked secret is rotated within [24] hours and reported to security. 8. INTELLECTUAL PROPERTY Suggestions matching public code are [blocked / shown with licence and reviewed]. Licence scanning runs in CI. 9. LOGGING AND INCIDENTS Tool usage is logged where the vendor supports it. Suspected data exposure, agent misbehaviour or prompt injection is reported as a security incident. 10. REVIEW CYCLE This policy and the approved-tool list are reviewed every [quarter]. Exceptions require written approval from [owner] and expire after [90] days.
Clauses 3, 4 and 5 do most of the work. They address the risks that are new with AI assistants, while clauses 6 to 8 adapt controls most engineering teams already run. If you only have time to implement three clauses this month, start there.
A 90-day rollout: contain, guard, scale
Publishing a policy changes nothing on its own. The sequence below moves from the controls that remove the largest exposure fastest to the ones that need process change. It lines up with the “govern, map, measure, manage” functions of the NIST AI Risk Management Framework, so the work also counts towards an ISO/IEC 42001 AI management system if you pursue one later.
| Phase | Actions | Owner | Done when |
|---|---|---|---|
| Contain (days 1–30) | Survey which assistants are actually in use, including personal accounts. Move everyone to business plans. Turn off training and turn on exclusions centrally. Remove production credentials from developer machines. | CTO, IT | Every active user is on a managed plan; no production secrets on laptops. |
| Guard (days 31–60) | Deploy managed settings and deny rules for agents. Publish an MCP allowlist. Add rules files to code-owner review. Make SAST, dependency and secret scanning blocking in CI. Publish the one-page policy. | Security, platform team | Pipeline blocks a planted test secret and a known-vulnerable pattern. |
| Scale (days 61–90) | Track DORA’s software delivery metrics, in particular change failure rate, before and after. Train reviewers on what AI-generated code gets wrong. Give agents a sandbox so autonomy can grow safely. | Engineering managers | A baseline and a 90-day comparison exist; the first quarterly review is booked. |
The measure that matters most is change failure rate: the share of deployments that cause an incident or need a fix. If adoption rises and change failure rate holds or falls, the policy is working. If it climbs, the review and testing clauses are not being applied, whatever the adoption numbers say.
Frequently asked questions
What should an AI coding policy include?
Ten things: scope, an approved-tool list, data controls (training off, sensitive paths excluded), agent permissions, rules for MCP tool connections and rules files, mandatory human review and security testing, secret scanning, an intellectual-property position on public-code matches, logging and incident reporting, and a review cycle. Clauses on data controls, agent permissions and tool connections address the risks that are new with AI assistants.
Is GitHub Copilot safe to use on company code?
It can be, on a Business or Enterprise plan with organisation policies set. Use content exclusion for sensitive files, but note GitHub documents that exclusion is not supported in the Edit and Agent modes of Copilot Chat. Turn on code referencing to block or flag suggestions that match public code, and keep human review and security scanning on every pull request.
Does Cursor train on my code?
Not with Privacy Mode on. Cursor states that with Privacy Mode enabled your code is not used for training and its model providers operate under zero-data-retention agreements, although data may be stored if abuse detection is triggered. With Privacy Mode off, code and prompts may be stored and used for training. Enforce Privacy Mode for the whole team rather than relying on each developer.
How do I stop Claude Code from running dangerous commands?
Use permission rules, which are evaluated in the order deny, ask, allow, and deploy them through managed settings so developers cannot override them. Deny destructive commands and reads of secret files. Anthropic notes that command rules are not a security boundary on their own, so combine them with the built-in OS-level sandbox and keep production credentials off developer machines.
What is prompt injection in an AI coding assistant?
It is an attack in which instructions hidden in content the assistant reads, such as a README, a rules file, an issue or a web page, cause it to act against the user’s intent. In coding tools that can mean inserting malicious code or running commands. The 2025 Rules File Backdoor and the CurXecute vulnerability in Cursor are documented examples. Review rules files as code, allowlist tool connections and keep tools patched.
Should developers be allowed to use personal AI accounts for work?
No. Personal and free-tier accounts sit outside the company’s data controls, contract terms and logging, so you cannot show what code left the organisation or how it is retained. Provide approved business accounts instead; banning AI without an alternative pushes usage to personal accounts.
How do we know whether AI coding is helping?
Measure delivery, not adoption. Track DORA’s software delivery metrics before and after rollout, especially change failure rate. Google’s 2024 DORA report associated a 25% increase in AI adoption with an estimated 7.2% fall in delivery stability, and a 2025 METR trial found experienced developers were slower with AI while believing they were faster. Self-reported speed is not a reliable signal.
How Assystant can help
Most of the controls above take a day to configure and a quarter to make stick. We help engineering leaders do both. Our AI consulting and governance team runs the Contain phase with you: a tool inventory, a gap review against this template and a policy adapted to your stack and regulators. If AI-generated code is already in production and you are not sure what it contains, our rescue service for Cursor and Claude Code projects starts with a fixed-price audit of security, secrets and test coverage.
Not sure where your team stands? Book a free 20-minute review and we will tell you which three clauses to implement first.
Sources
- Stack Overflow, 2025 Developer Survey press release, 29 July 2025: AI use and trust.
- Veracode, AI code security update, October 2026: share of AI coding tasks producing vulnerable code.
- GitGuardian, State of Secrets Sprawl 2025 and State of Secrets Sprawl 2026 press release, 17 March 2026.
- Google Cloud, Announcing the 2024 DORA report, 22 October 2024.
- METR, Measuring the impact of early-2025 AI on experienced open-source developer productivity, 10 July 2025, and 2026 update, 24 February 2026.
- Tenable, FAQ on CurXecute and MCPoison, 5 August 2025.
- The Hacker News, Rules File Backdoor attack, 18 March 2025.
- Fortune, AI coding tool wiped out a company database, 23 July 2025.
- GitHub Docs: Content exclusion, Code referencing and Secret scanning.
- Cursor, Data use and privacy overview.
- Anthropic, Claude Code docs: Configure permissions and Deploy managed settings.
- NIST, AI Risk Management Framework; ISO, ISO/IEC 42001; OWASP, LLM01 Prompt Injection.
Saket Shukla