Show HN: Dotenv Mask Editor: No more embarrassing screen leaks of your .env

https://marketplace.visualstudio.com/items?itemName=xinbenlv.dotenv-mask-editor
Hi HN,

I built this because I often work in coworking spaces or do screen sharing, and I've always had this fear of accidentally flashing my .env file with production secrets to the whole room (or recording).

It’s a simple VS Code extension that opens .env files in a custom grid editor. It automatically masks any value longer than 6 characters so I can safely open the file to check keys without exposing the actual secrets.

It runs 100% locally with zero dependencies (I know how sensitive these files are). It just reads the file, renders the grid, and saves it back as standard text.

It's open source (MIT) and I'd love any feedback on the masking logic or other features that would make it safer to use.

Marketplace: https://marketplace.visualstudio.com/items?itemName=xinbenlv... Github https://github.com/xinbenlv/dotenv-mask-editor

Comments

ReluctantLaserJan 22, 2026, 11:47 AM
I feel I see these solutions somewhat often, but you can execute a command and use that as a value. To me, I'm not sure why people aren't calling their secret store as part of it. I use direnv mostly, but seems `.env` supports the same thing. e.g:

MY_SECRET=$(pass show path/to/my/secret)

Of course substitute that for Vault/SSM/whatever. There are other solutions to this problem too, but I show this to people as there's so little friction to using it.

As for the solution itself, we shouldn't really be storing secrets as plain text wherever we can help it. Masking them feels like a kludge.

esperentJan 22, 2026, 5:19 AM
I recently got a phone with a high zoom level - once you factor in digital zooming it's 20x. The photo quality at that zoom level is trash, but it absolutely could be used to read text from people's laptop screens from across a big room, or even another building through a window.

Of course, real cameras have always had this kind of zoom level. The difference is that now, someone could appear to be browsing on their phone from very far away, but actually be reading text on your laptop screen.

It's much more likely they'll be looking for credit card details or something like that rather than .env secrets. But I guess it's better safe than sorry if you frequently work in a public, tech focused environment like a big coworking space.

We're talking someone sitting with their phone 50 meters away from you being able to read text on your laptop screen. That's about the distance where a person with good vision will struggle to recognize faces.

verdvermJan 22, 2026, 5:51 AM
Would they need something to help with stabilization at that zoom and distance?
esperentJan 22, 2026, 8:35 AM
Like sitting at a table and resting their phone on it, sure.
canadiantimJan 22, 2026, 6:07 AM
A selfie tripod
legitimate_keyJan 24, 2026, 9:29 PM
Congrats on the launch! This resonates - I've dealt with the "accidentally exposed credentials during a demo" problem a lot.

The .env file is one of the most common culprits, but I've found the problem extends beyond just one file type. What I've learned:

The broader challenge: - .env files in code editors - Config files in various formats (YAML, JSON, TOML) - Database GUIs (showing connection strings, table data) - API tools (Postman, Insomnia showing auth tokens) - Browser tabs (logged into admin panels, showing URLs with tokens) - Terminal windows (commands with API keys) - Slack/email windows (messages with sensitive info)

Most solutions are file-type specific or app-specific. But during a screen share, the sensitivity context switches constantly - one moment you're in VS Code, next you're in a browser, then Postman, then back to the terminal.

How did you decide to focus on .env files specifically vs. trying to tackle the broader problem? Curious about your thinking on scope vs. coverage trade-offs.

Also, what's your approach to detecting what qualifies as a "secret" that needs masking? Pattern matching, or something more sophisticated?

__MatrixMan__Jan 22, 2026, 4:50 AM
I recently made this as a component in a larger project https://gist.github.com/MatrixManAtYrService/7fc7fb05474d971...

The idea is that even if you can't see the full data for some reason (space constraints, in my case), different values will appear styled differently even if the non-hidden characters don't differ.

I'm not sure how easy/hard vscode makes this, bit it might be fun to use a hash of the secret (salted by that character's index) to determine the back/foreground colors of the *'s

That way even though you can't see the secret, you can tell that it has changed. Also you're in a position to notice if two hidden secrets are the same (this might clue the user into a mistake, like if they didn't actually copy what they think they copied and are instead pasting the previous thing.

globular-toastJan 22, 2026, 6:42 AM
Why would you have "production secrets" in a .env file in the first place? I feel like that's the real problem here.
xinbenlvJan 22, 2026, 6:49 AM
We use infiscial and other mechanism but hey, wouldn't it be nice to have one less square inch of attack surface?
globular-toastJan 22, 2026, 8:20 AM
Why not have one less square mile of attack surface by not having secrets in a .env file in the first place?

What are people doing that requires something like this?

pjjpoJan 22, 2026, 10:30 AM
I think it's common to have dev not production secrets there, and am reading the blurb about production secrets as non-local secrets. Even dev keys are a pain if they get leaked.

The idea seems nice with a simple yet effective implementation. While I think I currently have a shell script syntax highlight plugin reading env files, it's definitely overkill. Now if only this could protect from random npm packages reading your env files...

xinbenlvJan 25, 2026, 7:25 PM
Thanks @pjjpo, exactly. My bad to confuse people, no we don't put real prod-prod credentials in .env. We use mechanisms to ensure separation of secrets. Thank you for saying that it's a simple yet effective implementation. If you try it and let us know your feedback.
dissentJan 22, 2026, 10:55 AM
This implies there's some kind of shared resource out there on the network that your devs are developing on. Why not make all these resources part of your local dev stack, served on localhost, and use dummy credentials? You can even commit them because they're not sensitive.
pjjpoJan 22, 2026, 12:47 PM
Ok ok, it is indeed keys to AI APIs. I know it's not kosher to admit to that on HN anymore but it's the reality for me at least. Unfortunately local models just can't support development of products using them.
dietr1chJan 22, 2026, 5:16 AM
> I've always had this fear of accidentally flashing my .env file with production secrets to the whole room (or recording).

Can't you just intersperse entries with multiple-screens-worth of blank lines, or add noisy variables?

I'm thinking that 120 blank lines at the beginning and the end might be enough though, no need to make the file really hard to use.

xinbenlvJan 25, 2026, 7:23 PM
That's a good idea too, thanks for the suggestion
electromechJan 22, 2026, 8:14 AM
or, don't put secrets in .env files...
svgeekJan 22, 2026, 4:35 AM
OMG,I wish I had this years ago!
xinbenlvJan 22, 2026, 5:40 AM
Thanks, glad you liked it!
LuckyBuddyJan 26, 2026, 2:52 AM
[dead]
theozeroJan 22, 2026, 12:34 AM
Better than masking them in a file, get them out of the file entirely! Pull them declaratively instead - https://varlock.dev

This tool also redacts from your logs if working in js.

verdvermJan 22, 2026, 5:54 AM
This appears to be the only comment you make on HN

https://news.ycombinator.com/threads?id=theozero

Using HN less like a marketing platform would be appreciated

NewJazzJan 22, 2026, 6:08 AM
What does this offer that a scriptlet that sets the envvars doesn't?
xinbenlvJan 22, 2026, 2:32 AM
[dead]
nonethewiserJan 22, 2026, 4:50 AM
Bravo Founder and CEO of Namefi, but the DNS seems to resolve just fine. Do you understand the DNS space? Perhaps you could find out more using this little side project I've been working on: https://www.google.com/.
theozeroJan 22, 2026, 5:11 AM
yeah for our DNS we use a little provider called... Cloudflare.

But hey some tokenized crypto dns provider is probably much more reliable! lol

xinbenlvJan 22, 2026, 5:43 AM
Exactly, exactly
xinbenlvJan 22, 2026, 5:43 AM
Haha thanks my friend, well said.