1 Keys in JS Bundles, Git History, and Query Strings
API keys embedded in client-side JavaScript bundles are visible to anyone who views your site's source code. This is an extremely common mistake with payment, analytics, and third-party API keys.
Common exposure vectors:
// In frontend JavaScript (bundled and served to all users!)
const STRIPE_SECRET = "sk_live_AbCdEfGhIjKlMnOpQrStUvWx";
const response = await fetch("/api/charge", {
headers: { "X-API-Key": "api_key_real_value" }
});Query string exposure:
GET /api/data?api_key=secret_value HTTP/1.1
# Leaks in server logs, browser history, Referer headers, analyticsGit history:
# Even after deletion, keys remain in git history
git log --all -p | grep "sk_live_" # Key found in old commit!Automated scanners like GitGuardian, truffleHog, and GitHub's secret scanning find and alert on exposed keys within minutes of exposure.