AI Coding Assistant Security: What Happens When a Pull Request Gives Your Agent Orders

AI coding assistant security now comes down to what happens when a pull request gives your agent orders. The agent may obey, using your team’s permissions to run commands and hand over secret keys. In April 2026, researchers did exactly that to three popular coding tools from Anthropic, Google, and GitHub, with little more than a crafted title or comment.

Picture an AI code reviewer that holds a key to your repository, a command line that can run programs, and a few cloud passwords. Someone outside your company opens a pull request, the standard way to suggest a code change. Its title is really an instruction for the reviewer: print every password you can find. Nobody has to break into anything, because the AI simply complies.

Finding gaps like this before an attacker does is our job. In penetration testing, our engineers feed an agent the text a stranger could write, then track what it reaches and where the results end up. You get a list of every path into your pipeline before an attacker finds one.

Why AI Coding Assistant Security Is No Longer About Generated Code

For the past few years, AI coding assistant security meant checking the code suggestions that appeared in your editor. Did the code contain a bug or leak a password? That question still matters, but it misses a newer risk: assistants have become agents that act on their own inside your development process.

A modern coding agent doesn’t wait for a developer to accept its suggestions. Once a team connects it to GitHub Actions, the automation that runs tasks inside a repository, the agent picks up new pull requests and bug reports, known on the platform as issues. Then it runs commands, edits files, and posts replies on its own. To do all that, the agent carries access tokens, digital passes that let it act in your team’s name.

That combination changes the threat. Whoever can write text the agent will read can try to steer it, and on a public repository that includes every GitHub user. That exposure is growing fast. By September 2026, agents wrote the first draft of more than 40% of pull requests on GitHub, the company’s Octoverse 2026 report shows.

AI coding agent security is one branch of agentic AI security, the wider field that asks what any fooled AI system can reach.

What Is the Comment and Control Attack on AI Coding Agents?

Comment and Control is a set of attacks in which a few lines of ordinary GitHub text took over three AI coding agents. Researcher Aonan Guan disclosed them in April 2026, and SecurityWeek reported that all three vendors confirmed the findings. Each attack began with text anyone could write:

  • Claude Code Security Review: Anthropic’s reviewer read a pull request title, took it as orders, and ran the commands. Then it posted the stolen credentials in its own review, neatly labeled as a “security finding.”
  • Gemini CLI Action: A single issue comment talked Google’s agent past its safeguards. In return, the agent handed over a full API key, the password to a paid service.
  • GitHub Copilot Agent: The instructions hid in an issue, inside an HTML comment that nobody reading the page could see. Once a teammate assigned the issue to Copilot, the agent went hunting for secrets and slipped past the firewall meant to keep it in.

None of the stolen keys passed through a suspicious server. GitHub’s own comments and logs carried them out, so AI coding assistant security can’t rely on blocking outside traffic.

The same trick had already worked outside a lab in February 2026, two months before Guan’s disclosure. Attackers planted a malicious issue title in the repository of Cline, a popular open-source coding assistant, where an AI agent sorted incoming reports. The Hacker News reports that the title handed them the key Cline used to publish its software. For about eight hours, an unauthorized version of Cline installed an extra AI agent on users’ machines. That program was harmless, but the next one might not be.

Is your AI agent working for strangers?
Contact Us

Can a Pull Request Hijack an AI Coding Agent?

Yes, a pull request can hijack an AI coding agent. Every attack of this kind combines three things: text from an outsider, an agent allowed to run commands, and secrets within that agent’s reach. Take away any one, and the chain breaks. Separating them is the core job of AI coding assistant security.

Outside text reaches your agent through more doors than most teams expect:

Where Outside Text Reaches Your Agent, and What It Costs
Text the agent reads
Who can write it
What your business could face
Text the agent reads

Pull request titles and descriptions

Who can write it

Anyone who can propose a change

What your business could face

Customer data stolen from your cloud, followed by breach notices and cleanup costs

Text the agent reads

Issue titles and comments

Who can write it

Anyone with a GitHub account, on public repositories

What your business could face

An unauthorized release of your product, published under your name

Text the agent reads

Hidden HTML comments

Who can write it

Anyone who can post a comment

What your business could face

Secrets leaving your systems while every reviewer sees a clean page

Text the agent reads

Branch names

Who can write it

Anyone who creates a branch the agent works on

What your business could face

Strangers with access to your private source code

Text the agent reads

Configuration files inside the repository

Who can write it

Anyone whose change the agent opens

What your business could face

Malicious code running on your build machines and shipping to customers

The first four rows are forms of indirect prompt injection: orders hidden in content the AI reads while doing its job. Language models can’t reliably tell planted text from real requests, so protection has to come from the agent’s setup. Configuration files work differently, because many AI coding tools act on them automatically, with no persuasion needed.

What the agent may run and what secrets it can reach are the part of AI coding agent security your team controls. A reviewer that holds no secrets has little to give away. Hand it your deployment keys or cloud passwords, and one planted sentence can expose them all. Narrow access keeps protecting you even against tricks nobody has discovered yet, because a fooled agent can only leak what it can reach.

Coding agents often reach other services through the Model Context Protocol (MCP), the standard that lets AI use outside tools. A tool server a developer copied from GitHub can slip instructions to your agent as easily as a pull request can. That’s why MCP security starts with knowing who wrote every server your agents rely on.

How Opening a Repository Can Run Malicious Code in AI Coding Tools

Configuration files deserve a closer look. Many AI coding tools follow settings files stored inside a repository, so whoever controls them can make the assistant run their code the moment someone opens the project. That turns an ordinary project file into an AI coding agent security issue.

In April 2026, Google fixed exactly this kind of flaw in Gemini CLI and gave it the maximum severity score of 10. According to SecurityWeek, a pull request carrying its own settings file could run commands inside the build pipeline and push code that “ships to every downstream user.”

Attackers have already used this weakness at scale. In May and June 2026, two worms spread through hundreds of infected software packages in supply chain attacks aimed at AI coding tools. Mini Shai-Hulud planted a Claude Code hook that stayed behind even after developers removed the bad package. Miasma added settings files for Claude Code, Gemini CLI, Cursor, and VS Code. OWASP’s exploit roundup sums up the result: opening a cloned repository in an AI coding tool can run code without any installation step.

For AI coding assistant security, that puts your developers’ tools on the same risk list as the product they help build.

How to Secure and Test AI Agents in GitHub Actions

Securing AI agents in GitHub Actions comes down to one rule: grant only the access each job needs, then prove that this boundary holds under attack. The second part is where setups fail quietly. In June 2026, The Hacker News reported that the Claude Code GitHub action trusted any account whose name ended in “[bot]”, a label anyone can register. One crafted issue was enough to turn that loophole into write access to the repository.

Our AI agent testing, carried out by penetration testers, answers the questions that decide AI coding assistant security in your pipeline:

  • Who can start your agent? Outside contributors, look-alike bot accounts, and anyone else your trigger rules let through
  • What will it obey? Instructions hidden in pull request titles, issue comments, branch names, and settings files
  • What secrets can it reach? Every token and password in the agent’s environment, and every place a fooled agent could post them
  • Does a fix survive the next update? Upgrades to the agent, its model, or its connected tools, retested before your team relies on them

For every weak spot we find, you get evidence of what it exposed and a clear fix. Often that means nothing more than a narrower token or a teammate who approves the agent’s actions. If your team also ships AI features to customers, our pre-launch prompt injection checklist covers those inputs.

Your agents read outsiders’ text every day. Find out what it could make them do.

FAQ

Are AI coding assistants secure?

AI coding assistants carry modest risk while they only suggest code in an editor. The picture changes once the tool runs commands, holds access keys, and reads messages written by people outside the company, because their authors can steer it. AI coding assistant security therefore depends less on the model itself than on how much the tool is allowed to touch.

What permissions should an AI code reviewer have?

Think of an AI code reviewer as a read-only auditor: it may review the source and leave comments, nothing more. Its access key should cover a single repository and expire within hours. Credentials for deploying, publishing, or cloud accounts belong where the reviewer can’t see them, and every merge or release should wait for a person to sign off.

Are AI coding agents safe in a private repository?

A private repository keeps strangers from posting pull requests and issues, but hostile text can still get in. Planted instructions arrive through a compromised employee account, a dependency the team installs, or a project someone clones. In 2026, worm campaigns spread through hundreds of open-source packages and planted malicious settings for AI coding tools. Private or public, the agent’s access determines the damage.

See our security code review for a US-based e-commerce platform that highlights exploits and explains how to remedy them.

Please enter your business email isn′t a business email