Skip to content

AI Coding Agents and Developer Secrets: Lessons from s1ngularity and the GitHub MCP Exploit

10 min read Fullmakt Team

  • agentic-ai-gone-wrong
  • credentials
  • mcp
  • traceability
  • governance
  • authentication
  • agentic-actions
  • agents
  • business-case

AI coding agents are the most widely deployed agentic AI in most companies. They run in terminals, IDEs and CI pipelines, they execute shell commands, and they call MCP servers for GitHub, cloud consoles and databases. To do any of that they need credentials, and in most setups they get the same ones the developer has: a GitHub personal access token, an npm publish token, cloud keys in ~/.aws, a database URL in .env.

That makes the developer laptop and the CI runner the place where agentic AI and credential security collide. In 2025 two incidents showed what the collision looks like. In both, the damage was done by an AI agent doing what it was built to do, with secrets it should never have been able to reach.

This post walks through both incidents, explains the shared root cause, and shows how a credential broker changes the outcome.

What is the AI coding agent credential problem?

The AI coding agent credential problem is that coding agents inherit the developer’s ambient credentials: every token, key and secret readable from the user’s files, environment variables and tool configs. Whoever controls the agent’s instructions, through a prompt injection, a malicious package or a poisoned tool, controls those credentials too. The agent has no separate identity, so the resulting actions also look exactly like the developer’s.

Incident 1: s1ngularity turned AI CLIs into secret scanners

In August 2025, attackers published malicious versions of the popular nx build system package to npm, using a publishing token stolen through a vulnerable GitHub Actions workflow. The compromised versions ran a post-install script on every machine that installed them.

What made the attack new was its use of AI. The script checked whether AI coding CLIs, such as Claude Code, Gemini CLI and Amazon Q, were installed. If they were, it launched them with flags that skip permission prompts and a prompt asking the agent to search the file system for secrets: wallet files, SSH keys, .env files and similar. The results, together with GitHub and npm tokens from the machine, were encoded and uploaded to public GitHub repositories created in the victim’s own account, named s1ngularity-repository (sometimes with a numeric suffix).

Thousands of secrets were exposed before GitHub took the repositories down. Many of the stolen GitHub tokens were then used in a second wave that made victims’ private repositories public.

The lesson is uncomfortable: an AI agent with file system access is a very good secret scanner, and it works for whoever writes the prompt. Every plaintext secret on a developer machine is one prompt away from being collected. We described the same risk for agent config files in MCP config files with plaintext API keys.

Incident 2: the GitHub MCP “toxic agent flow”

In May 2025, Invariant Labs disclosed an attack against agents connected to the official GitHub MCP server. The setup was ordinary: a developer connects an agent, such as Claude Desktop, to GitHub using a personal access token that can read both public and private repositories.

The attacker only needs to open an issue in one of the developer’s public repositories. The issue contains instructions aimed at the agent. When the developer asks the agent to “look at the open issues”, the agent reads the injected instructions, uses the developer’s token to read private repositories, and writes what it found into a pull request in the public repository, where the attacker can read it.

There was no bug in the MCP server to patch. Every call was authorised, because the token allowed it. Invariant Labs described it as an architectural problem: an agent that reads untrusted content while holding a broadly scoped credential will eventually act on that content. This is the confused deputy pattern, and the lethal trifecta of private data, untrusted input and an exfiltration channel, in one GitHub workflow.

The shared root cause: ambient credentials

The two incidents look different. One is a supply chain attack, the other a prompt injection. They share three weaknesses:

  1. The secret was within the agent’s reach. In s1ngularity it was a file the agent could read. In the GitHub case it was a token the MCP server held on the agent’s behalf. Either way, the agent’s instructions decided what the credential did.
  2. The credential was broader than the task. A token that can read every private repository was used for a task that needed one public issue list. Nothing in the call path compared the action with the intent.
  3. Nobody could tell agent actions from human ones. The new public repositories, the PR and the API calls were all made with the developer’s identity. Audit logs said “the developer did it”, which slows down both detection and the incident forensics afterwards.

Telling developers to “be careful which packages you install” or “do not let the agent read untrusted issues” does not scale. Agents read untrusted content all day. That is the job.

How a credential broker changes the outcome

Fullmakt is a credential broker for AI agents. Agents connect to it over MCP, either through the fullmakt-mcp launcher for local clients like Claude Desktop and Claude Code, as a remote MCP server with OAuth, or as programmatic agents with their own OAuth client. A2A agents have their own surface. The broker checks policy, attaches the credential and forwards the call. Applied to the two incidents:

  • Upstream secrets off the machine. Requests carry vault references such as vault://local/github-ci, and agents never see the values. The values sit in Fullmakt’s encrypted vault, in HashiCorp Vault, or in a credential service you run yourself. A prompt that tells an agent to collect secrets finds no GitHub, npm or cloud keys to take. This only helps for secrets you move behind the broker, so the first step is getting them out of .env files and configs. One credential remains: the agent’s access to the broker itself. Prefer an agent OAuth client with short-lived tokens over a long-lived token in a config file, because that is now the secret worth protecting. If it leaks, you revoke it in one place instead of rotating every upstream key.
  • Credentials bound to named hosts. Each credential lists the hosts it may be sent to, for example api.github.com. A request to any other host is refused before the credential is attached, so an injected “send this to my server” fails. See host-bound credentials.
  • Policy on every tool call. hardDeny rules block tool calls whose arguments match a pattern, and requireApproval rules pause the call until a human approves it. Creating a pull request, or writing to a named set of repositories, can need a human click, while reading issues stays automatic. The approach is the same as in read/write policies for destructive actions.
  • Behaviour signals. The maxDistinctHostsPerDay rule requires approval for, or blocks, an agent that contacts more distinct hosts in a day than the limit you set, an early sign that it is doing something other than its job.
  • A separate identity for each agent. Agents that authenticate with their own OAuth client get an agent principal and short-lived tokens instead of the developer’s token. The fullmakt-mcp launcher can also be bound to a principal and sign each call as an ES256 task envelope, which the principal can require. The audit trail records which agent called which tool on which host with which credential reference, never the secret value, so “the agent did it” and “the developer did it” are different rows.
  • Revoke the agent, not the developer. Disabling an agent principal stops its tokens and, where signed envelopes are required, its launcher calls, without rotating every token the developer uses. The kill switch post covers why that matters mid-incident.

Replay the two incidents with these controls. In s1ngularity, the GitHub, npm and cloud credentials used through the broker are not on the machine for the AI CLI to find, and the broker access that is there is short-lived and revocable in one place. In the GitHub MCP case, the agent can read the issue, but opening the pull request hits an approval rule, and every step is logged against the agent’s own identity.

A broker does not stop an agent from reading a malicious issue, and it cannot protect secrets you leave in plaintext elsewhere. It controls what the agent can unlock, where those credentials can go, which actions need a human, and what is on record.

The business case: let developers use coding agents without the credential risk

Most engineering teams are not deciding whether to use AI coding agents. They already do. The decision is whether security can say yes without creating a new class of incident. A broker turns that into a concrete trade:

  1. Smaller blast radius per incident. When a package or prompt is compromised, the exposure is a set of host-bound references and the actions policy allowed, not every token on the machine. Responding to a leak becomes revoking one agent, not a weekend of rotations, as covered in rotating a leaked agent API key.
  2. Traceability that answers the auditor. Separate agent identities and a per-call audit trail give you evidence of what each AI agent did, which supports SOC 2 controls and non-human identity governance.
  3. One control point for every agent. Claude Code, other MCP clients and A2A agents all go through the same policies. A new coding agent does not need its own secret distribution or its own security review of where it keeps keys.

Checklist: securing AI coding agents’ credentials

  1. List every credential a coding agent can read: .env files, ~/.npmrc, cloud config folders, MCP config files and CI secrets exposed to agent jobs.
  2. Move the ones agents need behind a broker and give agents references, not values.
  3. Bind each credential to the hosts it is for.
  4. Give each agent its own identity instead of a developer’s personal access token.
  5. Require human approval for publishing, pushing to public repositories, changing visibility and deleting resources.
  6. Treat issues, pull request text, web pages and package READMEs as untrusted input.
  7. Make sure the audit trail separates agent actions from human actions and never stores secret values.
  8. Practise revoking a single agent without touching the developer’s own access.

FAQ

Can an AI coding agent leak my API keys?

Yes. A coding agent with file system or shell access can read any secret stored in plaintext on the machine, and a prompt injection or malicious package can instruct it to send them somewhere. The s1ngularity attack in August 2025 used installed AI CLIs to search for secrets on developer machines.

What was the s1ngularity attack?

It was a supply chain attack in August 2025 in which malicious versions of the nx npm package ran a post-install script. The script used installed AI coding CLIs to search for secrets and uploaded them, with GitHub and npm tokens, to public repositories named s1ngularity-repository in the victims’ own GitHub accounts.

What is the GitHub MCP prompt injection vulnerability?

Disclosed by Invariant Labs in May 2025, it showed that an attacker could put instructions in a public GitHub issue. An agent connected to the GitHub MCP server with a broad token would read the issue, access private repositories and leak their contents into a public pull request. It was an architectural problem rather than a server bug.

How do I give an AI coding agent GitHub access safely?

Give the agent its own identity and a credential reference instead of a personal access token, bind the credential to the GitHub API host, scope it to what the task needs, and require human approval for writes such as pull requests, pushes and visibility changes. Log every call against the agent’s identity.

Does Fullmakt work with Claude Code and other MCP clients?

Yes. Local MCP clients such as Claude Desktop and Claude Code can connect through the fullmakt-mcp launcher, and remote MCP clients connect over OAuth. Tool calls on these paths go through the same collection policies, credential references and audit trail.

See how Fullmakt keeps credentials out of your AI agents’ reach or browse the Fullmakt blog.