🐛 Fix the security vulnerability where anyone can execute admin commands

This commit is contained in:
洛水居室 2023-03-14 10:11:43 +08:00
parent c174571207
commit 33be295ac8
No known key found for this signature in database
GPG Key ID: C9DE87DA724B88FC

View File

@ -12,7 +12,7 @@ class UserAdminCache(BaseService.Component):
self.qname = "users:admin" self.qname = "users:admin"
async def ismember(self, user_id: int) -> bool: async def ismember(self, user_id: int) -> bool:
return self.client.sismember(self.qname, user_id) return await self.client.sismember(self.qname, user_id)
async def get_all(self) -> List[int]: async def get_all(self) -> List[int]:
return [int(str_data) for str_data in await self.client.smembers(self.qname)] return [int(str_data) for str_data in await self.client.smembers(self.qname)]