Security: Dont allow other users to manage application commands

This commit is contained in:
Rory&
2026-05-06 21:23:32 +02:00
parent 36940dc979
commit e7b96f2bea
2 changed files with 13 additions and 0 deletions
@@ -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) {