0
Challenge · 108Ship It
Environment & Secrets in Prod
Shipused in ~70% of apps
On your laptop a .env file is harmless. In production that same file is a loaded gun: commit it once and the secret lives in git history forever, prefix it by reflex and it ships to every browser, and either way a scraper bot can drain a Stripe account before you finish your coffee. Shipping means treating env config as a security boundary, not a convenience.
Core idea. In production, real secrets never live in your repo and never reach the client: keep .env out of git, store production values in your host's encrypted dashboard (read from process.env on the server), and remember that the only fix for a leaked secret is to rotate it — you can never un-ship one.
poke it, drag it,
try to break it
try to break it
no slides here.
you drive.
you drive.
Playground, this isn't a screenshot
Tracing one production secret:
STRIPE_SECRET_KEY=sk_live_9f3kZ8aQ2.envcommitted (mistake)
STRIPE_SECRET_KEY=sk_live_9f3kZ8aQ2
// git add .env && git commit
git log (history)PERMANENT · PUBLIC IF PUSHED
a1b2c3d add config
+ STRIPE_SECRET_KEY=sk_live_9f3kZ8aQ2
// the secret is now in a commit, copyable by anyone with the repo
Leaked forever. The key sits in commit
a1b2c3d. Anyone who cloned, forked, or scraped the repo already has it. Deleting the file does not rewrite history. The only real fix: rotate the key in Stripe now (then scrub history as cleanup).↑ play a little first, then dig in