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.
- Activity
- New: be the first to try it
- Installs
- 0 installs
- Likes
- 0 likes
- Clones
- 0 clones
- 1# Env and secrets check
- 3Finds secrets that are about to leak, or already have, before you push or launch. Then it helps you fix the files and gives you a checklist for rotating any key that was exposed.
- 5**For:** anyone shipping an app built with Next.js, Vite, Expo, or similar, especially if a coding agent wrote the env setup for you.
- 7## Example
- 9Input: a project with a `.env.local` that is not in `.gitignore`, `NEXT_PUBLIC_SUPABASE_SERVICE_ROLE_KEY` in it, and a password typed straight into `lib/config.ts`.
- 11Output (`out/secrets-report.md`):
- 13```markdown
- 14High: 2 | Medium: 3 | Low: 1
- 16## High
- 17- .env.local (env-file-not-ignored): This env file is not in .gitignore,
- 18 so the next `git add .` commits it.
- 19- .env.local:2 (public-env-secret): NEXT_PUBLIC_SUPABASE_SERVICE_ROLE_KEY is
- 20 bundled into the browser. Anyone can read it in the page source.
- 21 - Fix: Rename to SUPABASE_SERVICE_ROLE_KEY, read it only in server code.
- 23## Medium
- 24- lib/config.ts:2 (hardcoded-secret, let... (12 chars)): adminPassword is
- 25 set to a hardcoded value in code.
- 26```
- 28Values are always redacted. Try it on the bundled demo: `node scripts/secrets-scan.mjs examples/demo-app`.
- 30## What it checks
- 32- `.env` files tracked by git, not ignored, or found in git history.
- 33- Server secrets behind `NEXT_PUBLIC_`, `VITE_`, `EXPO_PUBLIC_`, `REACT_APP_`, `NUXT_PUBLIC_`, `GATSBY_`, `PUBLIC_`.
- 34- Stripe, AWS, GitHub, OpenAI, Anthropic, Slack and Google key shapes, private keys, database URLs with passwords, Supabase service_role keys.
- 35- Secret-named variables with hardcoded values, and templates (`.env.example`) holding real-looking values.
- 37## What it can access
- 39- Reads files in your project (skipping `node_modules`, build output, and lockfiles). It reads `.env` files only to check names and whether values are set.
- 40- Runs its own script, plus `git ls-files` and `git log` to see what is committed.
- 41- Writes reports to `out/`, and edits `.gitignore` only after you say yes.
- 42- No network, no env vars.
- 44## Setup
- 46None. Needs Node 22 or later. Git is optional.
