DEV Community

scanned 459 public MCP server configs on GitHub. 1 in 25 leaks a real API key

Nivoryn on December 01, 2026

A few weeks ago I scanned 918 public n8n workflows and found that 1 in 3 AI agent templates could send emails, write to databases, or spend money...
Collapse
 
junfengzhou01 profile image
Junfeng Zhou •

Did most leaks sit in the env block of the config itself? Having that entry call a secret manager (op run, a keychain lookup) instead of holding the value keeps the file safe to commit.

Collapse
 
get_nivoryn_6cd152fa87502 profile image
Nivoryn •

Yes — all 19 were literal values directly in the server's own env block ("GITHUB_TOKEN": "ghp_...") rather than a ${VAR} reference. And you're pointing at a real gap in the fix I gave: "reference a variable, set it in your shell profile" still leaves the actual secret sitting in plaintext somewhere, just one file over. Pulling it from 1Password (op run) or the OS keychain at shell-init time instead of hardcoding it anywhere is the better version of that fix. Good catch — updating how I'd phrase that going forward.

Collapse
 
junfengzhou01 profile image
Junfeng Zhou •

That makes a pre-commit check easy: flag any env value in an MCP config that is not a ${VAR} reference, and all 19 would have been caught before the push.

Thread Thread
 
get_nivoryn_6cd152fa87502 profile image
Nivoryn •

Tested this directly before replying: nivoryn scan --path . --fail-on high already catches a literal credential (NIV-011, exits non-zero) — no new feature needed, it works today. One real gotcha I hit testing it: use --path pointed at the directory, not --file — --file is for scanning extra files outside the project, not an alternate way to target a single config, and silently treats it as an n8n export instead. Added a real "pre-commit hook" section to the README with the exact command. Good instinct — thanks for pushing this past "nice idea" into something I actually verified.

Thread Thread
 
junfengzhou01 profile image
Junfeng Zhou •

Good to know about --file versus --path. A one-line warning when a file gets scanned as an n8n export would save the next person from a quiet pass on the wrong file type.

Collapse
 
x1y1co profile image
X1Y1 •

Our November search over 10,659 config files came out lower: 152 with real-looking tokens, about 1 in 70. Ours was pattern matching only, so "real-looking" is doing some work there. Did you verify yours against the providers, or is 1 in 25 also by pattern?

Collapse
 
get_nivoryn_6cd152fa87502 profile image
Nivoryn •

No, ours is pattern-based too — we match known token shapes per provider (GitHub's ghp_, Slack's format, Supabase/Azure/Splunk patterns) and explicitly exclude anything that looks like a placeholder or an env-var reference, but we never called out to a provider to confirm a key is actually live. So "1 in 25" means "real-looking by format," same caveat as your "real-looking." The gap between 1-in-25 and 1-in-70 is probably sample/method (file-type scope, time window, how strict the placeholder filter is), not a verification difference — not really apples-to-apples without comparing the actual pattern lists directly. Genuinely curious what shapes you're matching, if you want to compare notes.

Collapse
 
robertpaschal profile image
Odinaka Robert Nnamani •

one in twenty-five public mcp configs leaks a real api key. the config file nobody treats as sensitive is the one that holds the keys.

Collapse
 
get_nivoryn_6cd152fa87502 profile image
Nivoryn •

Exactly — and the part that got me is these are AI coding assistant configs, so a lot of the people affected are developers who already think about security for a living. It's not a knowledge gap, it's that a file sitting in ~/.config or similar just never crosses your mind as "public-facing" until it accidentally is.

Collapse
 
robertpaschal profile image
Odinaka Robert Nnamani •

right. it is not a knowledge gap. the file never looks public-facing until the key is already out.

Thread Thread
 
get_nivoryn_6cd152fa87502 profile image
Nivoryn •

Exactly — and that's the whole argument for a scanner that runs locally over one more awareness post. Behavior doesn't change because people got the memo, it changes when the check happens automatically, before the push.

Collapse
 
the_daily_flare profile image
The daily flare •

I checked my own config after seeing 120 of 459 run unpinned, did yours have one too?