Stop accidentally logging passwords and tokens — fix it in one line

javascript dev.to

We've all done this. console.log("User login:", req.body); // Oops. Password just went to Datadog. logger.info({ user, token, session }); // Oops. Token just went to Sentry. I kept doing this in my projects. So I built a tiny npm package to fix it — fieldmasker. What it does It masks sensitive fields from any JavaScript object before it touches your logger, analytics, or API response. const fieldmasker = require('fieldmasker'); const user = { name: "John", email: "

Read Full Tutorial open_in_new
arrow_back Back to Tutorials