CRITICAL: Fix bug where req.body was accidentally mutated

This commit is contained in:
zkldi
2021-09-08 09:44:48 +01:00
parent eb31769f03
commit 1b7b482d79
@@ -24,7 +24,7 @@ export const RequestLoggerMiddleware: RequestHandler = (req, res, next) => {
// still, i don't like it.
const safeBody = Object.prototype.hasOwnProperty.call(req.body, "password")
? Object.assign(req.body, { password: "[OMITTED]" })
? Object.assign({}, req.body, { password: "[OMITTED]" })
: req.body;
logger.debug(`Received request ${req.method} ${req.url}.`, {