NodeGoat
NodeGoat copied to clipboard
fix(security): redact secrets from config startup log (CWE-532)
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'ANDDEBUG_CONFIGenvironment variable - When logging is enabled, redact
cookieSecret,cryptoKey, and credentials in thedbconnection string
Fixes #390
Made with Cursor