Skip to content
Back to skills

Leaked Secrets

ASecurity

Use when reviewing client-side JavaScript, HTML source, or git history for exposed credentials, API keys, or tokens.

  • 74,358 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 5, 2026
developmentjavascriptgojavanextjsgitapidatabasefrontendsecurity

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned October 5, 2026

npx -y skills add thedaviddias/Front-End-Checklist --skill leaked-secrets --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Leaked Secrets?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Leaked Secrets
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/thedaviddias-leaked-secrets/badge)](https://www.skillsdirectory.com/skills/thedaviddias-leaked-secrets)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: leaked-secrets
description: "Use when reviewing client-side JavaScript, HTML source, or git history for exposed credentials, API keys, or tokens."
metadata:
  category: security
  priority: critical
  difficulty: intermediate
  estimatedTime: "20"
  source: frontendchecklist.io
  url: https://frontendchecklist.io/rules/security/leaked-secrets
---

# Leaked Environment Variables

An API key embedded in client-side JavaScript gives anyone with a browser devtools tab full access to your cloud services, databases, or third-party APIs — leading to data breaches, unexpected charges, or account takeover.

## Quick Reference

- Any secret in client-side JavaScript is publicly readable — treat all front-end code as public
- In Next.js, only variables prefixed with `NEXT_PUBLIC_` are exposed to the browser — never put secrets in these
- Common leak locations: `.env` files committed to git, hardcoded API keys in JS bundles, service account credentials in `window.__INITIAL_STATE__`
- Use `git log -S 'keyword'` to search git history for previously committed secrets; rotate any found secrets immediately
- Tools: GitLeaks, TruffleHog, GitHub Secret Scanning can detect leaks in repositories automatically

## Check

Scan the page HTML source and JavaScript bundles for patterns that look like secrets: API keys, tokens, passwords, private keys, connection strings, or credentials. Check for common patterns like sk_, pk_, AIza, ghp_, AKIA, and base64-encoded strings in unusual contexts.

## Fix

Move all secrets server-side. Replace client-exposed credentials with server-side API proxies. Rotate any leaked credentials immediately — treat them as compromised. Implement git-secrets or a pre-commit hook to prevent future leaks.

## Explain

Explain why client-side JavaScript is public code, how secrets leak into bundles, what the impact of a leaked API key is, and how to architect applications to keep secrets server-side.

## Code Review

Review server config, headers, forms, and integration points related to Leaked Environment Variables. Flag exact responses, cookies, or browser behaviors that violate the rule, and verify them against the effective production-like response.

---

For full implementation details, code examples, and framework-specific guidance,
see `references/rule.md`.

Rule page: https://frontendchecklist.io/rules/security/leaked-secrets

Files in this skill

  • SKILL.md2.3 KB
  • references/rule.md5.7 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…