Leaked Env in Logs

process.env.* leaked inside console.log() calls

warningSecurityleaked-env-in-logs

Why this matters

Logging env vars sends secrets to your log aggregator, CI output, and browser console. Anyone with log access sees your API keys and database URLs.

Example

Flaggedlib/config.ts
console.log("Config:", {
  dbUrl: process.env.DATABASE_URL,
  apiKey: process.env.STRIPE_SECRET_KEY,
});
Fixedlib/config.ts
const hasDbUrl = Boolean(process.env.DATABASE_URL);
const hasStripeKey = Boolean(process.env.STRIPE_SECRET_KEY);

console.log("Config:", { hasDbUrl, hasStripeKey });

How to fix

Keep process.env out of console calls altogether. Work out what you need to know first (is it set?), then log that.

Reference

In the output
Findings carry "ruleId": "leaked-env-in-logs" in --json and the same id in SARIF and in the terminal.
Silence one line
// prodlint-disable-next-line leaked-env-in-logs
Silence a whole file
// prodlint-disable leaked-env-in-logs at the top of the file
How it works
Reads the syntax tree, with a text fallback for files that don't parse. Source on GitHub