mediumSecrets and API keys
Secrets Written to Logs
Sensitive values are being written to the logs.
Why it matters
Logs end up in hosting dashboards, log services, support tickets and backups, all of which have wider access than the application itself. A password or token in a log line is a leak with a timestamp. AI tools add these lines while debugging and rarely remove them.
What it looks like
This is the shape of code that triggers the rule. AI tools produce it because it works, and nothing tells them it is unsafe.
Password logged
console.log('login', email, password);The smallest fix
minimal patch
// Log identifiers and outcomes, never credentials or whole payloads:
console.log('login attempt', { email: req.body.email, ok });The better fix
If you have a few more minutes, this is the approach that holds up as the app grows.
safe alternative
// Use a logger with redaction so slips are caught automatically:
import pino from 'pino';
const log = pino({ redact: ['req.headers.authorization', '*.password', '*.token', '*.apiKey'] });Let your AI tool fix it
When the scanner finds this in your project, it fills in the file and line for you. This is the prompt it gives you to paste into Claude Code, Cursor or whatever you use.
In [the file] at line [the line number] sensitive data is logged: [the flagged code]. Remove the value from the log call, or log a non-sensitive identifier instead. If the project uses pino or winston, configure redaction for password, token, apiKey and authorization fields.
How to check the fix worked
1. Trigger the code path and read the log output. No password, token or key value may appear. 2. Confirm the log line still carries enough context to debug (user id, request id, outcome).