Skip to main content
29 Million Secrets Leaked: The AI Agent IncidentIncident
4 min readFor Compliance Teams

29 Million Secrets Leaked: The AI Agent Incident

What Happened

In 2025, GitHub's public repositories exposed 28,649,024 new secrets, a 34% increase from the previous year. The root cause wasn't a single breach. It was systemic: AI-assisted development tools, particularly Claude Code, leaked credentials at roughly double the baseline rate. AI-service secrets specifically grew 81% year-over-year.

This isn't a vulnerability you can patch. It's a credential governance model that can't keep pace with how your developers now work.

Timeline

Q1 2025: AI coding assistants become standard in developer workflows. Teams adopt Claude Code, Copilot, and similar tools without updating credential management policies.

Throughout 2025: Developers integrate with multiple AI services (OpenRouter, Claude API, OpenAI endpoints) for different use cases. Each integration requires new API keys, each representing a potential leak vector.

Year-end 2025: GitGuardian's analysis reveals the scale: 28,649,024 secrets in public commits. Commits co-authored by AI tools show double the leak rate of human-only commits.

Current state: Your team is likely using AI assistants right now. Your credential governance model still assumes human developers manually copying and pasting keys.

Which Controls Failed

Three control categories broke down:

Secret detection at commit time: Pre-commit hooks and CI/CD scanning exist, but they're tuned for human commit patterns. AI tools generate code faster than your hooks can process it. Claude Code can write and commit a full integration in seconds. Your pre-commit hook runs for 3-5 seconds and gets skipped when developers are impatient.

Credential rotation policies: Your policy probably says "rotate API keys every 90 days." But when a developer uses an AI assistant to scaffold authentication for five different services in one afternoon, you now have five long-lived credentials that won't get rotated until Q2. The AI doesn't track what it created.

Access reviews: You're reviewing which humans have access to which systems. You're not reviewing which AI agents have credentials to which APIs, or which developers' AI assistants have cached which secrets in their context windows.

What Standards Require

PCI DSS v4.0.1 Requirement 8.3.2: "Strong cryptographic authentication is used for all interactive logins." Your AI agents authenticate with API keys, long-lived shared secrets that violate the spirit of "strong cryptographic authentication." The standard expects MFA, certificate-based auth, or time-limited tokens.

NIST 800-53 Rev 5 IA-5(1): "Password-based authentication requires minimum password complexity and enforces regular password changes." API keys don't expire by default. They don't have complexity requirements. They're bearer tokens, whoever has the string has access.

ISO/IEC 27001:2022 Control 5.17 (Authentication information): "Allocation and management of authentication information shall be controlled." When your developer asks Claude to "add authentication for the new API," Claude generates a key, uses it in code, and commits it. You didn't allocate it. You're not managing it. You don't know it exists until it leaks.

SOC 2 Type II CC6.1: "The entity implements logical access security measures to protect against threats from sources outside its system boundaries." AI assistants are outside your system boundary. They're SaaS products with their own data retention policies. When they cache credentials in conversation history, you've lost control of the authentication information.

Lessons and Action Items

Stop treating API keys as passwords. Passwords authenticate humans. API keys authenticate applications. Your governance model needs to reflect this:

  • Implement short-lived tokens (1-24 hours) for all AI service integrations.
  • Use OAuth 2.0 client credentials flow instead of static API keys where possible.
  • Require service accounts with explicit permission scopes, not admin-level keys.

Scan AI assistant conversations, not just code repositories. Your secrets are leaking in three places now:

  1. GitHub commits (you're probably scanning these).
  2. AI assistant chat logs (you're probably not).
  3. AI assistant training data (you definitely can't control this).

Deploy tools that scan Slack, Teams, and developer chat logs for leaked credentials. Assume anything pasted into an AI chat is now public.

Redesign your pre-commit hooks for AI speed:

  • Run secret scanning asynchronously and block merges, not commits.
  • Use client-side scanning tools that run in milliseconds, not seconds.
  • Implement secret detection in your IDE before code reaches version control.

Create an AI agent credential registry. You track which humans have access to what. Now track:

  • Which AI services your team uses.
  • Which API keys authenticate to those services.
  • Which developers' accounts are linked to which AI assistants.
  • Rotation schedules for AI service credentials.

Enforce credential-less development patterns:

  • Use environment variables that reference secrets managers (AWS Secrets Manager, HashiCorp Vault).
  • Never allow literal credential strings in code, even in examples or tests.
  • Implement automatic credential masking in your CI/CD logs and AI assistant integrations.

The 28,649,024 leaked secrets in 2025 aren't an anomaly. They're the new baseline. Your authentication model needs to assume AI-assisted development is the default, not the exception. If you're still rotating API keys every 90 days and hoping developers remember not to commit them, you're already behind.

OAuth 2.0

Topics:Incident

You Might Also Like