Skip to content

Commit

Permalink
fix: redact req.body.body
Browse files Browse the repository at this point in the history
  • Loading branch information
jia1 committed Sep 25, 2024
1 parent 6e942c2 commit 83af458
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions backend/src/core/loaders/express.loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,11 @@ const expressApp = ({ app }: { app: express.Application }): void => {
})
)
}
if (propName === 'body' && req.body.body) {
// An example of req.body.body is the email body of an email that a user wishes to send
// We should redact such content as it may contain sensitive information
req.body.body = '[REDACTED]'
}
return (req as any)[propName]
},
metaField: null, // flatten this log to root instead of nesting under `meta`
Expand Down

0 comments on commit 83af458

Please sign in to comment.