Back to BlogAI Security

39M GitHub Leaks: AI Coding Risk

67% of developers have accidentally exposed secrets in code (GitGuardian 2025). 39 million secrets leaked on GitHub in 2024, up 25% year-over-year.

March 29, 20268 minute read
GitHub secret leaksdeveloper AI securitycredential exposureMCP Server protectionGitGuardian 2025

39 Million Credentials Leaked in One Year

GitHub's Octoverse 2024 report found 39 million secrets leaked on GitHub in 2024. That is a 25% year-over-year increase from 2023. The secrets include API keys, database strings, auth tokens, and cloud credentials.

The cause is known. Developers commit code with secrets inside. The secrets come from debug sessions. Or they are hardcoded instead of stored in environment variables. At 39 million leaks, this is not rare. It is routine.

AI Tools Add a Second Leak Channel

GitGuardian's 2025 research found that 67% of developers have accidentally exposed secrets in code. The same habits that create GitHub leaks also create AI tool leaks.

A developer pastes code into Claude, ChatGPT, or another AI assistant for help. That code often has live credentials in it. The AI model receives the secret. It may store it in conversation history. It sends it to the provider's servers. The developer loses control — with no warning.

Three examples:

Database debugging. A developer pastes a stack trace. The trace includes the connection string. The AI reads the password too.

Pipeline review. A developer shares a data pipeline script. The script has an AWS access key and secret key. The AI receives both.

API integration review. A developer asks for feedback on an integration. The code includes a live partner API key. The key leaves the developer's network.

In each case, the goal is legitimate help. The credential leak is a side effect of giving the AI enough context. This is the same pattern as GitHub leaks — not malicious, just routine.

CI/CD Pipelines Face the Same Risk

CI/CD pipeline secret leaks increased 34% in 2024. Build scripts, deployment configs, and infrastructure-as-code files all go through AI review now. These files often hold cloud credentials and service account tokens.

As AI tools cover more of the dev cycle — review, docs, debugging, optimization — the exposure surface grows with them.

How MCP Architecture Blocks Leaks

For teams using Claude Desktop or Cursor IDE, Model Context Protocol (MCP) server architecture puts a credential filter in the path between developer and AI model.

The MCP server handles every text that moves through the session. Pasted code, stack traces, config files, debug context — all of it passes through an anonymization step before the model sees it.

The engine finds credential patterns: API key formats, database strings, OAuth tokens, private key headers, and custom formats your security team defines. Each match gets replaced with a token before transmission.

What this looks like in practice:

A developer pastes a stack trace with a database connection string. The MCP server replaces the string with [DB_CONNECTION_1]. The AI sees the trace with the token in place. It gives debugging help based on the anonymized version. The actual credential never left the internal network.

This stops the same leak vector that fills GitHub with secrets. The channel is different — AI tools, not git commits — but the fix works the same way: block it before it transmits.

See our security overview for how anonym.legal handles this across AI tools and document workflows, and the compliance center for audit controls.

Detection After the Fact Is Too Late

Some teams use post-commit scanning to catch leaked secrets. GitGuardian and truffleHog work well for the GitHub channel. They do not cover AI tool sessions.

When a secret reaches an AI provider's servers, the exposure is done. Scanning finds it after. MCP-layer anonymization stops it from reaching the model at all.

The 39 million GitHub leaks document one channel. AI tool exposure is the same problem in a channel with less monitoring and no audit trail. Prevention before transmission covers both.

When This Approach Has Limits

Stopping a secret before it reaches the model is genuinely better than scanning for it afterward. But pre-transmission anonymization at the MCP layer is one control, not a complete answer to credential exposure. Three limits matter.

Detection has to recognize the secret to redact it. The interception layer scrubs what it identifies as a credential — known key formats, token patterns, recognizable connection strings. A custom secret format, an internal token scheme, or a credential embedded in an unusual way can pass through unrecognized. Pattern-based and ML detection both reduce the leak rate sharply; neither guarantees that every secret in a developer's prompt is caught.

It only governs the channels it is installed on. An MCP-layer control protects AI sessions routed through it. A developer who pastes code into a web chat on a personal device, uses an unconfigured tool, or commits the same secret to GitHub bypasses it entirely. The 39 million GitHub leaks happened through a different channel that MCP anonymization does not touch — pre-commit hooks and repository scanning still matter. This is one layer in defense-in-depth, not a replacement for the others.

Prevention does not remediate already-exposed secrets. Blocking transmission going forward does nothing for the credentials already leaked, which is why post-hoc scanning tools like GitGuardian and truffleHog retain a role: finding and rotating secrets that escaped. The strongest posture combines prevention at the AI boundary with detection across repositories and a fast key-rotation process — because the only fully safe response to a leaked secret is to revoke it.

Sources

Limitations / When this doesn't apply

Detection has to recognize the secret to redact it. The interception layer scrubs what it identifies as a credential — known key formats, token patterns, recognizable connection strings — so a custom secret format, an internal token scheme, or a credential embedded in an unusual way can pass through unrecognized. Pattern-based and ML detection both sharply reduce the leak rate, but neither guarantees every secret in a prompt is caught.

  • It only governs the channels it is installed on: an MCP-layer control protects AI sessions routed through it, but a developer who pastes into a web chat on a personal device, uses an unconfigured tool, or commits the same secret to GitHub bypasses it entirely. Pre-commit hooks and repository scanning still matter — this is one layer in defense-in-depth.
  • Prevention does not remediate already-exposed secrets. Blocking transmission going forward does nothing for credentials already leaked, which is why scanning tools like GitGuardian and truffleHog retain a role, and why fast key rotation matters — the only fully safe response to a leaked secret is to revoke it.

Ready to protect your data?

Start anonymizing PII with 267+ entity types across 48 languages.

About this page

We update this page when our platform or the law changes.

Read our founder note for how we work.

Each change shows up in the timestamp at the top.

We follow these rules

  • GDPR (EU 2016/679).
  • ISO/IEC 27001:2022.
  • NIS2 (EU 2022/2555).
  • HIPAA safe harbor under 45 CFR § 164.514(b)(2).

Our promise

We do not sell your data.

We do not train models on your text.

We store your files in Germany.

You can delete your account at any time.

You own your work.

Where we run

Our company HQ is in Saarbrücken, Germany. Our servers run in Hetzner's Falkenstein datacenter.

Hetzner holds ISO 27001 certification.

All data stays in the EU.

Backups run every day.

Need help?

Email support@anonym.legal.

We reply within one business day.

How we test

We run a full check suite on every release.

Each surface gets its own sweep script and report.

Human reviewers spot-check the output each week.

We track recall and precision on a labelled set.

Bad runs block the deploy.

What we never do

  • We never sell your information to third parties.
  • We never train models on what you upload.
  • We never keep your work after you delete it.
  • We never share keys with any outside firm.
  • We never run ads inside the product.

Plans in plain words

We sell credits, not seats.

One credit covers one short job.

Long jobs use a few credits each.

You can top up at any time.

Unused credits roll over each month.

Read the plans page for current rates.

Who built this

A small team of engineers and lawyers built this.

We ship from Europe and work in the open.

Our founder note spells out why we started.

Where to start

How the parts fit

A browser add-on cleans text inside Chrome.

A Word plug-in handles drafts in Office.

A small desktop tool works on whole folders.

An agent protocol link feeds large models safely.

All four share one core engine and one rule set.

Words from our team

We started this work after a lunch about cookies.

One friend kept getting odd ads on her phone.

We asked why a court file leaked through a draft.

We sketched the first build on a napkin that week.

By month three we had a tiny demo for a friend.

She used it on her first case the next day.

Common questions we hear

Can the tool read scanned PDFs? Yes, with OCR.

Does it work on long files? Yes, in small chunks.

Can I roll my own rule set? Yes, save it as a preset.

Does it run offline? The desktop build runs offline.

Do you keep my files? No, the cloud build wipes after each run.

Will it learn from my work? No, we never train on inputs.

A short tour of the workflow

Upload a file or paste a snippet of prose.

Pick the entities you want gone from the draft.

Choose a method: replace, mask, hash, encrypt, or redact.

Press run and watch the side panel show each hit.

Skim the result and tweak any rule that misfired.

Save the cleaned file or send it to a teammate.