mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-06 19:02:33 +01:00
Fix IP leaks from bans route
This commit is contained in:
parent
f132065664
commit
48766b933d
@ -12,7 +12,14 @@ const router: Router = Router();
|
|||||||
router.get("/", route({ permission: "BAN_MEMBERS" }), async (req: Request, res: Response) => {
|
router.get("/", route({ permission: "BAN_MEMBERS" }), async (req: Request, res: Response) => {
|
||||||
const { guild_id } = req.params;
|
const { guild_id } = req.params;
|
||||||
|
|
||||||
var bans = await Ban.find({ guild_id: guild_id });
|
let bans = await Ban.find({ guild_id: guild_id });
|
||||||
|
|
||||||
|
/* Filter secret from database registry.*/
|
||||||
|
|
||||||
|
bans.forEach((registry) => {
|
||||||
|
delete regitry.ip;
|
||||||
|
});
|
||||||
|
|
||||||
return res.json(bans);
|
return res.json(bans);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -20,7 +27,12 @@ router.get("/:user", route({ permission: "BAN_MEMBERS" }), async (req: Request,
|
|||||||
const { guild_id } = req.params;
|
const { guild_id } = req.params;
|
||||||
const user_id = req.params.ban;
|
const user_id = req.params.ban;
|
||||||
|
|
||||||
var ban = await Ban.findOneOrFail({ guild_id: guild_id, user_id: user_id });
|
let ban = await Ban.findOneOrFail({ guild_id: guild_id, user_id: user_id });
|
||||||
|
|
||||||
|
/* Filter secret from registry. */
|
||||||
|
|
||||||
|
delete ban.ip
|
||||||
|
|
||||||
return res.json(ban);
|
return res.json(ban);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user