Show HN: Dotenv Mask Editor: No more embarrassing screen leaks of your .env
Posted by xinbenlv 2 days ago
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
Comment by ReluctantLaser 2 days ago
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.
Comment by esperent 2 days ago
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.
Comment by verdverm 2 days ago
Comment by esperent 2 days ago
Comment by canadiantim 2 days ago
Comment by __MatrixMan__ 2 days ago
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.
Comment by globular-toast 2 days ago
Comment by xinbenlv 2 days ago
Comment by globular-toast 2 days ago
What are people doing that requires something like this?
Comment by pjjpo 2 days ago
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...
Comment by dissent 2 days ago
Comment by pjjpo 2 days ago
Comment by dietr1ch 2 days ago
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.
Comment by electromech 2 days ago
Comment by svgeek 2 days ago
Comment by xinbenlv 2 days ago
Comment by theozero 2 days ago
This tool also redacts from your logs if working in js.
Comment by verdverm 2 days ago
https://news.ycombinator.com/threads?id=theozero
Using HN less like a marketing platform would be appreciated
Comment by NewJazz 2 days ago
Comment by xinbenlv 2 days ago
Comment by nonethewiser 2 days ago