Overview
Create anenvtrap.json file in your project root (next to package.json) to customise envtrap’s behaviour. All fields are optional — envtrap ships with safe, production-ready defaults.
envtrap validates this file on every envtrap run and prints warnings for any invalid fields. You can also validate it manually with envtrap check.
Full Schema with Defaults
channels
Type: objectDefault: see above Sets the enforcement mode for each interception channel independently. Each key accepts one of three string values:
Channel Keys
Example — set all channels to warn-only for development:
exclusions
Type: object
exclusions.domains
Type: string[]Default:
[]
A list of fully-qualified domain names that are allowed to bypass network scanning entirely. Requests to these domains are forwarded directly through the MITM proxy without inspecting headers, body, or URL.
Use this for your own known API endpoints where you intentionally send credentials:
exclusions.paths
Type: string[]Default:
[]
A list of glob patterns for source file paths. If an intercepted operation (dns lookup, subprocess spawn, stdout write) originates from a file that matches one of these patterns — resolved via call stack inspection — the detection is suppressed.
Common use case: suppress alerts from your own test files that intentionally use mock secrets:
*matches any sequence of characters except/**matches any sequence of characters including/- Patterns without a leading
/or**/are automatically prefixed with**/to match anywhere in the path
Path exclusions apply to
stdout, stderr, child_process, and dns channels. They do not apply to the network channel (the MITM proxy has no access to call stack information).entropy
Type: object
Controls the Shannon entropy threshold used to screen process.env and .env values as secret candidates at startup.
entropy.threshold
Type: numberDefault:
3.5Range: 0 to 8 Minimum Shannon entropy score a string must have to be registered as an active secret. Higher values are stricter (fewer false positives, might miss low-entropy secrets).
entropy.minLength
Type: numberDefault:
12
Minimum character length a value must have before entropy is evaluated. Values shorter than this are always dropped, regardless of entropy score.
These settings also control the high-entropy DNS tunneling detection threshold inside
hooks.mjs.quiet
Type: booleanDefault:
false
When true, suppresses all real-time output from envtrap:
- No startup banner
- No per-leak alert blocks
- No
warn()/info()lines
.envtrap-report.json are still produced.
Can also be set via the --quiet CLI flag.
logFile
Type: string | nullDefault:
null
Path (relative to the current working directory, or absolute) to a file where envtrap appends structured JSONL events as each leak is detected — one JSON object per line.
The log directory is created automatically if it does not exist.
Can also be set via the --log-file <path> CLI flag.
Validation
envtrap validatesenvtrap.json on every startup and prints warnings for any issues without crashing. Run envtrap check to validate explicitly:
