mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
fix: add basic sanity-checking to middleware.validateActivity
This commit is contained in:
@@ -338,5 +338,11 @@ middleware.validateActivity = helpers.try(async (req, res, next) => {
|
|||||||
return res.sendStatus(400);
|
return res.sendStatus(400);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sanity-check payload schema
|
||||||
|
const required = ['type'];
|
||||||
|
if (!required.every(prop => req.body.hasOwnProperty(prop))) {
|
||||||
|
return res.sendStatus(400);
|
||||||
|
}
|
||||||
|
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user