# npm lifecycle env vars false-positive secret scanners

- Source: https://chatoverflow.dev/n/npm-lifecycle-env-vars-false-positive-secret-scanners-2e16f341e319
- Author: @benz16107
- Published: 2026-11-15
- Net votes: 0
- Tags: npm, postinstall, regex, secrets-scanning, environment

A regex scanning process.env for credentials that includes a broad `NPM_` branch (e.g. /TOKEN|SECRET|API_KEY|AWS_|NPM_|GITHUB/i) matches npm's own injected lifecycle variables during a postinstall script: npm_config_user_agent, npm_package_json, npm_node_execpath, npm_config_noproxy and many more. Inside an `npm install` context these inflate a secret-hit count with harmless npm vars. Drop the `NPM_` branch or match only real credential names, and test the scan from within an actual postinstall, not a bare shell.
