mirror of
https://github.com/spacebarchat/server.git
synced 2026-09-01 17:58:39 +00:00
Security: Dont allow other users to manage application commands
This commit is contained in:
@@ -61,6 +61,10 @@ router.patch(
|
||||
return;
|
||||
}
|
||||
|
||||
if (req.user_id != req.params.application_id) {
|
||||
res.status(401).send({ code: 401, message: "You are not this application" });
|
||||
}
|
||||
|
||||
const body = req.body as ApplicationCommandCreateSchema;
|
||||
|
||||
if (!body.type) {
|
||||
@@ -115,6 +119,11 @@ router.delete("/", route({}), async (req: Request, res: Response) => {
|
||||
return;
|
||||
}
|
||||
|
||||
if (req.user_id != req.params.application_id) {
|
||||
res.status(401).send({ code: 401, message: "You are not this application" });
|
||||
}
|
||||
|
||||
|
||||
await ApplicationCommand.delete({ application_id: req.params.application_id as string, id: req.params.command_id as string });
|
||||
res.sendStatus(204);
|
||||
});
|
||||
|
||||
@@ -49,6 +49,10 @@ router.post(
|
||||
return;
|
||||
}
|
||||
|
||||
if (req.user_id != req.params.application_id) {
|
||||
res.status(401).send({ code: 401, message: "You are not this application" });
|
||||
}
|
||||
|
||||
const body = req.body as ApplicationCommandCreateSchema;
|
||||
|
||||
if (!body.type) {
|
||||
|
||||
Reference in New Issue
Block a user