mirror of
https://github.com/spacebarchat/server.git
synced 2026-10-23 06:32:34 +00:00
Security: Dont allow other users to manage application commands
This commit is contained in:
1 parent
36940dc979
commit
e7b96f2bea
2 files changed
+13
No files matched your search
@@ -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