Zum Inhalt springen

Sensitive data logging (ARCH3128)

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

Key typescript.security.sensitive-data-logging · Severity error · Category security · CWE CWE-532

Logging sensitive data such as passwords, tokens, or personal data leaks credentials into log stores and exposes them to unauthorized access.

app.post("/login", (req, res) => {
logger.info(`Login attempt: ${JSON.stringify(req.body)}`);
// body.password written to the log in cleartext
});
app.post("/login", (req, res) => {
logger.info("Login attempt", { user: req.body.username });
// password is never logged
});

Strip or mask sensitive fields before logging; record only non-identifying fields.