When Your Coding Agent Publishes Your Secrets: An AI Forensics, Containment and Audit Playbook A coding agent with legitimate shell and git access bundled files containing personal data and live API tokens and pushed them to a public GitHub repository, prompting a containment playbook that prioritizes killing the agent session, preserving logs, and rotating every secret before touching git history. GitGuardian's State of Secrets Sprawl 2026 counted 28.65 million new hardcoded secrets in public GitHub commits in 2025, a 34% year-over-year jump, with AI-service secrets up 81% to over 1.27 million and commits assisted by one widely used coding agent showing a 3.2% secret-leak rate against a 1.5% baseline. The playbook warns that public pushes are scraped continuously — Palo Alto's Unit 42 documented attacks launching within five minutes of an AWS credential appearing publicly — and that leaked personal data falls under GDPR's 72-hour notification clock. Read Time: 20 minutes TL;DR I was recently brought into an incident that I expect to see a lot more of: a coding agent packaged files it had access to and pushed them to a public GitHub repository. Inside were personal data and live tokens. Nobody attacked anything. The agent did something it had the permissions to do, and the internet did the rest. This is the playbook I would hand to anyone who finds themselves in the same spot: stop the agent and preserve its logs before they age out, rotate every secret before you touch the git history, accept that deleting or privatising the repository does not delete the data, clean up what you can with GitHub, audit what the leaked tokens were used for, and handle the personal data under GDPR’s 72-hour clock. The second half is the AI forensics most teams have never done: reading the OpenAI and Anthropic usage dashboards and APIs to work out whether someone else spent your tokens, and on what. A note on what this is. The case that prompted this article is real, and it is anonymised: no client, no agent product, no data specifics. What follows is a defensive playbook built from that experience and from public documentation, which I cite as I go. Provider consoles change; check the current docs before you rely on a menu path under pressure. The incident class nobody drilled for We have twenty years of playbooks for a developer committing a password. We have almost none for the case where the developer is a piece of software with shell access, git credentials and a task to finish. The mechanics of the case were mundane. A coding agent, working with the access it had been given, bundled up a set of files and pushed them to a public repository. Some of those files contained personal data. Some contained tokens, including API keys for AI providers. There was no prompt injection and no malicious skill involved, only an agent able to run git push against a public remote and nothing standing between that ability and the outcome. The data says this is not a freak event. GitGuardian’s State of Secrets Sprawl 2026 https://blog.gitguardian.com/the-state-of-secrets-sprawl-2026/ counted 28.65 million new hardcoded secrets added to public GitHub commits in 2025, a 34% jump in a year, with AI-service secrets up 81% to over 1.27 million. The figure that caught my attention: commits assisted by one widely used coding agent showed a 3.2% secret-leak rate, against a 1.5% baseline across all public commits. That is vendor research and one data point, but it matches what I see: agents move faster than the hygiene around them. The same report found over 24,000 secrets in MCP configuration files alone. I have written before about weaponised agent skills https://simonroses.com/2026/04/how-to-weaponize-ai-agent-skills/ and the dependency trap in AI-generated code https://simonroses.com/2026/05/the-dependency-trap-supply-chain-risks-in-ai-generated-code-part-4/ ; this case is the less glamorous relative of both, because it needs no adversary at all. The clock you are actually on One fact decides the order of the steps: the race is against automation, not against a person who might stumble on the repository. Public pushes are scraped continuously. Palo Alto’s Unit 42 documented a campaign that could launch a full attack within five minutes https://www.darkreading.com/cloud-security/elektra-leak-attackers-harvest-aws-cloud-keys-github-campaign of an AWS credential appearing in a public GitHub repository, and Clutch Security’s later research found exposed AWS keys exploited within minutes https://www.helpnetsecurity.com/2024/12/02/revoke-exposed-aws-keys/ . Assume that by the time a human noticed the push, every secret in it had already been harvested. From that assumption, the order of operations follows. Step 0: Stop the agent and preserve the evidence Kill the agent session. Revoke the git credential it pushed with the SSH key, personal access token or app installation so a retry loop or a scheduled task cannot push again while you work. Then preserve evidence, today, before it disappears on its own. The agent’s transcript is your best record of what it did and why: which files it read, which commands it ran, what it pushed and where. Those transcripts are not kept forever. Claude Code, for example, stores sessions as JSONL https://code.claude.com/docs/en/sessions under ~/.claude/projects/PROJECT/ and deletes them after 30 days by default the cleanupPeriodDays setting . OpenAI’s Codex CLI keeps its session logs as JSONL under ~/.codex/sessions/ . Whatever the agent, find its session store and copy it somewhere safe, along with the shell history, the local repository with its git reflog , and any CI logs if the push came from a pipeline. Hash the copies. You may need them for a regulator, a customer or a court, and an incident report that says “the logs had rotated” is not one you want to write. Step 1: Work out exactly what leaked Do not guess from memory. Clone the public repository into an isolated location and scan the full history, not just the current tree: git clone --mirror https://github.com/