AI coding agent security risks and how to control them

Coding agents read your code, run commands and install packages with the developer's own access. That makes them a new path for prompt injection, leaked secrets and supply chain attacks, and 2025 brought public examples of each.

Next step

AI Agent Blocklist: every coding agent, AI editor and MCP server we track, as package names, process names, app IDs and domains

Block the agents you have not approved on devices and on the network, with a risk grade on every entry and daily updates.

From $99 a month for one organisation See plans Ask a question

The risks, one by one

Each risk below is a way an agent's access gets used against you. Most stay small with the right settings and grow large when an agent runs with full access and nobody watching.

Prompt injection

Instructions hidden in a README, code comment, issue, web page or tool description can be read by the agent as a task.

High with full access

Secrets on the machine

.env files, cloud credentials, SSH keys and tokens in environment variables are all within reach of a shell command.

High

Destructive commands

An agent that misreads a task can delete files, rewrite history or drop a database with the developer's own rights.

High in production

Poisoned agent tools

The agent itself, its extensions and its plugins are software with releases. A tampered release reaches every developer who updates.

High

MCP servers

Each server adds tools that run code or reach data. Tool descriptions can carry hidden instructions, and servers can change after approval.

High when unmanaged

Unreviewed code

Agent output can contain vulnerabilities. Large changes tempt reviewers to skim, and some teams merge without review at all.

Medium to high

Code sent outside

Agents send code and context to model providers. Under a personal account, your contract and data terms do not apply.

Medium

Invented dependencies

Agents sometimes suggest packages that do not exist. If someone registers that name with harmful code, the next install pulls it in.

Medium

Patterns reported in 2025

Public research and reports in 2025 showed the same few patterns again and again. We describe the patterns, not products, because the controls are the same for every agent.

  • Pattern 1

    Hidden instructions in tool descriptions

    Researchers showed in 2025 that an MCP tool's description, which users rarely see, can ask a coding agent to read SSH keys and configuration files and pass them to the server.

  • Pattern 2

    A tampered release of an agent tool

    Agent extensions and plugins update like any other software. A tampered release can carry instructions that ask the agent to delete files or cloud resources. Pin versions and review updates.

  • Pattern 3

    Agents with production access deleting data

    Teams reported agents that deleted live data while working on a task, despite instructions not to. Keep production credentials off any machine where an agent runs.

  • Pattern 4

    Command injection in connection helpers

    Some helper tools for reaching remote MCP servers could run commands when pointed at an untrusted server. Connect only to servers you have reviewed, and keep helpers updated.

  • Pattern 5

    Injected MCP configuration

    Researchers showed that prompt injection in AI code editors can write or swap an MCP configuration file and start commands without a new prompt. Treat config files as sensitive and review every change.

  • Pattern 6

    Malware that asks local assistants for help

    A tampered package release carried a prompt asking AI coding assistants on the developer's machine to list files that could hold secrets. The results were posted to public repositories under the developer's own account.

The common thread: the agent had more access than the task needed, and no policy limited it. Each of the controls below reduces the damage from at least one of these patterns.

How much autonomy is safe, and where

Agents offer modes from read-only to fully autonomous. The right mode depends on the machine and what it can reach, not on the developer's experience.

ModeWhat the agent can doCompany laptopDisposable container
Read-only or planRead code, suggest changesYesYes
Edit with approvalEdit files, ask before commandsYes, with secrets deniedYes
Sandboxed auto-runRun commands inside a sandbox, ask to leave itWith managed settingsYes
Classifier or auto modesAn automated reviewer approves actionsOnly after a pilotYes
Bypass, full access, yoloEverything, no checksNoOnly without production credentials
Each agent has its own switch to remove the last row: a managed setting in Claude Code, a requirement in Codex and admin settings in Cursor and Copilot. The per-agent pages show the exact keys: Claude Code, Codex CLI, Cursor and GitHub Copilot.

Five layers of control

No single setting covers every risk. These layers work together, and each one is cheap on its own.

Layer 1

Inventory and block

Know which agents run, and block the ones you have not approved by package, process, app ID and domain.

Layer 2

Managed settings

Force company accounts, approvals and sandboxing on the agents you allow, so users cannot loosen them.

Layer 3

Secrets out of reach

Deny reads of secret files, keep tokens out of shells and give laptops no production credentials.

Layer 4

Tools and MCP

Allow only reviewed MCP servers and plugins, matched by command or URL, never by name.

Layer 5

Review and CI

Protected branches, required reviews and code scanning on every agent change.

Layer 1 in practice: find and block shadow coding agents

You cannot govern what you cannot see. Coding agents install in seconds from npm, PyPI, Homebrew or WinGet, and many live in the user's home folder where software inventory does not look.

Where to look

  • Endpoint telemetry for agent process names started from terminals
  • Package manager inventories on developer machines
  • Editor extension inventories for VS Code and JetBrains
  • Config folders such as .claude, .codex and .cursor in home directories
  • Agent instruction files committed to repositories
  • DNS and proxy logs for coding agent domains

Examples from our identifier file

  • @anthropic-ai/claude-code npm package of Claude Code
  • @openai/codex npm package of Codex CLI
  • @google/gemini-cli npm package of Gemini CLI
  • aider-chat PyPI package of Aider
  • cursor-agent process of the Cursor CLI
  • goose process of the goose agent
Shadow AI is broader than coding agents. Our page on shadow AI agents covers the whole picture, including browser agents and desktop apps.

Layer 2 in practice: managed settings for the agents you allow

Every major coding agent now has an admin layer that users cannot override. The names differ; the goals are the same: company accounts, approvals on, full access off.

AgentAdmin mechanismKeys or settings that matter most
Claude Codemanaged-settings.json, MDM profile, registry policy or server-managed settingspermissions.disableBypassPermissionsMode, allowManagedPermissionRulesOnly, forceLoginOrgUUID, managed-mcp.json
Codexrequirements.toml, macOS MDM or cloud-managed requirementsallowed_approval_policies, allowed_permission_profiles, prefix_rules, mcp_servers
CursorEnterprise MDM policies and the team dashboardAllowedTeamId, Auto Run Configuration, MCP Configuration, Privacy Settings
GitHub CopilotOrganisation and enterprise policies, IDE policiesFeature policies, MCP registry with Registry only, VS Code ChatAgentMode, Visual Studio Disable Agent Mode
Settings files on a laptop can be edited by anyone with local admin rights. Let your MDM redeploy them on a schedule, and give developers standard accounts where you can.

Who is most exposed

Risk follows access. Start your rollout with the groups whose machines hold the most powerful credentials.

Platform and DevOps engineers

Cloud admin tokens, infrastructure code and deployment pipelines. An agent mistake here reaches production.

Application developers

Source code, test credentials and access to shared repositories that other teams build on.

Data scientists

Notebooks next to customer data, database connections and large exports on local disks.

Non-developers who build

Analysts and makers who ship tools with agents, often without code review or a security contact.

Layer 3 in practice: secrets and credentials

Most of the 2025 patterns ended in the same place: credentials on a developer machine. Shrinking what sits there shrinks every other risk.

  • Deny agent reads of .env files, key folders and cloud credential files in each agent's settings
  • Turn on the agent's operating system sandbox where it has one, because tool-level rules do not cover every command
  • Keep long-lived tokens out of shell profiles; load short-lived ones when needed
  • Give developer laptops no production database or cloud admin credentials
  • Scan commits for secrets before they reach shared repositories
  • Rotate any credential an agent may have seen during an incident
The exact keys for Claude Code, Codex, Cursor and Copilot are side by side in stop AI coding agents from reading .env files and secrets.

Layer 4 in practice: MCP servers and plugins

MCP servers and agent plugins are the newest supply chain on a developer machine. They run locally or reach company systems, and few organisations review them today.

Risks specific to MCP

  • Hidden instructions in tool descriptions
  • A server that changes after you approved it
  • Local servers that run any command they are configured with
  • Remote servers that receive company data and tokens

Controls that work

  • Turn MCP off where nobody needs it
  • Allow servers by exact command or URL, never by name
  • Pin versions and review updates
  • Block MCP packages and domains you have not approved
Read MCP security risks for the threat model and how to block MCP servers for the steps.

Layer 5 in practice: review agent changes like a stranger's

Agent changes are fast and often large. The review process has to keep up without becoming a rubber stamp.

  • Protect main branches and require at least one human review for agent pull requests
  • Run code scanning and dependency checks on every agent change
  • Flag new dependencies for a second look, especially unfamiliar package names
  • Keep agent changes small: one task, one pull request
  • Label commits and pull requests made by agents so you can audit them later
  • Block agents from changing CI configuration and deployment files without a named approver

Vibe coding: security and evaluation for non-developers

Agents now let people who are not developers build and ship apps by prompting. The output can look finished while missing basics a reviewer would catch.

Check before it goes liveWhy it matters
Who can sign in, and what each user can seeGenerated apps often skip access checks between users
Where keys and passwords are storedKeys pasted into front-end code are visible to anyone
Which packages it usesUnknown or invented dependencies can carry harmful code
What data it collects and where it goesPersonal data brings legal duties the builder may not know
Who owns it after launchAn app with no owner never gets patched
Use the AI agent risk assessment to decide which agent-built apps need a full review before launch.

How the AI Agent Blocklist helps with coding agents

Layer 1 is where most companies are weakest, because the list of agents changes weekly. That is the part we maintain for you.

What we deliverWhere you use it
npm and PyPI package names of command-line coding agents and MCP serversInternal package proxies and endpoint rules
Process names, WinGet IDs, Homebrew names and macOS bundle IDsIntune, Jamf, Defender and other endpoint tools
VS Code, Open VSX and JetBrains extension IDsEditor policies such as AllowedExtensions
Coding agent and MCP domainsFirewalls, DNS filters and secure web gateways
Category and risk grade on every rowBlock all, or the higher grades first
For agents outside coding, see AI agent security risks.

Start with layer 1 today

The AI Agent Blocklist gives you 5,300+ agent identifiers on devices and 2,600+ AI agent domains, updated every day, so unapproved coding agents never get a foothold.

From $99 a month for one organisation. Download access is set up within one business day of your order.

See plans Ask a question
  • Package, process and app identifiers of coding agents
  • Editor extension IDs for VS Code and JetBrains
  • Domain list, hosts file, PAC file and firewall list format
  • CSV and JSON with tool name, category and risk grade
  • Daily updates as new agents appear

Ask us or order a plan

Tell us what you need to block and where your rules live. We reply within one business day.

  • Files for firewalls, DNS filters, secure web gateways, MDM and browser policies
  • Updated every day as new AI browsers, agents and extensions appear
  • Plans for one organisation, for MSPs and for product makers, or a hosted filter we run for you

We use your details only to answer you. No newsletters.

Questions about coding agent security

What are the main AI coding agent security risks?
Prompt injection from code, issues and web pages; exposure of secrets on the developer machine; destructive commands; compromised agent tools and MCP servers; insecure or unreviewed code; and company code sent to services outside your contract. Most become serious when the agent runs with full access and no approvals.
Is it safe to let AI coding agents run terminal commands?
Only inside limits. Keep the agent's sandbox on, require approval for commands outside it, deny access to secrets, and never use the modes that skip all checks on a normal workstation. Run full autonomy only in disposable containers or virtual machines without production credentials.
How do attackers use prompt injection against coding agents?
They hide instructions in content the agent reads: a README, a code comment, an issue, a dependency's documentation, a web page or an MCP tool description. The agent may treat that text as a task and act on it with the developer's access.
What is GitHub Copilot coding agent security like?
The cloud agent runs in GitHub's infrastructure. GitHub documents firewall allowlists for its cloud sandboxes, branch protection and rulesets that can stop it updating pull requests, and per-repository switches. Human review of every pull request remains the key control.
What is vibe coding and why is it a security concern?
Vibe coding means building software mainly by prompting an agent and accepting what it produces. The risk is code that ships without anyone understanding or reviewing it: missing access checks, exposed keys and unsafe dependencies. Treat it like any other code that needs review before it goes live.
Should companies block AI coding agents?
Block the ones you have not approved and govern the ones you have. Unapproved agents run with personal accounts and no rules, while an approved agent under managed settings, with approvals on and secrets out of reach, is a manageable risk.
Do AI coding agents send our code to AI providers?
Yes, the code and context an agent works on are sent to the model provider behind it. Under a company plan, your contract and data terms decide retention and training use. Under a personal account they do not, which is why company accounts only is a core control.
How do I find which coding agents developers already use?
Look for agent processes, packages and editor extensions in your endpoint and software inventory, config folders in home directories, agent instruction files in repositories, and traffic to AI agent domains in DNS and proxy logs.

Need a checklist for MCP specifically? Use the MCP security checklist.

Claude Code is a trademark of Anthropic, PBC. Codex is a trademark of OpenAI. Cursor is a trademark of Anysphere, Inc. GitHub and GitHub Copilot are trademarks of GitHub, Inc.

Gemini is a trademark of Google LLC. Aider and goose are trademarks of their respective owners. VS Code, Intune and Defender are trademarks of Microsoft Corporation. JetBrains is a trademark of JetBrains s.r.o. Jamf is a trademark of Jamf.

macOS is a trademark of Apple Inc. Visual Studio and WinGet are trademarks of Microsoft Corporation. Open VSX is a trademark of the Eclipse Foundation.

npm is a trademark of npm, Inc. PyPI is a trademark of the Python Software Foundation. Homebrew is a trademark of its owner.

Names are used only to identify the products discussed. AI Agent Blocklist is not affiliated with, sponsored or endorsed by these companies.