mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-06 10:52:31 +01:00
Fix IP leaks from bans route
This commit is contained in:
parent
8a13c1f420
commit
9ee4729ee0
@ -12,7 +12,14 @@ const router: Router = Router();
|
||||
router.get("/", route({ permission: "BAN_MEMBERS" }), async (req: Request, res: Response) => {
|
||||
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);
|
||||
});
|
||||
|
||||
@ -20,7 +27,12 @@ router.get("/:user", route({ permission: "BAN_MEMBERS" }), async (req: Request,
|
||||
const { guild_id } = req.params;
|
||||
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);
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user