DocsIntelligence ModulesSecrets Detection
🔐

Secrets Detection

The Secret Scanner reads every indexed file and the repository's own file tree, looking for credentials that were committed by accident — provider keys, connection strings, private key blocks, and files that should never have been checked in at all.

How it works

Detection is pattern-based. Mapnostics carries more than fifty provider-specific patterns rather than one generic “looks like a key” rule, because a pattern that knows what a Stripe live key looks like can be confident where a generic one can only guess. Coverage spans:

  • Cloud and infrastructure — AWS, GCP service account JSON, Azure storage, DigitalOcean, Vercel, PlanetScale, Doppler.
  • AI providers — OpenAI, Anthropic, Groq, xAI, Perplexity, Replicate, HuggingFace.
  • Payments and comms — Stripe live, restricted and webhook keys, Twilio, SendGrid, Resend, Mailgun, Mailchimp, Slack, Discord, Telegram.
  • Source control and project tools — GitHub PATs and fine-grained tokens, npm, Shopify, Linear, Notion, Sentry.
  • Structural patterns — database and Redis connection strings with embedded credentials, URLs with credentials, private key blocks, JWT secrets, and high-entropy values behind a secret-sounding name.

The file-tree pass

Before reading any content, the scanner walks the repository tree for files whose extension should never be committed — key files, keystores, credential dumps. Those are reported as Sensitive File Exposed in Repository at critical severity, whatever is inside them.

Suppressing the obvious fakes

Documented example keys are allowlisted, and any matched value containing a placeholder marker — EXAMPLE, CHANGE_ME, YOUR_API_KEY, DUMMY — is dropped. Real keys are random; those words inside a matched value are a strong signal it is not one.

NOTE
Duplicate hits on the same file, line and type collapse to a single finding, keeping the highest severity of the pair.

The tab

mapnostics.com/repo/mapnostics-app/secrets
Secret Scanner
Exposed API keys, tokens, and hardcoded credentials
Last scanned 31 Aug, 09:31Run Scan
Security Posture
Critical secrets detected — immediate action required
2 Critical1 High1 Medium
4 findings detectedLast scanned 31 Aug, 09:31
All Findings
4
Critical
2
High
1
Medium
1
Current Findings (4)Scan History
🗝️
Supabase Service Role KeyCritical
lib/supabase/admin.ts · line 12
eyJh****************👁
Code Context
const admin = createClient(url, "eyJhbGciOi…")
Why this matters

Critical secrets can immediately compromise production systems, authentication flows, or cloud infrastructure if exposed.

Recommended Fix
Rotate this credential immediately
Move to environment variables or secrets manager
Audit git history for public exposure
Enable secret scanning alerts on your repository
✓ Mark as rotated
Groq API KeyCritical
scripts/backfill.ts · line 8
gsk_****************👁
🗄️
Database Connection StringHigh
.env.example · line 3
postgres://***👁
🔑
Hardcoded PasswordMedium
app/__tests__/fixtures.ts · line 21
Demo****👁

Severity levels

Findings carry one of three severities, set by the pattern that matched rather than by anything about your repository.

Critical

Credentials that can compromise production on their own: cloud provider keys, live payment keys, service-role database keys, private key blocks, and committed sensitive files. Rotate immediately.

High

Keys that expose a sensitive system if the file is reachable: most provider API keys, connection strings, webhook URLs. Move them before the next deployment.

Medium

Likely development credentials — a hardcoded password in a fixture, a config value that should be an environment variable. Low risk in a private repository, still worth cleaning up.

NOTE
Git history is permanent. Removing a secret from the latest commit does not remove it from the repository. Rotate the credential first, then purge the history with git filter-repo or BFG.

Inside a finding

The value is masked by default; the eye toggle reveals the surrounding code context rather than the secret itself. Expanding a finding gives you three things:

  • Code context — the line as it appears in the file, so you can judge whether the match is real.
  • Why this matters — what an attacker could do with a credential at this severity.
  • Recommended fix — the ordered steps for that severity, starting with rotation.

The file path links straight to the line on GitHub. Once you have rotated a credential, Mark as rotated resolves the finding, and the Scan History tab keeps every past scan so you can see whether the count is going down.

NOTE
Secrets feed the Health Score too, weighted by severity — 8 points per critical finding, 5 per high, 2 per medium — capped at 15 so one noisy scan cannot sink the score.

How to respond

  • 1. Rotate the credential. Do this first, before touching the code.
  • 2. Check the provider’s logs for use during the exposure window.
  • 3. Replace the literal with an environment variable or a secrets manager reference.
  • 4. Purge it from git history, then confirm with a fresh scan.
  • 5. Mark the finding as rotated so the count reflects the work.
TIP
Keep local secrets in .env.local and keep that file in .gitignore. For production use your platform's secrets manager.

See Secret Scanning on the product page →