Skip to content

04 · 2025 · Builds · 1 reader

EnvShield

Visual masking for .env files in VS Code: so streams and screen shares do not leak secrets.

Role
Author
Focus
TypeScript · VS Code · Security
Stack
TypeScript · VS Code API · Node.js

EnvShield is a Visual Studio Code extension that masks environment variable values in the editor while leaving keys readable and the file fully editable. Built for developers who stream, record, or share their screen.

At a glance


Platform
Visual Studio Code extension
Language
TypeScript
Mechanism
Decoration API, visual only
Links
Marketplace + GitHub (markpython86/envshield)

01 · Context

How do .env files leak on a stream?

Live coding and video calls make .env files a liability. One scroll past a secret is enough. Existing habits: closing files, blanking monitors: fail under pressure. The fix needed to be visual, instant, and non-destructive.

EnvShield masking disabled
Masking disabled, full values visible for local work

02 · Decision

Why decorate instead of rewriting the file?

EnvShield uses VS Code’s text decoration API to overlay masks without changing file contents. Copy, paste, search, and edit keep working on the real text. A status-bar toggle and whitelist (e.g. NODE_ENV) keep the tool out of the way when secrets are not on screen.

EnvShield masking enabled
Masking enabled, values obscured, keys visible
{
  "envShield.enabled": true,
  "envShield.maskOnStartup": true,
  "envShield.maskChar": "•",
  "envShield.whitelistKeys": ["NODE_ENV", "PORT"],
  "envShield.extraFileGlobs": [".env.*", "*.env"]
}
Example user configuration
How to enable EnvShield
Enabling EnvShield from the editor

03 · Tradeoff

How do masks stay fast while typing?

Masks must update as the user types. Debounced parsing and targeted decoration updates keep the editor responsive while covering .env, .env.local, .env.production, and configurable globs.

04 · Outcome

What did EnvShield ship?

Published to the VS Code Marketplace with toggle control, whitelist support, smart file detection, real-time mask updates, and a clear status-bar indicator, so developers can share their screen without sharing their secrets.