
Prerequisites
- Node.js 18.0.0 or later (ESM customization hooks require Node 18+)
- npm or pnpm
Step 1 — Install
Installenvtrap globally:
Step 2 — Run your app through envtrap
Prefix your existing start command withenvtrap run:
- Starts a native-RSA in-memory MITM TLS proxy and routes all outbound HTTP/HTTPS through it
- Automatically sets
NO_PROXYfor loopback addresses so local Redis, Docker, and sidecar services are never proxied - Scans stdout and stderr streams for secrets in real time
- Intercepts all
child_processspawns to check if secrets are passed viaoptions.env - Intercepts all DNS lookups for exact secret matches and high-entropy subdomain patterns
- Wraps
process.envto detect and broadcast runtime-rotated credentials to the ESM loader thread
Step 3 — Read the startup output
On every run, envtrap prints a startup banner and configuration summary to stderr:Step 4 — (Optional) Create a config file
Createenvtrap.json in your project root for fine-grained control:
Step 5 — Add to package.json scripts
What Happens on Detection?
Framework Compatibility
envtrap hooks Node.js core modules, not your application layer — so it works with any framework:Next Steps
How It Works
Deep-dive into MITM proxy, ESM hooks, and CJS patching.
Configuration
Full reference for every envtrap.json field.
Attack Surfaces
Understand the five channels envtrap monitors.
CLI Reference
All CLI commands and flags.