Skip to content

fix(security): redact secrets from config startup log (CWE-532)#391

Open
aayushbaluni wants to merge 1 commit intoOWASP:masterfrom
aayushbaluni:fix/390-redact-config-secrets
Open

fix(security): redact secrets from config startup log (CWE-532)#391
aayushbaluni wants to merge 1 commit intoOWASP:masterfrom
aayushbaluni:fix/390-redact-config-secrets

Conversation

@aayushbaluni
Copy link
Copy Markdown

Summary

config/config.js logs the full configuration object to stdout on every startup, exposing cookieSecret, cryptoKey, and the MongoDB connection URI (which may contain credentials) to anyone with access to application logs.

This is CWE-532 (Insertion of Sensitive Information into Log File).

Root Cause

Lines 12-13 of config/config.js unconditionally call console.log(util.inspect(config)), dumping the entire config including secrets.

Fix

  • Gate config logging behind NODE_ENV === 'development' AND DEBUG_CONFIG environment variable
  • When logging is enabled, redact cookieSecret, cryptoKey, and credentials in the db connection string

Fixes #390

Made with Cursor

config/config.js logs the full config object including cookieSecret,
cryptoKey, and the MongoDB connection URI on every startup via
console.log(util.inspect(config)). In production, stdout feeds
into centralized logging (CloudWatch, ELK, etc.), exposing secrets
to anyone with log access.

Gate config logging behind NODE_ENV=development + DEBUG_CONFIG env var,
and redact sensitive values when logging is enabled.

Fixes OWASP#390

Made-with: Cursor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CWE-532: Full config object (secrets, DB URI) logged to stdout on startup

1 participant