Skip to content

Commit

Permalink
fix(api): v1 security fix
Browse files Browse the repository at this point in the history
  • Loading branch information
polonel committed May 16, 2022
1 parent 49befa2 commit e2db47f
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/controllers/api/v1/messages.js
Expand Up @@ -308,7 +308,18 @@ apiMessages.deleteConversation = function (req, res) {
convo.save(function (err, sConvo) {
if (err) return res.status(400).json({ success: false, error: err.message })

return res.json({ success: true, conversation: sConvo })
const cleanConvo = sConvo.toObject()
cleanConvo.participants.forEach(function (p) {
delete p._id
delete p.id
delete p.role
})

cleanConvo.userMeta.forEach(function (meta) {
delete meta.userId
})

return res.json({ success: true, conversation: cleanConvo })
})
})
}
Expand Down

0 comments on commit e2db47f

Please sign in to comment.