Skip to content
SlashClone
Made by@shipcheck

Env secrets check

@shipcheck/env-secrets-check

Check your repo for leaked secrets before you push or launch: .env files git tracks or will pick up, .env files hiding in git history, server keys behind NEXT_PUBLIC_ or VITE_ prefixes that ship to the browser, provider key shapes (Stripe, AWS, GitHub, OpenAI, Anthropic, Supabase service_role), and passwords hardcoded in code. Reports names and redacted hints, never the values.

SkillDevOpsv1.0.0 (latest)Tested
Activity
New: be the first to try it
  1. 1---
  2. 2name: env-secrets-check
  3. 3description: Scan a project for leaked secrets before pushing, open-sourcing, or launching. Finds .env files that git tracks or will commit, .env files left in git history, server keys exposed to the browser through NEXT_PUBLIC_, VITE_, EXPO_PUBLIC_ or REACT_APP_ prefixes, provider key shapes (Stripe, AWS, GitHub, OpenAI, Anthropic, Slack, Supabase service_role, database URLs with passwords), and hardcoded passwords. Use when the user says "did I leak any keys", "is my .env safe", "check for secrets", "can I make this repo public", before a first deploy, or after a key-leak warning email.
  4. 4license: MIT
  5. 5---
  6. 6
  7. 7# Env and secrets check
  8. 8
  9. 9Vibe-coded apps leak keys in a few predictable ways: a `.env` that was never ignored, a service key with a `NEXT_PUBLIC_` prefix so it ships to every browser, or a key pasted straight into code. This skill finds those, ranks them, and walks the user through fixing and rotating. It reports names and short redacted hints only, never full values.
  10. 11## When to use
  11. 13- Before the first `git push`, before making a repo public, before launch.
  12. 14- After GitHub, a provider, or a stranger emails about a leaked key.
  13. 15- "Is my .env safe?", "did I commit my Stripe key?", "should this be NEXT_PUBLIC?"
  14. 17## Steps
  15. 191. **Run the scan** from the project root.
  16. 21 ```bash
  17. 22 node scripts/secrets-scan.mjs . --json out/secrets-report.json --md out/secrets-report.md
  18. 23 ```
  19. 25 With git it scans tracked files plus new files git would add, and checks history for `.env` files. Without git it follows `.gitignore`.
  20. 272. **Show the summary** (High, Medium, Low counts) and every high finding in plain words: what leaked, where, and who can see it.
  21. 283. **Sort the high findings into two piles:**
  22. 29 - **Already exposed:** the file is committed, in history, pushed, or deployed with a public prefix. These keys must be rotated. Moving them is not enough.
  23. 30 - **About to be exposed:** not committed yet. Fixing the file is enough.
  24. 32 Ask whether the repo has been pushed and whether it is public if you cannot tell. `git log` is fine for checking history.
  25. 334. **Fix, with a yes for each change:**
  26. 34 - Add missing lines to `.gitignore` (`.env*`, `!.env.example`). Show the lines first.
  27. 35 - For a committed env file, give the user the command `git rm --cached <file>` to run. It keeps their local copy.
  28. 36 - For public-prefix secrets, rename the variable (drop the prefix), and move every use into server code (API routes, server actions, edge functions). Show the diff.
  29. 37 - For hardcoded values, replace them with `process.env.NAME` and add `NAME=` to `.env.example`.
  30. 385. **Rotation checklist.** For each exposed key, write a numbered list in `out/rotate-keys.md`: the provider, where in its dashboard to roll the key, and where to paste the new one (local `.env.local`, then the host's env settings, then redeploy).
  31. 396. **Re-run step 1** and show that high is 0.
  32. 41## Output format
  33. 43```markdown
  34. 44# Secrets check: <project>
  35. 45High 2 | Medium 3 | Low 1
  36. 47## Rotate now (already exposed)
  37. 481. STRIPE_SECRET_KEY: committed in .env (git tracks it). Roll it in Stripe, Developers, API keys.
  38. 50## Fix before you push
  39. 51- .env.local is not in .gitignore. Added .env* (you said yes).
  40. 53## Check
  41. 54- NEXT_PUBLIC_MAPBOX_TOKEN ships to the browser. Fine if it is restricted by URL.
  42. 55```
  43. 57## What is public on purpose
  44. 59These are meant for the browser and are not findings: Supabase URL and anon (publishable) key, Stripe publishable key (`pk_`), Firebase web config, analytics IDs, Sentry DSN, Mapbox tokens restricted by URL. The anon key is only safe when RLS is on; suggest the supabase-rls-audit kit if the project uses Supabase.
  45. 61## Guardrails
  46. 63- Never open, print, or paste the contents of `.env` files, and never repeat a full secret value. The script output is redacted; keep it that way.
  47. 64- Never rewrite git history (`filter-repo`, force push) yourself. If the user wants history cleaned, explain the trade-offs and let them run it. Rotation matters more than history.
  48. 65- Never call a provider API to test whether a key works.
  49. 66- Never move a secret into a public prefix to "make it work" in the browser. The fix is a server route.
  50. 67- A clean scan is not a guarantee. Say so, and mention keys in screenshots, logs, and chat messages too.