Dev.to Security πŸ” Cybersecurity πŸ‘ 0 πŸ“– 2 min read

Stop Catting Your .env File

We've all done it. Something's broken, someone asks "what's in your env?", and you run: cat .env Then you paste the output into Slack, a GitHub issue, or a screen share β€” and only afterwards remember that file h

We've all done it. Something's broken, someone asks "what's in your env?", and you run:

cat .env

Then you paste the output into Slack, a GitHub issue, or a screen share β€” and only afterwards remember that file holds your database password, your API keys, and your production tokens. Now they're in chat history forever.

That's the exact accident environmental-peek exists to prevent.

The problem hiding in plain sight

.env files are the worst-kept secrets in software. They sit in every project, they're full of credentials, and the only way to check them is to print them in full:

  • Debugging in public β€” pasting .env output into a support thread or team chat
  • Screen sharing β€” one cat .env during a call and the whole meeting has your keys
  • CI logs β€” a stray printenv in a debug step and your secrets are in the build log

You rarely need the actual values. What you actually want to know is: which keys are set, which are missing, and is anything misspelled? That's a very different question from "show me all my secrets."

What environmental-peek does

environmental-peek lets you safely inspect your .env files without leaking secrets. It shows you the structure of your environment β€” what keys exist and whether they're set β€” while keeping the sensitive values masked.

So instead of dumping credentials to check why your app can't connect, you get answers like:

  • DATABASE_URL β€” set βœ“
  • STRIPE_SECRET_KEY β€” missing βœ— (there's your bug)
  • API_KEY β€” set βœ“

No values on screen. No secrets in chat history. No panic after you hit send.

Get started

npm install environmental-peek

Then run envpeek in your project and check your environment the safe way.

Why I built it

Every "don't commit your .env" guide stops at the git part. Nobody talks about the dozen other ways secrets leak β€” the paste, the screenshot, the shared terminal. I wanted a tool that makes the safe way also the easy way, so checking your environment stops being a security incident waiting to happen.

environmental-peek is at v0.2.0 now, with 400+ total downloads on npm. It's still early β€” if you try it and there's a case it doesn't cover, I'd genuinely love to hear about it.

Try it, break it, and tell me what it missed. Feedback welcome.

npm: https://www.npmjs.com/package/environmental-peek
GitHub: https://github.com/parasraju/environmental-peek

Safely inspect your .env files without leaking secrets. npm install environmental-peek

πŸ“° Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.