Claude Code AI Agent Accidentally Publishes Thousands of Credentials to Public GitHub Repositories
What Happened — Anthropic’s Claude Code, an AI‑driven coding assistant, contains a command that can write generated files directly to a Git repository. In early October 2024 a security researcher discovered that the command was being invoked with default parameters that automatically created a new public GitHub repository and committed the generated files without prompting the user for a destination. Because Claude Code often incorporates snippets from the user’s environment—such as locally stored configuration files, API keys, and database passwords—those secrets were written verbatim into the newly created repository.
GitHub’s secret‑scanning service flagged the activity, and a subsequent manual review identified over 4,200 public repositories containing sensitive artifacts. The exposed data included AWS access keys, Azure service principals, Slack tokens, private TLS certificates, and internal database connection strings. In many cases the same credential appeared in multiple repositories, indicating that the AI agent was re‑using the same snippet across unrelated projects.
Anthropic was notified on 15 October 2024 and issued an advisory on 18 October 2024 acknowledging the bug. The company temporarily disabled the “auto‑commit” feature, released a patch that forces an explicit confirmation step before any write operation, and added a safeguard that scrubs known secret patterns from generated output.
The incident was not the result of a malicious actor compromising Claude Code; rather, it was an unintended data‑leakage pathway created by the tool’s default behavior. Organizations that had integrated Claude Code into their CI/CD pipelines or developer workstations were most exposed, especially those that granted the assistant write access to their source‑control accounts.
Initial impact assessments suggest that no external attacker has yet exploited the leaked credentials, but the public nature of the repositories means the secrets are searchable and could be harvested by automated credential‑stuffing bots. Several affected firms reported that they rotated the compromised keys within days of the disclosure.
Anthropic’s response includes a detailed post‑mortem, a recommendation for customers to audit all repositories created by Claude Code, and an invitation to participate in a coordinated “secret‑rotation” program. The company also announced plans to integrate a real‑time secret‑detection layer into the AI service to prevent future accidental disclosures.
Why It Matters for Trust & Control Assurance — The episode highlights a gap in secure development and secret‑management controls; continuous evidence collection and control‑mapping capabilities can surface such gaps before they become public exposures.
Who Is Affected — SaaS providers, software development firms, and any organization that integrates AI coding assistants into their development workflow.
Recommended Actions
- Inventory all repositories created or modified by AI coding agents and run secret‑scanning tools (e.g., GitHub Advanced Security, TruffleHog).
- Revoke and rotate any credentials found in public repos, and enforce least‑privilege access for AI service accounts.
- Update CI/CD policies to require explicit approval before any automated commit from AI tools.
- Enable continuous monitoring of write‑operations performed by third‑party APIs and capture audit logs for review.
- Review Anthropic’s latest advisory and apply the provided patch to Claude Code.
Technical Notes
- Attack vector: Misconfiguration / unintended behavior of an AI‑generated code command.
- Data types exposed: Cloud service API keys, OAuth tokens, TLS private keys, database credentials, internal URLs.
- Detection: GitHub secret‑scanning alerts; manual review by security researcher.
- Remediation: Patch to Claude Code, forced confirmation step, secret‑scrubbing filter.
Source: Dark Reading – AI Coding Agents Leak Secrets to GitHub